ONE 6th FORM Basic Python Functions

ONE 6th FORM Basic Python Functions

12th Grade

15 Qs

quiz-placeholder

Similar activities

Error Finding

Error Finding

12th Grade

10 Qs

Python Basics

Python Basics

9th - 12th Grade

20 Qs

Python Review

Python Review

9th - 12th Grade

20 Qs

Basic Python

Basic Python

9th - 12th Grade

20 Qs

Python revision

Python revision

10th Grade - University

15 Qs

Python: Functions and Parameters

Python: Functions and Parameters

9th - 12th Grade

10 Qs

J277 - 2.2 - Functions in Python

J277 - 2.2 - Functions in Python

10th Grade - University

10 Qs

Python Control Structures Vocab quiz

Python Control Structures Vocab quiz

9th - 12th Grade

14 Qs

ONE 6th FORM Basic Python Functions

ONE 6th FORM Basic Python Functions

Assessment

Quiz

Computers

12th Grade

Hard

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?

Discover more resources for Computers