Title: Test 2
Course: COP 1510 Programming Concepts > Section: Module 10 - Sorting and Searching Arrays

Q: What is the term used for the variable that receives an argument that passed into a module?
- Global
- Local
- Parameter
- Constant
- None of these
A: Parameter

Q: What tool would a programmer use to visualize the relationship between modules?
- Flowchart
- Hierarchy charts
- Pseudo charts
- Modular charts
- None of these
A: Hierarchy charts

Q: In a flowchart, the module call is represented by a ________ symbol with vertical bars at each side.
- Parallelogram
- Square
- Rhombus
- Rectangle
- None of these
A: Rectangle

Q: What is the term used for the memory address of the location of the statement immediately after the module call?
- Return address
- Return point
- Continue point
- Resume point
- Resume address
A: Return point

- Definition
- Header
- Body
- Display
- Execution
A: Execution

Q: The module definition comprises the module header and the module ________.
- Body
- Statements
- Call
- Arguments
- Parameters
A: Body

Q: Which of the following is not a benefit of using modules?
- Simpler Code
- Faster Development
- Code Reuse
- Better Testing
- None of these
A: None of these

Q: True/False: In most languages a module definition has three parts: a header, body, and footer.
- True
- False
A: False

Q: True/False: Modules can be written for commonly needed tasks, and those modules can be incorporated into each program that needs them.
- True
- False
A: True

Q: True/False: An attempt to pass a non-variable argument into a reference variable parameter will cause an error.
- True
- False
A: True

Q: True/False: A pass by reference argument establishes a two-way communication with the module, but the value of the argument cannot be modified via the reference variable.
- True
- False
A: False

Q: True/False: When an argument is passed by value, the communication channel works only in one direction.
- True
- False
A: True

Q: True/False: The scope of the parameter variables is the entire program and it is visible to any statement in the program.
- True
- False
A: False

Q: True/False: The arguments in a module call and the parameters listed in the module header must be of compatible data types.
- True
- False
A: True

Q: True/False: A module can have two variables of the same name because they are within the same scope.
- True
- False
A: False

Q: True/False: The scope of a variable is the segment of the program in which the variable can be accessed.
- True
- False
A: True

Q: To execute a module, we must ________ it.
- Parse
- Debug
- Call
- Compile
- Define
A: Call

Q: Modules are commonly called what?
- Procedures
- Subroutines
- Subprograms
- Methods
- All of these
A: All of these

Q: To create a module you write its ________.
- Definition
- Body
- Pseudocode
- Flowchart
- Name
A: Definition

Q: ________ variables are useful for establishing two-way communication between modules.
- Value
- Constant
- Reference
- I/O
- None of these
A: Reference

Q: What phrase is placed in the starting terminal symbol of a module in a flowchart?
- Start
- Begin
- Name of the module
- Continue
- Resume
A: Name of the module

Q: When an argument is passed by ________, it is not affected by a change of the content of the parameter variable.
- Value
- Constant
- Reference
- Variable
- None of these
A: Value

Q: Function is another name for ________.
- Module
- Variable
- Reference
- Sub class
- None of these
A: Module

Q: A pass by ________ argument means that the argument is passed into a parameter that will reference the content of the argument in the module.
- Value
- Constant
- Reference
- Variable
- None of these
A: Reference

Q: Which type of variable is not recommended to be used in programs because they make programs hard to understand and debug?
- Local
- Pass by value
- Reference
- Global
- Pass by reference
A: Global

Q: Passing an argument by ________ means that only a copy of the argument's value is passed into the parameter variable.
- Value
- Constant
- Reference
- Variable
- None of these
A: Value

Q: Which type of variable is visible to every module and the entire program?
- Local
- Pass by value
- Reference
- Global
- Pass by reference
A: Global

Q: True/False: Array bounds checking happens at runtime, which is while the program is running.
- True
- False
A: True

