wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

LA4.C4: Conditions and Loops

Total questions: 14

Worksheet time: 7mins

Name
Class
Date
1.

What will the program output if the current hour is 10?

a)

Good Morning World

b)

Good Evening World

c)

Good Night World

d)

Hello World

2.

Which keyword is used to start a conditional statement in the program?

a)

EndIf

b)

Else

c)

If

d)

Then

3.

What does the Math.Remainder function do?

a)

Multiplies two numbers

b)

Divides one number by another and returns the remainder

c)

Subtracts one number from another

d)

Adds two numbers

4.

What is the purpose of the Else statement in the program?

a)

To end the program

b)

To provide an alternative action if the condition is false

c)

To define a new variable

d)

To repeat the condition

5.

How can you increment a variable by 2 in a For loop?

a)

For i = 1 To 24 Increase 2

b)

For i = 1 To 24 Add 2

c)

For i = 1 To 24 Increment 2

d)

For i = 1 To 24 Step 2

6.

What will the While loop do in the provided example?

a)

Run for a fixed number of times

b)

Run until the number is greater than 1

c)

Run until the number is less than or equal to 1

d)

Run indefinitely

7.

What is the output of the program if the input number is 7?

a)

The number is Composite

b)

The number is Prime

c)

The number is Odd

d)

The number is Even

8.

What does indentation in programming help with?

a)

It is required for the program to work

b)

It helps in understanding the structure of the program

c)

It makes the program run faster

d)

It adds comments to the code

9.

What is the purpose of the EndIf statement?

a)

To define a loop

b)

To declare a variable

c)

To end a conditional execution

d)

To start a new condition

10.

Which of the following is a valid For loop syntax?

a)

For i = 1 To 24 Step 1

b)

For i = 1 To 24

c)

For i = 1 To 24 EndFor

d)

For i = 1 To 24 Increment 1

11.

What will the output be if the current hour is 12?

a)

Good Morning World

b)

Good Night World

c)

Good Evening World

d)

Good Afternoon World

12.

What is the initial value of 'i' in the For loop example?

a)

0

b)

24

c)

1

d)

10

13.

What does the Step keyword do in a For loop?

a)

Defines the end of the loop

b)

Specifies the increment value

c)

Starts a new loop

d)

Ends the program

14.

What is the output of the program when counting backwards from 10?

a)

10, 9, 8, 7, 6, 5, 4, 3, 2

b)

10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0

c)

1, 2, 3, 4, 5, 6, 7, 8, 9, 10

d)

10, 9, 8, 7, 6, 5, 4, 3, 2, 1