wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basics

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

Which type of Programming does Python support?

a)

object-oriented programming

b)

structured programming

c)

functional programming

d)

all of the mentioned

2.

How do you insert COMMENTS in Python code?

a)

//

b)

#

c)

/*

3.

What is a correct syntax to output "Hello World" in Python?

a)

echo"Hello World"

b)

echo("Hello World")

c)

p "Hello World" 

d)

print("Hello World")

4.

What is the output of the following code?

str = "pynative"

print (str[1:3])

a)

py

b)

yn

c)

pyn

d)

yna

5.

Which of the following is used to define a block of code in Python language?

a)

Key

b)

Brackets

c)

Indentation

d)

All of the mentioned

6.

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

a)

int a = 5

b)

Both answers are correct

c)

a=5

7.

What is the output of the following

x = 36 / 4 (3 +  2) 4 + 2

print(x)

a)

182.0

b)

 37

c)

117

d)

The Program executed with errors

8.

What will be the output of the following Python code?

i = 1

while True:

if i%3 == 0:

break

print(i)  

i + = 1

a)

1 2 3

b)

error

c)

1 2

d)

none of the mentioned

9.

Which one is NOT a legal variable name?

a)

_myvar

b)

my-var

c)

MyVar

d)

My_Var

10.

What does pip stand for python?

a)

unlimited length

b)

all private members must have leading and trailing underscores

c)

Preferred Installer Program

d)

none of the mentioned