Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 9 students

Tracing Nested If Statements

Mark
< Prev
Next >

Consider the following method.

public static void message(int a, int b, int c)
{
    if (a < 10)
    {
        if (b < 10)
        {
            System.out.print("X");
        }
        System.out.print("Y");
    }
    if (c < 10)
    {
        if (b > 10)
        {
            System.out.print("Y");
        }
        else
        {
            System.out.print("Z");
        }
    }
}

What is printed as a result of the call message(5, 15, 5)?

A

Z

B

YY

C

XYZ

D

Y

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1hitrishabhatia23 0m 00s 190
#2kazvin.tjakradinata22 0m 54s 146
#3y.seong202722 0m 56s 144
#4lsj0803092211 0m 00s 100
#5Potter1611 0m 20s 80
#6suhanakochhar00611 0m 54s 46
#7tellabhinaya11 1m 31s 9
#8namansoin00011 5m 29s -229
#9bommasam00033 58m 37s -3,217
Items per page:
10
1 – 9 of 9

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|