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

Tracing Nested If Statements

< 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
Mark for review

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
#5suhanakochhar00611 0m 54s 46
#6tellabhinaya11 1m 31s 9
#7namansoin00011 5m 29s -229
#8bommasam00033 58m 37s -3,217
Items per page:
10
1 – 8 of 8
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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