Score:

Screen Shot 2023-03-09 at 11 59 07 AM

Corrections:

Question 2: Which of the following has the potential for compromising a user’s personal privacy?

A: A group of cookies stored by the user’s Web browser B: The internet Protocol (IP) address of the user’s compute C: The user’s email address D: The user’s public key used for encryption

Correct answer: A – Cookies can be used to track the sites that a user visits, which can be used to collect further information on the user

Question 2: In order ot test the program, the programmer initializes numList to [0, 1, 4, 5]. The program displays 10, and the programmer concludes that the program works as intended. Which of the following is true?

A: The conclusion is correct, the program works as intended B: The conclusion is incorrect, the program does not display the correct value for the test case C: The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct. D: The conclusion is incorrect; using the test case [0, 1, 4, 5] only confirms that the program works for lists in increasing order.

Correct answer: C – In this specific test case, the program displays the correct answer, because the first number is 0. The error in the program is that the first number is added twice, which does not matter in this specific test case. Therefore the program may seem correct even though it is not.

Question 43: Consider the following procedures:

PROCEDURE proc1(str)
{
    DISPLAY(str)
    DISPLAY("happy")    
}
PROCEDURE proc2(str1, str2)
{
    proc1(str2)
    DISPLAY(str1)
}

What is displayed as a result of the procedure call proc2(“birthday”, “to you”)?

A: birthday happy to you B: birthday happy birthday C: to you birthday happy D: to you happy birthday

Correct answer: D – the first string becomes “to you” “happy”. Then the second procedure prints the first string and adds “birthday”.

Question 50: A computer scientist is analyzing four different algorithms used to sort a list. The table below shows the number of steps each algorithm took to sort lists of different sizes.

Correct answer: A and D – B is not the correct answer, since B is growing exponentially. A and D are growing at a linear rate, which means the number of steps needed will increase less as the list size increase.