Java
TOPIC 14 – IF STATEMENTS – PART 1
AP EXTRA
AP LESSON WORK
QUESTION
1
What will be outputted by the
following?
a)
int mark = 72;
if(mark > 50)
System.out.println("You're
passing!");
System.out.println("For
now!");
|
b)
int mark = 44;
if(mark > 50)
System.out.println("You're
passing!");
System.out.println("For
now!");
|
c)
boolean allGood = true;
if(allGood)
System.out.println("A");
else
System.out.println("B");
System.out.println("C");
|
d)
int x = 100;
if(x++ == 10*10)
System.out.println("A");
else
System.out.println("B");
System.out.println(x);
|
e)
int x = 1;
x += 4;
if(x<=4)
System.out.println("A");
else
System.out.println("B");
System.out.println(x);
|
|