wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python-Basic

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What would be printed by the command

print('12-5')

a)

12-5

b)

'12-5'

c)

7

d)

'7'

2.

Which of the operators do we use if we want at least one condition to be true?

a)

and

b)

or

c)

else

d)

not

3.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
4.

What will be the output of the following statement?

type('5')

a)

str

b)

int

c)

float

d)

Boolean

5.

Which one is NOT a legal variable name?

a)

my_var

b)

myvar

c)

_myvar

d)

my-var

6.

What is the correct file extension for Python files?

a)

.py

b)

.pt

c)

.pyt

d)

.pyth

7.

How do you create a variable with the numeric value 5?

a)

Both are correct

b)

x=5

c)

x=int(5)

8.

Which operator can be used to compare two values?

a)

=

b)

<>

c)

><

d)

==

9.

Which of the following is a data type in Python? Select multiple answers.

a)

int

b)

words

c)

string

d)

decimals

10.

a = "Good Morning!"

print(len(a))

a)

13

b)

12

c)

11

d)

14

11.

a = "Hello, World!"

print(a.lower())

a)

hello, World!

b)

HELLO, WORLD!

c)

hello, world!

d)

Error

12.

x = 23

y = 3


print(x // y)

a)

7

b)

7.6666

c)

7.7

d)

Error

13.

What is the output of the code shown in the image?

a)

2

b)

3

c)

'2'

d)

'3'

14.

What is the output of the code shown in the image?

a)

#

#

#

#

b)

####

c)

#

##

###

####

d)

#

##

###

####

#####

15.

How difficult was the quiz?

a)

Easy

b)

Medium

c)

Hard

d)

Extremely Difficult