## CCC '11 S2 - Multiple Choice

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 256M

Problem type
##### Canadian Computing Competition: 2011 Stage 1, Senior #2

Your teacher likes to give multiple choice tests. One benefit of giving these tests is that they are easy to mark, given an answer key. The other benefit is that students believe they have a one-in-five chance of getting the correct answer, assuming the multiple choice possibilities are A, B, C, D or E.

Write a program that your teacher can use to grade one multiple choice test.

#### Input Specification

The input will contain the number followed by lines. The lines are composed of lines of student responses (with one of A, B, C, D or E on each line), followed by lines of correct answers (with one of A, B, C, D or E on each line), in the same order as the student answered the questions (that is, if line is the student response, then line will contain the correct answer to that question).

#### Output Specification

Output the integer which corresponds to the number of questions the student answered correctly.

#### Sample Input 1

3
A
B
C
A
C
B

#### Output for Sample Input 1

1

#### Sample Input 2

3
A
A
A
A
B
A

#### Output for Sample Input 2

2

• commented on May 26, 2024, 4:47 p.m. edit 2

There are three categories of input data: i) The number of questions on the test: ii) inputs of students' answers: one of (A, B, C, D, E) iii) inputs of answer key: one of (A, B, C, D, E)

Desired output: total number of correct student answers.

num_qns = int(input()) # get the length of the test
test = {} # blank test object
for qn in range(num_qns):
test.update({qn: input()})
for qn in range(num_qns):
# review the submitted test

• commented on April 21, 2024, 10:55 p.m.

• commented on April 22, 2024, 3:39 p.m.

because it can be look at ccc 2024 s2

• commented on Jan. 4, 2024, 5:15 p.m. edited

The problem is not well worded. You get presented with a number of inputs, where the first input is the number of test questions. There then follows a list of inputs corresponding to the answers submitted by the student, then a list of inputs corresponding to the list of correct answers.

So if the first input is 3, the test has three questions and three answers, e.g.

3
A
B
C
A
C
B

(This example should output 1, because the answer to the first question is correct and the second and third are incorrect)

• commented on Nov. 30, 2022, 11:55 p.m.

I find the problem almost impossible to understand. I've read the text three times already. Not a great job explaining it, I have to say.

• commented on Dec. 1, 2022, 8:49 a.m. edited

I think I get it, but I'm not really sure. So the first line is a digit that represents the number of questions/answers that the students gives. The come the real answers which need to have the same number of lines. There's no mention at all about how these answers are generated or I'm missing something. Otherwise I'll have to assume that the correct answers are actually random.

• commented on Dec. 3, 2022, 4:29 p.m. edit 3

First line of input: Number of questions in the test ().

First lines of input (not including first line): The answers the student gave.

Next lines of input: The answer key (assume this is by default correct).

The question is asking you the number of answers the student got correctly. How these answers are generated does not matter.