MCQ Question Final + Corrections

Score:Screen Shot 2022-11-07 at 9 20 42 AM

Question My Answer Correct Answer Explanation
Question 8 E C The correct answer doesn’t have option III as a correct answer. Only I and II. III does not work because the int 15 should not be in quotes. When put in quotes, it becomes a string. That is why it doesn’t work
Question 9 C B For this question, the correct answer is sum += key [i - 1]. This is because the for loop starts at i = 1 instead of i = 0, which I didn’t notice
Question 15 C A The correct answer is I only instead of III only because the third option does not work, due to the fact that a return will occur prematurely, after checking only 0 and 1. I is correct because it starts at 1 and goes through the length of the entire array, checking all values.
Question 17 D C D is not correct because the value 8 is not in the array to start the code segment. By the end of the segment, the loop has kept going and assigned values to the element after it. Thus, there is a repeat 7 at the end of the array,
Question 25 A D The correct answer is options I and II instead of just I. II is also correct because it checks if the width, height, and depth of the box is less than the first one. Choice three doesn’t necesarily work because less surface area and less volume don’t necesarily guarantee a smaller box.
Question 30 D C The correct answer is C “liercom” and not D “liercomp” because D would be the value returned if the second call to word.substring was word.substring(0, howFar + 1) due to the extra index. Thus C is the correct answer because the call is just howFar and not howFar + 1.
Question 37 D E The correct options are I and III only, and not II. II does not work because it iterates as long as is not equal to 6. Since the code segment iterates through odd numbbers, it will never be equal to six. Thus, this results in an infinite loop which never terminates.

NATM

Screen Shot 2022-11-07 at 9 56 45 PM

Screen Shot 2022-11-07 at 9 57 00 PM

Screen Shot 2022-11-07 at 9 57 11 PM

Screen Shot 2022-11-07 at 9 57 30 PM

Screen Shot 2022-11-07 at 9 57 43 PM

Screen Shot 2022-11-07 at 9 57 55 PM

Screen Shot 2022-11-07 at 9 58 04 PM