College Board Final
- I got question 26 wrong; “The variable isOpen is to be used to indicate whether or not a store is currently open. Which of the following is the most appropriate data type for isOpen?” The answered “number” when the real answer was Boolean. I was not 100% sure what Boolean meant. It means a value that is true or false. I put number because I thought I could use the values 1 and 0 to represent open and closed. It would have been more beneficial to use true to represent open and false to represent closed.
- I got question 28 wrong; “The cost of a customer’s electricity bill is based on the number of units of electricity the customer uses. For the first 25 units of electricity, the cost is $5 per unit. For units of electricity after the first 25, the cost is $7 per unit.Which of the following code segments correctly sets the value of the variable cost to the cost, in dollars, of using numUnits units of electricity?” I answered “If numUnits < 25 Cost <– numUnits * 5. Else Cost <– 25 * 7 + (numUnits - 25) * 5.” I should have switched the 5 and 7 on the else if statement. This is because the else if statement counts the first 25 units times 5 for 5 dollars per units. So it is 25 * 5. The units after cost 7 which is why it is times 7.
- I got question 35 wrong; “In a certain video game, the variable maxPS represents the maximum possible score a player can earn. The maximum possible score depends on the time it takes the player to complete the game. The value of maxPS should be 30 if time is greater than 120 and 50 otherwise. Which of the following code segments correctly sets the value of maxPS based on the value of time ? Select two answers.” I answered D and A. Then correct answer was D and C. The reason C is wrong is because it is puting maxPS <– 30 as an else if statement and maxPS <– 50 as an if. This is incorrect because it is saying if time > 120 then 50 would be correct when it should be 30. By excluding 50 from the if statement it means that it is only true if time < 120.
- I got question 46 wrong; “Consider the following code segment. What are the values of first and second as a result of executing the code segment?” I answered “The value of first is false, and the value of second is true.” The correct answer was “The value of first is false, and the value of second is true.” I beilive I misclicked on this question. The code segment says first <– true and second <– false. This practically gives me the answer because it is saying exactly what it does.
- I got question 47 wrong; “Consider the following code segment. What is displayed as a result of executing the code segment?” I put 10, 20, 30, 40. I should have said 21, 40, 30, 50. I looked at what each value represented and I didn’t think about the equation very hard. I should have completed the math and done and algebra equation. A would be displayed as 21 because x=20 and it is X + 1. 20+1=21. B would be 40 because x is 20 and b was intially 20. This block of code changes it to 40 because 20 + 20 = 40. C is thirty because there are no further blcoks of code changing its value. D is 50 because it is 30 + 40/2. D is initially 40. 40/2=20. 20+30=50.
- I got question 48 wrong; “Consider the following code segment.Which of the variables have the value 50 after executing the code segment?” I put x, y, and z when y is not correct. I saw that y=50 before the code segment but I didn’t think about after. It wouldn’t equal 50 because it changes its value.
- I got question 49 wrong; “Consider the following procedures for string manipulation. Which of the following code segments can be used to store “noon” in the string variable word?” I put “word <– “no” word <– concat (reverse(word), reverse(word).” The correct answer is word <– “on” word <– concat(reverse(word), word).” The word would not be reversed twice in this segment. Also it assigns on to word instead of no to word.