zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcardStudy GuideStudy GuideQuestion BankQuestion Bank
GlossaryGlossary

Boolean Logic & Conditional Statements

Question 1
college-boardComputer Science AAPExam Style
1 mark

What is the output of the following code snippet if the integer variable score is 85?

java
if (score >= 90) {
    System.out.println("A");
} else if (score >= 80) {
    System.out.println("B");
} else if (score >= 70) {
    System.out.println("C");
} else {
    System.out.println("F");
}
Question 2
college-boardComputer Science AAPExam Style
1 mark

What would be printed by this Java code segment?

int score =85; if(score >=90){ System.out.println("A"); }else{ System.out.println("B"); }

Question 3
college-boardComputer Science AAPExam Style
1 mark

In a Java program, what will happen if all conditions in an "if-else-if" ladder are false?

Question 4
college-boardComputer Science AAPExam Style
1 mark

In what scenario would an inner 'else-if' block be executed when nested inside another 'if-else' structure?

Question 5
college-boardComputer Science AAPExam Style
1 mark

Which of these changes would correctly cause an output of “Average” when inputting a speed value of ‘50’ into this speed assessment code?

Question 6
college-boardComputer Science AAPExam Style
1 mark

Assuming there's an integer variable age, which conditional structure would correctly print "Adult" when age is at least eighteen, otherwise "Minor"?

Question 7
college-boardComputer Science AAPExam Style
1 mark

Which outcome best represents a potential downside when excessively using nested else-if structures to navigate complex decision trees within an algorithm?

Feedback stars icon

How are we doing?

Give us your feedback and let us know how we can improve

Question 8
college-boardComputer Science AAPExam Style
1 mark

Given a complex system with multiple levels of inheritance and polymorphism, which statement correctly identifies when a superclass constructor gets called during object creation?

Question 9
college-boardComputer Science AAPExam Style
1 mark

What keyword should follow an ‘if’ block to provide an alternative path when the ‘if’ condition is not met?

Question 10
college-boardComputer Science AAPExam Style
1 mark

Which method returns the largest divisor between 1 and 10 that a number is divisible by?