Q: True/False: In a sequential search algorithm, the Boolean variable used as a flag is initialized to TRUE.
- True
- False
A: False

Q: True/False: Subscripts are used to identify specific elements in an array.
- True
- False
A: True

Q: True/False: Unlike variables, arrays need to be initialized separately from the declaration.
- True
- False
A: False

Q: True/False: When processing the data in a two-dimensional array, each element has two subscripts.
- True
- False
A: True

Q: True/False: Multiple-dimensional arrays can be used to model data that occurs in multiple sets.
- True
- False
A: True

Q: True/False: The first step in calculating the average of the values in an array is to get the total of the values.
- True
- False
A: True

Q: True/False: If array name contains a list of names, name[1] is the name of the first person.
- True
- False
A: False

Q: True/False: Variables work well in many situations, but they have limitations.
- True
- False
A: True

Q: True/False: Arrays, like variables, can only hold one value at a time.
- True
- False
A: False

Q: True/False: One of the advantages of two- or more dimensional arrays is that the data values can be of two or more data types.
- True
- False
A: False

Q: True/False: To calculate the total of the values in an array, a loop is used with an accumulator variable.
- True
- False
A: True

Q: Access the individual elements in an array by using their ________.
- Sizes
- Numbers
- Integers
- Subscripts
- None of these
A: Subscripts

Q: A partially filled array is normally used with ________.
- a library function that performs array insertions
- an accompanying variable that holds a copy of the last item stored in the array
- an accompanying integer variable that holds the number of items that are actually stored in the array
- a warning to the user that some of the elements contain invalid values
- None of these
A: an accompanying integer variable that holds the number of items that are actually stored in the array

Q: Processing a large number of items in a(n) ________ is usually easier than processing a large number of items stored in separate variables.
- Constant
- Variable
- Array
- Loop
- None of these
A: Array

Q: What is the term used for the number inside the bracket that specifies the number of values that an array can hold?
- Size
- Size declarator
- Number
- Number declarator
- None of these
A: Size declarator

Q: ________ arrays are two or more arrays that hold related data, and the elements are accessed using a common subscript.
- Sequential
- Binary
- Parallel
- Linear
- None of these
A: Parallel

Q: Which of the following arguments must be passed when passing an array as an argument?
- The array itself
- An integer that specifies the number of elements in the array
- The data type of the array
- The array itself and An integer that specifies the number of elements in the array
- The array itself and The data type of the array
A: The array itself and An integer that specifies the number of elements in the array

Q: Which is the simplest search technique to use to find an item in an array?
- Sequential
- Binary
- Bubble
- Select
- None of these
A: Sequential

Q: Some programming languages provide this specialized loop that steps through an array, retrieving the value of each element.
- While Each
- For Each
- Repeat Get
- Step Loop
- None of these
A: For Each

Q: In the following declaration, what is the data type of the elements of the array?
- SIZE
- numbers
- Integer
- Declare
- None of these
A: Integer

Q: A three-dimensional array can be thought of as ________ of two-dimensional arrays.
- Rows
- Columns
- Lines
- Pages
- None of these
A: Pages

Q: Two-dimensional arrays can be thought of as containing ________.
- Rows and columns
- Lines and pages
- Rows and lines
- Lines and columns
- Rows and pages
A: Rows and columns

Q: How many subscripts do you need to access one element in a two-dimensional array?
- One
- Two
- Three
- Four
- None of these
A: Two

Q: What is the term used for the value that is searched for in a search algorithm?
- stringValue
- searchValue
- matchValue
- flag
- None of these
A: searchValue

Q: What is the subscript for the data value 92 in the example given below?
- One
- Two
- A
- B
- None of these
A: One

Q: Which of the following statement is true about the statement below?
- This is an array declaration.
- This is an array initialization.
- This is an array size establishment.
- This is an array declaration and initialization.
- This is an array declaration and size establishment.
A: This is an array declaration and initialization.

