Python Functions

Python Functions

12th Grade

20 Qs

quiz-placeholder

Similar activities

PCEP Section 4C: Python Built-In Exceptions Hierarchy

PCEP Section 4C: Python Built-In Exceptions Hierarchy

12th Grade

15 Qs

Subroutines - Procedures & Functions

Subroutines - Procedures & Functions

9th - 12th Grade

20 Qs

XII_CS_FUNCTIONS

XII_CS_FUNCTIONS

12th Grade

15 Qs

Python Basics Quiz

Python Basics Quiz

9th - 12th Grade

15 Qs

Python CT con

Python CT con

10th - 12th Grade

15 Qs

Python basics

Python basics

9th - 12th Grade

16 Qs

Objects

Objects

8th - 12th Grade

16 Qs

การเขียนโปรแกรมภาษา python ม.5 ภาคเรียนที่ 2 ปีการศึกษา 2561

การเขียนโปรแกรมภาษา python ม.5 ภาคเรียนที่ 2 ปีการศึกษา 2561

10th - 12th Grade

20 Qs

Python Functions

Python Functions

Assessment

Quiz

Computers

12th Grade

Medium

Created by

DLM DLM

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the scope of a variable defined inside a function in a coding bootcamp?

The scope is global and accessible from any function

The scope is limited to the function where it is defined.

The scope is limited to the entire coding bootcamp program

The scope is limited to the block where the function is defined

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the difference between ordering food online and dining in a restaurant.

Ordering food online is done through a website or app, while dining in a restaurant involves physically going to the restaurant.

Ordering food online and dining in a restaurant are the same in terms of convenience and experience.

Dining in a restaurant involves physically going to the restaurant, while ordering food online is done through a website or app.

Dining in a restaurant is done through a website or app, while ordering food online involves physically going to the restaurant.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How would you define a recipe in Python?

recipe_name(ingredients):

define recipe_name(ingredients):

def recipe_name:

def recipe_name(ingredients):

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Imagine a scenario where John is a carpenter working on a project. He has a function called calculate_total_cost that calculates the total cost of materials and labor. The function takes two parameters, material_cost and labor_cost, and returns the sum of the two. What will be the output when John calls calculate_total_cost with material_cost as $300 and labor_cost as $400?

$3

$8

$7

$10

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Identify the error in the following recipe function:

def bake_cake(flour, sugar):
mix = flour + sugar
return mix
print(bake_cake(2))

The function should be defined as bake_cake(flour, sugar=1)

The function call should be corrected to bake_cake(2, 3) where 3 is the second ingredient.

The function should return flour - sugar instead of flour + sugar

The function should have a default value for sugar

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the 'global' keyword do in a programming project?

Creates a new variable in the project scope

Automatically initializes a variable with a default value

Modifies a variable outside of the current scope

Allows access to built-in project functions

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Explain the components of a recipe header in a cookbook.

Method name, ingredients, cooking instructions

Recipe name, steps, serving size

Name, ingredients, cuisine type

Recipe name, ingredients, cooking time

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?