Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz 1

Total questions: 17

Worksheet time: 17mins

Name
Class
Date
1.

Python is a

a)

text language

b)

database language

c)

programming language

2.

Code for Hello, World!

a)

print Hello, World!

b)

print("Hello, World!)

c)

print("Hello, World!")

3.

Insert the missing part of the code below to output

_________________ "My name is ".

a)

Print

b)

PRINT

c)

print

4.

Python language use

a)

upper case letters

b)

lower case letters

c)

upper and lower case letters

5.

The output of the program

x = 4

x = "Sally"

print(x)

a)

four

b)

Saly

c)

Sally

6.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
7.

What will be the output?

name = 'Dave'

greeting = "Good morning " + name

print (greeting)

a)

Good moning 'Dave'

b)

Good morning Dave

c)

Good morning name

d)

Good morning + Dave

8.

What is the correct syntax to output "Hello World" in python?

a)

p("Hello World")

b)

echo("Hello World")

c)

print("Hello World")

9.

How do you insert COMMENTS in Python code?

a)

/*This is a comment*/

b)

//This is a comment

c)

#This is a comment

10.

Which one is NOT a legal variable name?

a)

Myvar

b)

my-var

c)

_myvar

11.

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

a)

Both the other answers are correct.

b)

x = 5

c)

x = int(5)

12.

What is the correct file extension for Python files?

a)

.py

b)

.pyt

c)

.pyth

13.

How do you create a variable with the floating number 2.8?

a)

Both the other answers are correct.

b)

x = 2.8

c)

x = float(2.8)

14.

What is the correct syntax to output the type of a variable or object in Python?

a)

print(type(x))

b)

print(typeOf(x))

c)

print(typeof(x))

15.

What is the correct way to create a function in Python?

a)

function myfunction():

b)

create myFunction():

c)

def myFunction():

16.

In Python, 'Hello', is the same as "Hello"

a)

True

b)

False

17.

What bracket is a list known for?

a)

()

b)

{}

c)

[]