[Quiz] Python Function

Quiz
•
Information Technology (IT)
•
University
•
Medium
Fatin Hanani
Used 7+ times
FREE Resource
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax for defining a function in Python?
def function_name:
function function_name():
define function_name()
def function_name():
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the return statement do in a function?
It ends the function and sends a value back.
It defines the input parameters of a function.
It prints the output to the console.
It loops through the function.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Parameters are values passed to a function when it is called.
True
False
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the function:
def greet(name):
return "Hello, " + name
What will greet("Alice") output?
Hello, Alice
Hello, name
"Hello, Alice"
Alice
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which variable is accessible both inside and outside of functions?
Local variable
Global variable
Input variable
Parameter variable
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Variables defined inside a function have a local scope.
True
False
7.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Write a function named add_two_numbers that takes two parameters, a and b, and returns their sum.
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python Programming Basics Quiz

Quiz
•
University
10 questions
Chapter Quiz

Quiz
•
University
15 questions
IT/CS Review Quizzizz

Quiz
•
6th Grade - University
13 questions
Python Programming Quiz

Quiz
•
University
15 questions
Python Challenge

Quiz
•
University
10 questions
HTML + CSS + JS

Quiz
•
University
15 questions
Bài 27

Quiz
•
10th Grade - University
15 questions
Assembly Language and MIPS Architecture Quiz

Quiz
•
University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade