Data Abstraction MCQ Practice

Question 1 of 10

Naming a list inventory instead of describing each product record in every line of code is primarily an example of:

  1. A. Losing all product data
  2. B. Forcing every value to be Boolean
  3. C. Data abstraction
  4. D. A syntax error

Question 2 of 10

A team documents PROCEDURE median(values) but keeps the body private from other teams. Other teams still call it successfully. What does this show?

  1. A. Procedures cannot accept lists named values
  2. B. median must DISPLAY its steps
  3. C. Abstraction fails unless source code is shared
  4. D. An interface can be used without exposing implementation details

Question 3 of 10

Which situation least demonstrates data abstraction?

  1. A. Hard-coding each passenger string into twenty separate unrelated statements with no shared collection name
  2. B. Storing seat numbers in a list named seats
  3. C. Referring to passengerNames as a whole list when printing a roster
  4. D. Calling sortAscending(passengerNames) without rewriting the sort each time

Question 4 of 10

A graphics library lets artists call drawSprite(icon) while the library stores pixels internally. Artists never edit pixel arrays. Which statement is best?

  1. A. There is no abstraction because icons are still data
  2. B. drawSprite provides an abstraction that hides pixel-level representation
  3. C. Artists must delete icon before drawing
  4. D. Lists cannot represent icons

Question 5 of 10

Why might a programmer prefer one list named quizScores over five variables q1 through q5 for the same five numbers?

  1. A. Lists forbid finding a maximum
  2. B. Lists use less accurate arithmetic
  3. C. The list name treats the scores as one related collection that later code can process uniformly
  4. D. Variables cannot store numbers

Question 6 of 10

Module Alpha builds a list named route. Module Beta only calls LENGTH(route) and route[i]. Module Beta never sees how Alpha collected GPS points. This separation is valuable because:

  1. A. LENGTH cannot work across modules
  2. B. route must be renamed in Beta
  3. C. Beta is forced to reimplement GPS capture
  4. D. Beta can use the route abstraction without depending on Alpha's collection details

Question 7 of 10

Which rename most improves clarity of a data abstraction?

  1. A. Rename list x to customerEmails
  2. B. Rename customerEmails to a
  3. C. Rename customerEmails to list2
  4. D. Replace customerEmails with twenty anonymous values and no list

Question 8 of 10

A procedure compress(data) returns a shorter representation. Callers treat data as a list of bytes. Which claim matches AP CSP data abstraction ideas?

  1. A. Callers must manually expand every byte before calling compress
  2. B. Callers can pass the list and use the returned result without managing compression mathematics
  3. C. compress cannot accept a list
  4. D. Abstraction requires printing data before compression

Question 9 of 10

Data abstraction is most nearly:

  1. A. Using only DISPLAY and INPUT
  2. B. Avoiding lists forever
  3. C. Managing complexity by focusing on meaningful data names and interfaces while hiding lower-level detail
  4. D. Deleting all variables from a program

Question 10 of 10

A program stores map locations in a list named stops. A future update changes internal geotag precision but keeps the same list name and element order for callers. Existing code that only reads stops[i] keeps working. What does this illustrate?

  1. A. Lists cannot change after creation in any sense
  2. B. stops[i] is illegal in AP CSP pseudocode
  3. C. Breaking changes are required whenever representation improves
  4. D. Stable abstract interfaces can survive internal representation changes