wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Third Day Quiz!

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

What's wrong with the syntax? (ignore the indentation)

def Function1();

print("hello world")

a)

it doesn't take in any parameters

b)

the semicolon should be replaced by colon

c)

the function name starts with upper-case "F"

d)

it doesn't return anything

2.

A function is

a)

Specific codes with a specific purpose(s) all together so they are maintainable and organized

b)

A waste of time to use and it doesn't help your codes at all

c)

Locate your codes in a single place so that it's easier to maintain

d)

It's like a factory that may take into input (parameters) and process the input and give you a product (return)

3.

How do I call the helloWorld function?

a)

helloWorld

b)

shout HELLO WORLD as loud as you can

c)

helloWorld()

d)

print("Hello World")

4.

What's wrong with this code?

a)

It doesn't return a*b

b)

It's missing two required parameters

c)

the syntax of the function is wrong

5.

What will be the output and why?

a)

False because the function is not equal to "Hello!"

b)

False because "Hello!" is not equal to a

c)

True because the voice_echo function will return "Hello!"

d)

True because voice_echo function has been assigned to True by the return keyword

6.

Which of the following statement is false?

a)

Sometimes function doesn't take parameters, sometimes it doesn't return anything, it all depends on your use case

b)

return is only used when there is at least one parameter

c)

using a return without parameter(s) is possible

d)

We should always use functions to group our codes with specific purpose(s)

7.

Which of the hierarchical variable scope order is correct?

a)

Local -> Enclosing -> Built-in -> Global

b)

Built-in -> Global -> Enclosing -> Local

c)

Enclosing -> Local -> Global -> Built-in

d)

Local -> Enclosing -> Global -> Built-in

8.

What will be printed out?

a)

20

b)

30

c)

10

d)

UnboundLocalError will be raised

9.

Why do we use import?

a)

To simplify our codes

b)

So we can write thousands of line ourselves without using others' codes

c)

So we can reuse a certain library that one has written in different programs

d)

To save our time

10.

which of the following is wrong?

a)

import math as m

b)

from math import * as a

c)

from math import radians as rd

d)

from math import sin