Programming Logic & Design (9th Edition)
Program comments are a type of internal documentation. (T or F)
Answer: True
The NOT operator is a unary operator, meaning it takes only one operand. (T or F)
Answer: True
The for loop is a good tool when working with arrays because you frequently need to process every element of an array from beginning to end. (T or F)
Answer: True
When you have a five element array and use subscript 6, your subscript is said to be out of bounds. (T or F)
Answer: True
An indefinite loop is a loop that never stops. (T or F)
Answer: False
Modularization makes it harder for multiple programmers to work on a problem. (T or F)
Answer: False
Most programming languages limit the number of AND and OR operators in an expression. (T or F)
Answer: False
Repetition and sequence are alternate names for a loop structure. (T or F)
Answer: False
When you combine AND and OR operators, the OR operators take precedence, meaning their Boolean values are evaluated first. (T or F)
Answer: False
Besides making your code easier to modify, using a _____ makes the code easier to understand.
Answer: Named Constant
An array whose elements you can access using a single subscript is a _____ array.
Answer: One-Dimensional
Which statement is true of arrays?
Answer: Only whole numbers can be used as array subscripts
A(n) _____ in a class diagram indicates public access.
Answer: Plus Sign (+)
When you learn a method like sorting, programmers say you are learning a(n) _____.
Answer: Algorithm
A(n) _____ is any numeric variable you use to count the number of times an even has occurred.
Answer: Counter
Array elements all have the same _____ in common.
Answer: Data Type
Programmers use the term _____ to describe programs that are well designed and easy to understand and maintain.
Answer: Elegant
The number of bytes in an array is always a multiple of the number of _____ in an array.
Answer: Elements
The _____ clause of the decision is the part that executes only when the tested condition in the decision is false.
Answer: Else (else)
The _____ loop is a particularly useful when processing arrays.
Answer: FOR (for)
Arrays cannot be used if you need to search for a range of values. (T or F)
Answer: False
In some cases, a loop control variable does not have to be initialized. (T or F)
Answer: False
Every array has a(n) _____ size.
Answer: Finite
Variables and constants are _____ within, or local to, only the method in which they are declared.
Answer: In Scope
A mistake programmers often make with loops is that they _____.
Answer: Include statements inside the loop that belong outside the loop
Many loop control variable values are altered by _____, or adding to them.
Answer: Incrementing
A(n) _____ is another name for a subscript.
Answer: Index
In all languages, subscript values must be sequential _____.
Answer: Integers
A method that calls itself is a _____.
Answer: Recursive Method
The conditional AND operator in Java, C++, and C# is _____.
Answer: &&
A(n) _____ decision is a decision in which two conditions must be true for an action to take place.
Answer: AND
Most programming languages allow you to ask two or more questions in a single comparison by using a(n) _____ operator that joins decisions in a single statement.
Answer: AND
When you combine AND and OR operators, the _____ operators take precedence, meaning their Boolean values are evaluated first.
Answer: AND
A(n) _____ is very similar to a counter that you use to count loop iterations, except that you usually add a value other than one to this type of variable.
Answer: Accumulator
When using a bubble sort to sort a 10-element array, on the fourth pass through the array list you detect that no swap has occurred. This indicates _____.
Answer: All elements in the array are already in the correct order
A calling method sends a(n) _____ to a called method.
Answer: Argument
When the records in a file are sorted in order from lowest to highest values, the records are in _____ order.
Answer: Ascending
A _____ expression is one that represents only one of two states, usually expressed as true or false.
Answer: Boolean
In a _____, items in a list are compared with each other in pairs.
Answer: Bubble Sort
When you ask multiple questions before an outcome is determined, you create a _____ condition.
Answer: Compound
Both operands in a comparison expression must be the same _____.
Answer: Data Type
Fill in the blank in the following pseudocode: if someCondition is true then do oneProcess _____ do theOtherProcess endif
Answer: ELSE (else)
The first step in a while loop is typically to _____.
Answer: Initialize the loop control variable
Declaring a starting value for a variable is known as _____ the variable.
Answer: Initializing
The data components of a class that belong to every instantiated object are the class's _____.
Answer: Instance Variables
Object-oriented programmers sometimes say an object is one _____ of a class.
Answer: Instantiation
When you search through a list from one end to the other, you are performing a _____.
Answer: Linear Search
A _____ error results when you use a syntactically correct statement but use the wrong one for the current context.
Answer: Logical
Usually, when you create nested loops, each loop has its own _____.
Answer: Loop Control Variable
A loop must return to the _____ question at some later point in a structure.
Answer: Loop-Controlling
Structured programs can be easily broken down into routines or _____ that can be assigned to any number of programmers.
Answer: Modules
You use the _____ operator to reverse the meaning of a Boolean expression.
Answer: NOT
A mistake programmers often make with loops is that they _____.
Answer: Neglect to initialize the loop control variable prior to entering the loop body
A loop within another loop is known as a(n) _____ loop.
Answer: Nested
To avoid confusion, you can use _____ statements instead of using AND and OR operators.
Answer: Nested If
Placing a structure within another structure is called _____ structures.
Answer: Nesting
When you use the _____ operator, only one of the listed conditions must be met for the resulting action to take place.
Answer: OR
In some programming languages, such as C#, Visual Basic, and Java, every class you create is a child of one ultimate base class, often called the _____ class.
Answer: Object
When a subscript is not within the range of acceptable subscripts, it is said to be _____.
Answer: Out of Bounds
When one loop appears inside another, the loop that contains the other loop is called the _____ loop.
Answer: Outer
When you _____ a method, you write multiple methods with a shared name but different parameter lists.
Answer: Overload
A called method accepts the value of an argument passed to it as its _____.
Answer: Parameter
You can use _____ for clarity and to override the default order of operations.
Answer: Parentheses
By using _____, you can use reasonable, easy-to-remember names for methods and concentrate on their purpose rather than on memorizing different method names.
Answer: Polymorphism
Providing array values is sometimes called _____.
Answer: Populating the Array
In a _____, the loop body executes at least one time because the loop control variable is not tested until after one iteration.
Answer: Post-Test (Posttest) Loop
In a _____, the loop body might never execute because the question controlling the loop might be false the first time it is asked.
Answer: Pretest (Pre-Test) Loop
To search an array for a(n) _____ match, you can store either the highest or lowest value of each range for comparison.
Answer: Range
Arrays, unlike simple built-in types, are passed by _____.
Answer: Reference
The concept of a class is useful because of its _____.
Answer: Reusability
One advantage to using a named constant is that the statement becomes _____.
Answer: Self-Documenting
Use a counter or a(n) _____ to control a loop's repetitions.
Answer: Sentinel Value
A structured program includes only combinations of the three basic structures: _____.
Answer: Sequence, Selection, and Loop
A method's name and a list of argument types together are its _____.
Answer: Signature
Programs that use _____ code logic are unstructured programs that do not follow the rules of structured logic.
Answer: Spaghetti
The amount by which a for loop control variable changes is often called a _____ value.
Answer: Step
In every programming language, when you access data stored in an array, you must use a _____ containing a value that accesses memory occupied by the array.
Answer: Subscript
To correctly swap two values, you create a(n) _____ variable to hold one of the values.
Answer: Temporary
When you write a program that stores a value in a variable, you are using _____ storage.
Answer: Temporary
A program contains an array that holds all the names of the days of the week. Which of the following is true?
Answer: The highest subscript is 6
An infinite loop is a flow of program logic that repeats and never ends. (T or F)
Answer: True
Any constructor you write must have the same name as the class it constructs, and it cannot have a return type. (T or F)
Answer: True
Both the while loop and the for loop are examples of pretest loops. (T or F)
Answer: True
Declaring a named constant makes code easier to modify and understand. (T or F)
Answer: True
Every high-level computer programming language contains a while statement. (T or F)
Answer: True
Forgetting to initialize and alter the loop control variable are common mistakes that programmers make. (T or F)
Answer: True
It is the programmer's responsibility to initialize all variables that must start with a specific value. (T or F)
Answer: True
Many newer programming languages such as C++, Java and C# use the square bracket notation for arrays. (T or F)
Answer: True
Most programming languages allow you to ask two or more questions in a single comparison. (T or F)
Answer: True
You can either increment or decrement the loop control variable. (T or F)
Answer: True
You can use parentheses to override the default order of operations. (T or F)
Answer: True
If you declare a variable to be Boolean, you can set its value to _____.
Answer: True or False
Loops are frequently used to _____; that is, to make sure it is meaningful and useful.
Answer: Validate Data
When a copy of a variable is sent to a method, it is passed by _____.
Answer: Value
A(n) _____ is a named memory location whose value can vary.
Answer: Variable
The true benefit of using an array lies in your ability to use a _____ as a subscript to the array.
Answer: Variable
The do loop is a variation of the _____ loop.
Answer: WHILE (while)
In a truth table, the expression _____ is false.
Answer: false OR false
In a truth table, the expression _____ is true.
Answer: true AND true
C#, C++, C, and Java use the symbol _____ as the logical OR operator.
Answer: ||
