[Quiz] Python Function

[Quiz] Python Function

University

12 Qs

quiz-placeholder

Similar activities

Bài 27

Bài 27

10th Grade - University

15 Qs

Fundamentos de Programación en Python

Fundamentos de Programación en Python

6th Grade - University

10 Qs

Quiz on Basics of C

Quiz on Basics of C

University

10 Qs

Kuis Uji Pemahaman Python Variabel, Sintaks Dasar, Type Data

Kuis Uji Pemahaman Python Variabel, Sintaks Dasar, Type Data

11th Grade - University

16 Qs

DSA (QUIZ 3) - Recursion

DSA (QUIZ 3) - Recursion

University

15 Qs

Bài 26

Bài 26

10th Grade - University

15 Qs

Intro to JS: Variables & Values

Intro to JS: Variables & Values

11th Grade - University

8 Qs

Quiz Meet 3 Mini SC Programing

Quiz Meet 3 Mini SC Programing

University

10 Qs

[Quiz] Python Function

[Quiz] Python Function

Assessment

Quiz

Information Technology (IT)

University

Medium

Created by

Fatin Hanani

Used 6+ times

FREE Resource

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
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?