Control Structures in Java

Control Structures in Java

8th Grade

10 Qs

quiz-placeholder

Similar activities

11. Light following Robot

11. Light following Robot

1st - 10th Grade

7 Qs

If-Else in Java

If-Else in Java

8th Grade

10 Qs

Class 8 Program coding Java

Class 8 Program coding Java

8th Grade

13 Qs

Logic Building in Java Part 1

Logic Building in Java Part 1

6th - 9th Grade

10 Qs

Езикът Java - синтаксис

Езикът Java - синтаксис

KG - Professional Development

9 Qs

Class 8 Java

Class 8 Java

8th Grade

15 Qs

Computer Ethics

Computer Ethics

6th - 8th Grade

13 Qs

Week 3 Arduino Basics Quiz

Week 3 Arduino Basics Quiz

7th - 12th Grade

10 Qs

Control Structures in Java

Control Structures in Java

Assessment

Quiz

Computers

8th Grade

Hard

Created by

Adya Dalela

Used 83+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How many choices are possible when using a single if-else statement?

1

2

3

4

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How many "else" statements can you pair with a single "if" statement

1

<10

<20

As many as is needed.

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How many "else if" links can you have in an "if else if" ladder?

<10

<20

<30

As many as is needed to represent the situation

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Give the O/P.


int age= 5;

if (age > 6)

System.out.println("John is getting ice cream");

else

System.out.println("John is getting apple juice");

System.out.println("John is getting grapes);

John is getting ice cream

John is getting grapes

John is getting apple juice

John is getting grapes

John is getting apple juice

John is getting ice cream

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Suppose income is 4001, what is the output of the following code:
if (income > 3000) {
 System.out.println("Income is greater than 3000");
}
else if (income > 4000) {
 System.out.println("Income is greater than 4000");
}
no output
No output
Income is greater than 3000 
Income is greater than 3000 followed by Income is greater than 4000
Income is greater than 4000 followed by Income is greater than 3000

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Suppose you write the code to display "Cannot get a driver's license" if age is less than 16 and 
"Can get a driver's license" if age is greater than or equal to 16. 
Which of the following code is the best?
if (age < 16) 
 System.out.println("Cannot get a driver's license");
if (age >= 16) 
 System.out.println("Can get a driver's license");
if (age < 16) 
 System.out.println("Cannot get a driver's license");
else 
 System.out.println("Can get a driver's license");
if (age < 16) 
 System.out.println("Cannot get a driver's license");
else if (age >= 16) 
 System.out.println("Can get a driver's license");
if (age < 16) 
 System.out.println("Cannot get a driver's license");
else if (age > 16) 
 System.out.println("Can get a driver's license");
else if (age == 16) 
 System.out.println("Can get a driver's license");

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

The following code displays ___________.
double temperature = 50;
if (temperature >= 100)
 System.out.println("too hot");
else if (temperature <= 40)
 System.out.println("too cold");
else
 System.out.println("just right");
too hot
too cold
just right
too hot too cold just right

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?