PCEP Section 4B: the function and its environment

PCEP Section 4B: the function and its environment

12th Grade

10 Qs

quiz-placeholder

Similar activities

1.2.4. Types of Programming Language

1.2.4. Types of Programming Language

12th Grade

12 Qs

Test on Python Function

Test on Python Function

11th - 12th Grade

12 Qs

Types of Mass Media

Types of Mass Media

10th Grade - Professional Development

11 Qs

Common Protocols

Common Protocols

10th - 12th Grade

15 Qs

Word 2016 Lesson 1

Word 2016 Lesson 1

9th - 12th Grade

10 Qs

ICT as Platform for Change

ICT as Platform for Change

11th - 12th Grade

10 Qs

emtech

emtech

12th Grade

10 Qs

Visual Basic 2010

Visual Basic 2010

8th Grade - University

10 Qs

PCEP Section 4B: the function and its environment

PCEP Section 4B: the function and its environment

Assessment

Quiz

Computers

12th Grade

Practice Problem

Medium

Created by

Misti McDaniel

Used 3+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following best describes the difference between a parameter and an argument in Python?

A parameter is the value passed to a function, while an argument is the variable in the function definition.

A parameter is the variable in the function definition, while an argument is the value passed to the function.

Both terms mean the same thing in Python.

A parameter is always a string, while an argument is always a number.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following code? ```python def greet(name, message="Hello"): print(message, name) greet("Alice") ```

Hello Alice

Alice Hello

Error: missing argument

Hello

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an example of passing arguments by keyword in Python?

func(1, 2)

func(a=1, b=2)

func(1, b=2)

func(1, 2, 3)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be printed by the following code? ```python x = 5 def foo(): x = 10 print(x) foo() print(x) ```

10 10

5 10

10 5

5 5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement about default parameter values in Python is correct?

Default parameter values must always be provided when calling the function.

Default parameter values are specified in the function definition and used if no argument is provided.

Default parameter values can only be integers.

Default parameter values are specified when calling the function.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the following function definition, which call will result in an error? ```python def add(a, b=2, c=3): return a + b + c ```

add(1)

add(1, 4)

add(1, 4, 5)

add(a=1, c=5, b=4)

add(b=4, c=5)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? ```python x = 1 def change(): global x x = 2 change() print(x) ```

1

2

Error: x is not defined

None

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?