To calculate test score, three condition must be followed:
1. 2 points for CORRECT answer
2. -1 points for WRONG answer
3. 0 for NO ANSWER
Calculate the total points for each student and give
corresponding letter grade. To calculate the grade,
assumed the following grade scale:
A 90% or above
B 80%-89.99%
C 70%-79.99%
D 60%-69.99%
F 0%-59.99%
Courtesy of Perry James.
Part 1:
Given a file that contains student ids followed by student
responses of the true or false test (20 question). Compare the
student responses with the solution of the test (first line)
of the file.
Example file contents;
FFTFTFFTFTFTFFFTTFFF
GRL24032 TFTFFTFTFTFTFFTTTFFF
SPE88937 TFFF FFTTTFFFFFFF TF
YAN52218 FFTFT TTF FTFFFTTFTF
PEY20822 FFFFTFFTFTFF TFTTFFF
UTQ56051 FFTFFFFTFFFFFFTFTFFT
OJQ79992 TTTFTFFTFTFTFTFTTFTF
GLX00563 TFTFTFFTFT TFFFTTFFT
MKR44741 FFTFTFFTFTFTFTFTTFFT
QZR02154 FFTFFTFTTTFTFFTTTTTT
Output
run:
GRL24032 TFTFFTFTFTFTFFTTTFFF 28 C
SPE88937 TFFF FFTTTFFFFFFF TF 15 F
YAN52218 FFTFT TTF FTFFFTTFTF 30 C
PEY20822 FFFFTFFTFTFF TFTTFFF 29 C
UTQ56051 FFTFFFFTFFFFFFTFTFFT 22 F
OJQ79992 TTTFTFFTFTFTFTFTTFTF 28 C
GLX00563 TFTFTFFTFT TFFFTTFFT 32 B
MKR44741 FFTFTFFTFTFTFTFTTFFT 34 B
QZR02154 FFTFFTFTTTFTFFTTTTTT 19 F
Part 2:
Display the questions by which more than 20% of
student got wrong.
Example:
Question one's expected answer is F but 45/200 students
answered T. This is 22.5% of 200 students.
Output
01 : F 45 22.5
03 : T 47 23.5
08 : T 52 26.0
09 : F 45 22.5
13 : F 44 22.0
14 : F 46 23.0
16 : T 42 21.0
18 : F 45 22.5
19 : F 48 24.0
20 : F 52 26.0