Chapter 5 - Reading Quiz -Python

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

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

It is recommended that programmers avoid using ________ variables in a program whenever possible.

global

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

hierchy

chart is a visual representation of the relationships between functions.

hierchy

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

A ________ variable is created inside a function.

local

The main function contains a program's ________ logic which is the overall logic of the program

mainline

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

math

The approach known as __________ makes a program easier to understand, test and maintain

modularization

Functions that are in the standard library are stored in files that are known as

modules

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

standard library

The top-down design breaks down the overall task of a program into a series of

subtasks

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

top-down

In Python you can have a list of variables on the left side of the argument operator. T/F

True

In Python, a module's file name should end in

.py

One reason not to use global variables is that it makes a program hard to debug. T/F

True

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

floor

One of the drawbacks of a modularized program is that the only structure you can use in such a program is the sequence structure. T/F

False

def main(): print("The answer is", magic(5)) def magic(num): answer = num + 2 * 10 return answer main()

25

Different functions can have local variables with the same names. T/F

True

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

Boolean

A function definition specifies what a function does and causes the function to execute. T/F

False

A hierarchy chart shows all the steps that are taken inside a function. T/F

False

A local variable can be accessed from anywhere in the program. T/F

False

In Python there is no restriction on the name of a module file. T/F

False

The math function atan(x) returns one tangent of x in radians. T/F

False

The value assigned to a global constant can be changed in the mainline logic. T/F

False

Unfortunately, there is no way to store and call on functions when using turtle graphics. T/F

False

Unlike other languages, in Python the number of values a function can return is limited to one. T/F

False

chart is an effective tool used by programmers to design and document functions.

IPO

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.

A value-returning function is like a simple function except that when it finishes it returns a value back to the part of the program that called it. T/F

True

One reason to store graphics functions in a module is so that you can import the module into any program that needs to use those functions. T/F

True

Python allows you to pass multiple arguments to a function. T/F

True

Python function names follow the same rules as those for naming variables. T/F

True

The function header marks the beginning of the function definition. T/F

True

The math function ceil(x) returns the smallest integer that is greater than or equal to x. T/F

True

The randrange function returns a randomly selected value from a specific sequence of numbers. T/F

True

To assign a value to a global variable in a function, the global variable must be first declared in the function. T/F

True

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

a function

A value-returning function is

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

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

a header

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

The function header begins with the keyword _______ and is followed by the name of the function

def

The code for a function is known as a function

definition

To refer to a function in a module, Python uses _______ notation

dot

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

executed

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

Arguments are passed by _____ to the corresponding parameter variables in the function.

position

The 'P' in the acronym IPO refers to

processing

The return values of the trigonometric functions in Python are in

radians

In a flowchart, a function call is depicted by a(n)

rectangle

A value-returning function has a(n) ________ statement that sends a value back to the part of the program that called it.

return

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

A variable is available only to statements in the variable's

scope

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

scope


Kaugnay na mga set ng pag-aaral

Chapter 5: The Nursing Role in Reproductive and Sexual Health

View Set

Chapter 18: Feeding, Eating, and Elimination Disorders

View Set

Solving Systems of Linear Equations: Substitution (6.2.2)

View Set