Medium Multiple Choice QuestionsΒΆ
These problems are similar to those you will see on the AP CS A exam.

3101: Which of the following would be the correct result from the following expression: 123 (decimal)  12 (octal) + 111 (binary)?
 (A) 222
 That would be the answer if these were all decimal values, but they are not.
 (B) 120
 12 in octal is 10 in decimal and 111 in binary is 7 in decimal so this is 123  10 + 7.
 (C) 118
 This would be the answer if it was 123  12 + 111 (binary) but the 12 is in octal.
 (D) 121
 Remember that the rightmost digit in any base is the base to the 0th power which is 1.
 (E) 214
 Remember that the 111 is in binary (base 2). Its decimal value is 7.

3102: What will be printed by
 (A) 2147483647
 This would be true if it was printing just the maximum integer value.
 (B) 0
 This might make sense, but adding one to the maximum integer value gives the minimum integer value.
 (C) There will be a compile time error
 It will compile, but what will it do when you run it?
 (D) 2147483648
 Adding one to the maximum integer value gives the minimum integer value due to overflow.
 (E) There will be a run time error
 This makes sense, but it is not what happens.
System.out.println(Integer.MAX_VALUE + 1);
?