stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Functions in Python CH 5 Flashcards | StudBud
Explore
/
Functions in Python CH 5
Functions in Python CH 5
40 terms
·
StudBud Administration
·
52 plays
#functions in Python #CMSC 135 #DR.VEGA
Flashcards
40 cards
F
Practice quiz
P
Host live
L
Questions
40
Answers
1
Function name should be descriptive of the task carried out by the function
True
False
2
A set of statements that belong together as a group and contribute to the function definition is known as a
block
function
group
organized
3
You can use the pass keyword to create empty functions
True
False
4
A value-returning function executes the statements it contains, and then it returns a value back to the statement.
True
False
5
variable that is assigned a value inside a function
pass keyword
argument
Local variable
Scope
6
The first line of a function definition is know as the __________.
header
body
initialization
introduction
7
The math function ceil(x) returns the smallest integer that is greater than or equal to x.
False
True
8
What is the
name
of the function shown below?
drawFramedLabel('Go Team!', 200, 100, 'gold')
drawFramedLabel
drawFramedLabel(value, x, y, color)
def drawFramedLabel(value, x, y, color):
9
In a flowchart, start or end call is depicted by a(n) ________.
Rectangle
Diamond
Oval
Parallelogram
10
In a flowchart, input and output operation is shown by a(n) ________.
Oval
Rectangle
Diamond
Parallelogram
11
In a flowchart, a function call is depicted by a(n) ________.
Rectangle
Parallelogram
Oval
Diamond
12
What is the primary purpose of a function?
To help the programmer organise programs into simpler chunks
To improve the speed of execution.
All Python programs must be written using functions.
To calculate values.
13
Only the first line of code inside a function must be indented
False
True
14
A void function simply executes the statements it contains and then terminates.
False
True
15
Which of the following is a valid
function
header
(first line of a function definition)?
def drawCircle:
drawCircle(t, sz):
def drawCircle(t):
def drawCircle(t, sz)
16
In a flowchart, and operation of true or false is shown by a(n) ________.
Diamond
Oval
Rectangle
Parallelogram
17
What is a group of statements that exists within a program for the purpose of performing a specific task?
a pseudocode
a statement
a group
a function
18
The benefits of using functions does not include:
Simpler code
Slower testing and debugging
Faster development
Code reuse
19
Top-down design is a technique for breaking algorithm into functions
True
False
20
A modularized program is a program wherein each task within the program is in its own function
True
False
21
Which of the statements below is a correct
call
to the function? (assume "
alex"
is a turtle)
def drawSquare(t, sz)
drawSquare(10)
drawSquare(alex, 10)
drawSquare(alex, 10):
22
Indentation in Python does not include _______
Lines in block must begin with the same number of spaces
IDLE automatically indents the lines in a block
Each block must be indented
Use both tabs or spaces to indent lines at the same time
23
The header of a function must end with this punctuation.
;
:
nothing is needed at the end of the header
{
24
The ________ of a local variable is the function in which that variable is created.
destination
type
name
scope
25
Function naming rules does not include:
Cannot contain spaces
use keywords as a function name
First character must be a letter or underscore
Uppercase and lowercase characters are distinct
26
main function: called when the ______
returns a value
debugging
program starts
when that function is needed
27
You ______ the function to execute it.
call
export
define
import
28
A ________ constant is a name that references a value that cannot be changed while the program runs.
keyword
local
global
public
29
A(n) ________ chart is a visual representation of the relationships between functions.
hierarchy
Bar
Pie
flow
30
The function header begins with the keyword ________ and is followed by the name of the function.
def
public
set
print
31
the part of a program in which a variable may be accessed
Local variable
argument
Scope
pass keyword
32
piece of data that is sent into a function
pass keyword
argument
Scope
Local variable
33
You must define the function before you call it.
False
True
34
A function is a group of statements within a program that perform as specific task
True
False
35
The return values of the trigonometric functions in Python are in ________
radians
Quadratic
algorithm
linear
36
What are the
arguments
to the DrawFramedLabel function?
def
value, x, y, color
drawFramedLabel
'Go Team!', 200 , 100, 'gold'
37
What are the
parameters
of the function shown below?
value, x, y, color
value, x, y, size=48, bold=True
'Go Team!', 200, 100, 'gold'
drawFramedLabel
38
You start the definition by using the word __________.
Rect
def
Label
void
39
What is a function in Python?
Any block of statements.
A named sequence of statements.
A mathematical expression that can be evaluated.
A statement of the form x = x + 4.
40
The math function atan(x) returns one tangent of x in radians.
False
True