Deck 5: Functions
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/66
العب
ملء الشاشة (f)
Deck 5: Functions
1
Unlike other languages,in Python the number of values a function can return is limited to one.
False
2
In Python there is no restriction on the name of a module file.
False
3
The math function ceil(x)returns the smallest integer that is greater than or equal to x.
True
4
One of the drawbacks of a modularized program is that the only structure you can use in such a program is the sequence structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
5
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
6
The math function atan(x)returns one tangent of x in radians.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
7
A hierarchy chart shows all the steps that are taken inside a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
8
Different functions can have local variables with the same names.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
9
The function header marks the beginning of the function definition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
10
In Python you can have a list of variables on the left side of the argument operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
11
One reason not to use global variables is that it makes a program hard to debug.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
12
The value assigned to a global constant can be changed in the mainline logic.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
13
Python allows you to pass multiple arguments to a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
14
Unfortunately,there is no way to store and call on functions when using turtle graphics.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
15
Python function names follow the same rules as those for naming variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
16
A local variable can be accessed from anywhere in the program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
17
To assign a value to a global variable in a function,the global variable must be first declared in the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
18
A function definition specifies what a function does and causes the function to execute.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
19
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
20
The randrange function returns a randomly selected value from a specific sequence of numbers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
21
A __________ constant is a name that references a value that cannot be changed while the program runs.
A) keyword
B) local
C) global
D) string
A) keyword
B) local
C) global
D) string
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
22
The Python library functions that are built into the Python __________ can be used by simply calling the required function.
A) code
B) compiler
C) linker
D) interpreter
A) code
B) compiler
C) linker
D) interpreter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
23
A __________ variable is accessible to all the functions in a program file.
A) keyword
B) local
C) global
D) string
A) keyword
B) local
C) global
D) string
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
24
Whic of the following will assign a random integer in the range of 1 through 50 to the variable number?
A) random(1, 50) = number
B) number = random.randint(1, 50)
C) randint(1, 50) = number
D) number = random(range(1, 50))
A) random(1, 50) = number
B) number = random.randint(1, 50)
C) randint(1, 50) = number
D) number = random(range(1, 50))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
25
What does the following statement mean?
Num1,num2 = get_num()
A) The function get_num() is expected to return a value for num1 and for num2.
B) The function get_num() is expected to return one value and assign it to num1 and num2.
C) This statement will cause a syntax error.
D) The function get_num() will receive the values stored in num1 and num2.
Num1,num2 = get_num()
A) The function get_num() is expected to return a value for num1 and for num2.
B) The function get_num() is expected to return one value and assign it to num1 and num2.
C) This statement will cause a syntax error.
D) The function get_num() will receive the values stored in num1 and num2.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
26
A __________ variable is created inside a function.
A) global
B) constant
C) named constant
D) local
A) global
B) constant
C) named constant
D) local
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
27
The __________ design technique can be used to break down an algorithm into functions.
A) subtask
B) block
C) top-down
D) simplification
A) subtask
B) block
C) top-down
D) simplification
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
28
What is a group of statements that exists within a program for the purpose of performing a specific task?
A) a function
B) a subtask
C) a process
D) a subprocess
A) a function
B) a subtask
C) a process
D) a subprocess
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
29
A(n)__________ is any piece of data that is passed into a function when the function is called.
A) global variable
B) argument
C) local variable
D) parameter
A) global variable
B) argument
C) local variable
D) parameter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
30
A(n)__________ is a variable that receives an argument that is passed into a function.
A) global variable
B) argument
C) named constant
D) parameter
A) global variable
B) argument
C) named constant
D) parameter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following statements causes the interpreter to load the contents of the random module into memory?
A) load random
B) import random
C) upload random
D) download random
A) load random
B) import random
C) upload random
D) download random
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
32
A set of statements that belong together as a group and contribute to the function definition is known as a
A) header
B) block
C) return
D) parameter
A) header
B) block
C) return
D) parameter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
33
A value-returning function is
A) a single statement that performs a specific task
B) called when you want the function to stop
C) a function that will return a value back to the part of the program that called it
D) a function that receives a value when called
A) a single statement that performs a specific task
B) called when you want the function to stop
C) a function that will return a value back to the part of the program that called it
D) a function that receives a value when called
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
34
The __________ of a local variable is the function in which that variable is created.
A) global reach
B) definition
C) space
D) scope
A) global reach
B) definition
C) space
D) scope
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
35
A(n)__________ chart is also known as a structured chart.
A) flow
B) data
C) hierarchy
D) organizational
A) flow
B) data
C) hierarchy
D) organizational
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
36
The first line in a function definition is known as the function
A) header
B) block
C) return
D) parameter
A) header
B) block
C) return
D) parameter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
37
Python comes with __________ functions that have already been prewritten for the programmer.
A) standard
B) library
C) custom
D) key
A) standard
B) library
C) custom
D) key
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
38
What type of function can be used to determine whether a number is even or odd?
A) even
B) odd
C) math
D) Boolean
A) even
B) odd
C) math
D) Boolean
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
39
It is recommended that programmers avoid using __________ variables in a program whenever possible.
A) local
B) global
C) string
D) keyword
A) local
B) global
C) string
D) keyword
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
40
When a function is called by its name during the execution of a program,then it is
A) executed
B) located
C) defined
D) exported
A) executed
B) located
C) defined
D) exported
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
41
Functions that are in the standard library are stored in files that are known as __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
42
What will be the output after the following code is executed?

