Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Control Statements - Java

Total questions: 15

Worksheet time: 3mins

Name
Class
Date
1.

In Given syntax, condition refers to ________ expression

a)

int

b)

char

c)

boolean

d)

None

2.

What is the output of the following program?

a)

blank screen

b)

Statement outside if block

c)

The number is negative

d)

Error

3.

What will be the output of the following program?

a)

Age is greater than 18

b)

age=20

c)

age=18

d)

Error

4.

The given syntax represents what type of selection control statement?

a)

If-then

b)

If-else

c)

If-else Ladder

d)

None

5.

Write the type of Selective control statement for the given image?

a)

If-else

b)

if-then

c)

Ladder if-else

d)

None

6.

What is the output for the given program?

a)

20 is greater than 18

b)

Error

c)

Blank Screen

d)

None

7.

Fill the gaps in the code given

a)

if & ==

b)

if & >

c)

if & >=

d)

None

8.

What is the output for the given code?

a)

Good day

b)

Good evening

c)

time=20

d)

Error

9.

What will be the output for the given program?

a)

Thursady

b)

Friday

c)

Saturday

d)

Sunday

10.

What is the output for the given program?

a)

Today is Sunday

b)

Today is Saturday

c)

Looking forward to the Weekend

d)

Compile Error

11.

In the given while loop statement, what statement will be used in the place of updation?

a)

continue

b)

break

c)

Increment/ Decrement

d)

update

12.
a)

Sum of 'n' numbers=11

b)

Sum of 'n' numbers=55

c)

Compile Error

d)

10

13.

What the output for the given switch statement?

a)

Small

b)

Medium

c)

Large

d)

Unknown

14.

Predict the output for the given program

a)

Case 2

b)

Case 3

c)

Default Case

d)

Case 2

Case 3

Default Case

15.

Is this given statement of for loop declaration is correct or not?

a)

True

b)

False