wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Module 1 Quiz

Total questions: 60

Worksheet time: 45mins

Name
Class
Date
1.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
2.

What will the output be from the following code?

print "Hello world!"

a)

SyntaxError

b)

Hello world!

c)

"Hello world!"

d)

print(Hello world!)

3.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
4.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
5.

What will the output be from the following code?

print ( 3*4)

a)

34

b)

7

c)

12

d)

3*4

6.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
7.
What will the output be from the following code?
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
8.

What will the output be from the following code?

print(9/3)

a)

3

b)

3.0

c)

9/3

d)

SyntaxError

9.
What will the output be from the following code?
print(9/3*2+4-5)
a)
19
b)
5.0
c)
0.5
d)
5
10.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
11.

What will the output be from the following code?
print("Hello"+ " " + "world" +" "+ "today")

a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
12.
What will the output be from the following code?
print("Hello" + 2 + "world")
a)
Hello 2 world
b)
Hello2world
c)
TypeError
d)
HelloHelloworld
13.
What will the output be from the following code?
print("Hello world!" * 2)
a)
TypeError
b)
Hello world world!
c)
Hello world!Hello world!
d)
Hello world! * 2
14.
What will the output be from the following code?
print("Hello world!" * 2 * "Hello world!")
a)
TypeError
b)
Hello world! Hello world! Hello world! Hello world!
c)
Hello Hello World! World!
d)
Hello world! Hello world!
15.
What will the output be from the following code?
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!
16.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
17.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
18.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
19.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information 
20.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
21.
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
22.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
23.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
24.
Why is it called 'Python'?
a)
The guy who created it loves snakes
b)
The guy who created it loves Monty Python films
c)
You can create a game on python called snake
d)
It was created by someone called Mr Python
25.

Python is an example of a....

a)

Text-based programming language

b)

low level programming language

c)

language written in java script

d)

Visual-based programming language

26.
What is the answer to print (12/6)?
a)
1
b)

2.0

c)
6
d)
10
27.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
28.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
29.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
30.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
31.
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
32.

The character that must be at the end of the line for if, while, for etc.

a)

:

b)

;

c)

.

d)

,

33.

Which line number contains an output statement?

a)

1

b)

2

c)

3

d)

4

e)

5

34.

Which line number contains variable assignment?

a)

1

b)

2

c)

3

d)

4

e)

5

35.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
36.

What is a list in python?

a)

A collection of variables

b)

A collection of items assigned to a single variable

c)

A statement that cant be changed

d)

A Christmas list

37.

How do i remove something from a list?

a)

variable.append()

b)

variable.delete()

c)

variable.remove()

d)

variable=(new variable)

38.

Which of these operators means EQUAL TO?

a)

'='

b)

'=>'

c)

'<='

d)

'=='

39.

What sort of loop is this?

a)

Count Controlled

b)

Condition Controlled

40.

Python creator is Guido Van Rossum

a)

True

b)

False

41.

What would be the output?

colors = ["red", "green", "yellow", "blue", "white"]

print (colors[2])

a)

red

b)

green

c)

yellow

d)

blue

42.

Square brackets in an assignment statement will create which type of data structure?

s = [ ]

a)

List

b)

Tuple

c)

Dictionary

d)

String

43.

Which of these pieces of code would return the name "Harry" from the following list?

nameList = ["John", "Harry", "Jesse", "Peter", "Tom"]

a)

nameList[0]

b)

nameList(1)

c)

nameList[1]

d)

nameList{1}

44.

To print a list called fruitList we use ---------

a)

 list(print)

b)

fruitList.print()

c)

print(fruitList)

d)

fruitList(print)

45.

Which symbols are used to open and close a tuple?

a)

( )

b)

[ ]

c)

< >

d)

{ }

46.

What is a data type of python dictionary?

a)

dicn

b)

tuple

c)

dict

d)

list

47.

Dictionaries use _________ and keys are separated with _________

a)

{ }, :

b)

( ), :

c)

{ }, ( )

d)

[ ], :

48.

What does .append () do?

a)

To delete the item specified.

b)

To add a new item to a specified position in the list.

c)

To find the index of a specific item.

d)

To add a new item to the end of the list.

49.

What does .insert( ) do?

a)

To find the index of a specific item.

b)

To delete the item specified.

c)

To add a new item to a specified position in the list.

d)

To add a new item to the end of the list.

50.

What would be the output?

list1 = [“apple”, “grape”, “orange”, “watermelon”]

list1.pop(2)

print (list1)

a)

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

b)

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

c)

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

d)

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

51.

Find the syntax to invert the given list:

list1 = [“apple”, “grape”, “orange”, “watermelon”]

a)

print (0 : 4)

b)

print invert (0 : 3)

c)

print( : : -1)

d)

print ( invert)

52.

Tuples in Python are mutable

a)

True

b)

False

53.

What would be the output?

colors = ("red", "green", "white", "blue")

print (type(colors))

a)

("red", "green", "white", "blue")

b)

<class 'tuple'>

c)

<class 'dict'>

d)

<class 'list'>

54.

What does the following comparison operator “>=” represent in Python programming?

a)

Greater than and equal to

b)

Greater than or equal to

c)

Greater than

d)

Less than or equal to

55.

How many possible values are there for a boolean variable?

a)

1

b)

2

c)

3

d)

Infinite

56.

Choose the correct output of the following code.

for i in range(10,13):

print (i)

a)

10

11

12

13

b)

10

11

12

c)

10

11

d)

10

57.

Choose the correct output of the following code.

for i in range(2):       

print (i)

a)

2

b)

0

1

2

c)

0

1

d)

0

58.

Choose the correct output of the following code.

for x in range(10,15,3):       

print (x)

a)

10

12

14

b)

10

11

12

13

14

15

c)

10

13

d)

10

13

15

59.

A varible defined inside a function is called

a)

Local variable

b)

Global variable

60.

Which of the following Python code will create a set?
(i) set1=set((0,9,0))
(ii) set1=set([0,2,9])
(iii) set1={}

a)

i

b)

ii

c)

iii

d)

All of the above