Sunteți pe pagina 1din 3

Birla Institute of Technology & Science, Pilani

Second Semester 2015-2016, CS F111 Computer Programming


ONLINE EXAM - Batch 2 (Open Book)

Date: March 20, 2016 Time: 11.00 AM- 12.30 PM Weightage: 17.5%
[Note: Where ever you are taking input from the user, assume that user will give input in correct form.]

Consider a problem to grade an 8-question multiple-choice exam, where each question has five options
numbered from 1 to 5. Also, for each question only one of the options is correct.

The answer-key of 8 questions can be taken as input in the form of an 8-digit integer, where most
significant digit represent the answer of Q1, second most significant digit represent the answer of Q2, and
so on. In the same way, students attempt can also be taken as input. For example, if 8-digit integer
corresponding to answer-key is 25324523 then answer of Q1 is option-2, answer of Q2 is option-5, and so
on. Similarly, if 8-digit integer 53412413 represents student's answer, then for Q1 the student has selected
opion-5, for Q2 the student has selected option-3, and so on.

Answer-key is stored in a one-dimensional array with the answer of Q1 stored at index-0, answer of Q2
stored at index-1, and so on. For example, the array elements corresponding to answer-key 25324523 is
[2,5,3,2,4,5,2,3].

Write a program to do the following in sequence, assuming that each student attempts all the questions:

(a) Take the answer-key as input and store the answers in an array.

(b) Take the answers for 10 students as input and store them in an array.

(c) Find and print the number of students who have attempted Q7 correctly.

(d) The examination committee decided to award 4M for each correct answer and deduct 1M for each
wrong answer. Find and print the marks of each of the 10 students.
(a) [10M]

0) If individual digits of ans key are taken as input and stored in array: give 4M

1) 2M for taking num as input

2) 8M for storing the digits correctly in array. [2M for extracting the digits correctly and 6M for
storing the digits correctly (i.e. most significant digit should go in index 0 in array.

(b) [7.5M]

Here, with respect to an students answers, one 8-digit integer is to be taken as input. If, someone
is not doing this (i.e. reading one ans at a time): deduct 5.5M.

(c) [15M]

1) 5M for traversing the array correctly.

2) 10M for finding and printing the number of students with Q7 as a correct answer.

(d) [20M]

1) 6M for 2 nested loops

2) 7M for extracting each students answer and comparing with answer key.

3) 7M for finding marks of a student correctly.

Testcase 1

12345123

12345123

12345121

12345122

12342312

12345321

12321455

21324354

54321234

55555555

22222222
Testcase 2

11111111

12345123

12345121

12345122

12342312

12345321

12321455

21324354

54321234

55555555

22222222

S-ar putea să vă placă și