C++ Help-- 3 program

profilepramdut
MidtermII.pdf

Midterm Exam II CIS 3100 (DMWA)


Baruch College
 City University of New York

Jarrod Placide-Raymond 
 Spring 2018

Instructions: For each question, create a new C++ program to craft a solution to the requirements specified in the question. After completion of a question, rename the file by the Question number.

To submit your exam, compress all of your answer files into a single zip file, and submit it via Slack in a private message.

Total Points: 60


Question 1 Write a program that reads in the answer key for a 50-question multiple choice exam from a text file named “CIS3400AnswerKey.txt" and stores the questions and its answer in parallel arrays named examQuestions & examAnswers. In the file, the data will be stored in the following format:

Question Text Multiple Choice Answer (A, B, C or D)

Secondly, the program should be able to read in a student’s answers from a file specified by the user (You should ask the user for the filename). In the file, each multiple choice answer will be stored on a single line. For example: A D

C D

After reading in the answers, the program should be able to grade the student’s answers by comparing them to the values stored in the examAnswers array.

The final output should list, for each question

• The text of each question • The student’s answer • “Correct” or “Incorrect” according to the evaluation • ONLY IF INCORRECT, the correct answer should be shown after “Incorrect in displayed” After each question’s result is listed as specified above, the program should display the

student’s final percentage grade.

30 points.

Question 2 Write a program that accepts a word from the user and checks to see if that word is a palindrome or not. Output the result of the evaluation to the user.

15 points.

Question 3 Write a program with these following two functions: string* registerExpletives() - this function should accept an array of words that the user would like to censor. Be sure to create an array only of the required size, and return a pointer to that array from this function. censorText(string filename, char replacementCharacter, string *expletives) - this function should open a file that contains text that must be censored, reading in the text from the file, and checking to see if any words need to be replaced. The function takes two parameters - the name of the file that has to be opened and the character that would be used to replace the words.

40 points.