Questions that I missed

6. Loop terminates when count exceeds max, so only values less than or equal to max are printed.

8. The procedure does not interchange the values of j and k. Rather, it returns a new list with the values at indices j and k interchanged.

11. Wasn’t too sure on this question and confused. The inner loop iterates from index j + 1 to the end of the list, so each element is only compared with the elements that follow it.

14. When numCorrect is 9, the condition numCorrect > 7 evaluates to true and the condition numCorrect ≥ 9 evaluates to true. Therefore “check plus” is displayed as intended.

16. Thought that it was only broken up into two packets but there are many more. Messages are broken into as many packets as are needed to transmit the data. Each packet contains both data and metadata.

21. Statement I is true because strings of characters can be represented by sequences of bits.

22. Confused on binary numbers a bit. Binary 0110 is equivalent to 22+21, or decimal 6.

29. Switched my answers at the very end from the right one to the wrong one. Input data can be stored as any data type. Programming languages do not typically store input data in a list for record-keeping purposes.

32. The last assignment statement assigns a copy of myList to yourList, rather than appending one list to the other.

34. The code segment initializes the three lists, and then swaps the contents of firstList and secondList rather than appending one list to the other.

35. Didn’t know if the MaxPs 50 goes before or after.

36. This would be the correct solution if i were initialized to 2 instead of 1. This code segment will generate the list [1, 3, 5, 7, 9, 11, 13, 15, 17, 19].

37. Confused on what temp means. A temporary variable is needed to interchange the values of two variables.

39. List indices are typically nonnegative integers, so a decimal number between two integers would be considered an invalid index.

41. This is the initial value of p. None of the variables has the value 10 after executing the code segment.

42. After initially assigning values to the variables, the code segment assigns the value 4 to num3 and assigns the value 8 to num1. The value of sum at the end of the code segment is 8 + 4 + 4, or 16.

43. This is the value of x after the code segment is executed, not the value of result.

45. The code segment iterates through each element in the list, incrementing count1 for each positive value and incrementing count2 otherwise. There are only two positive values in the list, not five.

46. The fourth statement assigns the value of second (which is true) to first.

48. The value of y is initially 50, but its value is changed to 75 in the fifth statement.

49. Switched answers last second. This code segment produces the string “onno”.

50. Overall confused on how to attack this question. Took my best guess on this one.