Open realethantran opened 1 year ago
My corrections and reflection for the 2018 Practice Exam MCQ
- toc: true
- author: Ethan Tran
- categories: [cb, mcq 2018]
Question 68
Answer: [10, 10, 20, 20, 10, 10]
The code segment will iterate over myList from right to left, removing each element that is equal in value to the element immediately preceding it. For this list, the code segment will remove the sixth element (10), the fourth element (20), and the second element (10). This results in the list [10, 20, 10], which still contains duplicates.
Question 66
Answer:
In this code segment, if timer is greater than 60, bonus is assigned 1500 in the first IF block. If timer is between 30 and 60, inclusive, bonus is assigned 1000 in the second IF block. If timer is less than 30, bonus is assigned 500 in the third IF block. The correct number of bonus points is assigned to bonus for all possible values of timer.
Question 64
Answer:
Line 8 - This line should be removed. This return statement causes execution of the procedure to end early. As a result, if age is less than 18, result will never be assigned the value "minor".
Line 10 - This line should be removed. This statement causes result to be assigned the value "adult", even if it should have been assigned the value "senior citizen".
Question 63
Answer:
A - When input1 and input2 are both true, the expressions (NOT input1) and (NOT input2) are both false, so (NOT input1) OR (NOT input2) will evaluate to false. In all other cases, either (NOT input1) or (NOT input2) (or both) will evaluate to true, so (NOT input1) OR (NOT input2) will evaluate to true.
D - When input1 and input2 are both true, the expression (input1 AND input2) is true, so NOT (input1 AND input2) will evaluate to false. In all other cases, (input1 AND input2) will evaluate to false, so NOT (input1 AND input2) will evaluate to true.
Question 62
Answer:
Individuals who signed up for a premium account - Users with a premium account do not receive advertisements.
Question 44
Answer:
The account balances are represented using a fixed number of bits, resulting in round-off errors. - The fixed number of bits used to represent real numbers limits the range of these values; this limitation can result in round-off errors. Round-off errors typically result in imprecise values or results.
Question 43
Which of the following best exemplifies the use of keylogging to gain unauthorized access to a computer system?
Answer:
A user unintentionally installs a program on their computer that records all user input and forwards it to another computer. A few weeks later, someone else is able to access the user’s computer using the recorded data. - Keylogging is the use of a program to record every keystroke made by a computer to gain fraudulent access to passwords and other confidential information.
Question 33
Answer:
Algorithm II uses a heuristic approach to provide an approximate solution in reasonable time. - Algorithm II runs in time proportional to n^2 , which is considered reasonable time because n2 is a polynomial. This is considered a heuristic approach because it finds an approximate solution in reasonable time when the technique that finds an exact solution (algorithm I) does not run in reasonable time.
Question 25
Answer:
The procedure returns the sum of the integers from 1 to n. - The procedure initially sets result to 1 and j to 2. In the REPEAT UNTIL loop, result is first assigned the sum of result and j, or 1 + 2. The value of j is then increased to 3. In each subsequent iteration of the loop, result is increased by each successive value of j (3, 4, 5, etc.) until j exceeds n. Therefore, the procedure returns the sum of the integers from 1 to n.
Total Score: 4.67/5