Title: Module 7 Quiz (Ungraded)
Course: COP 1510 Programming Concepts > Section: Module 7 - Functions

Q: The function ________ comprises one or more statements that are executed when the function is called.
- Definition
- Header
- Body
- Datatype
- None of these
A: Body

Q: Which of the following statements is true after the execution of the following statement?
- A random number is generated between 5 and 10.
- The random number is assigned to the variable needANumber.
- The numbers 5 and 10 are the arguments of the random number function.
- All of these
- None of these
A: All of these

Q: Examine the following piece of code and state the return value of the function.
- Real
- Integer
- product
- result
- None of these
A: result

Q: Examine the following piece of code and determine the data type of the function's return value.
- Real
- Integer
- Sum
- result
- None of these
A: Real

Q: What is the data type of the value returned by the random library function?
- String
- Integer
- Boolean
- Real
- None of these
A: Integer

Q: Random numbers are commonly used in which type of program?
- Games
- Simulations
- Statistical analysis
- Data encryption
- All of these
A: All of these

Q: Which of the following is optional when writing a function definition?
- Function header
- Function body
- Data type
- Return statement
- None of these
A: None of these

Q: The ________ function does the same thing as using the mathematical operator.
- cos
- abs
- sqrt
- round
- pow
A: sqrt

Q: In the IPO chart, the ________ column describes the data that is passed to the function as arguments.
- Output
- Function
- Process
- Input
- None of these
A: Input

Q: Which function returns a string within a string?
- Append
- Concatenate
- Contains
- Substring
- None of these
A: Substring

Q: Which function accepts two strings as arguments, returns "True" if the first string contains the second string, and otherwise returns "False"?
- Append
- Concatenate
- Contains
- Substring
- None of these
A: Contains

Q: Which of the following statements is true after the execution of the following statement?
- y contains the absolute value of x
- x contains the absolute value of y
- x contains the absolute value of the value in y
- y contains the absolute value of the value in x
- None of these
A: y contains the absolute value of the value in x

Q: Which of the following errors occur when a real value is attempted to be assigned to an integer variable?
- Integer value
- Type mismatch
- Conversion
- Assignment
- None of these
A: Type mismatch

Q: A ________ is a module that returns a value back to the part of the program that called it.
- Function
- For
- Loop
- While
- None of these
A: Function

Q: The variable r would contain the value ________ after the execution of the following statement.
- 12
- 1.2
- 12.0
- 0.12
- None of these
A: 12.0

Q: True/False: Random numbers are useful in simulation programs where the computer must randomly decide how an object will behave.
- True
- False
A: True

Q: True/False: The function body follows the function header in a function definition.
- True
- False
A: True

Q: True/False: The toInteger function accepts a real number as its argument and preserves any fractional part in the returned number.
- True
- False
A: False

Q: True/False: When a function finishes, it returns a value back to the part of the program that called it.
- True
- False
A: True

Q: True/False: The value that is returned from a function can be used just like any other value.
- True
- False
A: True