Search Header Logo
Python Function

Python Function

Assessment

Presentation

Computers

8th - 10th Grade

Medium

Created by

Asma Al-Faran

Used 42+ times

FREE Resource

1 Slide • 23 Questions

1

Python Function

By Asma Al-Faran

2

Multiple Choice

What keyword is used to halt a function and go back to the calling code?

1

stop

2

base case

3

quit

4

return

3

Multiple Choice

Every time you _ a function, the indented statements are run.

1

return

2

use

3

call

4

print

4

Multiple Choice

Which function has the correct function syntax?

1
2
3
4

5

Multiple Choice

Question image

What is the output?

1

None

2

98

3

17

4

72

6

Multiple Choice

What keyword is required to define a function?

1

define

2

return

3

def

4

base case

7

Multiple Choice

Question image

What is the output when z = 2

1

2

2

2

1

3

2

1

0

4

0

1

2

8

Multiple Choice

How to create a function in Python

1

def myFunction():

2

create myFunction():

3

define myFunction():

4

make myFunction():

9

Multiple Choice

What is the output?

if "cat" == "dog":

print("purr")

else:

print("woof")

1

purr

2

purr

woof

3

woof

4

error

10

Multiple Choice

Which is the correct statement used to check if two values 'a' and 'b' are equal to each other

1

if a == b

2

if a = b

3

if a == b:

4

none of the mentioned

11

Multiple Choice

Question image
What will print ?
1
cats eat mice
2
mice get away
3
unknown
4
error message

12

Multiple Choice

You assign a value to a variable with which symbol

1

@

2

==

3

=

4

*

13

Multiple Choice

Question image

What is the output from the following code:

1

[3,2,6,1,Dave]

2

[Dave,3,2,6,1]

3

[3,2,6,1,'Dave']

4

['Dave',3,2,6,1]

14

Multiple Choice

You can evaluate an expression using:

1

@

2

==

3

=

4

*

15

Multiple Choice

The name of the function you use to test the length of a string or list ?

1

lenght()

2

length()

3

len()

4

leng()

16

Multiple Choice

What data type does the input() function always return ?

1

Boolean

2

String

3

Integer

4

Float

17

Multiple Choice

The use of for or while loops are examples of:

1

Selection

2

Iteration

18

Multiple Choice

Which of the following data types is shown below?


L = [2, 54, 'javatpoint', 5]

1

Dictionary

2

Tuple

3

List

4

Stack

19

Multiple Choice

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

1

create myFunction():

2

def myFunction():

3

function myFunction():

20

Multiple Choice

Which statement is used to stop a loop?

1

stop

2

return

3

break

4

exit

21

Multiple Choice

What is used to define a block of code (body of loop, function etc.) in Python?

1

Curly braces

2

Parenthesis

3

Indentation

4

Quotation

22

Multiple Choice

How are comments initiated in Python?

1

#Comment

2

//Comment

3

/Comment/

4

(Comment)

23

Multiple Choice

Which type of function is provided by the Python language?

1

Anonymous Functions

2

User-defined Functions

3

Object Functions

4

Built-in functions

24

Multiple Choice

When defining a function, what do we call the variables that are put in the brackets as placeholders for the arguments?

1

arguments

2

parameters

3

inputs

4

placeholders

Python Function

By Asma Al-Faran

Show answer

Auto Play

Slide 1 / 24

SLIDE