wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python syntax quiz

Total questions: 15

Worksheet time: 17mins

Name
Class
Date
1.

Syntax is ..

a)

Rules for programming language

b)

Type of loops

c)

Condition

d)

Logical operator

2.

Output of Print("Hello world") appears in

a)

stage

b)

console

c)

workspace

d)

all of these

3.

to create a new function what is the first word you should type?

a)

fun

b)

func

c)

def

d)

function

4.

function called add how i can define it in python

a)

add()

b)

add def()

c)

def add():

d)

def add

5.

how many types of loops in python

(a)  

6.

there is a colon ( : ) in 4 things in python what are these thing

a)

for

b)

function

c)

if

d)

while

e)

syntax

7.

num = 5

def fun():

num = 6

fun()

print(num)

a)

5

b)

6

c)

11

d)

1

8.

num = 5

def fun():

global num

num = 6

fun()

print(num)

a)

5

b)

6

c)

11

d)

1

9.

num = 5

def fun():

global num

num = 6

print(num)

a)

5

b)

6

c)

11

d)

1

10.

(5<6) and (3<4)

a)

false

b)

true

11.

(5<6) or(3>4)

a)

false

b)

true

12.

correct syntax for (for loop ) is

a)

for i range(3)

b)

for i in range 3

c)

for in range(3):

d)

for i in range(3):

13.

x = 5

if x > 6 :

print("Hello")

else:

print("Hi")

a)

Hi

b)

Hello

14.

x = 5

y = 6

if x > y or y == 6:

print("Hi")

else:

print("Hello")

a)

Hi

b)

Hello

15.

l = [2, 6, 5 , 3] what is the index of number 6

a)

0

b)

1

c)

2

d)

3