Python Post-Test Exam Review

  1. Computer programs also are known as 




    B. software
  2. The major computer operations include




    D. input, processing, and output
  3. Visual Basic, C++, and Java are all examples of computer




    C. programming languages
  4. A programming language's rules are its




    C. syntax
  5. The most important task of a compiler or interpreter is to




    A. translate programming language statements into machine language
  6. Which of the following is temporary, internal storage?




    A. memory
  7. Which of the following pairs of steps in the programming process in the correct order?




    B. code the program, translate it into machine language
  8. A programmer's most important task before planning the logic of a program is to




    A. understand the problem
  9. The two most commonly used tools for planning a program's logic are




    C. flowcharts and pseudocode
  10. Writing a program in a language such as C++ or Java known as _________ the program.




    B. coding
  11. An English-like programming language such s Java or Visual basic is a ________ programming language.




    C. high-level
  12. Which of the following is an example of a syntax error?




    C. misspelling a programming language word
  13. Which of the following is an example of a logical error?




    D. all of the above
  14. The parallelogram is the flowchart symbol representing




    C. either a or b
  15. In a flowchart, a rectangle represents




    A. processing
  16. The term eof represents




    A. a generic sentinel value
  17. In flowcharts, the decision symbol is a 




    B. diamond
  18. When you use an IDE instead of a simple text editor to develop a program,




    D. some help is provided
  19. When you write a program that will run in a GUI environment as opposed to a command-line environment,




    A. some syntax is different
  20. As compared to procedural programming, with object-oriented programming,




    A. the programmer's focus differs
  21. What does a declaration provide for a variable?




    C. both of the above
  22. A variable's data type describes all of the following except




    D. the scope of the variable
  23. The value stored in an uninitialized variable is




    C. garbage
  24. The value 3 is a




    C. numeric constant
  25. The assignment operator




    A. is a binary operator
  26. Multiplication has a lower precedence than




    D. none of the above
  27. Which of the following is not a term used a synonym for module?




    D. object
  28. Modularization




    A. facilitates reusability
  29. What is the name for the process of paying attention to important properties while ignoring nonessential details?




    C. abstraction
  30. Every module has all of the following except




    B. local variables
  31. Programmers say that one module can ________ another, meaning that the first module causes the second module to execute.




    A. call
  32. The more that a module's statements contribute to the same job, the greater the ________ of the module.




    B. functional cohesion
  33. In most modern programming languages, a variable or constant that is declared in a module is ________ in that module.




    B. in scope
  34. Which of the following is not a typical housekeeping task?




    A. printing summaries
  35. Which module in a typical program will execute the most times?




    B. the detail loop
  36. A hierarchy chart tells you




    A. which modules call other modules
  37. What are nonexecuting statements that place within code to explain program statements in English?




    A. comments
  38. Program comments are




    D. none of the above
  39. Which of the following is valid advice for naming variables?




    B. To make names easier to read, separate long names by using underscores or capitalization for each new word
  40. A message that asks a user for input is a(n)




    C. prompt
  41. Snarled program logic is called ________ code.




    A. spaghetti
  42. The three structures of structured programming are which of the following?




    C. sequence, selection, and loop
  43. A sequence structure can contain which of the following?




    A. any number of tasks
  44. Which of the following is not another term for a selection structure?




    A. loop structure
  45. The structure in which you ask a question, and, depending on the answer, take some action and then ask the question again, can be called all of the following except a(n)




    C. if-then-else
  46. Placing a structure within another structure is called ______ the structures.




    D. nesting
  47. Attaching structures end to end is called _________.




    C. stacking
  48. The statement if age >= 65 then senior Discount = "yes" is an example of a 




    B. dual-alternative selection
  49. The statement while temperature remains below 60, leave the furnace on is an example of a 




    B. loop
  50. The statement if age < 13 then movieTicket = 4.00 else movieTicket = 8.50 is an example of a 




    B. dual-alternative selection
  51. Which of the following attributes do all three basic structures share?




    B. They all have one entry and one exit point
  52. Which of true of stacking structures?




    C. When you stack structures, the top structure must be a sequence
  53. When you input data in a loop within a program, the input statement that precedes the loop




    B. is called a priming input
  54. A group statements that executes as a unit is a




    C. block
  55. Which of the following is acceptable is a structured program?




    C. all of these are acceptable
  56. In a selection structure, the structure-controlling question is




    A. asked once at the beginning of the structure
  57. When a loop executes, the structure - controlling question is




    A. asked before and after the loop body executes
  58. Which of the following is not a reason for enforcing structure rules in computer programs?




    A. Structured programs usually are shorter than unstructured ones
  59. Which of the following is not a benefit of modularizing programs?




    D. If you use modules, you can ignore the rules of structure
  60. Which of the following is true of structured logic?




    A. Any task can be described using some combination of three structures
  61. A __________ expression has one of two values: true or false.




    D. Boolean
  62. In a selection, the else clause executes




    D. when the tested condition is false
  63. The greater-than operator evaluates as true when




    B. the left operand is greater than the right operand
  64. A trivial Boolean expression is one that




    D. always has the same value
  65. If x <=y is true, then




    A. x > y is false
  66. If j <> k is true, then




    D. Both b and c are true
  67. In an AND condition, the most efficient technique is to first ask the question that




    D. is least likely to be true
  68. If a is true and b is false, then




    A. a AND b is false
  69. If p is true and q is false, then




    B. p OR q is true
  70. Which of the lettered choices is equivalent to the following decision?

    if x > 10 then
    if y > 10 then
    output "X"
    endif
    endif




    D. if x > 10 AND y > 10 then output "X" endif
  71. If a conditionA is 30 percent likely to be true and conditionB is 10 percent likely to be true, then it is most efficient to test conditionA first




    d never
    C. in an OR decision
  72. Which of the following is a poorly written, trivial Boolean expression?




    C. a < 10 AND a > 40
  73. Which of the following must always be false?




    D. e > 10 AND e < 7
  74. Which of the following must always be true?




    D. g <> 12 OR g <> 15
  75. In the following pseudocode, what percentage raise will an employee in Department 8 receive?

    if department < 5 then
    raise = SMALL_RAISE
    else
    if department < 14 then
    raise = MEDIUM_RAISE
    else
    if department < 9 then
    raise = BIG_RAISE
    endif
    endif
    endif




    B. MEDIUM_RAISE
  76. In the following pseudocode, what percentage raise will an employee in Department 10 receive?
    if department < 2 then
    raise = SMALL_RAISE
    else
    if department < 6 then
    raise = MEDIUM_RAISE
    else
    if department < 10 then
    raise = BIG_RAISE
    endif
    endif
    endif




    D. impossible to tell
  77. When you use a range check, you always compare a variable to  ___________ value in the range.




    C. an end-of-range value
  78. If sales = 100, rate = 0.10, and expenses = 50, which of the following expressions is true?




    D. two of the above
  79. If a is true, b is true, and c is false, which of the following expressions is true?




    D. two of the above
  80. If d is true, e is false, and f is false, which of the following expressions is true?




    C. d OR e AND f
  81. The structure that allows you to write one set of instructions that operates on multiple, separate sets of data is the __________.




    B. loop
  82. The loop that frequently appears in a program's mainline logic _______.




    B. works correctly based on the same logic as other loops
  83. Which of the following is not a step that must occur with every correctly working loop?




    C. Set the loop control value equal to a sentinel during each iteration
  84. The statements executed within a loop are known collectively as the ___________.




    C. loop body
  85. A counter keeps track of _______________.




    D. the number of times an event has occurred
  86. Adding 1 to a variable is also called ______________ it.




    A. incrementing
  87. Which of the following is a definite loop?




    B. a loop that executes 1,000 times
  88. Which of the following is an indefinite loop?




    B. a loop that follows a prompt that asks a user how many repetitions to make and uses the value to control the loop
  89. When two loop are nested, the loop that is contained by the other is the ___________ loop.




    B. inner
  90. When the loops are nested, ___________.




    D. none of the above
  91. Most programmers use a for loop ____________.




    C. when they know the exact number of times a loop will repeat
  92. A report that lists only totals, with no details about individual records, is a(n) __________ report.




    C. summary
  93. Typically, the value added to a counter variable is _________.




    A. 1
  94. Typically, the value added to an accumulator variable is ___________.




    B. different in each iteration
  95. After an accumulator or counter variable is displayed at the end of a program, it is best to ____________.




    D. none of the above
  96. When you ___________, you make sure data items are the correct type and fall within the correct range.




    D. validate data
  97. Overriding a user's entered value by setting it to a predetermined value is known as __________.




    C. forcing
  98. To ensure that a user's entry is the correct data type, frequently you _______________.




    B. use a method built into the programming language
  99. A variable might hold an incorrect value even when it is ____________.




    D. all of the above
  100. A do-while loop ____________.




    C. can be replaced by a sequence and a while loop
  101. You can access every element of an array using a ___________.




    C. either of the above
  102. Suppose that you want to write a program that inputs customer data including name, zipCode, balance and regionNum. At the end of the program, a summary of the number of customers in each of 12 sales regions who owe more than $1000 each is displayed. The most likely statement during the main processing loop would be __________.




    D. customerCount[regionNum] = customerCount[regionNum] + 1
  103. Each element in an array must have the same ________ as the others.




    C. data type
  104. When you use a subscript value that is negative or higher than the number of elements in an array, __________.




    B. the resulting action depends on the programming language used
  105. Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0. Which of the following is an allowed operation?




    D. all of the above
  106. The subscripts of any array are always _________.




    C. integers
  107. Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know that _____________.




    A. the array has at least five elements
  108. Suppose that you have declared a numeric array that has 13 elements. Which of the following must be true?




    D. values[13] is out of bounds
  109. Each element in a seven-element array can hold _______ value(s).




    C. one
  110. Filling an array with values during a program's execution is known as _________ the array.




    D. populating
  111. Suppose that you have declared an array as follows: num values[4] = 0, 0, 0, 0. Which f the following is an allowed operation?




    A. output values[3]
  112. In most modern programming languages, the highest subscript you should use with a 12-element array is __________.




    A. 11
  113. Two arrays in which each element in one array is associated with the element in the same relative position are _________.




    C. parallel
  114. Suppose that an instructor assigns different letter grades based on points earned on a 10-point quiz, and that all scores have been verified to be between 0 and 10 inclusive. Also suppose that four possible letter grade can be assigned and that 9 or 10 points is an A, 7 or 8 points is a B, 6 points is a C, and 5 or fewer points is an F. To assign letter grades, the most efficient numeric array containing point values would contain __________ elements.




    A. three
  115. Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know that _______.




    A. there are exactly two elements between those two elements
  116. A subscript is a(n) __________.




    B. number that indicates the position of an array element
  117. Parallel arrays ___________.




    A. frequently have an indirect relationship
  118. n every array, a subscript is out of bounds when it is __________.




    C. negative
  119. A program contains a seven-element array that holds the names of the days of the week. At the start of the program, you display the day names using a subscript named dayNum. You display the same array values again at the end of the program, where you _____ as a subscript to the array.




    D. can use dayNum, but can also use another numeric value
  120. A __________ is a variable that can be set to indicate whether some event has occurred.




    A. flag
  121. Random access memory is ________.




    B. volatile
  122. Which is true of text files?




    A. Text files contain data that can be read in a text editor
  123. Every file on a storage device has a _______.




    C. both of the above
  124. Which of the following is true regarding the data hierarchy?




    A. Files contain records
  125. The process of ________ a file locates it on a storage device and associates a variable name within your program with the file.




    D. opening
  126. When you write to a file, you ___________.




    D. copy data from memory to a storage device
  127. Unlike when you print a report or display information on a screen, when a program's output is a data file, you do not _________.




    A. include explanations or formatting such as dollar signs
  128. When you close a file, it ____________.




    C. is no longer available to the program
  129. A file in which records are stored one after another in order based on the contents of a field is a(n) ________ file.




    B. sequential
  130. When you combine two or more sorted files while maintaining their sequential order based on a field, you are ______ the files.




    C. merging
  131. A control break occurs when a program ____________.




    D. pauses to perform special processing based on the value of a field
  132. Which of the following is an example of a control break report?




    A. a list of all customers of a business in zip code order, with a count of the number of customers who reside in each zip code
  133. A control break field _____________.




    D. causes special processing to occur
  134. Wherever a control break occurs during record processing in any control break program, you must ________.




    C. update the value in the control break field
  135. Assume that you are writing a program to merge two files name FallStudents and SpringStudents. Each file contains a list of students enrolled in a programming logic course during the semester indicated, and each file is sorted in student ID number order. After the program compares two records and subsequently writes a Fall student to output, the next step is to ___________.




    C. read a FallStudents record
  136. When you merge records from two or more sequential files, the usual case is that the records in the files __________.




    A. have the same format
  137. A file that holds more permanent data than a transaction file is a ______ file.




    D. Master
  138. A transaction file is often used to _____________ another file.




    A. update
  139. The saved version of a file that does not contain the most recently applied transactions is known as a ________ file.




    B. parent
  140. Random access files are used most frequently in all of the following EXCEPT _______________. 




    A. batch processing
  141. Employee records stored in order from highest-paid to lowest-paid have been sorted in __________ order.




    D. descending
  142. Student records stored in alphabetical order by last name have been sorted in ____________ order.




    D. ascending
  143. When computers sort data, they always ________.




    B. use numeric values when making comparisons
  144. Which of the following code segments correctly swaps the values of variables named x and y?

    A. x = y
        y = temp
        x = temp
    B. temp = x
        x = y
        y = temp
    C. x = y
        temp = x
        y = temp
    D. temp = x
        y = x
        x = temp
    • B. temp = x
    •     x = y
    •     y = temp
  145. Which type of sort compares list items in pairs, swapping any two adjacent values that are out of order?




    B. bubble sort
  146. To sort a list of 15 values using a bubble sort, the greatest number of times you would have to pass through the list making comparisons is ____.




    D. 14
  147. To completely sort a list of 10 values using a bubble sort, the greatest possible number of required pair comparisons is ____.




    D. 81
  148. When you do not know many items need to be sorted in a program, you can create an array that has _____.




    C. at least as many elements as the number you predict you will need
  149. In a bubble sort, on each pass through the list that must be sorted, you can stop making pair comparisons _____.




    B. one comparison sooner
  150. When performing a bubble sort on a list of 10 values, you can stop making passes through the list of values as soon as ____ on a single pass through the list.




    A. no swaps are made
  151. The bubble sort is ________.




    C. a relatively easy sort to understand
  152. Data stored in a table that can be accessed using row and column numbers is stored as a ______ array.




    D. two-dimensional
  153. A two-dimensional array declared as num myArray [6] [7] has _____ columns.




    C. 7
  154. In a two-dimensional array declared as num myArray [6] [7], the highest row number is ____.




    B. 5
  155. If you access a two-dimensional array with the expression output myArray [2] [5], the output value will be _____.




    D. impossible to tell from the information given
  156. Three-dimensional arrays ______.




    A. are supported in many modern programming languages
  157. Student records are stored in ID number order, but accessed by grade-point average for a report. Grade-point average order is a(n) ______ order.




    A. logical
  158. When you store a list of key fields paired with the storage address for the corresponding data record, you are creating _____.




    A. an index
  159. When a record in an indexed file is not needed for further processing, __________.




    C. the record can stay in place physically, but its reference is removed from the index
  160. With a linked list, every record ______.




    B. contains a field that holds the address of another record
  161. 1. Which of the following is true?




    C. A program can contain a method that calls another method.
  162. Which of the following must every method have?




    B. a header
  163. Which of the following is most closely related to the concept of local?




    C. in scope
  164. Although the terms parameter and argument are closely related, the difference is that argument refers to _____.




    D. a value in a method call
  165. A method's interface is its ______.




    D. all of the above
  166. When you write the declaration for a method that can receive a parameter, which of the following must be included in the method declaration?




    C. two of these
  167. When you use a variable name in a method call, it ____ as the variable in the method header.




    A. can have the same name
  168. Assume you have written a method with the header void myMethod(num a, string b). Which of the following is a correct method call?




    B. myMethod(12, "Hello")
  169. Assume you have written a method with the header num yourMethod(string name, num code). The method's type is _______.




    B. num
  170. Assume you have written a method with the header string myMethod(num score, string grade). Also assume you have declared a numeric variable named test. Which of the following is a correct method call?




    A. myMethod(test, "A")
  171. The value used in a method's return statement must _______.




    C. match the data type used before the method name in the header
  172. When a method receives a copy of the value stored in an argument used in the method call, it means the variable was _________.




    A. passed by value
  173. A void method _________.




    D. returns nothing
  174. When an array is passed to a method, it is _________.




    A. passed by reference
  175. When you overload a method, you write multiple methods with the same ________.




    A. name
  176. A program contains a method with the header num calculateTaxes(num amount, string name). Which of the following methods can coexist in the same program with no possible ambiguity?




    B. num calculateTaxes(string name, num amount)
  177. Methods in the same program with identical names and identical parameter lists are _________.




    A. ambiguous
  178. Methods in different programs with identical names and identical parameter lists are ________.




    D. none of the above
  179. The notion of _________ most closely describes the way a calling method is not aware of the statements within a called methods.




    B. implementation hiding
  180. Programmers should strive to ______.




    B. increase cohesion
Author
jdavis123
ID
358069
Card Set
Python Post-Test Exam Review
Description
Updated