A) 81
B) 64
C) 12
D) None

A) 81
B) 64
C) 12
D) None
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
43
A variable is available only to statements in the variable's __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
44
To refer to a function in a module,Python uses ___________ notation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
45
What does the following program do?

A) It draws a blue square at coordinates (100, 0), 50 pixels wide, starting at the top right corner.
B) It draws a blue square at coordinates (0, 50), 100 pixels wide, starting at the top right corner.
C) It draws a blue square at coordinates (100, 0), 50 pixels wide, in the lower-left corner.
D) Nothing since you cannot call a function with turtle graphics.

A) It draws a blue square at coordinates (100, 0), 50 pixels wide, starting at the top right corner.
B) It draws a blue square at coordinates (0, 50), 100 pixels wide, starting at the top right corner.
C) It draws a blue square at coordinates (100, 0), 50 pixels wide, in the lower-left corner.
D) Nothing since you cannot call a function with turtle graphics.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
46
The top-down design breaks down the overall task of a program into a series of __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
47
What will be the output after the following code is executed?

A) Tony Gaddis
B) Gaddis Tony
C) Tony, Gaddis
D) Gaddis, Tony

A) Tony Gaddis
B) Gaddis Tony
C) Tony, Gaddis
D) Gaddis, Tony
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
48
What does the following program do?

A) It draws a blue square.
B) It draws a blue triangle.
C) It draws 2 blue lines.
D) Nothing since you cannot call a function with turtle graphics.

A) It draws a blue square.
B) It draws a blue triangle.
C) It draws 2 blue lines.
D) Nothing since you cannot call a function with turtle graphics.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
49
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()
A) 70
B) 25
C) 100
D) The statement will cause a syntax error.
Def main():
Print("The answer is",magic(5))
Def magic(num):
Answer = num + 2 * 10
Return answer
Main()
A) 70
B) 25
C) 100
D) The statement will cause a syntax error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
50
The code for a function is known as a function ___________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
51
The main function contains a program's __________ logic which is the overall logic of the program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
52
Arguments are passed by __________ to the corresponding parameter variables in a function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
53
What will be the output after the following code is executed?

A) 4, 8
B) 8, 4
C) 48
D) None

A) 4, 8
B) 8, 4
C) 48
D) None
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
54
The Python standard library's __________ module contains numerous functions that can be used in mathematical calculations.
A) math
B) string
C) random
D) number
A) math
B) string
C) random
D) number
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
55
The function header begins with the keyword __________ and is followed by the name of the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
56
What will be displayed after the following code is executed?

A) 12
B) 9
C) 14
D) Nothing, this code contains a syntax error.

A) 12
B) 9
C) 14
D) Nothing, this code contains a syntax error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
57
In a flowchart,a function call is depicted by a(n)___________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
58
Which of the following functions returns the largest integer that is less than or equal to its argument?
A) floor
B) ceil
C) lesser
D) greater
A) floor
B) ceil
C) lesser
D) greater
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
59
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.
A) def
B) result
C) sent
D) return
A) def
B) result
C) sent
D) return
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
60
A(n)__________ chart is a visual representation of the relationships between functions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
61
The approach known as __________ makes a program easier to understand,test,and maintain.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
62
The ___________ chart is an effective tool used by programmers to design and document functions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
63
A value-returning function has a(n)___________ statement that sends a value back to the part of the program that called it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
64
The return values of the trigonometric functions in Python are in __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
65
The 'P' in the acronym IPO refers to ___________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck
66
In Python,a module's file name should end in ___________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 66 في هذه المجموعة.
فتح الحزمة
k this deck