Python Unit 8

  1. Employee records stored in order from highest-paid to lowest-paid have been sorted in ____ order.




    A. descending
  2. Student records stored in alphabetical order by last name have been sorted in _____ order.




    B. ascending
  3. When computers sort data, they always ______.




    C. use numeric values when making comparisons
  4. 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
  5. Which type of sort compares list items in pairs, swapping any two adjacent values that are out of order?




    B. bubble sort
  6. 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 ____.




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




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




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




    B. one comparison sooner
  10. 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.




    C. no swaps are made
  11. The bubble sort is ________.




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




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




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




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




    B. impossible to tell from the information given
  16. Three-dimensional arrays ______.




    A. are supported in many modern programming languages
  17. 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.




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




    B. an index
  19. When a record in an indexed file is not needed for further processing, _______.




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




    A. contains a field that holds the address of another record
Author
jdavis123
ID
357658
Card Set
Python Unit 8
Description
Updated