Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Competitive Exam Score Competitive exams follow a different scoring system wherein there is a score for a correct response and negative score for a
1. Competitive Exam Score Competitive exams follow a different scoring system wherein there is a score for a correct response and negative score for a wrong response. Consider a competitive exam comprising of 15 questions which is split into 3 parts viz. Part \#1, Part \#2 and Part \#3. Each part has exactly 5 questions. Following are the scoring rules followed It can be deduced from the above tables that one can score a maximum of 30 It can be deduced from the above tables that one can score a maximum of 30 marks if all the responses are correct. Also, if the candidate gets a score of 15 (out of 30 ) or above shall be considered a pass; otherwise the candidate would be declared fail. Given the response for 15 questions for a candidate as an input, you are expected to the complete the function below to compute the total score of the candidate and also the result of the test i.e Pass or Fail. Consider the following input: Q1\%,a,a Q2%,a,b Q3%,c,c Q4%,c,c Q5\$,d,a Q6$,b, Q7\$,b,b Q8\$,b,b Q9\$,a, Q10^,a, Q11^,a,a Q12^,b, Q13^,c,b Q14^,c,d Q15\%,d,d Each line of the input has a format , , candidate response . If the candidate Q14^, c, d Q15\%,d,d Each line of the input has a format , , candidate response . If the candidate does not attempt a question, then is present for the candidate response. Question \# is of the format Qq no type Based on the above rules, let us consider the following inputs: - Q1%,a,a - here Q1% is the question number, % indicates that the question belongs to part 1,a is the actual response, and the second a is the candidate response. As it belongs to Part #1 of the question paper, and it is correct, 1 mark will be awarded - Q2$,a,b - here Q2$ is the question number, $ indicates that the queytion belongs to part 2,a is the actual response, b is the candidate response. As it belongs to Part \#1 of the question paper and is incorrect, 0.25 marks will be deducted from the already obtained score. - Q3,b, - here Q3, is the question number, indicates that the question belongs to part 3,b is the actual response, and as candidate has not attempted a is passed to denote that the question is not attempted. No marks will be deducted/awarded in this case. Applying the same rules to all the questions of Part \#1 and Part \#2, Part \#3, we get the computed score as 8.25 out of 30 , which means that the candidate has failed, as the pass percentage in this case is 50% Function Description Complete the function calculatescore in the editor below and print the computed score and result. calculatescore has the following parameter(s): Function Description Complete the function calculatescore in the editor below and print the computed score and result. calculatescore has the following parameter(s): responses - an array of strings - with each string per line in the format: Constraints - Every question has 4 options a,b,c,d from which the response has to be chosen. - Every question has only 1 correct option (no multiple options) - In case the candidate has not attempted a question, a * will be passed in the place of a blank response. - The input having the correct rsponse/candidate response can be in upper case or lower case. Input Format For Custom Testing The first line of the input is number which represent the number of lines that would follow in the format: , Q2%,a,b Explanation For each of the questions which begins with a % it belongs to Part 1 , wherever the candidate response matches the actual response, 1 mark is awarded. Where it does not match, 0.25 is deducted. When the question is not attempted, no Explanation For each of the questions which begins with a \% it belongs to Part 1 , wherever the candidate response matches the actual respopse, 1 mark is awarded. Where it does not match, 0.25 is deducted. When the question is not attempted, no action is taken. For each of the questions which begins with a $ it belongs to Part Q15\%, d,d Each line of the input has a format , , candidate response . If the candidate does not attempt a question, then is present for the candidate response. Question \# is of the format Qq no type Based on the above rules, let us consider the following inputs: - Q1%,a,a - here Q1% is the question number, % indicates that the question belongs to part 1,a is the actual response, and the second a is the candidate response. As it belongs to Part \#1 of the question paper, and it is correct, 1 mark will be awarded - Q2$,a,b - here Q2$ is the question number, $ indicates that the queytion belongs to part 2,a is the actual response, b is the candidate response. As it belongs to Part \#1 of the question paper and is incorrect, 0.25 marks will be deducted from the already obtained score. - Q3,b, - here Q3, is the question number, indicates that the question belongs to part 3,b is the actual response, and as candidate has not attempted a is passed to denote that the question is not attempted. No marks will be deducted/awarded in this case. Applying the same rules to all the questions of Part \#1 and Part \#2, Part \#3, we get the computed score as 8.25 out of 30 , which means that the candidate has failed, as the pass percentage in this case is 50% Function Description Complete the function calculatescore in the editor below and print the computed score and result. calculatescore has the following parameter(s): Explanation For each of the questions which begins with a \% it belongs to Part 1 , wherever the candidate response matches the actual response, 1 mark is awarded. Where it does not match, 0.25 is deducted. When the question is not attempted, no action is taken. For each of the questions which begins with a $ it belongs to Part 2, wherever the candidate response matches the actual response, 2 mark is awarded. Where it does not match, 0.5 is deducted. When the question is not attempted, no action is taken. For each of the questions which begins with a it belongs to Part 3 , wherever the candidate response matches the actual response, 3 mark is awarded. Where it does not match, 1 is deducted. When the question is not attempted, no action is taken.The final score is then computed to be 17.25/30 which is more than 50%. So PASS is printed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started