wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Grade10-11 Quiz(variables, if-else, while loops)

Total questions: 37

Worksheet time: 29mins

Name
Class
Date
1.

What language is used in Riders?

a)

Python

b)

Java

c)

Java Script

d)

C++

2.

Look at the following code:

name = "John"

age = 23

What type of data is stored in the variable name?

a)

str

b)

int

c)

float

d)

nothing

3.

Look at the following code:

name = "John"

age = 23

What type of data is stored in the variable age?

a)

str

b)

int

c)

float

d)

nothing

4.

Look at the following code:

name = "John"

age = "23"

What type of data is stored in the variable age?

a)

str

b)

int

c)

float

d)

nothing

5.

If I want to store my height in a variable, which of the following would be a good variable name in best practice?

a)

abcdefg

b)

inches

c)

number

d)

height

6.

If I want to store my name in a variable, which of the following would be a good variable name in best practice?

a)

name

b)

teacher

c)

mister

d)

abcdef

7.

If I want to store multiple names in variables, which of the following would be good variable names in best practice?

a)

a

b

c

b)

name1

name2

name3

c)

Audrey

Ben

John

d)

blah1

blah2

blah3

8.

---------------------- is a reference to a location in memory where the data is stored.

a)

Variable

b)

python

c)

Vakue

d)

Operators

9.

After run the following code, x = -------------

a)

12

b)

15

c)

36

d)

1728

10.

After run the following code , the output will be -----------------

a)

test

b)

exam

c)

testexam

d)

z

11.

After run the following code , the output will be -----------------

a)

test

b)

exam

c)

testexam

d)

z

12.

After run the following code, x = -------------

a)

12

b)

2

c)

14

d)

24

13.

Which is the python logo?

a)

Top left

b)

Bottom left

c)

Top right

d)

Bottom right

14.

What will be the output after the following statements?

a)

15

b)

yes

c)

equal

d)

no

e)

error

15.

Which symbol means "not equal to"?

a)

==

b)

<=

c)

>=

d)

!=

16.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
17.

Which character must be at the end of the line for if?

a)

:

b)

;

c)

.

d)

{

18.

What will be the output after the following statements?

a)

0

b)

1

c)

2

d)

15

e)

error

19.
Max has written this program in Python.
One of the lines contains at least one error.
Which line is it?
a)
Line 1
b)
Line 2
c)
Line 3
d)
Line 4
20.

What will this program output?

a)

:(

b)

":("

c)

Error

d)

nothing

21.

What will be displayed at the end of the program?

a)

Case 1

b)

Case 2

c)

Nothing will be displayed.

d)

Case 1 and Case 2

22.

What will be displayed at the end of the program?

a)

Case 1

b)

Case 2

c)

Nothing will be displayed.

d)

Case 1 and Case 2

23.

What will display at the end of the program running?

a)

You can ride the carousel!

b)

Nothing will display

c)

You cannot ride the carousel!

d)

There will be an error.

24.

What will display at the end of the program running?

a)

You can ride the carousel!

b)

Nothing will display

c)

Sorry! Not tall enough!

d)

There will be an error.

25.

What will display at the end of the program running?

a)

You can ride the carousel!

b)

Nothing will display

c)

Sorry! Not tall enough!

d)

There will be an error.

26.

a)

5

4

3

2

1

b)

4

3

2

1

0

c)

0

d)

Infinite loop

27.

a)

0

b)

4

3

2

1

0

c)

5

d)

4 3 2 1 0

28.

a)

5

4

3

2

1

b)

4

3

2

1

0

c)

0

d)

Infinite loop

29.

Which of the following is the definition of Iteration in terms of programming

a)

Repetition of a sequence, usually with some change

b)

A gap at the start of a line of code

c)

A line of code that includes a condition, followed by lines of code that only run if the condition is met

d)

Repetition of the first letter at the start of each word in a sentence

30.

Which of the following is the definition of Indentation in terms of programming

a)

Repetition of a sequence, usually with some change

b)

A gap at the start of a line of code

c)

A line of code that includes a condition, followed by lines of code that only run if the condition is met

d)

Repetition of the first letter at the start of each word in a sentence

31.

What will happen when this program runs

a)

It will display numbers 0-10 on separate lines

b)

It will display numbers 0-9 on separate lines

c)

It will crash

d)

It will display 0s in an infinite loop

32.

What will happen when this program runs

a)

It will display numbers 0-10 on separate lines

b)

It will display numbers 0-9 on separate lines

c)

It will crash

d)

It will display 0s in an infinite loop

33.

What will happen when this program runs

a)

It will display numbers 0-10 on separate lines

b)

It will display numbers 0-9 on separate lines

c)

It will crash

d)

It will display 0s in an infinite loop

34.

What will happen when this program runs

a)

It will display numbers 0-10 on separate lines

b)

It will display numbers 0-9 on separate lines

c)

It will crash

d)

It will display 0s in an infinite loop

35.

Which of the following keywords is used to create a while loop in Python?

a)

repeat

b)

while

c)

loop

d)

until

36.

Which of the following statements will correctly increment a variable `count` by 1 inside a while loop?

a)

count = count + 1

b)

count += 1

c)

Both A and B

d)

count =+ 1

37.

Which of the following is the correct way to use break in a while loop?

a)

break()

b)

break

c)

stop

d)

exit()