| preferred AP College board partner for AP classes
AP Computer Science A/Unit 4: Iteration
Start Practice TestPractice Test
Share
About Exam
medium Solved by 2 students
Java Nested Conditional Logic
< Prev
Next >

Develop code to represent nested branching logical processes and determine the result of these processes.

Which of the following could NOT be printed by this code segment?

int num = /* some integer value */;
if (num > 0) {
    if (num % 2 == 0) {
        System.out.print("Even");
        if (num > 10) {
            System.out.print(" Large");
        }
    } else {
        System.out.print("Odd");
        if (num < 10) {
            System.out.print(" Small");
        }
    }
} else {
    System.out.print("Zero or Negative");
}
A

Zero or Negative

B

Odd Small

C

Even Small

D

Even Large

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy