联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2018-11-03 10:12

Programming Exam 2

CMPE 126 Lab Section 03

Date: 11/01/2018 2:30-5:30pm

General guidelines

This exam will be for 3 hours only.

Please submit your best work by 5:30pm

You may use external sources with citation

Academic Dishonesty

The following will be considered actions of academic dishonesty and will be reported without further

discussion.

Copying code:

o You are NOT permitted to share code or reuse someone else's work.

Discussing with others:

o You are NOT permitted to discuss in class or online with your classmates or anyone else

about the lab.

Expected exam etiquette

If you are found disregarding the following guidelines, you will be penalized in this exam:

Using your cellphone – Using cellphones is strictly not allowed during exam time. Your cellphone

must be turned off (as stated in the syllabus) during your exams.

Leaving the exam hall/lab without informing the instructor/TA.

Expected outcome from this exam

The exam will test your skills and understanding of the following concepts:

C++ programming skills

Problem-solving skills

Arrays

Linked Lists

Recursion

Stacks

Exam in the next page…

This exam consists of two problems as follows:

Problem 1

Consider a sentence stored as a singly linked list, where each node consists of a word (of type string). E.g.,

the sentence “How are you” is stored in three linked list nodes, each containing the words “How”, “are”,

and “you”. Node containing “How” is the head of the linked list with next pointing to the node containing

“are” and so on. Node containing “you” is the tail node.

1. Write a pseudocode using recursion to reverse such a sentence word by word. E.g., if the input

sentence is “A quick brown fox jumps over the lazy dog”, the output needs to be “dog lazy the

over jumps fox brown quick A”. Put your pseudocode, including all your sources, in a file called

recursiveReverseWords.pdf. You cannot make the linked list doubly linked.

2. Implement your pseudocode. You are provided a file called recursiveReverseWords.cpp

with a main function and the function declaration. Do not change the function declaration. The

input parameter and return types must be as specified. You will need to include your

implementation in this file. The main function includes some test cases.

In a separate file called LinkedList.h, you will find the template declaration for a linked list

with the basic functionalities implemented. For bonus points, implement a function that checks if

the element you insert into the linked list is a word (i.e., does not contain special characters or

white spaces).

Problem 2

In this problem, you will implement back and forward button, and history functionality for a web browser

tab. The browser tab allows a user to visit websites sequentially. After each visit, the user may perform a

back or forward operation until such an operation is possible. The back button takes the user back to the

previous visited website, and forward button invalidates the back operation and takes the user to the

page they visited before selecting the back operation. E.g., the user has already visited the following

websites:

i. www.google.com

ii. www.google.com/search?source=hp&q=hello

iii. www.google.com/search?source=hp&q=spartans

iv. www.google.com/search?source=hp&q=sjsu

At this point, the current page is “www.google.com/search?source=hp&q=sjsu”. Now, a back operation

takes the user back to “www.google.com/search?source=hp&q=spartans”. Another back operation takes

the user back to “www.google.com/search?source=hp&q=hello”. Now, a forward operation takes the

user to “www.google.com/search?source=hp&q=spartans”. Another forward operation takes the user

back to “www.google.com/search?source=hp&q=sjsu”. At this point, no more forward operations are

possible.

You are provided two files BrowserTab.h and main.cpp. BrowserTab.h consists of the declaration of

the browser class. main.cpp consists of test cases and expected behavior of the program. An important

operation you will need to support is the ability to print all the operations performed (the history of all

pages visited, backs and forwards). You may choose to store this information in an array or a linked list.

You may not use any STL data structures or other libraries to store the history.

You will need to create a file called BrowserTab.cpp, in which you will implement the functions declared

in BrowserTab.h that supports the operations provided in main.cpp. Implement back and forward

operations using stacks. You may use the STL stack, or your own implementation of stacks.

For bonus points, implement a Browser class consisting of a list of browser tabs by implementing the

functions defined in Browser.h that is provided to you. You may choose to change the data structure

used to store the browser tabs. Uncomment the last try catch block in main.cpp to test your code.

In a file called Browser.pdf, include your ideas on the algorithm and implementation. Also include all

your sources in this file.

Rubric

1. Problem 1 (pseudocode) – 15 points

2. Problem 1 (recursive function) – 20 points

3. Problem 1 – Coding skills (files compile and run fine) – 5 points

4. Problem 2 – Basic functionalities of Browser Tab (visit page) – 10 points

5. Problem 2 – Back operation implemented correctly – 15 points

6. Problem 2 – Forward operation implemented correctly – 15 points

7. Problem 2 – History – 15 points

8. Problem 2 – Coding skills (files compile and run fine) – 5 points

9. BONUS Problem 1 – Checked if element is a word – 5 points

10. BONUS Problem 2 – Implemented Browser class – 20 points

Submission instructions

Submit the following files in a zip file:

recursiveReverseWords.pdf

recursiveReverseWords.cpp

LinkedList.h

Browser.pdf

BrowserTab.h

BrowserTab.cpp

main.cpp

Browser.cpp (if implemented)

Browser.h (if used)

Name your zip file ProgrammingExam2_XXXYYYXXX.zip, where XXXYYYXXX is your SJSU ID. E.g., if your

SJSU ID is 111000111, your submission will be called ProgrammingExam2_111000111.zip.

Warning – If you reuse code from the Internet as-is without proper citation, you risk losing all points for

this exam. Even if you refer to code on the Internet, copying entire functions as-is is not acceptable. Make

sure your submission is your original work.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp