Control Structures in Java

Control Structures in Java

8th Grade

10 Qs

quiz-placeholder

Similar activities

CPF 1 - 3

CPF 1 - 3

6th - 8th Grade

15 Qs

Systemy operacyjne w środowisku sieciowym

Systemy operacyjne w środowisku sieciowym

6th - 12th Grade

10 Qs

7.02 going online

7.02 going online

4th - 9th Grade

10 Qs

hardware and software(g3)

hardware and software(g3)

2nd - 10th Grade

10 Qs

DBMS- CLASS8 CBSE

DBMS- CLASS8 CBSE

7th - 10th Grade

10 Qs

ICT: WEEK 1

ICT: WEEK 1

8th Grade

10 Qs

Физика и информатика

Физика и информатика

8th Grade

15 Qs

Python lesson 3

Python lesson 3

8th Grade

11 Qs

Control Structures in Java

Control Structures in Java

Assessment

Quiz

Computers

8th Grade

Practice Problem

Hard

Created by

Adya Dalela

Used 86+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?