Midterm Study
A loop structure does not contain a decision point. True False
False
A method cannot be used more than once within a program or in other programs. True False
False
A named constant can be assigned a value multiple times. True False
False
An adjective would be a good choice of identifier for a variable that holds status. True False
False
An error commonly made by beginning programmers is to forget that array subscripts start with the integer 1. True False
False
Computers deal with two basic types of data - text and string. True False
False
For greatest program efficiency when using the AND operator, first ask the question that is more likely to be true. True False
False
In a flowchart, processing symbols are represented by parallelograms. True False
False
In echoing input, the program tells the user the desired form of the input data. True False
False
In every object-oriented programming language, the variables and constants declared in any method are usable anywhere within the program. True False
False
Logical errors are sometimes referred to as structural errors. True False
False
Overloading a method is a good idea because it eliminates some programming work compared to writing separate methods. True False
False
The body of a loop can contain only a limited number of statements. True False
False
The more the statements contribute to the same job, the less the functional cohesion of the method. True False
False
The selection structure can be called an if-then structure. True False
False
Usually, a comparison operator is used to compare values of different data types. True False
False
When writing pseudocode, you need to be careful about syntax. True False
False
You can ask every programming question by using one of only four types of comparison operators in a Boolean expression. True False
False
You can use a while loop to execute a body of statements continuously as long as some condition continues to be false. True False
False
A literal numeric constant does not change. True False
True
A loop control variable's value is tested to control the loop's execution. True False
True
A noun would be a good choice for a variable or constant identifier. True False
True
A while loop can be used to code both definite and indefinite loops. True False
True
An argument can be passed into a method in two ways: by value and by reference. True False
True
An item's data type defines what operations can be performed on the item. True False
True
As with a while loop, when you use a for loop, you must be careful to stay within array bounds, remembering that the highest usable array subscript is one less than the size of the array. True False
True
Computer circuitry consists of two-state on/off switches, often represented by 1 or 0. True False
True
Computer instructions are written in a computer programming language such as Visual Basic, C#, C++, or Java. True False
True
Each variable within an array has the same name and the same data type. True False
True
If you store important papers in a series of file folders and label each folder with a consecutive letter of the alphabet, then you are using the equivalent of an array. True False
True
If you use the wrong comparison with the loop control variable, the body of the loop may never execute. True False
True
In a flowchart, you draw the main() method and every other method separately with its own sentinel symbols. True False
True
In all structured loops, the loop-controlling question provides the only entry to, or exit from, the repeating structure. True False
True
Language translation software for a computer is called a compiler or interpreter. True False
True
Leaving a loop as soon as a match is found improves the program's efficiency. True False
True
Most programming languages support a NOT operator, which reverses the meaning of a Boolean expression. True False
True
Parallel arrays are two arrays such that each element in one array is associated with the element in the same relative position in the other array. True False
True
The assignment operator is said to have right-to-left associativity. True False
True
The three parts of a method are the method's header, the method's body, and the method's return statement. True False
True
There is no benefit to changing a variable's value when it will never be used again during the current execution. True False
True
When using the OR operator, an action is taken when at least one of the comparisons evaluates to true. True False
True
Writing a program includes planning the logic, coding the program, translating the program into machine language, and testing the program. True False
True
You should avoid overloading a method with the same argument data types because this will create an ambiguous method that will not compile. True False
True
he values stored in arrays should be constants. True False
True
The safest and clearest course of action is to assign the value ____ to accumulators before using them. a. 0 b. 1 c. null d. blank
a. 0
People have been writing modern computer programs since the ____. a. 1940s b. 1950s c. 1960s d. 1970s
a. 1940
When you use one or more ____ operators to combine two or more Boolean expressions, each Boolean expression must be true for the entire expression to be evaluated as true. a. AND b. OR c. NOT d. EQUALS
a. AND
____ a data item means you override incorrect data by setting the variable to a specific value. a. Forcing b. Incrementing c. Initializing d. Terminating
a. Forcing
____ variables and constants are those that are known to an entire class. a. Global b. Local c. Universal d. Comprehensive
a. Global
Computer circuitry consists of two-state on/off switches, often represented by 1 or 0. a. True b. False
a. True
Depending on the syntax rules of the programming language you use, you place the subscript within parentheses or square brackets following the group name. a. True b. False
a. True
Each variable within an array has the same name and the same data type. a. True b. False
a. True
Loops are frequently used to validate data. a. True b. False
a. True
When you overload a method, you run the risk of creating ____ methods-a situation in which the compiler cannot determine which method to use. a. ambiguous b. uncertain c. vague d. unclear
a. ambiguous
The decision that controls every loop is always based on a ____ comparison. a. Boolean b. logical c. standard d. regular
a. boolean
A structure that includes separate actions when an expression is true and when it is false is called a(n) ____ structure. a. dual-alternative selection b. diverging selection c. single-alternative selection d. null-alternative selection
a. dual-alternative selection
Each separate array variable is one ____ of an array. a. element b. block c. factor d. aspect
a. element
Every array has a(n) ____ size. a. finite b. infinite c. indefinite d. large
a. finite
What is one item that must be included in a method's header if it can receive a parameter? a. local parameter name b. global parameter name c. parameter's client d. return data structure
a. local parameter name
Using an array is never ____. a. mandatory b. optional c. a good idea d. easy to understand
a. mandatory
Whenever you require ____ storage locations for objects, you are using a real-life counterpart of a programming array. a. multiple b. fixed c. stacked d. expandable
a. multiple
Most languages provide a built-in way to check whether entered data is ____. a. numeric b. garbage c. alphanumeric d. correct
a. numeric
In most programming languages, you are allowed to include multiple ____ statements in a method. a. return b. end c. back d. depart
a. return
The ____ type for a method can be any type, which includes numeric, character, and string, as well as other more specific types that exist in the programming language you are using. a. return b. data c. case d. variable
a. return
You control a loop's repetitions by using either a counter or a(n) ____ value. a. sentinel b. standard c. end d. constant
a. sentinel
In C++ and C#, which type of punctuation is used to hold the array's subscript following the group name? a. square brackets b. asterisks c. parenthesis d. quotes
a. square brackets
A(n) ____ is a number you use to increase a loop control variable on each pass through a loop. a. step value b. control value c. increment value d. step variable
a. step value
Users enter incorrect data frequently; a good program should be able to handle the mistake and not allow the ____ to be out of bounds. a. subscript b. superscript c. range d. variable
a. subscript
Arrays are always composed of elements of the same data ____. a. type b. style c. method d. mode
a. type
Simple non-array variables are usually passed to methods by ____. a. value b. reference c. type d. class
a. value
Which of the following is correct if the data type for weight is num? a. weight = 2.75 b. weight = "2.75" c. weight = (2.75) d. weight = "heavy"
a. weight = 2.75
Which takes precedence when the two are combined in a single statement: AND or OR? a. OR b. AND c. whichever comes first d. whichever comes last
b. AND
____, the entire set of actions an organization must take to switch over to using a new program or set of programs, can sometimes take months or years to accomplish. a. Duplication b. Conversion c. Exchange d. Replication
b. Conversion
____ is the feature of programs and methods that assures you each has been tested and proven to function correctly. a. Modularization b. Reliability c. Portability d. Reusability
b. Reliability
Which of the following is an advantage of using an integrated development environment? a. Syntax errors do not occur. b. Syntax errors are visually highlighted. c. The program can run with syntax errors. d. Logical errors do not occur.
b. Syntax errors are visually highlighted
What is one drawback to including program comments? a. They take up too much memory. b. They must be kept current. c. You cannot use abbreviations. d. They make a program difficult to read.
b. They must be kept current.
____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts. a. Text tables b. Truth tables c. Results tables d. Yes/No tables
b. Truth tables
The arguments sent to a method in a method call are often referred to as ____ parameters. a. signature b. actual c. formal d. recognized
b. actual
A common mistake when programming with loops is neglecting to ____ the loop control variable. a. reset b. alter c. end d. output
b. alter
A(n) ____ is a series or list of variables in computer memory, all of which have the same name and data type but are differentiated with special numbers called subscripts. a. collection b. array c. script d. group
b. array
A series of nested if statements can also be called a ____ if statement. a. layered b. cascading c. stacked d. dual
b. cascading
A series of nested if statements can also be called a ____ if statement. a. layered b. cascading c. stacked d. dual
b. cascading
Programmers must be careful to use the correct ____ in the statement that controls a loop. a. sequence b. comparison c. variable d. identifier
b. comparison
When you need to ask multiple questions before an outcome is determined, you must create a ____. a. dual condition b. compound condition c. large condition d. coordinated condition
b. compound condition
A(n) ____ is any numeric variable you use to count the number of times an event has occurred. a. numerator b. counter c. incremental value d. accumulator
b. counter
In pseudocode, which statement is used to show the stopping point of a loop structure? a. stop b. endwhile c. endif d. exitwhile
b. endwhile
All array elements have the same ____ name, but each individual element also has a unique subscript indicating how far away it is from the first element. a. variable b. group c. superscript d. value
b. group
What is the correct data type of an accumulator variable used to store real estate sales totals? a. string b. numeric c. text d. character
b. numeric
Two corresponding arrays are known as ____ arrays when each element in one array is associated with the element in the same relative position in the other array. a. perpendicular b. parallel c. similar d. matching
b. parallel
If you run the same application a second time, the variables might occupy different ____ from the ones they occupied during the first run. a. virtual storage locations b. physical memory locations c. virtual memory locations d. physical storage locations
b. physical memory locations
A ____ is any series of contiguous values between specified limits. a. parallel array b. range of values c. bounded series d. subscript search
b. range of values
A method can return nothing, which makes it a(n) ____ method. a. empty b. void c. open d. valid
b. void
Machine language is also called ____ language. a. volatile b. high-level c. binary d. primary
c. Binary
A(n) ____ expression is one that represents only one of two states, usually expressed as true or false. a. alternative b. dual c. Boolean d. double
c. Boolean
____ constants do not have identifiers like variables do. a. Alphabetic b. Named c. Unnamed d. Uncertain
c. Unnamed
The difference between an accumulator and a counter lies in the ____ that you add to the variable. a. comments b. updates c. value d. text
c. Value
One of the components of object-oriented design is identifying ____. a. detail b. procedures c. attributes d. syntax
c. attributes
Machine language is also called ____ language. a. volatile b. high-level c. binary d. primary
c. binary
Each array element occupies an area in memory next to, or ____, the others. a. coupled with b. associated with c. contiguous to d. parallel with
c. contiguous to
It is always a mistake to fail to initialize a loop's ____ variable. a. operational b. sequence c. control d. terminal
c. control
You usually use the for statement with ____ loops. a. non-testing b. infinite c. definite d. indefinite
c. definite
When you declare an array, you provide a(n) ____ name for a number of associated variables in memory. a. permanent b. immutable c. group d. standard
c. group
A method's ____ includes the method identifier and possibly other necessary identifying information. a. title b. space c. header d. opener
c. header
There will always be only one class ____ for each class. a. statement b. method c. header d. footer
c. header
The structure that takes one of two paths based on a decision is called a(n) ____ structure. a. if-then b. if-else c. if-then-else d. if-endif
c. if-then-else
When the value of a loop control variable is not altered by arithmetic, but is instead altered by user input, this is known as a(n) ____ loop. a. counted b. user-defined c. indefinite d. definite
c. indefinite
When the value of a loop control variable is not altered by arithmetic, but is instead altered by user input, this is known as a(n) ____ loop. a. counted b. user-defined c. indefinite d. definite
c. indefinite
When the value of a loop control variable is not altered by arithmetic, but is instead altered by user input, this is known as a(n) ____ loop. a. counted b. user-defined c. indefinite d. definite
c. indefinite
When you write a loop, you must control the number of repetitions it performs; if you do not, you run the risk of creating a(n) ____ loop. a. updating b. eternal c. infinite d. long
c. infinite
All computers have temporary, ____ storage, also known as random access memory (RAM). a. processing b. machine c. internal d. external
c. internal
A(n) ____ is the process of searching through a list from one end to another. a. binary search b. array search c. linear search d. midpoint searc
c. linear search
A(n) ____ is the process of searching through a list from one end to another. a. binary search b. array search c. linear search d. midpoint search
c. linear search
One advantage of modularization is that it simplifies the ____. a. functions b. arguments c. logic d. subroutines
c. logic
You use the ____ operator to reverse the meaning of a Boolean expression. a. duplicate b. reverse c. logical NOT d. unequal
c. logical NOT
In all structured loops, the ____ must provide either entry to, or exit from, the repeating structure. a. loop-controlling statement b. loop-directing question c. loop-controlling question d. loop-ending question
c. loop-controlling question
In all structured loops, the ____ must provide either entry to, or exit from, the repeating structure. a. loop-controlling statement b.. loop-directing question c. loop-controlling question d. loop-ending question
c. loop-controlling question
Some programmers refer to an array as a table, or a ____. a. catalog b. template c. matrix d. list
c. matrix
When you use a subscript not within the range of acceptable subscripts, your subscript is said to be ____. a. out of range b. out of area c. out of bounds d. out of series
c. out of bounds
Methods can be ____ correctly by providing different parameter lists for methods with the same name. a. updated b. tested c. overloaded d. passed
c. overloaded
Arrays are passed to a method by ____. a. type b. class c. reference d. value
c. reference
In an interactive program, a ____ enters data. a. disk b. database c. user d. graphical user interface
c. user
Loops are frequently used to ____ data; that is, to make sure it is meaningful and useful. a. include b. declare c. validate d. update
c. validate
Programmers say that data items are ____ only after they have been declared and within the method in which they are declared. a. available b. identified c. visible d. useable
c. visible
Programmers say that data items are ____ only after they have been declared and within the method in which they are declared. a. available b. identified c. visible d. useable
c. visible
A ____, also called an index, is a number that indicates the position of a particular item within an array. a. superscript b. key c. placeholder d. subscript
d. Subscript
What is an advantage of using the practice of echoing input? a. The program is shorter. b. Memory usage is lower. c. There is less chance of syntax errors. d. The user is more likely to catch input errors
d. The user is more likely to catch input errors
What is an advantage of using the practice of echoing input? a. The program is shorter. b. Memory usage is lower. c. There is less chance of syntax errors. d. The user is more likely to catch input errors.
d. The user is more likely to catch input errors.
Modularization provides ____. a. ambiguity b. complexity c. detail focus d. abstraction
d. abstraction
In a flowchart or in pseudocode, you can use the symbol that mathematicians use to mean "not equal," which is ____. a. an equal sign with an octagon over it b. an equal sign with a circle around it c. an equal sign with a slash after it d. an equal sign with a slash through it
d. an equal sign with a slash through it
In a flowchart or in pseudocode, you can use the symbol that mathematicians use to mean "not equal," which is ____. a. an equal sign with an octagon over it b. an equal sign with a circle around it c. an equal sign with a slash after it d. an equal sign with a slash through it
d. an equal sign with a slash through it
When a method returns a value, you usually want to use it in the ____ method. a. working b. current c. return d. calling
d. calling
A ____ dictionary is a list of every variable name used in a program. a. naming b. string c. constant d. data
d. data
One appropriate action when invalid input data has been detected is to assign a(n) ____value and proceed. a. error b. random c. decrement d. default
d. default
Programmers use the term "____" to describe programs that are well designed, and easy to understand and maintain. a. refined b. graceful c. stylish d. elegant
d. elegant
A ____ is a variable that you set to indicate whether some event has occurred. a. banner b. sentry c. sentinel d. flag
d. flag
With ____, you make a request to a method without knowing the details of how the method works. a. implementation masking b. method masking c. method hiding d. implementation hiding
d. implementation hiding
Programmers say that variables and constants declared within a method are ____ only after declaration within that method. a. in line b. useable c. out of scope d. in scope
d. in scope
What is another word for a subscript? a. superscript b. subroutine c. variable d. index
d. index
At the beginning of any method, it is the programmer's responsibility to ____ all variables that must start with a specific value. a. internalize b. setup c. clear d. initialize
d. initialize
Any array's subscripts are always a sequence of ____. a. alphanumeric characters b. symbols c. links d. integers
d. integers
Statements inside a loop that could be placed outside the loop make the loop ____. a. more efficient b. cleaner c. incorrect d. less efficient
d. less efficient
The ____ variable is initialized before entering the loop. a. loop-ending b. ending control c. interrupt control d. loop control
d. loop control
Program logic gets more complicated when you must use loops within loops, or ____ loops. a. internal b. grouped c. stacked d. nested
d. nested
The highest usable array subscript is ____. a. twice the size of the array b. the size of the array c. one more than the size of the array d. one less than the size of the array
d. one less than the size of the array
The ___ dictate the order in which operations in the same statement are carried out. a. sequence structures b. named constants c. decision points d. order of operations
d. order of operations
When you ____ a method, you write multiple methods with a shared name but different parameter lists. a. redo b. repurpose c. reload d. overload
d. overload
When using a flowchart, input is represented by what geometric shape? a. rectangle b. diamond c. circle d. parallelogram
d. parallelogram
A method's name and parameter list constitute the method's ____. a. identity b. autograph c. fingerprint d. signature
d. signature
Reprompting for data validation of a user's input is only necessary once. True False
false
The set of instructions that tell the computer what to do are called ____. a. software b. input c. hardware d. data
a. Software
A(n) ____ statement stores the value of the right-hand side of the expression in the memory location of the left-hand side. a. construct b. arithmetic c. equals d. assignment
d. assignment
Which language does a computer know? a. Java b. C++ c. high-level d. machine language
d. machine language
Only a few decisions you make in a computer program involve evaluating a Boolean expression. True False
False
For greatest program efficiency when using the OR operator, first ask the question that is more likely to be true. True False
True
In a flowchart, decision symbols are represented by diamonds. True False
True
The two major techniques for developing programs are procedural programming and object-oriented programming (OOP). True False
True
Three types of program structures are sequence, selection, and loop. True False
True
The rules that govern a programming language are called ____. a. syntax b. compilers c. structure d. constructs
a. Syntax
In the following statement, which operation is done third? answer = a + b + c * d / e - f a. a+b b. b+c c. e-f d. d/e
a. a+b
What is an equivalent way to write the following statement? answer = a + b + c * d / e - f a. answer = a+b+(c*d)/(e-f) b. answer = a+b+(c*d)/e-f c. answer = a+b+(c*d/e-f) d. answer = a+b+c*(d/e)-f
a. answer = a+b+(c*d)/(e-f)
A(n) ____ is a named set of statements that perform some task or group of tasks within an application. a. method b. class c. object d. flowchart
a. method
An AND decision can be constructed using a ____ decision. a. nested b. stacked c. combined d. dual
a. nested
A structured selection must have one entry point at the decision, and ____ exit point(s) when the two logical paths rejoin. a. one b. two c. three d. four
a. one
The instruction Myanswer = Mynumber*2 is an example of a(n) ____ operation. a. processing b. numerical c. data d. input
a. processing
A common error when using range checking is creating a(n) ____ path in the code. a. unreachable b. ending c. parallel d. decision
a. unreachable
The convention used in this book for named constants is ____ characters ____ underscores to separate words. a. uppercase, with b. uppercase, without c. lowercase, with d. lowercase, without
a. uppercase, with
What is one common error in using an OR selection? a. using AND logic when OR is needed b. creating structured logic c. using too many comparison operators d. using too few comparison operators
a. using AND logic when OR is needed
What is one common error in using an OR selection? a. using AND logic when OR is needed b. creating structured logic c. using too many comparison operators d. using too few comparison operators
a. using AND logic when OR is needed
What is one common error in using an OR selection? a. using AND logic when OR is needed b. creating structured logic c. using too many comparison operators d. using too few comparison operators
a. using AND logic when OR is needed
In an AND decision, why is it good practice to make the first question the one that is less likely to be true? a. This eliminates all instances of the second decision. b. This eliminates as many instances of the second decision as possible. c. This eliminates evaluation of the first decision. d. This makes program execution longer.
b. This eliminates as many instances of the second decision as possible.
In an AND decision, why is it good practice to make the first question the one that is less likely to be true? a. This eliminates all instances of the second decision. b. This eliminates as many instances of the second decision as possible. c. This eliminates evaluation of the first decision. d. This makes program execution longer.
b. This eliminates as many instances of the second decision as possible.
A ____ is an example of a user environment. a. prompt b. command line c. text line d. command box
b. command line
In pseudocode, a(n) ____ statement is used to clearly show where the selection structure ends. a. end b. endif c. endifelse d. stop
b. endif
One type of tool to aid the programmer during the planning stage is called a ____. a. placeholder b. flowchart c. desk-checker d. graphical user interface
b. flowchart
A(n) ____ is the name of a programming object - for example, a class, method, or variable. a. convention b. identifier c. keyword d. class header
b. identifier
Data items enter the computer system through ____ devices. a. software b. input c. output d. storage
b. input
Which of the following is correct if the data type of inventoryItem is string? a. inventoryItem = 3 b. inventoryItem = "printer" c. inventoryItem = -9 d. inventoryItem = (printer)
b. inventoryItem = "printer"
When using a flowchart, terminal symbols are represented by what geometric shape? a. parallelogram b. lozenge c. rectangle d. diamond
b. lozenge
Programmers refer to programs that contain meaningful names as ____. a. external documentation b. self-documenting c. internally consistent d. applications
b. self-documenting
The programming statements you write in a programming language are known as the ____ code. a. object b. source c. translated d. external
b. source
In the following statement, which arithmetic operation is performed first? answer = a + b + c * d / e - f a. e-f b. a+b c. c*d d. d/e
c. c*d
In the following statement, which arithmetic operation is performed first? answer = a + b + c * d / e - f a. e-f b. a+b c. c*d d. d/e
c. c*d
Sequences never include ____. a. terminations b. tasks c. decisions d. steps
c. decisions
Besides being awkward to use, the "____" comparison operator is the one most likely to be different in various programming languages. a. equal to b. greater than c. not equal to d. less than
c. not equal to
Many programming languages allow you to use ____ to force an expression to evaluate first. a. a pound sign b. an asterisk c. parentheses d. quotation marks
c. parentheses
Misuse of a language's grammar rules is called a(n) ____ error. a. illegal b. logical c. syntax d. semantic
c. syntax
You can use named constants to make your programs easier to understand by eliminating ____. a. constants b. variables c. strings d. magic numbers
d. magic numbers
You can use ____ statements instead of using AND and OR operators. a. conditional b. stacked if c. nesting loop d. nesting if
d. nesting if
You should never ask a question if there is ____ possible answer(s) or outcome(s). a. an unknown set of b. a known set of c. two or fewer d. only one
d. only one
You should never ask a question if there is ____ possible answer(s) or outcome(s). a. an unknown set of b. a known set of c. two or fewer d. only one
d. only one
With a ____ structure, you perform an action or event, and then you perform the next action in order. a. loop b. decision c. selection d. sequence
d. sequence
A graphical ____ is one example of a user environment. a. flowchart b. keyboard c. user screen d. user interface
d. user interface
What operator has the lowest precedence? a. + b. / c. * d. =
d.=