J277 - 2.2 - Functions in Python
Quiz
•
Computers
•
10th Grade
•
Practice Problem
•
Medium
R Eveleigh
Used 8+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to define a function in Python?
`function myFunction():`
`def myFunction():`
`define myFunction():`
`func myFunction():`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid function parameter in Python?
`def myFunction(x, y):`
`def myFunction(x y):`
`def myFunction(x; y):`
`def myFunction(x: y):`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following function call: `print(add(2, 3))` if the function is defined as `def add(a, b): return a + b`?
`23`
`5`
`None`
`Error`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you specify a default value for a function parameter in Python?
`def myFunction(x = 10):`
`def myFunction(x: 10):`
`def myFunction(x -> 10):`
`def myFunction(x <- 10):`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the `return` statement in a function?
To print the result
To exit the function and return a value
To define a function
To pass control to another function
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following functions will return the square of a number?
`def square(x): return x * 2`
`def square(x): return x ** 2`
`def square(x): return x + x`
`def square(x): return x / 2`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code snippet? ```python def greet(name): return "Hello, " + name print(greet("Alice")) ```
`Hello,`
`Hello, Alice`
`Alice`
`Error`
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Unit 4 Advanced AP CSP
Quiz
•
9th - 12th Grade
10 questions
Cybersecurity Quiz
Quiz
•
12th Grade
14 questions
BÀI 14- THUẬT TOÁN TÌM KIẾM TUẦN TỰ
Quiz
•
6th Grade - University
15 questions
After Effect Intoduction
Quiz
•
10th Grade - University
10 questions
Pengantar Coding
Quiz
•
University
10 questions
Inspire - AI Trivia
Quiz
•
11th Grade
10 questions
Parcial-Dibujo
Quiz
•
12th Grade
10 questions
Empowerment Technologies Quiz 2
Quiz
•
11th Grade
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
