wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Function Basics Quiz

Total questions: 22

Worksheet time: 11mins

Name
Class
Date
1.

In what section of CMU CS1 do you learn about Function Basics?

a)

1.2.1

b)

2.1.1

c)

2.2.1

d)

3.2.1

2.

The function call is what line number?

a)

1

b)

2

c)

3

d)

5

3.

The function definition is what line number?

a)

1

b)

3

c)

4

d)

5

4.

The body of the function definition starts in what line number?

a)

1

b)

2

c)

4

d)

5

5.

How can you tell which line is the start of the function definition?

a)

It starts with Star(

b)

It's always after a blank line

c)

It's always indented

d)

It starts with "def"

6.

What is one function parameter in the code here?

a)

starSides

b)

'gold'

c)

Star

d)

drawBigStar

7.

What is one function argument in the code here?

a)

starSides

b)

'gold'

c)

drawBigStar

d)

Star

8.

How does Python know which line of code is the body of the function?

a)

The line stars with def

b)

The line has parameters

c)

The line is indented

d)

The line has arguments

9.

How does Python know when the body of the function has ended?

a)

The code starts with def

b)

The line of code has parameters

c)

The code is no longer indented

d)

The line of code has arguments

10.

What does the keyword "pass" do in a Python function?

a)

It passes a value to a variable

b)

It prints "pass"

c)

It does nothing

d)

It causes an error

11.

What would happen if you had a function definition with no body and no "pass" statement?

a)

You would get an error message

b)

Nothing would happen

c)

The code would ask if you want to pass

d)

The code would run with no problems

12.

What is line 1 in this code?

a)

Function body

b)

Function call

c)

Function definition

d)

Dysfunctional

13.

What is line 5 in this code?

a)

Function definition

b)

Function body

c)

Function call

d)

Function parameter

14.

What is line 4 in this code?

a)

Function definition

b)

Function body

c)

Function call

d)

Function parameter

15.

What is line 2 in this code?

a)

Function definition

b)

Function body

c)

Function call

d)

Function parameter

16.

What is 'black' in line 4 of this code?

a)

Function definition

b)

Function body

c)

Function argument

d)

Function parameter

17.

What is starSides in line 1 of this code?

a)

Function definition

b)

Function body

c)

Function argument

d)

Function parameter

18.

Why is line 2 indented in this code?

a)

It's the body of the function

b)

It's the argument of the function

c)

It's the parameter of the function

19.

Why is starSides in parentheses in this code?

a)

It's the body of the function

b)

It's the parameter of the function

c)

It's the argument of the function

20.

Why is 'gold' in parentheses in this code?

a)

It's the body of the function

b)

It's the parameter of the function

c)

It's the argument of the function

21.

Function parameters go with

a)

Function definitions

b)

Function calls

c)

The body of the function

d)

Function arguments

22.

Function arguments go with

a)

Function definitions

b)

Function calls

c)

The body of the function

d)

Function arguments