AMP

Chapter 2: Data Abstraction — Online MCQ Test

COMPUTER SCIENCE · CLASS 12th · Tamil Nadu State Board
Practice Chapter 2: Data Abstraction with a free chapter-wise online MCQ test. This chapter covers: Focusing on abstract data types this chapter explains how complex data structures are created using constructors and selectors. It demonstrates isolating code implementation detail.... AI-generated questions from basic to board-exam level, with instant results and explanations.

Start Exam on Full Site →

Chapter 2: Data Abstraction — Important Questions & Answers

What is the main goal of data abstraction?
  • A. To hide implementation details and expose only essential features
  • B. To increase the size of the program
  • C. To make all variables global
  • D. To avoid using functions
Answer: A. To hide implementation details and expose only essential features
Data abstraction focuses on showing only the necessary features while hiding internal details. This helps in managing complexity in programs.
Which of the following is used to create a new abstract data type from simpler data items?
  • A. Constructor
  • B. Loop
  • C. Conditional statement
  • D. Operator precedence
Answer: A. Constructor
A constructor combines simpler values into a complex data object. It is one of the key ideas in building abstract data types.
Which statement best describes abstraction in programming?
  • A. It requires the user to know every internal step
  • B. It separates interface from implementation
  • C. It removes all data from the program
  • D. It uses only one type of variable
Answer: B. It separates interface from implementation
Abstraction provides a clear interface while hiding the internal working details. This makes programs easier to use and maintain.
A student designs a point ADT with constructor make-point(x, y) and selectors x-point and y-point. Which operation is performed by x-point?
  • A. Creates a point object
  • B. Returns the x-coordinate of the point
  • C. Returns the y-coordinate of the point
  • D. Deletes the point object
Answer: B. Returns the x-coordinate of the point
x-point is a selector, so it extracts one part of the compound object. In this case, it returns the x-coordinate.
Which statement is TRUE about a constructor and a selector in an ADT?
  • A. A constructor breaks a compound object into parts
  • B. A selector creates a new compound object
  • C. A constructor builds the object, and a selector retrieves its components
  • D. Both only display values without processing
Answer: C. A constructor builds the object, and a selector retrieves its components
Constructors are used to build compound data structures from simpler values. Selectors are used to access the components of those structures.