My Score

After taking the test, I answered 50 questions on programming problem-solving as well as computer science connection knowledge (API's, protocols, how data is shared, etc.). I got 48 of them correct.

The first question I got wrong was about how information is transferred over the Internet. I chose the answer, "The message is broken into two packets. One packet contains the data to be transmitted and the other packet contains metadata for routing the data to the recipient’s device." The correct answer was, "The message is broken into packets. The packets can be received in any order and still be reassembled by the recipient’s device." The reason I did not get this correct is because of my lack of knowledge on the subject. This was under a unit that I apparently did not study very well, and caused me to get the answer wrong. My plan to improve in the future is to study and quiz myself and have my friends quiz me on questions that are not cheating on tests.

The second question that I got wrong was the question, "Consider the following code segment. What are the values of first and second as a result of executing the code segment?" The code looked like this:

first = True
second = False
second = first
first = second

I picked the answer, "The value of first is false, and the value of second is true." As shown below by printing both values, that answer was wrong.

first = True
second = False
second = first
first = second

print(first)
print(second)
True
True

This is a logic proven by a concept called variable swapping. The following code incorrectly swaps variables.

def swap(x, y):
    x = y
    y = x
    print(str(x) + ", " +str(y))

a = 4
b = 2
swap(a, b)
2, 2

This is because when x is set to y, x loses its original value, setting both values equal to the original value of y. The following code swaps variables correctly.

def swap(x, y):
    temp = x
    x = y
    y = temp
    print(str(x) + ", " + str(y))

a = 4
b = 2
swap(a, b)
2, 4

The improvement that I can do to avoid these mistakes is to look over the code twice.