
Python Functions Flashcard

Flashcard
•
Education
•
University
•
Hard
Wayground Content
FREE Resource
Student preview

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
Create a free account and access millions of resources
Similar Resources on Wayground
47 questions
Is it a function? Which function?

Flashcard
•
10th - 12th Grade
42 questions
coding advanced

Flashcard
•
9th - 12th Grade
45 questions
APCSA Practice test mine

Flashcard
•
11th Grade
40 questions
Microsoft PowerPoint Basics

Flashcard
•
11th Grade
30 questions
Python Programming Flashcard for Grade 13

Flashcard
•
University
33 questions
CS3 Week 1 Python Terms

Flashcard
•
9th - 12th Grade
25 questions
coding relay MCQ

Flashcard
•
KG - University
22 questions
Final Review Part 4

Flashcard
•
11th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Education
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University