Python Functions Flashcard

Python Functions Flashcard

Assessment

Flashcard

•

Education

•

University

•

Practice Problem

•

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

50 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What will be the output of the following code?
```python
def add(a, b):
return a + b
result = add(5, 3)
print(result)
```

Back

8

2.

FLASHCARD QUESTION

Front

What will the following code output?
```python
def multiply(x, y):
return x * y
result = multiply(4, 3)
print(result)
```

Back

12

3.

FLASHCARD QUESTION

Front

What will be the output of the following code?
```python
x = 10
def func():
x = 5
return x
print(func())
print(x)
```
Options: 5 10, 10 5, 5 5, 10 10

Back

5 10

4.

FLASHCARD QUESTION

Front

Which function demonstrates recursion?
def factorial(n):
if n == 1:
return 1
else:
return n * factorial(n - 1)

Back

factorial

5.

FLASHCARD QUESTION

Front

What is the output of the following code?
```python
def func(a, b=3):
return a * b
result = func(4)
print(result)
```

Back

12

6.

FLASHCARD QUESTION

Front

Which of the following statements about recursion is true?
```python
def count_down(n):
if n == 0:
return
else:
print(n)
count_down(n-1)
```
Options: Recursion will never terminate, Recursion is only valid for integer inputs, The function will print numbers from n down to 1, Recursion terminates before printing

Back

The function will print numbers from n down to 1

7.

FLASHCARD QUESTION

Front

What does this code output?
```python
def test(x):
return x + 2
x = test(10)
print(x)
```

Back

12

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?