Question: This assignment requires you to write a program to generate a multiple-choice exam. The file, questions.txt, contains a set of multiple-choice questions. Each question has
This assignment requires you to write a program to generate a multiple-choice exam. The file, questions.txt, contains a set of multiple-choice questions. Each question has exactly four responses. The following shows the layout of each item of data that is stored for a question: Data Item Description ID Question ID (a string without spaces on a line by itself) Text The actual question on a line by itself (a string that could contain spaces) Responses Four responses, each on a line by itself, followed by the correct response on a line by itself, followed by 1 or 0 where 1 indicates that the responses should be shuffled and indicates otherwise. Points The amount of points gained if the question is correctly answered. For example, here is the data for one of the questions in questions.txt: Data Description Popeye ID of question Which of the following gives Popeye his strength? Question text Broccoli Choice 1 Spinach Choice 2 Fried chicken Choice 3 All of them Choice 4 Spinach Correct answer 1: shuffle responses: O: don't shuffle 1 If correctly answered, 1 mark is awarded Program Requirements Your program must provide the following functionality: (a) Read all the questions from the file, questions.txt, and store them in an array. This array is referred to as the Question Bank. The file contains no more than 100 questions. (b) Create an array of exam questions by randomly selecting questions (specified by the user) from the Question Bank. The array of exam questions is referred to as the Exam. When a question is selected from the Question Bank, the four responses must be shuffled, if necessary. (c) Allow a user to take the exam by presenting the questions from the exam, one by one. Three actions are possible when a question is displayed to the user: the user answers the question correctly (H) the user answers the question incorrectly (i) the user skips the question A record must be kept of the user's performance on each question (d) At the end of the examination, a summary of the user's performance is given. The summary displays how many responses were correct or incorrect and how many questions were skipped. The total marks obtained by the user is also displayed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
