wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

KODEKIDDO HACK #MLH3

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the correct syntax to create loop in Python?

a)

For i in range(10) print i

b)

For i in range (10): print i

c)

For i in range (10) print i

d)

For i in range 1-10: print i

2.

What is the output of the following code?




var1 = 1

 var2 = 2 

var3 = "3" 

print(var + var2 + var3)

a)

6

b)

88

c)

123

d)

Error. Mixing operators between numbers and strings are not supported

3.

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

a)

echo ("Hello World")

b)

print ("Hello World")

c)

p ("Hello World")

d)

print Hello World

4.

How do you insert COMMENTS in Python code?

a)

//This is a comment

b)

#This is a comment

c)

/* This is a comment */

d)

*/ This is a comment/*

5.

Which one is NOT a legal variable name?

a)

_myVar

b)

my_var

c)

Myvar

d)

my-var

6.

What is the correct file extension for Python files?

a)

.py

b)

.pyth

c)

.pt

d)

.pyt

7.

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

a)

def myFunction():

b)

create myFunction():

c)

function myFunction():

d)

loop myFunction():

8.

Which operator is used to multiply numbers?

a)

#

b)

*

c)

X

d)

%

9.

Which of these collections defines a LIST?

a)

{"apple", "cherry", "banana"}

b)

["apple", "cherry", "banana"]

c)

("apple", "cherry", "banana")

d)

{name : "apple" , color : "red"}

10.

Which statement is used to stop a loop?

a)

break

b)

stop

c)

return

d)

exit