Data Abstraction: One Mark Questions, Book Back Answers and Notes
Data abstraction means using data through functions without knowing how it is stored. It covers abstract data types, constructors and selectors, concrete versus abstract representation, wishful thinking, pairs built from lists and tuples, and classes for objects with named parts.
Study this chapter
Asked in previous board exams
7 questions from this chapter came in 7 past public exams. Open any of them to see the answer and explanation.
-
March 2026
The datatype whose representation is known are called __________.See answer in the solved paper →
-
March 2025
Which of the following functions that build the abstract data type?See answer in the solved paper →
-
March 2024
The datatype whose representation is unknown are called as :See answer in the solved paper →
-
March 2023
The datatype whose representation is known are called :See answer in the solved paper →
-
May 2022
Which of the following will retrieve information from the data type ?See answer in the solved paper →
-
Supplementary 2021
Which of the following functions build the abstract data type ?See answer in the solved paper →
-
March 2020
A sequence of immutable objects is called :See answer in the solved paper →
About Data Abstraction
Medium ~90 min study
Large programs are written by teams, and nobody can keep every line of the implementation in mind. Data abstraction solves this by hiding how data is stored and showing only what you can do with it. The rest of the program talks to the data through a few functions, so the storage can change without breaking everything else.
The chapter starts with the Abstract Data Type (ADT), which is defined by its values and operations, not by its storage. It then introduces the two kinds of functions that make abstraction work: constructors, which build an object, and selectors, which read parts of it. The textbook's examples are a city built with makecity(name, lat, lon) and a rational number built from a numerator and denominator. Finally, it shows how these objects are actually stored using pairs (lists and tuples) and classes.
Expect questions that ask you to pick out the constructor and the selectors in a short piece of pseudo-code, to say whether a list or a tuple can be changed, and to explain concrete versus abstract data representation. These ideas come back when you study classes and objects later in the book.
What you'll learn
- Define an Abstract Data Type in terms of its values and operations.
- Distinguish concrete data representation from abstract data representation.
- Identify the constructor and selectors in a given pseudo-code example.
- Explain wishful thinking as a way of writing a program before the data storage is decided.
- Build pairs using lists and tuples in Python and state which one can be changed.
- Use a class to represent an object with named parts, and tell a class from an object.
Before you start
- Variables, functions and parameters from Unit 1.
- How a name is bound to a value when you assign it.
- A basic idea of lists and indexing in Python.
Topics covered in this chapter
Data Abstraction explained
ADTs, Constructors, Selectors and Pairs
Abstract Data Types
An Abstract Data Type (ADT) is a type for objects whose behaviour is defined by a set of values and a set of operations. The definition says what operations can be done, not how they are done or how the data is laid out in memory. This is why an ADT is said to give an implementation-independent view of data. Abstraction means hiding these details and showing only the essential features, which lets a large program be split into modules that different people can work on.
Constructors and Selectors
Constructors are functions that build an abstract data type. city := makecity(name, lat, lon) is a constructor: it bundles three values into one city object. Selectors are functions that retrieve information from that object: getname(city), getlat(city) and getlon(city). For a rational number, rational(n, d) builds it while numer(x) and denom(x) read the numerator and denominator.
The textbook calls this design strategy wishful thinking: you assume the constructor and selectors already exist and write the rest of the program using them. You decide how the data is actually stored later.
Concrete and Abstract Data Representation
In a concrete data representation, the way the data is stored is fully known. In an abstract data representation, the storage is hidden and you use the data only through its functions. A program that calls numer(x) is using the abstract view; a program that reads x[0] directly depends on the concrete list.
Pairs: Lists and Tuples
Any way of bundling two values into one can be treated as a pair, and Python builds pairs with lists or tuples. A list is written with values in square brackets, such as lst = [10, 20]. Its elements can be read by index and changed after creation, so a list is mutable. A tuple is a comma-separated sequence of values in parentheses, such as colour = ('red', 'blue'). Its elements cannot be changed once assigned, so a tuple is immutable. Both allow indexing and multiple assignment, for example x, y = lst.
Classes for Named Parts
A list like ['Ram', 17, 90] does not tell you which value is the name and which is the mark. When an object has several parts, a structure or class is used so that each part has a name. A class is a template for creating objects, and an object is one instance of that class; the textbook compares them to a cookie cutter and a cookie. A class holds both the named data and the functions that work on it, keeping related data and behaviour together.
Common mistakes to avoid
- Thinking a selector changes the object. Selectors only read values; the constructor is what builds the object.
- Saying tuples can be modified. List elements can be changed after assignment; tuple elements cannot.
- Reading abstract data with list indices like x[0] instead of calling numer(x). This ties the program to one storage format and breaks the abstraction.
- Treating class and object as the same thing. The class is the template (cookie cutter); an object is one instance made from it (a cookie).
Test yourself on these with the practice test, then check the worked reasoning in the solved MCQs.
Frequently asked questions
What is an Abstract Data Type (ADT)?
An ADT is a type for objects whose behaviour is defined by a set of values and a set of operations. It says what operations are allowed but not how they are carried out or how the data is stored, so it gives an implementation-independent view of the data.
What is the difference between a constructor and a selector?
A constructor builds an abstract data object from its parts, for example makecity(name, lat, lon). A selector reads one piece of information from that object, for example getname(city) or getlat(city). Selectors do not change the object.
Why do we use pairs in data abstraction?
A pair bundles two values into a single unit. That is exactly what you need for data such as a rational number (numerator and denominator) or a point (x and y coordinates). In Python, pairs are made with lists or tuples.
How are lists different from tuples in Python?
A list is written in square brackets, like [10, 20], and its elements can be changed, added or removed. A tuple is a comma-separated sequence in parentheses, like (10, 20), and its elements cannot be changed once assigned.
What is wishful thinking in program design?
Wishful thinking means writing your program as if the constructor and selectors already exist, for example using numer(x) and denom(x) before deciding how a rational number is stored. You fill in the storage details afterwards.
What is the difference between a class and an object?
A class is a template that defines the named data and the functions for a new type. An object is one instance created from that class. The textbook's comparison is a cookie cutter (class) and the cookies made with it (objects).
Last updated 15 September 2026