πŸ“š

Β >Β 

πŸ’»Β 

Β >Β 

πŸ–₯

3.9 MC Answers and Review

4 min readβ€’december 28, 2021


AP Computer Science AΒ πŸ’»

130Β resources
See Units

Answers and Review for Multiple Choice Practice on Boolean Expressions and if Statements

https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-cDYfvJAySI9F.png?alt=media&token=4d2af3e6-5f6f-45b5-a83b-a2d7dd629783

Truth table discussed in key concept 3.6.

β›”STOP!β›” Before you look at the answers make sure you gave this practice quiz a try so you can assess your understanding of the concepts covered in unit 3. Click here for the practice questions: AP Computer Science A Unit 3 Multiple Choice Questions.
Facts about the test: The AP Computer Science A exam has 40 multiple choice questions and you will be given 90 minutes to complete the section. That means it should take you around 34 minutes to complete 15 questions.

*The following questions were not written by CollegeBoard and although they cover information outlined in the AP Computer Science A Course and Exam Description the formatting on the exam may be different.


1. An event that occurs during the execution of a program, that disrupts the normal flow of the instruction is called...
A. comment line
B. exception
C. static
D. method
Answer: This is the definition of exception.

2. Items whose value does not change are called...
A. variable
B. stay-same
C. literal
D. unvariable
Answer: This is the definition of a literal item.

3.Β  A program error that makes it do something other than what the programmer intended is called a...
A. logic error
B. run time error
C. divide by zero error
D. syntax error
Answer: This is an example of a logic error.
πŸ“„ Study AP Computer Science A, Unit 3.0: Unit 3 Overview

4. Which of the following conditions tests whether x is NOT between 1 and 10 (inclusive)?
A. 1 > x && x <= 10
B. !(1 <= x <= 10)
C. 1 <= x || x <= 10
D. 10 < x || x < 1
Answer: This question tests your knowledge of logic syntax.
πŸ“„ Study AP Computer Science A, Unit 3.5: Compound Boolean Expressions

5. Assume that x & y are boolean variables that have been properly initialized. What will the output be if the value of x is true and the value of y is false?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-RCjSNc1xoSzS.png?alt=media&token=b667bd9c-9644-4093-b973-fd4a61b5d040
A. One
B. Two
C. Three
D. OneTwo
Answer: || is OR, && is AND, ! is NOT or negation
πŸ“„ Study AP Computer Science A, Unit 3.5: Compound Boolean Expressions

6. Temporarily changing the type of arithmetic operand for use in calculations or assignments is called...
A. changing
B. forming
C. casting
D. variable
Answer: This is the definition of casting

7. The following truth table matched which boolean condition?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-oDqO4NG9BmUa.png?alt=media&token=d05077ed-147f-44dd-a2e6-092c688a035a
A. A || ( A || B )
B. !A && ( A || !B )
C. A && ( A || B )
D. A && ( A && B )
Answer: evaluation of truth tables: || is OR, && is AND, ! is NOT or negation
πŸ“„ Study AP Computer Science A, Unit 3.6: Equivalent Boolean Expressions

8. In a list, the place of each item is known as its...
A. place value
B. order
C. gate
D. index
Answer: Index is the location/place of an item

9. The boolean expression (A || B) && A is true...
A. whenever either A is true or B is true
B. whenever A is true
C. whenever B is true
D. whenever A is true and B is true
Answer: || is OR and && is AND..
πŸ“„ Study AP Computer Science A, Unit 3.5: Compound Boolean Expressions

10. Consider the following code, assuming word is a string, what does the code do?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-T2LDq8VWHzTp.png?alt=media&token=d9888fc9-1b3e-4a3c-b52b-0ccf2e46e07d
A. tests if the String word contains only lower case letters
B. tests if the String word contains only upper case letters
C. tests if the String word contains only nonletter characters
D. tests if the String word contains only numeric values
Answer: Boolean check to see if the string word is the same as it is when lower case
πŸ“„ Study AP Computer Science A, Unit 3.0: Unit 3 Overview

11. Which IF condition correctly checks whether there are sufficient funds in the bank account to withdraw "amount"?
A. if (balance = amount)
B. if {balance >= amount}
C. if (balance >= amount)
D. if [balance >= amount]
Answer: The correct syntax is with parentheses.
πŸ“„ Study AP Computer Science A, Unit 3.0: Unit 3 Overview

12. What is the output by the following code?
https://firebasestorage.googleapis.com/v0/b/fiveable-92889.appspot.com/o/images%2F-MEKZYbVNOQJ3.png?alt=media&token=fbaffb2f-3555-48ae-9065-1615483a747b
A. 11
B. 15
C. 31
D. error
Answer: x=10, increases to 11 which is < 31 so 11 is displayed

13. Which condition should be used to test whether the contents of two strings string1 and string2 have the same value?
A. (String.equals(string1, string2))
B. (string1.equals(string2))
C. (string1 == string2)
D. (Equals(string1, string2))
Answer: This question tests your knowledge of Java syntax.

14. If string1 and string2 are equal, then string1.compareTo(string2)___________.Β 
A. ==true
B. ==null
C. ==0
D. .equals(0)
Answer: Syntax, logical equivalency
πŸ“„ Study AP Computer Science A, Unit 3.7: Comparing Object

15. Which of the following statements determines whether a person is ineligible for a junior or senior discount, assuming that a person is eligible for the discount if they are younger than 18 or older than 62?
A. age >= 18 && age > 62
B. age >= 18 || age <= 62
C. age >= 18 && age <= 62
D. age <= 18 || age >= 62
Answer: This question tests your knowledge of Boolean syntax.
πŸ“„ Study AP Computer Science A, Unit 3.6: Equivalent Boolean Expressions

What can we help you do now?
πŸ”Study for Unit 4
🦘Jump to AP Computer Science A Unit 4 Multiple Choice Questions
🀝Connect with other students studying AP Computer Science A with Hours
Browse Study Guides By Unit
βž•Unit 1 – Primitive Types
πŸ“±Unit 2 – Using Objects
πŸ•ΉUnit 4 – Iteration
βš™οΈUnit 5 – Writing Classes
⌚️Unit 6 – Array
πŸ’ΎUnit 7 – ArrayList
πŸ’»Unit 8 – 2D Array
πŸ–²Unit 9 – Inheritance
πŸ–±Unit 10 – Recursion
πŸ™Exam Reviews