Search Header Logo

ONE 6th FORM Basic Python Functions

Authored by Lorna Jarrett

Computers

12th Grade

Used 1+ times

ONE 6th FORM Basic Python Functions
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?