[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
15 questions
Perl

Quiz
•
University
15 questions
Bài 25

Quiz
•
10th Grade - University
10 questions
NoSQL Concepts

Quiz
•
University
10 questions
Ôn tập - Hệ thống tự động hóa - Robotics

Quiz
•
9th Grade - University
15 questions
Classes, Objects & Functions

Quiz
•
University
10 questions
Quiz 4

Quiz
•
University
15 questions
DSA (QUIZ 3) - Recursion

Quiz
•
University
15 questions
Bài 26

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 Information Technology (IT)
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