Skip to the content.
Home Create Task Project Data Structures Project Test Prep Create Task (NEW) Study Plan/Reflection

Finals - Quiz 5

Score: 43/50

Corrections

15. C) The programs each display ten values, but each value displayed by program B is one greater than the corresponding value from program A. Program A displays 1 2 3 4 5 6 7 8 9 10 and program B displays 2 3 4 5 6 7 8 9 10 11.

17. D) Version I calls the GetPrediction procedure once for each element of idList, or four times total. Since each call requires 1 minute of execution time, version I requires approximately 4 minutes to execute. Version II calls the GetPrediction procedure twice for each element of idList, and then again in the final display statement. This results in the procedure being called nine times, requiring approximately 9 minutes of execution time.

21. C) If you switch from 32 bit integers to 64 bit integers, you will be able to have 2^32 times as many values that can be represented.

25. C and A) 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. 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. This list does not contain any pairs of adjacent elements that are equal in value, so no elements will be removed even though the value 40 appears twice in the list.

31. C) The game piece begins at the rightmost black space. The piece moves one space to the left to a yellow space, and the counter is incremented to 1. The piece then moves three spaces to the left to another yellow space, and the counter is incremented to 2. The piece then moves three spaces to the left to a green space, and the counter is incremented to 3. The piece then moves two spaces to the right to the red space, and the counter is incremented to 4. The algorithm terminates now that the piece is in the red space.

43. B) The Internet was designed to be scalable, using open protocols to easily connect additional computing devices to the network. The Internet uses standardized, open (nonproprietary) communication protocols.

48. D) Certificate authorities are entities that issue digital certificates, which are used to certify the ownership of public keys. Domain names are translated into IP addresses using the domain name system. This does not fall into the realm of activities performed by certificate authorities.