Programming Quiz: Ch.05

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which of the following functions returns the largest integer that is less than or equal to its argument?

Floor

What will be the output after the following code is executed? def pass_it(x, y): z = x + ", " + y return(z) name2 = "Tony" name1 = "Gaddis" fullname = pass_it(name1, name2) print(fullname)

Gaddis, Tony

What will be the output after the following code is executed? def pass_it(x, y): z = x , ", " , y num1 = 4 num2 = 8 answer = pass_it(num1, num2) print(answer)

None

The ________ design technique can be used to break down an algorithm into functions.

Top-down

A value-returning function is..

a function that will return a value back to the part of the program that called it.

What will be the output after the following code is executed? def pass_it(x, y): z = y**x return(z) num1 = 3 num2 = 4 answer = pass_it(num1, num2) print(answer)

64

What is a group of statements that exists within a program for the purpose of performing a specific task?

A function

What will be displayed after the following code is executed? def pass_it(x, y): z = x*y result = get_result(z) return(result) def get_result(number): z = number + 2 return(z) num1 = 3 num2 = 4 answer = pass_it(num1, num2) print(answer)

14

What will display after the following code is executed? def main(): print("The answer is", magic(5)) def magic(num): answer = num + 2 * 10 return answer main()

25

A(n) ________ is any piece of data that is passed into a function when the function is called.

Argument

A set of statements that belong together as a group and contribute to the function definition is known as a..

Block

What type of function can be used to determine whether a number is even or odd?

Boolean

When a function is called by its name during the execution of a program, then it is..

Executed

A ________ constant is a name that references a value that cannot be changed while the program runs.

Global

A ________ variable is accessible to all the functions in a program file.

Global

The first line in a function definition is known as the function..

Header

A(n) ________ chart is also known as a structured chart.

Hierarchy

Which of the following statements causes the interpreter to load the contents of the random module into memory?

Import random

The Python library functions that are built into the Python ________ can be used by simply calling the required function.

Interpreter

Python comes with ________ functions that have already been prewritten for the programmer.

Library

A ________ variable is created inside a function.

Local

The Python standard library's ________ module contains numerous functions that can be used in mathematical calculations.

Math

Which of the following will assign a random integer in the range of 1 through 50 to the variable number?

Number = random.randint(1,50)

A(n) ________ is a variable that receives an argument that is passed into a function.

Parameter

In a value-returning function, the value of the expression that follows the keyword ________ will be sent back to the part of the program that called the function.

Return

The ________ of a local variable is the function in which that variable is created.

Scope

What does the following statement mean? num1, num2 = get_num()

The function get_num() is expected to return a value for num1 and for num2.


Set pelajaran terkait

CM 2: Introduction à l'éthique en recherche

View Set

Intro to Astronomy: Hw Questions First Exam

View Set

Parallel and Perpendicular lines

View Set