Sunday, April 6, 2014
Programming study questions
Final study guide
Multiple Choice
Identify the choice that best completes the statement or answers the question.
__b__ 1. ____ errors are detected by a compiler.
a. Logic c. Input
b. Syntax d. Process
__d__ 2. After a programmer plans the logic of a program, the next step is ____.
a. understanding the problem c. translating the program
b. testing the program d. coding the program
__a__ 3. The process of walking through a program’s logic on paper before you actually write the program is called ____.
a. desk-checking c. pseudocoding
b. flowcharting d. testing
__d__ 4. Typically, a programmer develops a program’s logic, writes the code, and then ____ the program, which may generate a list of syntax errors.
a. runs c. executes
b. compiles d. tests
__c__ 5. A(n) ____ is a message that is displayed on a monitor, asking the user for a response.
a. command prompt c. prompt
b. input screen d. input data
__d__ 6. A database holds a group of files, often called ____, that together serve the information needs of an organization.
a. records c. fields
b. characters d. tables
__a__ 7. The ____ is the standard terminal symbol for a flowchart.
a. circle c. diamond
b. lozenge d. square
__c__ 8. If a flowchart has six processing steps and a page provides room for only three, you can use a ____ to create the completed flowchart.
a. decision symbol c. connector
b. lozenge d. terminator
_d___ 9. The problem with the following statement is that ____.
100 = grade
a. 100 is not a reasonable grade
b. 100 should be in quotes
c. the data types don’t match
d. the value on the left must be a variable name
__a__ 10. The major difference between the two main programming styles in use today is the ____.
a. use of flowcharts versus pseudocode
b. testing procedure used by the programmer
c. focus the programmer takes during the earliest planning stages of a project
d. programming language used
__b__ 11. The following pseudocode is an example of a(n) ____ structure:
if firstNumber is bigger than secondNumber then
print firstNumber
else
print secondNumber
a. sequence c. loop
b. decision d. nested
__d__ 12. Fill in the blank in the following pseudocode:
if someCondition is true then
do oneProcess
____
do theOtherProcess
a. then c. do
b. while d. else
_c___ 13. The following pseudocode is an example of a(n) ____ structure:
get number
while number is positive
add to sum
get number
a. sequence c. loop
b. decision d. nested
__c__ 14. Another name for a loop structure is ____.
a. execution c. iteration
b. selection d. case
_b___ 15. The following pseudocode is an example of ____.
do stepA
do stepB
if conditionC is true then
do stepD
else
do stepE
endif
while conditionF is true
do stepG
endwhile
a. nesting c. single alternative structures
b. stacking d. a posttest
_a___ 16. The following pseudocode is an example of ____.
if conditionA is true then
do stepE
else
do stepB
do stepC
do stepD
endif
a. nesting c. a posttest
b. stacking d. a pretest
__d__ 17. Years ago, programmers could avoid using structure by inserting a “____” statement into their pseudocode.
a. loop c. next
b. go next d. go to
__b__ 18. Structured programs can be easily broken down into routines or ____ that can be assigned to any number of programmers.
a. segments c. units
b. modules d. sequences
__b__ 19. ____ is considered to be a convenience structure.
a. if-then-else c. case
b. while d. sequence
__c__ 20. In a case structure, the term ____ means “if none of the other cases were true.”
a. else c. default
b. then d. loop
__a__ 21. A case structure can be replaced by one or more ____ structures.
a. if-then-else c. do-until
b. do-while d. while
__d__ 22. In a ____ loop, the loop body continues to execute as long as the answer to the controlling question is yes, or true.
a. do-then c. do-until
b. do-when d. do-while
__c__ 23. ____ is an example of a pretest loop.
a. do-while c. while
b. do-until d. case
__d__ 24. People who use computer programs are called ____.
a. managers c. stakeholders
b. programmers d. end users
__c__ 25. The ____ of documentation is typically written first.
a. input c. internal program
b. output d. external program
__a__ 26. ____ is the process of paying attention to important properties while ignoring nonessential details.
a. Abstraction c. Reusability
b. Modularization d. Direction
_c___ 27. ____ is the feature of programs that assures you a module has been tested and proven to function correctly.
a. Modularization c. Reliability
b. Abstraction d. Reusability
_d___ 28. When a program or module uses another module, you can refer to the main program as the ____ program.
a. director c. called
b. calling d. parent
_a___ 29. The ____ statement is used to indicate the end of a module.
a. stop c. return
b. end d. done
_d___ 30. The name that is best suited to a module that calculates overtime pay is ____.
a. calcO() c. calculate overtime()
b. cO() d. calculateOvertime()
__b__ 31. The structure that is used in a binary selection is ____.
a. if-then c. while
b. if-then-else d. do-while
__c__ 32. Boolean expressions are named after ____.
a. Harold Boolean c. George Boole
b. Henry Boole d. Gerhardt Boolean
__a__ 33. In ____ the equal sign (=) is used to express testing equivalency.
a. VisualBasic c. C++
b. Java d. C#
__d__ 34. The pseudocode that produces the same result as the following is ____.
if customerAge >= 65 then
discount = 0.10
else
discount = 0
endif
a. if customerAge > 65 then
discount = 0.10
else
discount = 0
endif
b. if customerAge < 65 then
discount = 0.10
else
discount = 0
endif
c. if customerAge > 65 then
discount = 0
else
discount = 0.10
endif
d. if customerAge < 65 then
discount = 0
else
discount = 0.10
endif
_c___ 35. The decision structure that is logically equivalent to the following is ___.
if customerCode not equal to 1 then
discount = 0.25
else
discount = 0.50
endif
a. if customerCode > 1 then
discount = 0.50
else
discount = 0.25
endif
b. if customerCode < 1 then
discount = 0.50
else
discount = 0.25
endif
c. if customerCode = 1 then
discount = 0.50
else
discount = 0.25
endif
d. if customerCode = 1 then
discount = 0.20
else
discount = 0.50
endif
__d__ 36. When you need to ask multiple questions before an outcome is determined, you must create a(n) ____ condition.
a. dual-alternative c. single-alternative
b. nested d. compound
__b__ 37. A series of nested if statements can also be called a(n) ____ statement.
a. n-alternative if c. case
b. cascading if d. loop
__d__ 38. ____ are diagrams used in mathematics and logic to help describe the truth of an entire expression based on the truth of its parts.
a. Decision matrices c. Truth diagrams
b. Decision diagrams d. Truth tables
__d__ 39. For maximum efficiency, a good rule of thumb in an OR decision is to ____.
a. first ask the question that is more likely to be true
b. first ask the question that is more likely to be false
c. rewrite as an and decision and ask the question more likely to be true
d. rewrite as an and decision and ask the question more likely to be false
__c__ 40. The symbol that represents a logical OR in Java, C++, and C# is ____.
a. % c. ||
b. $ d. ^
___a_ 41. Suppose a movie theater manager says, “Provide a discount to patrons who are under 13 years old and those who are over 64 years old; otherwise, charge the full price.” Which statement will implement this logic correctly?
a. if patronAge < 13 AND patronAge > 64 then
price = discountPrice
else
price = fullPrice
endif
b. if patronAge > 13 AND patronAge < 64 then
price = discountPrice
else
price = fullPrice
endif
c. if patronAge < 13 OR patronAge > 64 then
price = discountPrice
else
price = fullPrice
endif
d. if patronAge > 13 OR patronAge < 64 then
price = discountPrice
else
price = fullPrice
endif
__c__ 42. The logical OR operator can be compared to ____ in terms of precedence.
a. addition c. multiplication
b. subtraction d. division
_b___ 43. The type of nested if-then-else structure that could be replaced with a case structure is ____.
a. inner nested if within the if portion of the outer if
b. inner if within the else portion of the outer if
c. one that uses a logical AND
d. one that uses a logical OR
__b__ 44. When creating a decision table, you must determine how many possible Boolean value combinations exist for the conditions. If there are two conditions, ____ combinations will exist.
a. 2 c. 8
b. 4 d. 16
__a__ 45. The first step in a loop is typically ____.
a. compare the variable to a value that determines if the loop stops or continues
b. initialize the variable
c. increment the variable
d. perform the loop action
__d__ 46. In the following pseudocode fragment, the while loop will terminate when ____.
counter = 10
while response = ‘Y’
print counter
counter = counter - 1
print “Do you want to see the next counter? Y or N”
get response
endwhile
a. counter = 0 c. response = ‘Y’
b. the while loop will not terminate. d. response = ‘N’
__a__ 47. Once a program enters the body of a structured loop, ____.
a. the entire loop must execute
b. the loop can be terminated with a break statement
c. the loop will execute indefinitely
d. a decision statement will be evaluated
__d__ 48. The following loop will execute ____ times.
counter = 0
while counter <= 10
print “Hello”
counter = counter + 1
endwhile
a. 0 times c. 10 times
b. 9 times d. 11 times
_a___ 49. The ____ loop provides three actions in one compact statement.
a. for c. do until
b. while d. repeat
_c___ 50. In a ____ loop, the body of the loop will always execute at least once.
a. for c. do until
b. while d. repeat
_c___ 51. The statement that is true of a structured loop is that ____.
a. the loop can exit from any point
b. the loop body must execute at least once
c. the loop condition represents the only exit from the loop
d. the loop can repeat an infinite number of times
__c__ 52. A(n) ____ is increased by an arbitrary value, whereas a(n) ____ is usually increased by one.
a. summary, total c. accumulator, counter
b. counter, accumulator d. counter, summary
__b__ 53. ____ is another name for an array.
a. group c. matrix
b. sequence d. subscript
__c__ 54. In all languages, subscript values must be ____.
a. characters c. real numbers
b. non-sequential d. non-negative
__c__ 55. An array can be used to replace ____.
a. records c. nested decisions
b. methods d. loops
__c__ 56. Of the following, ____, is true of arrays.
a. An array subscript can be a number or a character.
b. Using a numeric constant as a subscript is generally much better than using a variable.
c. A named constant equal to the array size can be used to subscript the array.
d. In Java, when an array is declared, a constant representing the size is automatically created.
__b__ 57. The type of loop____, is used to set the initial value for array variables.
a. declaration c. implied
b. initialization d. direct
__d__ 58. Providing array values is called ____.
a. creating the array c. accumulating the array
b. declaring the array d. populating the array
__c__ 59. Another name for an array is a(n) ____.
a. vector c. collection
b. table d. set
__a__ 60. ____ is true of arrays.
a. Only whole numbers can be used as array subscripts.
b. Only whole numbers can be stored in arrays.
c. Arrays cause more work for the programmer, but allow faster program execution.
d. Array elements cannot be reset after the array is declared.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment