Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python 100

Total questions: 103

Worksheet time: 59mins

Name
Class
Date
1.

What Data type is a str() #string (a)  

Choose from the below words
name
"Bob"
15.6
300278
2.

What Data type is a int() #integer

a)

name

b)

"Bob"

c)

15.6

d)

300278

3.

What Data type is a float() #real

a)

name

b)

"Bob"

c)

15.6

d)

300278

4.

What is the Variable?

a)

name

b)

"A"

c)

15.6

d)

300278

5.

What is the Data Type : Char? #Character

a)

name

b)

"A"

c)

15.6

d)

300278

6.

The technical name for converting a variable from one data type to another (Like a magic spell!)

a)

Cussing

b)

Cashing

c)

Casting

d)

Cauldron

7.

An IDE stands for...

a)

Interactive Development Entity

b)

Intuitive Development Entity

c)

Instant Decision Error

d)

Interactive Development Environment

8.

What will this OUTPUT?

a)

6

b)

33

c)

66

d)

12

9.

What will line 2 Print?

a)

1.6

b)

1

c)

2

d)

1.618

10.

What will line 4 OUTPUT?

a)

1.6

b)

1

c)

2

d)

1.618

11.

Which value is of data type String?

a)

64

b)

"Cat"

c)

True

d)

0.5

12.

What is a Float?

a)

A data type that contains whole numbers. E.g. 3, 45, 124

b)

Numbers with decimal point. E.g. 0.5, 2.45, 56.04

c)

Group of characters between quotation marks. E.g. "Table"

d)

Data type that can only be True or False.

13.

Which value is of data type Float?

a)

64

b)

"Cat"

c)

True

d)

0.5

14.

What is a Boolean?

a)

A data type that contains whole numbers. E.g. 3, 45, 124

b)

Numbers with decimal point. E.g. 0.5, 2.45, 56.04

c)

Group of characters between quotation marks. E.g. "Table"

d)

Data type that can only be True or False.

15.

Which value is a Boolean?

a)

64

b)

"Cat"

c)

True

d)

0.5

16.

Select the correct answer:


x = 15

y = 4


print( 'x * y')

a)

59

b)

60

c)

54

d)

22

17.

Choose three properties of a variable below:

a)

Has a name.

b)

Holds a value.

c)

Has a data type.

d)

Has a length.

18.

A named memory location used to store values in computer is a ...

a)

Casting

b)

String

c)

Variable

d)

Hard Drive Disk

19.

!=

a)

NOT EQUAL

b)

EQUAL or LESS THAN

c)

MORE THAN

d)

NOT

20.

<

a)

LESS THAN

b)

LESS THAN OR EQUAL TO

c)

GREATER THAN

d)

LESS OR MORE THAN

21.

<=

a)

LESS THAN

b)

LESS THAN OR EQUAL TO

c)

GREATER THAN

d)

LESS OR MORE THAN

22.

==

a)

LESS THAN

b)

LESS THAN OR EQUAL TO

c)

EQUAL TO

d)

LESS OR MORE THAN

23.

>=

a)

LESS THAN

b)

MORE THAN OR EQUAL TO

c)

EQUAL TO

d)

LESS OR MORE THAN

24.

What Data type is TRUE

a)

Integer

b)

String

c)

Boolean

d)

Float

25.

What is the == on line 1

a)

Conditional Operator

b)

Assignment

c)

Casting

d)

String

26.

What program construct is line 3?

a)

Selection (Step by step)

b)

Iteration (Loop)

c)

Selection (Decision)

27.

In which line is casting happening?

a)

1

b)

2

c)

4

d)

5

28.

What Comparative operator is used here?

a)

assigment

b)

Not Equal To

c)

Equal To

d)

Ieration

29.

The functions input , print and ________ are used here

a)

Choice

b)

elif

c)

if

d)

upper

30.

What will be output if someone types Insult

a)

