2018 MCQ Practice Test 5
1
Question: The code segment below is intended to swap the values of the variables first and second using a temporary variable, temp. Which of the following can be used to replace missing code so that the code segment works as intended?
- My answer: temp <– first
- Correct answer: second <– temp, the code segment assigns the initial value of first to temp, then assigns the initial value of second to first. The initial value of first, which has been stored in temp, is then assigned to second. Therefore, the initial values of first and second have been interchanged.
14
Question: Which of the following best compares the values displayed by programs A and B?
- My answer: B, Program A and program B display the same values in different orders.
- Correct answer: C, Program A and program B display the same number of values, but the values differ. 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.
41
Question: Which of the following could be used in the procedure to calculate a student’s total points earned in the course and store the result in the variable One word, adjusted Total ?
- My answer: adjustedTotal <– Max, (midtermExam, finalExam)
- Correct answer: adjustedTotal <– Max, (midtermExam, finalExam) + finalExam. This expression uses theMax procedure to replace the midterm score with the higher of the two scores. The selected value is then added to the final exam score and assigned to adjustedTotal.
43
Question: Based on the values in the table, which of the following best characterizes the algorithm for very large values of n ?
- My answer: The algorithm runs, but not in reasonable time.
- Correct answer: The algorithm runs in reasonable time. The pattern in the table appears to indicate that there are n squared steps for a list containing n items. This number of steps is a polynomial and therefore the algorithm runs in reasonable time.
47
Question: In public key cryptography, the sender uses the recipient’s public key to encrypt a message. Which of the following is needed to decrypt the message?
- My answer: The recipient’s public key
- Correct answer: The recipient’s private key. In public cryptography, a message is encrypted with a recipient’s public key and decrypted with the recipient’s private key.
59
Question: A media librarian at a movie studio is planning to save digital video files for archival purposes. The movie studio would like to be able to access full-quality videos if they are needed for future projects. Which of the following actions is LEAST likely to support the studio’s goal?
- My answer: Using a system that incorporates redundancy to handle disk failure
- Correct answer: Using lossy compression software to reduce the size requirements of the data being stored. Using lossy compression will provide only an approximation of the original video data. The full-quality original versions of the videos will be lost if lossy compression is used. Using redundancy will help ensure that video files are not lost if a storage device fails.
Additional Searches
What is citizen science?
- the collection and analysis of data relating to the natural world by members of the general public, typically as part of a collaborative project with professional scientists. What is an overflow error:
- An overflow error will be produced, for example, if a data type is a single byte and the data to be stored is greater than 256.
A float is a floating-point number, which means it is a number that has a decimal place.
- What is symmetric encryption? helpful link