
ONE 6th FORM Basic Python Functions

Quiz
•
Computers
•
12th Grade
•
Hard

Lorna Jarrett
Used 1+ times
FREE Resource
15 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 call for a function defined as `def add(a, b):`?
`add(5)`
`add(5, 10)`
`add()`
`add(5, 10, 15)`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following function call if the function is defined as `def multiply(x, y=2): return x * y` and called as `multiply(3)`?
3
6
9
12
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a return statement in a function?
To print the result
To exit the function and return a value
To define a function
To pass arguments to a function
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? ```python def subtract(a, b): return a - b result = subtract(10, 5) print(result) ```
5
10
15
0
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements about variable scope is true?
Variables defined inside a function are global.
Variables defined inside a function are local to that function.
Variables defined inside a function can be accessed from anywhere in the program.
Variables defined inside a function are automatically global.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? ```python x = 10 def change_x(): x = 5 change_x() print(x) ```
5
10
15
Error
Create a free account and access millions of resources
Similar Resources on Wayground
19 questions
OCR GCSE Computer Science Subroutines

Quiz
•
12th Grade
20 questions
Data handling using pandas and Data visualization

Quiz
•
12th Grade
10 questions
XII CS 6-8

Quiz
•
12th Grade
16 questions
Introduction to Programming (Ch2)

Quiz
•
9th - 12th Grade
10 questions
Python Generators

Quiz
•
10th Grade - University
20 questions
Define Function

Quiz
•
12th Grade
10 questions
Python Strings

Quiz
•
12th Grade
15 questions
Python Inbuilt functions

Quiz
•
12th Grade
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade