Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Revision Tour

Total questions: 30

Worksheet time: 10mins

Name
Class
Date
1.

Choose the INVALID identifiers from the following

a)

NUmbEr1

b)

1NUMBer

c)

A_B

d)

A&B

2.

________ are data items that have a fixed value

a)

Tokens

b)

Literals

c)

Keyword

d)

Operators

3.

What is the answer to this expression, 22 % 3 is?

a)

7

b)

1

c)

0

d)

5

4.

Which of the following cannot be a variable?

a)

_init_

b)

in

c)

it

d)

on

5.

Which data type can store unique values?

a)

List

b)

Tuple

c)

Set

d)

Dictionar

6.
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!
7.

num1= 10

num2 = 30

(num1<num2) or (num2<0)

a)

true

b)

false

c)

nothing

8.

Which of these collections defines a DICTIONARY?

a)

{"name": "apple", "color": "green"}

b)

{"apple", "banana", "cherry"}

c)

["apple", "banana", "cherry"]

d)

("apple", "banana", "cherry")

9.

Which statement is used to stop a loop?

a)

exit

b)

break

c)

return

d)

stop

10.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
11.

Identify Mutable Data Types

a)

LIST

b)

TUPLE

c)

STRING

d)

DICTIONARY

12.

Which is the correct version of while statement in python??

a)

a

b)

b

c)

c

d)

d

13.

What would be the output of the following code

a)

a

b)

b

c)

c

d)

d

14.

What would be the output of following code

a)

a

b)

b

c)

c

d)

d

15.

consider the following code and find the output

a)

5

b)

6

c)

56

d)

None

16.

Which part contains error

a)

a

b)

b

c)

c

d)

a and b

17.

If you want to write code to check whether the given no. is divisible by 3. what condition will you write with if ( ) in the code written below

a)

n/30==0

b)

n//10==3

c)

n/3==0

d)

n%3==0

18.

If you want to write code to check whether the given no. is divisible by 3. what condition will you write with if ( ) in the code written below

a)

n/30==0

b)

n//10==3

c)

n/3==0

d)

n%3==0

19.

Identify the suitable construct to make the following Program

a)

if

b)

for

c)

if...elif

20.

Identify the type of structure in the following code snippet

a)

if else

b)

if else if

c)

nested if else

21.

'Classroom Diary' or "Python" will produce result

a)

True

b)

False

c)

Classroom Diary

d)

Python

22.

not ( "Learn Python" and 2<3 ) will produce result

a)

True

b)

False

c)

" "

d)

Learn Python

23.

In the expression x= 5/2 .....Data type of x is

a)

int

b)

float

c)

bool

d)

list

24.

Data type of "TRUE" is

a)

int

b)

float

c)

string

d)

bool

25.

Consider a tuple tup1 = (10, 15, 25, and 30). Identify the statement that will result in an error.

a)

print(tup1[2])

b)

tup1[2] = 20

c)

print(min(tup1))

d)

print(len(tup1))

26.

Which of these about a dictionary is false?

a)

The values of a dictionary can be accessed using keys

b)

The keys of a dictionary can be accessed using values

c)

Dictionaries aren’t ordered

d)

Dictionaries are mutable

27.

Identify the output of the following Python statements.

x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]]

y = x[1][2]

print(y)

a)

12.0

b)

13.0

c)

14.0

d)

15.0

28.

Identify the output of the following Python statements.

x = 2

while x < 9:

print(x, end='')

x = x + 1

a)

12345678

b)

123456789

c)

2345678

d)

23456789

29.

Suppose list1 [0.5 * x for x in range(0, 4)], list1 is ?

a)

[0, 1, 2, 3, 4]

b)

[0, 1, 2, 3]

c)

[0.0, 0.5, 1.0, 1.5]

d)

[0.0, 0.5, 1.0, 1.5, 20]

30.

What will be the output when the following code is executed?

>>> str1="helloworld"

>>> stri[:-1]

a)

dlrowolleh

b)

helloworld

c)

hello

d)

world