{ "q1": { "type": "multiple", "question": "\n\n\nRegarding bit representation, which of the following statements is true\n(select all that apply?)\n\n\n", "responses": { "signed_two": "In signed representation, two's complement is used to compute the negative value of an integer.", "signed_one": "In signed representation, one's complement is used to compute the negative value of an integer.", "unsigned": "In unsigned representation, only nonnegative numbers can be used, but the upper bound for the values is larger.", "assignment": "In unsigned representation, it is illegal to assignment a negative number (ie. compiler error)." } }, "q3": { "type": "blank", "question": "\n\n\nGiven a completed version of the bitset Python script above, what values\nare printed at the lines marked by the comments:\n\n\n\n

\nA. ____ After adding elements to bitset.\n

\n\n

\nB. ____ After removing elements from bitset.\n

\n" }, "q2": { "type": "blank", "question": "\nComplete the following script utilizing bitsets in Python:\n\n
\nelements = (1, 2, 4)\nbitset   = ____                     # 1. Initialize bitset\n\n# Add elements to bitset\nfor i in elements:\n    bitset = ____                   # 2. Add element to bitset\n\n# Print contents of bitset\nprint(bitset)                       # A. After adding alements to bitset\n\n# Test for elements in bitset\nfor i in range(6):\n    if ____:                        # 3. Test if element is in bitset\n        print(i)\n\n# Remove elements from bitset\nfor i in elements:\n    bitset = _____                  # 4. Remove element from bitset\n\n# Print contents of bitset\nprint(bitset)                       # B. After removing elements from bitset\n
\n" }, "q5": { "type": "blank", "question": "\n\nMemoization is a technique that ____ values in a container such as an ____\nafter ____ them. For each parameter in a ____ function, the value of the\nfunction is calculated ____, and after this, the value can be directly\nretrieved from the container.\n\n\n" }, "q4": { "type": "multiple", "question": "\n\n\nRegarding dynamic programming, which of the following statements is true\n(select all that apply?)\n\n\n", "responses": { "count": "Dynamic programming can be used to calculate the total number of possible solutions.", "optimal": "Dynamic programming is useful in finding an optimal solution.", "technique": "Dynamic programming combines the correctness of complete search and the efficiency of greedy algorithms.", "memoization": "Dynamic programming utilizes memoization.", "overlapping": "Dynamic programming is utilized when the problem can be divided into independent overlapping subproblems." } }, "q6": { "type": "blank", "question": "\n\nImplement a solution to the coins problem (denominations 1, 3, 4) using\ndynamic programming and determine what is the minimum number of coins\nnecessary to form the following sums:\n\n\n\n
\n1. 17 = ____\n2. 33 = ____\n3. 64 = ____\n4. 71 = ____\n5. 99 = ____\n
\n" } }