J277 - 2.2 - Functions in Python

Quiz
•
Computers
•
10th Grade
•
Medium
R Eveleigh
Used 8+ times
FREE Resource
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
Similar Resources on Wayground
10 questions
Проверка знаний по Пайтону

Quiz
•
11th Grade
10 questions
bài 28

Quiz
•
11th Grade - University
14 questions
python functions

Quiz
•
University
10 questions
KIỂM TRA 15P L2 HK2 2022-2023 TIN 10

Quiz
•
10th Grade
15 questions
Scope of Variables in Python

Quiz
•
1st Grade - Professio...
10 questions
Penggunaan Pernyataan Function (4.2.2)

Quiz
•
3rd Grade - University
15 questions
PROGRAMMING IN PYTHON - UNIT II - TEST 1 MCQS

Quiz
•
University
15 questions
Python and PseudoCode Quiz

Quiz
•
10th Grade - University
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 Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade