Python-Functions

Python-Functions

9th Grade

17 Qs

quiz-placeholder

Similar activities

Python Basics-02

Python Basics-02

9th - 12th Grade

21 Qs

Python Loops

Python Loops

9th - 11th Grade

12 Qs

APCSP Semester Review

APCSP Semester Review

8th - 9th Grade

20 Qs

Python

Python

KG - Professional Development

13 Qs

Python L1

Python L1

8th Grade - University

14 Qs

Python Functions and Escape Sequences

Python Functions and Escape Sequences

9th - 12th Grade

12 Qs

Python 2 модуль

Python 2 модуль

4th - 11th Grade

18 Qs

Quiz Pemrograman Phyton

Quiz Pemrograman Phyton

9th - 12th Grade

20 Qs

Python-Functions

Python-Functions

Assessment

Quiz

Computers

9th Grade

Medium

Created by

Zubaidah Shaheen

Used 1+ times

FREE Resource

17 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to call a function named print_sum?

  1. def print_sum():


  1. print_sum


  1. print_sum():


  1. print_sum()

Answered

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to declare a function in Python?

print_hello:

print("hello")

function print_hello():

print("hello")

print_hello():

print("hello")

def print_hello():

print("hello")

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following code samples correctly passes the number 10 as an argument to the function print_number?

print_number(10)

print_number()

print 10

10(print_number)

print print_number

print 10

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following code samples correctly creates a function that takes a single parameter and prints it?

def print_number(x):

print(x)

def print_number():

print(parameter)

def print_number():

print(x)

def print(x)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

In which namespace is the variable ‘x’ defined in the following program?

  1. Function namespace

Global namespace

Object namespace

Class namespace

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Consider this code snippet.

Which of the following additional functions could be safely added to this code, without causing an error?

def subtract_nums():

z = x - y

print(z)

def subtract_nums():

z = z - x

print(z)

def subtract_nums():

y = 5

z = x - y

print(z)

def subtract_nums():

z = y

z = x - y

print(z)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following functions successfully returns the number 10?

def my_function():

10

def my_function(10):

return

def my_function():

return 10

def my_function():

print(10)

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?