id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

scoreExam


The "key" array is an array containing the correct answers to an exam, like {"a", "a", "b", "b"}. the "answers" array contains a student's answers, with "?" representing a question left blank. The two arrays are not empty and are the same length. Return the score for this array of answers, giving +4 for each correct answer, -1 for each incorrect answer, and +0 for each blank answer.


scoreExam(["a", "a"], ["a", "a"]) → 8
scoreExam(["a", "b"], ["a", "c"]) → 3
scoreExam(["a", "b", "c"], ["a", "?", "?"]) → 4

...Save, Compile, Run (ctrl-enter)

public int scoreExam(String[] key, String[] answers) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Copyright Nick Parlante 2017 - privacy