You smell funny

b)

You look lovely today

c)

Invalid response

d)

Syntax error

31.

What is int()?

a)

Text

b)

Console

c)

Function

d)

Decoder

32.
Why would you use a WHILE loop?
a)
To repeat code
b)
To repeat code until a condition is met
c)
To save time
d)
To increase the range of code
33.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
34.
Which of these would be used to loop through instructions a set number of times?
a)
IF statement
b)
WHILE loop
c)
FOR loop
35.
The _________ mode in Python makes it easy to run and test short snippets of code..
a)
Interactive Shell
b)
Edit
c)
Command
d)
Program
36.
What construct is used in line 3
a)
Selection
b)
Iteration
c)
Sequence
d)
Loop
37.

To repeat until a particular condition is met, TRUE is used

a)

while loop

b)

for loop

c)

if loop

d)

Eternal Loop

38.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
39.
Data type that can only be true or false
a)
int
b)
string
c)
bool
d)
float
40.
The character that must be at the end of the line for
if, while, for. in pseudo code it is THEN
a)
:
b)
;
c)
.
d)
,
41.

Converts (Casting) a number to a string

a)

str()

b)

int()

c)

parseInt()

d)

convert

42.
Each time the body of a loop is executed, it is called a(n) _______________. 
a)
pass
b)
loopy
c)
iteration
d)
lap
43.
What is print()?
a)
Text
b)
Console
c)
Function
d)
Decoder
44.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
45.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
46.

Is this the correct code for a list?

register = {"Sam", "Pheobe", Georgia", Richard"}

a)

Yes

b)

No

47.

What is the index of “grape” in the list

[“apple”, “grape”, “orange”, “watermelon”]?

a)

0

b)

1

c)

2

d)

3

48.

What is the output of program below?


bicycles = ['trek', 'cannondale', 'redline', 'specialized']

print(bicycles[-1])

a)

trek

b)

cannondale

c)

redline

d)

specialized

49.
What letter will be printed on the screen after running this code:
a)
e
b)
x
c)
t
d)
Nothing prints
50.
What is the position of the name "Robert" in the following list:
a)
0
b)
1
c)
2
d)
3
51.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
52.
Each item in a list has an "address" or index. The first index in a Python list is what?
a)
0
b)
1
c)
a
d)
A
53.

In a list called "players" if you wanted to delete the item with an index of 3 which of the following examples of code would be correct?

a)

players.pop[3]

b)

players.delete(3)

c)

players.remove(3)

d)

players.pop(3)

54.
If you want to create an empty list called colours, which of the following pieces of code is correct?
a)
colours = [ ]
b)
colours = ( )
c)
colours = { }
d)
colors = [ ]
55.
What output will this code produce?
a)
Exeter
b)
4
c)
6
d)
city
56.
What output will this code produce?
a)
red
b)
['blue', 'green', 'red']
c)
['red', 'green', 'blue']
d)
error
57.
What output will this code produce?
a)
['blue', 'green', 'red', 'yellow']
b)
['blue', 'red', 'yellow']
c)
['yellow', 'red', 'green']
d)
['yellow', 'red', 'blue']
58.

What will line 3 OUTPUT?

a)

3

b)

2

c)

TRUE

d)

FALSE

