Question 1
A logistics company designs a `ParcelTracking` ADT with operations `addParcel()`, `updateStatus()`, and `getLocation()`. A new developer joins the team and complains that the interface is too restrictive because they cannot directly modify the internal parcel records. Which response best explains why this restriction is intentional and beneficial?No clue? Show me the answer
Correct answer
Correct!
IncorrectStep-by-step walkthrough
Choose a solution method
Method #1Direct ApproachStep 1: Identify the core principle being tested
The question describes a developer being unable to directly access internal records — this is a scenario about encapsulation and information hiding, two of the three core ADT principles.
Step 2: Apply the definition of encapsulation
Encapsulation means that the internal representation of an ADT is hidden from the user, and all access occurs through the defined interface. This is not a flaw — it is a deliberate design choice to protect data integrity.
Step 3: Connect to practical benefits
If external code could directly modify internal parcel records, a developer might accidentally corrupt the state (e.g., set a negative parcel count). The interface ensures only valid, defined operations can alter the data.
Step 4: Select the correct answer
The option stating that encapsulation protects internal state and reduces bugs correctly captures why the restriction exists and why it is beneficial.
Method #2Process of EliminationStep 1: Identify what the question is really asking
The question asks why a restricted interface is intentional and beneficial — we are looking for an answer that defends the design decision using ADT principles.
Step 2: Eliminate: 'direct access is always faster'
The option claiming direct access is always faster is incorrect in this context. While it may sometimes be true in performance terms, it does not explain why the restriction is beneficial for design — and absolute claims like 'always' are a red flag.
Step 3: Eliminate: 'a well-designed ADT should expose all internal data structures'
This directly contradicts a fundamental ADT principle. Exposing internal data structures violates information hiding and encapsulation — a well-designed ADT does the opposite.
Step 4: Eliminate: 'forces all developers to use the same programming language'
ADTs are language-agnostic concepts. Restricting direct access has nothing to do with forcing a particular programming language, making this option irrelevant.
Step 5: Select the correct answer
The remaining option — encapsulation through a defined interface protects internal state and reduces bugs — is the only one that correctly applies ADT principles to justify the design decision.
Question 2
An autonomous drone navigation system operates at three layers: motor layer (individual propeller speed), coordination layer (balanced flight manoeuvres), and mission layer (complex routes like search-and-rescue patterns). Which ADT principle does this layered design most directly illustrate?No clue? Show me the answer
Correct answer
Correct!
IncorrectStep-by-step walkthrough
Choose a solution method
Method #1Direct ApproachStep 1: Identify the concept being tested
The question describes a system where each layer hides the complexity of lower layers and presents a simplified interface to the layer above. This is the textbook definition of abstraction.
Step 2: Apply the definition of abstraction
Abstraction is the principle of focusing on what a component does rather than how it does it. The mission layer does not need to know about individual propeller speeds — it simply calls high-level route operations.
Step 3: Match to the scenario
Each layer in the drone system presents a defined interface (operations) while hiding the implementation details of the layer below. This is abstraction applied in a hierarchical, multi-layer design.
Step 4: Select the correct answer
The correct answer explicitly names abstraction and correctly explains that each layer hides the complexity below it, which matches the scenario perfectly.
Method #2Process of EliminationStep 1: Identify what is being asked
We need to identify which ADT principle is illustrated by a layered design where each level hides lower-level complexity.
Step 2: Eliminate: 'Collision resolution'
'Collision resolution' is a concept from hash table implementation (handling two keys mapping to the same bucket). It is completely unrelated to hierarchical system design.
Step 3: Eliminate: 'Load balancing'
'Load balancing' refers to distributing computational workload across servers or processors. The drone layers are not distributing workload evenly — they are providing different levels of abstraction.
Step 4: Eliminate: 'Open addressing'
'Open addressing' is another hash table collision strategy (probing for the next free slot). It has no relevance to layered system architecture or ADT principles.
Step 5: Select the correct answer
Abstraction is the only ADT principle among the options, and it correctly describes how the layered drone system hides complexity at each level.