wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

mix quiz

Total questions: 52

Worksheet time: 31mins

Name
Class
Date
1.
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
2.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
3.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
4.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
5.

What will be the output?

name = 'Dave'

print (name)

a)

Dave

b)

dave

c)

name

d)

(name)

6.
What will be the output?
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
a)
Good moning 'Dave'
b)
Good morning Dave
c)
Good morning name
d)
Good morning + Dave
7.
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!
8.
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
9.

What does the following code do? myAge = int (myAge)

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

10.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
11.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
12.

Give Output

a = 4

b = 6

print(a*b)

a)

24

b)

12

c)

6

d)

a*b

13.

What will be the output?

x = 5

print(x == 2)

a)

True

b)

0

c)

2

d)

False

14.

Give output (assume indentation)?

a = 2

If a<3:

print(a+1) #indentation

else:

print(a-1) #indentation

a)

3

b)

2

c)

1

d)

0

15.

Give Output (assume indentation)

b = 2

if b > 4:

b = b + 2 #indentation

print(b)

a)

4

b)

2

c)

0

d)

None

16.

What will be the result?

a = 5

b = 10/2

print(a == b)

a)

True

b)

5

c)

0

d)

False

17.

Give output (assume indentation)

a = 2

b = 5

if a > b:

c = a # indentation

else:

c = b # indentation

print(c)

a)

2

b)

5

c)

None

d)

0

18.
An if statement must evaluate to:
a)
Right or Wrong
b)
True
c)
True or False
d)
False
19.
This operator means that one value is the same as the other value
a)
==
b)
!=
c)
>
d)
<
20.

FOR loops are

a)

loops which run an unknown number of times

b)

loops which run for a specific number of times

c)

the same as if statements

d)

not part of programming

21.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

22.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

23.

What is the output?

a)

250.0

b)

200.0

c)

300.0

d)

350.0

24.

What is the output?

a)

next

stop

b)

next

c)

stop

d)

syntax error - program doesn't work

25.

What is the output?

a)

40

b)

15.0

c)

30

d)

25.0

26.

What is the output of Following code?

List = ['spam', 2.0, 5, [10, 20]]

print(List[2])

(a)  

27.

In Python, list is mutable

a)

True

b)

False

28.

What is the output of the following code?

list = [1,2,3,4,5,6,7,8,9,10]

print(list[1:2])

(a)  

29.

What is the output of the following code?

list = [1,2,3,4,5,6,7,8,9,10]

print(list[2:1])

(a)  

30.

What is the output of the following code?

list = [1,2,3,4,5,6,7,8,9,10]

print(list[::-3])

a)

[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

b)

Compilation error

c)

[8,9,10]

d)

[10, 7, 4, 1]

31.

What is the output of the following code?

list = []

list.append(1)

list.append(2.0)

list.append("vk")

print(list)

a)

[1, 2.0, 'vk']

b)

Error

c)

['vk', 1, 2.0]

d)

No putput

32.

What will this code do?

a)

Print Numbers 1-11

b)

Print Numbers 1-10

c)

Print Numbers 2-10

d)

Print Error

33.
What will the output be from the following code?
print(9/3)
a)
3
b)
3.0
c)
9/3
d)
SyntaxError
34.
In python the ' BOOLEAN data type' can be defined as...?
a)
holds alphanumerical data
b)
holds whole numbers
c)
holds a number with a decimal point
d)
holds either true or false
35.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
36.
Which of the following symbols is used in Python to mean "Greater than or equal to"?
a)
<=
b)
>>
c)
>=
d)
=>
37.
What is printed when this program is run:
days = 5 
if days > 6:  
   print(“Month”)

else:  
   print(“Week”)
a)
Month
b)
Week
c)
Day
d)
4
38.
What will be printed after running this FOR loop:

for number in range(6):
 
    print(number)
a)
The number 6 
b)
The numbers 0 - 5
c)
The number 5
d)
The numbers 1 - 6
39.
What will the following lines of code print?
a)
A
b)
B
C
c)
A
C
d)
Nothing, it will return an error.
40.
What will the following code result in:

name = “Alison”
number = len(name)
print(number)
a)
4
b)
5
c)
6
d)
7
41.
What output will this code produce?
a)
['France', 'Wales', 'England']
France
b)
['France', 'Wales', 'England']
Wales
c)
France, Wales, England
Wales
d)
France  Wales  England
France
42.
What output will this code produce?
a)
3
b)
20
c)
25
d)
17
43.
What would be the value of ‘marks’ after running this code:
 
marks = 20
total = 5 
newmarks = marks * 3
a)
60
b)
45
c)
100
d)
75
44.
How many times does the following program print the word ‘computer’:

word= "computer"  
for num in range(1,6):
 
    print(word)
a)
5
b)
6
c)
1
d)
0
45.
Look at the code below and identify which of the statements below are true:

for loopCounter in range(10,101,10):
               
     print(loopCounter)
a)
Starts at 10, goes up to 100, increases by 10
b)
Starts at 10, goes upto 101, increases by 10
c)
Starts at 1, goes upto 100, increases by 1
d)
Starts at 10, goes upto 10, increases by 10
46.
In the following code what will happen if the wrong password is entered:
while password != "computer":
   
    print("Enter Password: ")
 
    p
assword = input()
a)
It will log in
b)
It will keep asking to type in password
47.
What does the APPEND procedure do in the following code:
teams = [“Man Utd”,“Man City”,"Arsenal"]

teams.append(“Liverpool”)
a)
Deletes Liverpool from the list
b)
Adds Chelsea to the list 
c)
Removes Arsenal from the list
d)
Adds Liverpool the list
48.

When we create a program to extract each alphabet from a given string, what is it known as?

a)

Transpose

b)

Traverse

c)

Translate

d)

Terminate

49.

Which of the operator can be used in Strings?

a)

+

b)

*

c)

Both of the above

d)

None of the above

50.

word = "amazing"

For the given string if we run word[2:5] what does it mean?

a)

It will extract alphabets from index 2 to index 4

b)

It will extract alphabets from index 2 to index 5

c)

It will extract alphabets from position 2 to position 4

d)

It will extract alphabets from position 2 to position 5

51.

s1="Hello"

n1=10

print(s1+n1)

What is the error in this code?

a)

Print statement not written in quotes

b)

Numeric value not written in quotes

c)

colon not written after the print statement

d)

string cannot be added to a number

52.

[1, 2, 8, 9] < [1, 2, 8, 4]


What will be the result if we compare these two lists?

a)

True

b)

False