Q: Every element in an array is assigned a unique number known as a ________.
- subscript
- integer
- character
- number
- None of these
A: subscript

Q: What type of error occurs when a loop iterates one time too few or one time too many?
- Run time error
- Off-by-one error
- Validation error
- Syntax error
- All of these
A: Off-by-one error

Q: When working with arrays, most programming languages perform ________, which means they do not allow programs to use invalid subscripts.
- array bounds checking
- buffer overrun protection
- bitwise data execution
- subscript binding
- None of these
A: array bounds checking

Q: Which of the following array declarations would be best suited for storing the retail prices?
- Declare String retailPrice[SIZE]
- Declare Real retailPrice[SIZE]
- Declare Integer retailPrice[SIZE]
- All of these
- None of these
A: Declare Real retailPrice[SIZE]

Q: The expression score[5] is pronounced ________.
- Score of 5
- Score 5
- Score sub 5
- Score of 4
- Score sub 4
A: Score sub 5

Q: True/False: Library functions are built into the programming language, and can be called any time they are needed.
- True
- False
A: True

Q: True/False: The parameter list that accepts arguments is optional in a function definition.
- True
- False
A: True

Q: True/False: The input column in the IPO chart describes the process the function performs on the input data.
- True
- False
A: False

Q: True/False: Most programming languages let you assign an integer value to a real variable without causing an error.
- True
- False
A: True

Q: True/False: The library functions in every programming language have the same function names and accept the same arguments, but their behaviors might differ slightly.
- True
- False
A: False

Q: True/False: The number of arguments that can be passed to a function are limited in most programming languages.
- True
- False
A: False

Q: True/False: Programming languages have not yet started to support localization.
- True
- False
A: False

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

Q: The term ________ is used to describe any mechanism that accepts input, performs some operation that cannot be seen on the input, and produces output.
- White box
- Black box
- White cube
- Black cube
- None of these
A: Black box

Q: The function ________ specifies the return data type, name of the function, and the parameter variable(s).
- Definition
- Body
- Header
- Statement
- None of these
A: Header

Q: What term is used in the ending terminal symbol of a function flowchart?
- Return
- End
- Function End
- Function Return
- None of these
A: Return

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 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: The ________ function does the same thing as using the mathematical operator.
- cos
- abs
- sqrt
- round
- pow
A: sqrt

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: Which function returns a string within a string?
- Append
- Concatenate
- Contains
- Substring
- None of these
A: Substring

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: 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 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: 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: 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: 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: Random numbers are commonly used in which type of program?
- Games
- Simulations
- Statistical analysis
- Data encryption
- All 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: 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: What is the data type of the value returned by the random library function?
- String
- Integer
- Boolean
- Real
- None of these
A: Integer

Q: True/False: The top-down design process is sometimes called stepwise refinement.
- True
- False
A: True

Q: True/False: Modules make it impossible for programmers to work in teams.
- True
- False
A: False

Q: True/False: The user's menu selection can be validated using an input validation loop immediately after the Input statements.
- True
- False
A: True

Q: True/False: It is not possible to give the user an opportunity to make additional selections from the menu without having to run the program.
- True
- False
A: False

Q: True/False: An iteration structure is needed to process the menu selection made by the user.
- True
- False
A: False

Q: True/False: The If-Then-Else If statement can be used as an alternative for performing the user's menu selection.
- True
- False
A: True

Q: True/False: The hierarchy chart does not reveal any details of the steps taken inside the module.
- True
- False
A: True

Q: True/False: A case structure is the only decision structure that can be used in a menu-driven program.
- True
- False
A: False

Q: True/False: In most cases, menu-driven programs should be broken down into modules that perform individual tasks.
- True
- False
A: True

Q: True/False: It is a cumbersome process for a user to make a selection from a menu because the user has to type the selection out.
- True
- False
A: False

Q: True/False: In a menu-driven program, the user would have to usually type the word "end" to stop the program.
- True
- False
A: False