Deck 6: Value-Returning functions and Modules
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/35
العب
ملء الشاشة (f)
Deck 6: Value-Returning functions and Modules
1
What makes it easier to reuse the same code in more than one program?
A) Mods
B) Procedures
C) Modules
D) functions
A) Mods
B) Procedures
C) Modules
D) functions
C
2
Python comes with _____ functions that have been already prewritten for the programmer.
A) standard
B) library
C) custom
D) built-in
A) standard
B) library
C) custom
D) built-in
A
3
What is the result of the following statement? x = random.randint(5, 15) * 2
A) A random integer from 5 to 15, multiplied by 2, assigned to the variable x
B) A random integer from 5 to 15 assigned to the variable x
C) A random integer from 5 to 15, selected in 2 steps, assigned to the variable x
D) A random integer from 5 to 15, raised to the power of 2, assigned to the variable x
A) A random integer from 5 to 15, multiplied by 2, assigned to the variable x
B) A random integer from 5 to 15 assigned to the variable x
C) A random integer from 5 to 15, selected in 2 steps, assigned to the variable x
D) A random integer from 5 to 15, raised to the power of 2, assigned to the variable x
A
4
Which of the following functions returns the largest integer that is less than or equal to x?
A) floor
B) ceil
C) lesser
D) greater
A) floor
B) ceil
C) lesser
D) greater
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
5
Unlike other languages, in Python, the number of values a function can return is limited to one.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
6
In Python, there is no restriction on the name of a module file.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
7
Given the following function definition, what would the statement print magic(5) display? def magic(num):
Return num + 2 * 10
A) 70
B) 25
C) Statement will cause a syntax error.
D) Statement will cause a run-time error.
Return num + 2 * 10
A) 70
B) 25
C) Statement will cause a syntax error.
D) Statement will cause a run-time error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
8
In Python, one can have a list of variables on the left side of the assignment operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
9
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
10
A value-returning function is _____.
A) a single statement that perform 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 it is called
A) a single statement that perform 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 it is called
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
11
In a menu-driven program, what statement is used to determine and carry out the user's desired action?
A) if-else
B) if-elif-else
C) while
D) for
A) if-else
B) if-elif-else
C) while
D) for
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
12
What does the following statement mean? num1, num2 = get_num()
A) The function get_num() is expected to return a value each for num1 and num2.
B) The function get_num() is expected to return a value and assign it to num1 and num2.
C) Statement will cause a syntax error.
D) Statement will cause a run-time error.
A) The function get_num() is expected to return a value each for num1 and num2.
B) The function get_num() is expected to return a value and assign it to num1 and num2.
C) Statement will cause a syntax error.
D) Statement will cause a run-time error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
13
A value-returning function is like a simple function except that when it finishes it returns a value back to the called part of the program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
14
The Python library functions that are built into the Python _____ can be used by simply calling the function.
A) code
B) compiler
C) linker
D) interpreter
A) code
B) compiler
C) linker
D) interpreter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
15
Boolean functions are useful for simplifying complex conditions that are tested in decision and repetition structures.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
16
What type of value is returned by the functions random and uniform?
A) integer
B) number
C) float
D) double
A) integer
B) number
C) float
D) double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
17
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which of the following will assign a random number 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))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
19
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
20
In a value-returning function, the value of the expression that follows the key word _____ will be sent back to the part of the program that called the function.
A) def
B) return
C) sent
D) result
A) def
B) return
C) sent
D) result
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
21
One of the drawbacks of a modularized program is that the only structure we could use is sequence structure.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
22
functions in the standard library are stored in files that are known as _______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
23
To refer to a function in a module, in our program we have to use the _______________ notation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
24
The return values of the trigonometric functions in Python are in _______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
25
The randrange function returns a randomly selected value from a specific sequence of numbers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
26
In a menu-driven program, a loop structure is used to determine the menu item the user selected.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
27
The math function, atan(x), returns one tangent of x in radians.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
28
The 'P' in the acronym IPO refers to _______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
29
A value-returning function has a(n) _______________ statement that returns a value back to the part of the program that called it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
30
The approach of _______________ makes the program easier to understand, test, and maintain.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
31
The term _______________ is used to describe any mechanism that accepts input, performs some operation that cannot be seen, and produces output.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
32
A(n) _______________ program displays a list of the operations on the screen and allows the user to select the operation that the program should perform.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
33
The _______________ chart is an effective tool that programmers use for designing and documenting functions.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
34
In Python, a module's file name should end in _______________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck
35
The math function, ceil(x), returns the smallest integer that is greater than or equal to x.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 35 في هذه المجموعة.
فتح الحزمة
k this deck