[Quiz] Python Function

[Quiz] Python Function

University

12 Qs

quiz-placeholder

Similar activities

P3 IAS 2 Quiz

P3 IAS 2 Quiz

University

15 Qs

OOP-Q1

OOP-Q1

University

10 Qs

CLC Lesson 4&5 Quiz

CLC Lesson 4&5 Quiz

University

12 Qs

Emp. Tech. 12 - Intro to MS Excel Quiz

Emp. Tech. 12 - Intro to MS Excel Quiz

12th Grade - University

15 Qs

Getting Familiar with GIT and GITHUB

Getting Familiar with GIT and GITHUB

University

15 Qs

Python_MCQ_2

Python_MCQ_2

University

15 Qs

Java Basics Quiz for CH/PT Students

Java Basics Quiz for CH/PT Students

University

16 Qs

Introduction to Programming

Introduction to Programming

University

15 Qs

[Quiz] Python Function

[Quiz] Python Function

Assessment

Quiz

Information Technology (IT)

University

Practice Problem

Medium

Created by

Fatin Hanani

Used 10+ times

FREE Resource

AI

Enhance your content in a minute

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

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for defining a function in Python?

def function_name:

function function_name():

define function_name()

def function_name():

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the return statement do in a function?

It ends the function and sends a value back.

It defines the input parameters of a function.

It prints the output to the console.

It loops through the function.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Parameters are values passed to a function when it is called.

True

False

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the function:

def greet(name):
return "Hello, " + name

What will greet("Alice") output?

Hello, Alice

Hello, name

"Hello, Alice"

Alice

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which variable is accessible both inside and outside of functions?

Local variable

Global variable

Input variable

Parameter variable

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Variables defined inside a function have a local scope.

True

False

7.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Write a function named add_two_numbers that takes two parameters, a and b, and returns their sum.

Create a free account and access millions of resources

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?