Search Header Logo

Python Functions

Authored by DLM DLM

Computers

12th Grade

Used 2+ times

Python Functions
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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

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?