wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python_12BG

Total questions: 21

Worksheet time: 33mins

Name
Class
Date
1.

What would the output be for the program if the user enters 50 and 25?

a)

60

b)

75

c)

16

d)

error

2.

Which of the following best describes the order in which these lines are processed in Python?

a)

4, 1, 2

b)

4, 2, 1

c)

1, 2, 3, 4

d)

3, 1, 2

3.

What will be the output of this program if the user enters "Welcome" and then " World!!"?

a)

WelcomeWorld!!

b)

Welcome World!!

c)

WELCOME WORLD!!

d)

all of these

4.

What Python keyword is used to indicate that a code segment is a function definition?(Only the keyword)

(a)  

5.

What is the function header in the Python code above?

(a)  

6.

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

a)

Converts the variable myAge to a string

b)

Converts the variable myAge to a integer

c)

Converts the variable myAge from string

7.

What will the output be from the following code?

print("Welcome\nHello world!")

a)

Welcome\n Hello world!

b)

Welcome

Hello world!

c)

SyntaxError

d)

Hello world!

8.

What will the output be from the following code?

print("Hello" + str(32) + "Python")

(a)  

9.

Python identifies blocks of code by

a)

BEGIN and END keywords

b)

{ and }

c)

indentation

d)

guessing

10.

What will the output be from the following code?

print("Peace" * 2)

a)

TypeError

b)

Peace2

c)

PeacePeace

d)

Peace* 2

11.

Which is an assignment operator?

a)

+=

b)

=+

c)

==

d)

!=

12.

Which is a relational operator?

a)

AND

b)

=

c)

==

d)

non of these

13.

What is the value of the expression 170 / 50?

a)

3

b)

3.4

c)

3.0

14.

What is the output of the following code :


print 9//2

a)

4

b)

4.5

c)

4.0

d)

'4'

15.

Which is the correct operator for power(x^y) in Python?

(a)  

16.

What is the answer of this expression, 27 % 4 is?

(a)  

17.

x = 5


print(x > 3 and x > 10)

a)

True

b)

False

18.

x = 14


print(x > 10 or x < 3)

a)

True

b)

False

19.

x = 5

y = 3


print(x == y)

a)

True

b)

False

20.

x = 5


x%=3


print(x)

What will be the output?

a)

2.0

b)

2

c)

2.5

d)

error

21.

Write an assignment statement that stores the remainder obtained from dividing 100 and 4 in the variable mod

(a)