Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Question bank

Total questions: 31

Worksheet time: 16mins

Name
Class
Date
1.

………..is simply a set of steps used to complete a specific task.

a)

Coder

b)

Sprite

c)

Algorithm

d)

Coding

2.

How do we make programs in mBlock?

a)

by typing code in Java

b)

By connecting code blocks

c)

By using Python language

d)

By writing scripts

3.

What is it called when we tell the computer what to do step by step?

a)

Coder

b)

Sprite

c)

Algorithm

d)

Coding

4.

How is user input typically read in Python?

a)

Integer

b)

Boolean Value

c)

Text String

d)

Floating Decimal

5.

Which of the following is an assignment operator in Python?

a)

=

b)

>>>

c)

===

d)

==

6.

Which of these codes would return the name "Mona" from the list nameList = ["Ahmed", "Mai", "Hour", "Mona", "Hesham"]?

a)

nameList()

b)

nameList[]

c)

nameList[3]

d)

nameList["3"]

7.

Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?

a)

3

b)

1

c)

5

d)

25

8.

Suppose list1 is [1, 5, 9], what is sum(list1)?

a)

1

b)

9

c)

15

d)

none

9.

The first index in a Python list is:

a)

1

b)

0

c)

A

d)

a

10.

x.sort() will do what?

a)

Sort the list in ascending order

b)

Sort the list into reverse order

c)

Create a new list

d)

Error

11.

How do I remove something from a list?

a)

x.append()

b)

x.remove()

c)

x.delete()

d)

x=(new variable)

12.

What is used to separate elements in a list?

a)

Bracket

b)

Comma

c)

Full Stop

d)

Space

13.

Which code would I use to add an item to a list?

a)

x.append()

b)

x.sort()

c)

x.add()

d)

Append.x()

14.

_________ is a short form of "else if" statement.

a)

if

b)

else

c)

elif

d)

Else-if

15.

Which of the following commands will return the length of the list mylist?

a)

length(mylist)

b)

len(mylist)

c)

mylist.length()

d)

mylist.len()

16.

Loop That Runs Till Condition is True :

a)

list

b)

while

c)

for

d)

if

17.

Loop That Runs Till Condition is True :

a)

list

b)

while

c)

for

d)

if

18.

Kind of loop used when you know the number of times you want it to repeat.

a)

List

b)

for

c)

while

d)

if

19.

In Python, the two types of loops are _____ and _______.

a)

for

b)

while

c)

list

d)

if

20.

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

a)

:

b)

{

c)

;

d)

.

21.

Which statement will check to see if a is equal to b?

a)

if a == b

b)

if a = b:

c)

if a == b:

d)

if a != b:

22.

The second part of an if statement, that is executed when the condition is false, is:

a)

if

b)

else

c)

for

d)

input

23.

Pieces of code that only run "under certain conditions" are:

a)

conditional statements

b)

syntax

c)

variables

d)

control flow statements

24.

Which symbol means "not equal to"?

a)

==

b)

!=

c)

>=

d)

<=

25.

If-Else lets you decide between two actions: one if true, another if not.

a)

True

b)

False

26.

In programming, you use conditions to decide what to do next.

a)

True

b)

False

27.

With Python, you can make programs by just moving blocks around.

a)

True

b)

False

28.

Loops help avoid doing the same thing many times by hand in programming.

a)

True

b)

False

29.

In programming, loops are a way to do something over and over again.

a)

True

b)

False

30.

An algorithm is a plan or a series of steps to finish a task.

a)

True

b)

False

31.

A computer program is a list of steps that tell the computer how to finish a job.

a)

True

b)

False