59.
What construct is used in line 3
a)
Selection
b)
Iteration
c)
Sequence
d)
Loop
60.
What keyword is used to define a function? 
a)
def
b)
if
c)
while
d)
for
61.
To obtain the length of a string, you can use which function?
a)
length()
b)
len()
c)
index()
d)
length_input()
62.
Which keyword is used to immediately terminate a loop
a)
break
b)
continue
c)
stop
d)
terminate
63.
How would you convert "hello" to lower case?
a)
"hello".lower()
b)
lower"hello"
c)
lower.("hello")
d)
("hello").lower
64.
Which of the following is a multi-line comment?
a)
"""Multi-line Comment Here"""
b)
""Multi-line Comment Here""
c)
"Multi-line Comment Here"
d)
'Multi-line Comment Here'
65.
Why will the third line not work?
a)
Because num could be an integer, float or a string
b)
Because num will always be greater than count
c)
Because count doesn't add 1
d)
Because num will never be an integer
66.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
67.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
68.
Data type that can only be true or false
a)
int
b)
string
c)
bool
d)
float
69.
A variable that can hold a collection of values, often called an array in other programming languages
a)
list
b)
int
c)
string
d)
constant
70.
The character that must be at the end of the line for
if, while, for. in pseudo code it is THEN
a)
:
b)
;
c)
.
d)
,
71.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
72.
What do end="" is similar to \n but what is it doing here?
a)
removes brackets
b)
removes blank lines
73.
What is this code doing?
a)
deleting
b)
apending
c)
pop
d)
amending
74.
What data type is found_flag?
a)
String
b)
Boolean
c)
Integer
d)
Float
75.
What is being done to this file?
a)
Read
b)
Write
c)
Append
d)
Delete
76.
This will output the whole file
a)
True
b)
False
77.
What is a_file
a)
text file
b)
List
c)
Array
d)
File handling variable
78.
What is .pop doing in line 6?
a)
Append
b)
Amend
c)
Delete
d)
Replace
79.

Which of the following is not an example of a subroutine?

a)

Procedure

b)

Function

c)

List

80.

Subroutines are designed to save the programmer time

a)

True

b)

False

81.

Subroutines are designed to save the user time

a)

True

b)

False

82.

Using a subroutine ensures you avoid having ______ code throughout your program

a)

Repeated

b)

Incorrect

c)

Illogical

83.

Ensuring your program can still be used by another person without your help

a)

Code Maintainability

b)

Code Reusing

c)

Code Sharing

84.

What is the purpose of using subroutines in your programming?

a)

Avoiding repeated sections of code

b)

Making your code shorter and easier to read

c)

Enabling you to split your code into sections

d)

Avoiding making errors in your code

85.

What is the name of the subroutine?

a)

happyBirthday

b)

person

c)

def

86.

What is the name of the parameter?

a)

happyBirthday

b)

person

c)

def

87.

What is the name of the subroutine?

a)

addNumbers

b)

num1

c)

num2

d)

total

88.

num1 and num2 are the parameters

a)

True

b)

False

89.

What will this program display?

a)

The sum is 5

The sum is 691255

b)

2, 3

12345, 678910

90.

Which subroutine will return a value back to the program?

a)

Procedure

b)

Function

91.

Which subroutine will not return a value back to the program?

a)

Procedure

b)

Function

92.

A procedure can return a value to be used later in the program

a)

True

b)

False

93.

A function can return a value to be used later in the program

a)

True

b)

False

94.

What is the name of the subroutine?

a)

username

b)

firstName

c)

secondName

95.

What are the parameters in this program?

a)

username

b)

firstName and secondName

c)

def

96.

Parameters are the data that will _______ each time the subroutine is run

a)

Run

b)

Change

c)

Display

97.

What parameters would be sensible for a subroutine to display a full name?

a)

name

b)

firstName, secondName

c)

firstName, middleName, secondName

98.

What will be displayed if I type in "Mr Richardsf"?

a)

Welcome to the system. Your username is Mr Richards

b)

Welcome to the system. Your username is Mr Richards

99.

A procedure will not ____ a value

a)

Return

b)

Display

c)

Remember

100.

A function will ____ a value

a)

Return

b)

Display

c)

Remember

101.

What is the name of the subroutine?

a)

average

b)

total

c)

num1

102.

num1, num2 and num3 are the ________

a)

variables

b)

parameters

c)

subroutines

103.

"Return a value" means....

a)

The value can be used outside the subroutine

b)

The subroutine cannot be used outside the subroutine