Skip to content

Problem 1 : Array

Jatawatsafe edited this page May 22, 2018 · 1 revision

ExamChecking

Practice: Condition, Loop, Array

Write method "public static int examChecking(char[]stdAnswer,char[] solAnswer)" for checking answers from student.

If student answer correct get 2 point/question but if it wrong -1 point/question.

LEVEL 1:

If number of student answers not equals number of questions, returns -10.

Example 1:

stdAnswer : {'A', 'B', 'C', 'B', 'C'};

solAnswer : {'A', 'B', 'C', 'A', 'B'};

Point = 4;

Example 2:

stdAnswer : {'A', 'B', 'C'};

solAnswer : {'B', 'C', 'D', 'A', 'B'};

Point = -10;

LEVEL 2:

If number of student answers not equals number of questions, you need to check only number of student Answer.

Example

stdAnswer : {'A', 'B', 'C'};

solAnswer : {'B', 'B', 'C', 'A', 'B'};

Point = 3;

LEVEL 3:

If number of student answers not equals number of questions, you need to check number of student Answers and question that not answer get -1/question.

Example

stdAnswer : {'A', 'B', 'C'};

solAnswer : {'B', 'B', 'C', 'A', 'B'};

Point = 1;


Test Package for Level 3 : https://github.com/safesit23/JavaLabExercise/blob/master/00JavaProblem/Problem%201/ExamCheckingTest.java

Key : https://github.com/safesit23/JavaLabExercise/blob/master/00JavaProblem/Problem%201/ExamChecking.java

Clone this wiki locally