wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to python programming-I

Total questions: 15

Worksheet time: 7mins

Name
Class
Date
1.

What is the word (command) used to display numbers and text on the screen?

a)

Input

b)

Output

c)

Print

d)

Command

2.

What symbol is used in python to assign values to a variable?

a)

:

b)

*

c)

=

d)

==

3.

Which of these would work as a piece of code?

a)

if string="Dove"

b)

if string=="Dove"

c)

IF string="Dove":

d)

if string=="Dove":

4.

Python is -------language

a)

compiled

b)

interpreted

c)

both compiled and interpreted

d)

none of the above

5.

What extension must you add to the end of a file when saving?

a)

.c

b)

.java

c)

.py

d)

.pyc

6.

The program above

a)

prints all the odd numbers between 1 and 20

b)

prints all even numbers between 1 and 20

c)

print all the odd numbers between 1 and 21

d)

prints all the even numbers between 1 and 21

7.

The equivalent of the above for loop using the while syntax would be

a)
b)
c)
d)
8.

The above program prints

a)

Numbers 1 to 10 in reverse order

b)

Numbers 1 to 11 in reverse order

c)

Numbers 1 to 10

d)

Numbers 1 to 11

9.
This operator means that one value is the same as the other value
a)
==
b)
!=
c)
>
d)
<
10.

The result of this program:

Friday = False

if Friday:

print("Jeans day!")

else:

print("Uniform day")

a)

Jeans day

b)

Today is Friday

c)

Uniform day

d)

Not Friday

11.

What is the output?

a)

condition

b)

True

c)

Program has a syntax error.

d)

3 > 2

12.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

13.

What is the output?

a)

True

b)

NIL

c)

True

NIL

d)

True

NIL

NIL

14.

Result of the program above is

a)

('1', '2', '3', '4', '5')

b)

(1, 2, 3, 4, 5)

c)

12345

d)

"12345"

15.

What is the output of the code:

d1 = {"john":40, "peter":45}

d2 = {"john":466, "peter":45}

print d1 > d2

a)

True

b)

False

c)

Not applicable