Data Abstraction MCQ Practice

Question 1 of 10

A program refers to a list named temperatures without listing every thermometer reading in each later statement. Which idea does this best illustrate?

  1. A. Data abstraction by naming a collection so details of individual elements can be managed separately
  2. B. That lists cannot store more than one value
  3. C. That DISPLAY is required before any list can be used
  4. D. That every element must be renamed before use

Question 2 of 10

A procedure named averageScore is documented to return the mean of values in a list scores. Callers write result ← averageScore(scores). What do callers need to know?

  1. A. Every arithmetic step inside averageScore
  2. B. Only the procedure name, its inputs, and what it returns, not the internal steps
  3. C. The machine language used by the CPU
  4. D. That averageScore cannot be reused

Question 3 of 10

Which change improves data abstraction for a music app that currently uses unnamed positions 1, 2, and 3 for song titles?

  1. A. Print the titles twice
  2. B. Store each title in a separate program file with no shared name
  3. C. Replace the three values with a list named playlist
  4. D. Delete all song titles

Question 4 of 10

The table compares two designs for storing three class periods.

Design Approach
X Separate variables p1, p2, p3 with no shared name
Y One list named periods holding the three values

Which statement is best?

  1. A. Neither design can store text
  2. B. Design Y forbids accessing individual periods
  3. C. Design X is more abstract because it uses more variable names
  4. D. Design Y is a better data abstraction for a collection of related period values

Question 5 of 10

A library provides PROCEDURE maxValue(list) that returns the largest element. A student uses it without reading the procedure body. Which claim is correct?

  1. A. Using the procedure by name and documented behavior is an example of procedural abstraction supporting data work on the list
  2. B. The list elements must be deleted before calling maxValue
  3. C. Abstraction requires that maxValue print every comparison
  4. D. The student cannot trust the result without rewriting the body each call

Question 6 of 10

Which example best shows data abstraction?

  1. A. Using DISPLAY as a substitute for storing data
  2. B. Naming a list studentIds instead of repeatedly describing each ID field layout
  3. C. Writing every ID bit pattern by hand in every statement
  4. D. Avoiding lists entirely

Question 7 of 10

A programmer renames a list from list1 to dailySteps. Why can that rename help?

  1. A. It removes the need for assignment
  2. B. It changes how addition works in the language
  3. C. A clearer name communicates the meaning of the data without exposing how each step count is stored
  4. D. It forces every element to become a string

Question 8 of 10

A simulation stores city populations in a list named pops. Later code uses LENGTH(pops) and pops[i] but never opens a spreadsheet of how the numbers were typed in. What does this demonstrate?

  1. A. That LENGTH cannot be used with named lists
  2. B. That pops must be a single number, not a list
  3. C. That abstraction failed because indexes are still used
  4. D. That the list name and operations let the program work with the collection while hiding input-entry details

Question 9 of 10

Which statement about data abstraction is false?

  1. A. It requires that no program ever access individual list elements
  2. B. It helps separate what data means from how it is represented
  3. C. It can reduce the amount of detail a programmer must keep in mind at once
  4. D. It often uses names for complex data like lists

Question 10 of 10

Two procedures both filter a list of scores. Team A copies the filtering loop into five places. Team B writes PROCEDURE passingScores(scores) once and calls it. Which team better uses abstraction?

  1. A. Team A, because duplication makes the algorithm clearer
  2. B. Team B, because a named procedure hides filtering details behind one interface
  3. C. Neither, because lists cannot be abstracted
  4. D. Team A, because procedures cannot accept lists