Finals Week Test Corrections
2014 Practice Exam MCQ
Question 4
- I got this question wrong because I didn’t read the code snipped properly. I thought it said y>0 and thus assumed that it would evaluate to true and print 3*7 = 21.
- Answer C is correct because the condition states (x<10 and y<0). Since y is 3 and not less than 0, the else condition evaluates printing 7/3 which comes out to 2.
- I can watch 3.5 daily videos 1-3 to learn this concept.
Question 12
- I misinterpreted the code snippet and didn’t notice that incrementing k by two would result in letters being skipped.
- Answer C is correct the value of k starts at 1 and is incremented by 2 each time around. This means that k will be 1,3,5,7, and 9 over the loop. This means that every other letter is outputted resulting in optr.
- I can watch 2.7 and 4.3 daily videos to learn this concept.
Question 13
- This answer is incorrect because the code outputs k and not arr[k]. Therefore it is the index that is printed and not the value of the list at that index.
- Answer B is corrected because it is the index that is printed whenever a value is greater than the following value. Therefore, the output must start as 0 because that is the index.
- I can watch 6.4 daily vides 1-3 to learn this concept.
Question 21
- This answer is incorrect due to the type of for loop. I did not notice the prescence of an enhanced for loop. Therefore, num is not an index but an actual value in the list. subtracting val from row[num] would not be accurate because num is not an index.
- Answer D is correct because it recognizes that num is a value in the list so all that must be done is subtract val from num.
- I can watch 2.9 and 8.2 videos 1-3 to learn this concept.
Question 23
- I got this question wrong because I couldn’t comprehend the complex code and figure out what function it was accomplishing.
- Answer B is correct because the elements that start with B are being appended the opposite side of the list.
- I can watch 2.7 videos 1-3 as well as 7.4 video 1 to learn this concept.
Question 34
- I got this question wrong because I did not realize that x and y were private variables and thus cannot be accessed the way they are being accessed in option 3. Therefore, option 3 is not valid.
- Answer B is correct because 2 is the only valid option. The center and radius are defined by (a,b), while options 1 and 3 do not work.
- I can watch 5.2 daily videos 1-3 to learn this concept.
Question 39
- I got this wrong because I did not read code properly. I did not notice that it was recur(recur(x)) and therefore thought the code ended after one run and returned 18.
- Option D is correct because recur is repeated until recur(n) is a value under 10. This occurs when n=8 and n*2 = 16 is returned.
- I can watch 10.1 videos 1 and 2 to learn this concept.