wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Computational Thinking in Python[Quiz 3]

Total questions: 15

Worksheet time: 6mins

Name
Class
Date
1.

l1 = [4,6,8,1]

l1.append(5)

print(l1)

a)

4,5,6,8,1

b)

1,5,6,8,4

c)

4,6,8,1,5

d)

4,8,1,6,5

2.

What is the symbol of floor division in Python

a)

**

b)

/

c)

\

d)

//

3.

What is the output

x = 4

y = 6

print(x == y)

a)

True

b)

Error

c)

False

d)

Invalid statement

4.

Correct syntax for while loop is

a)

while(x>1)

#statements

b)

While(x>1)

#statements

c)

while x>1:

#statements

d)

while x>1

#statements

5.

Which function do we use to add an element at a particular element in the list

a)

insert()

b)

append()

c)

add_list()

d)

list_append

6.

Which statement brings the control out of the loop

a)

pass

b)

break

c)

catch

d)

try

7.

What is the output of the following code

a = 4

b = 3

pro = a**b

print(pro)

a)

12

b)

64

c)

32

d)

128

8.

To get an integer input from the user, which is the valid line of code to be used

a)

x = input()

b)

x = int()

c)

x = int(input)

d)

x = int(input())

9.

Can the for loop we used to print the star-pattern program

a)

True

b)

False

10.

list_1 = [1,2,3,5]

_______

print(list)

output: 1,2,3,4,5

Which line of code should we enter in the blank to get the mentioned output?

a)

list_1.append(4)

b)

list1.insert(3,4)

c)

list_1.insert(3,4)

d)

list1.append(4)

11.

What is the output of the following code

for in in range(1,2):

print(i)

a)

1,2

b)

1

c)

2

d)

error

12.

What command is used to go to the next line

a)

\t

b)

\b

c)

\r

d)

\n

13.
What type of loop is used when you know how many times you want to repeat something?
a)
A WHILE Loop
b)
An IF function
c)
A FOR Loop
d)
A Variable
14.

What is wrong with the following code?

esports = ("Donkey Kong", "Galaga", "Pac Man")

esports[1] = "Centipede"

a)

The item at index 1 does not exist

b)

You cannot update an item in a tuple

c)

The [1] notation after the variable name is not valid

d)

Nothing; this will work fine

15.
The condition for a while loop to continue could include which of the following?
a)
While something equals something
b)
While something is greater than something
c)
While something is True
d)
All of these