MBOSE Class X Computer Science · Chapter 8
OOP and Introduction to C++
Live nowThe core ideas of object-oriented programming, like classes and objects, and how to write, compile and debug your first C++ programs.
22 lessons · 110 practice questions
What this chapter covers
- Procedural and object-oriented programming
- Object, class, abstraction, encapsulation, inheritance, polymorphism
- C vs C++
- Structure of a C++ program
- Header files
- Comments
- Cin, cout, endl
- Escape sequences
- Tokens and identifiers
- Variables, declaration and initialisation
- Data types
- Compiling
- Syntax, logical and execution errors
- Debugging
Key terms
- object
Meaning: real-world entity with state and behaviour
Example: a student
- class
Meaning: blueprint for objects
Example:
class Student- method
Meaning: member function; defines an object's abilities
Example:
display()- behaviour
Meaning: set of activities an object performs
- abstraction
Meaning: showing essentials, hiding details
- encapsulation
Meaning: data + functions in one unit
Example: a class
- inheritance
Meaning: derived class acquires base class's properties
Example: Car from Vehicle
- polymorphism
Meaning: one name, many forms
Example:
+on numbers and strings- header file
Meaning: declarations of functions and identifiers
Example:
iostream.h- manipulator
Meaning: modifies output format
Example:
endl,setw()- escape sequence
Meaning: backslash code for special output
Example:
\n- token
Meaning: smallest unit of a program
Example: keyword
Important questions with answers
10 of the 110 questions on this chapter, solved.
Question 1 · Multiple choice · 1 mark
In polymorphism, the derived class is also known as ______ class.
- (a) daughter
- (b) baby
- (c) son
- (d) child
Answer: (d) child
MBOSE SSLC 2026, Q14. The base class is the parent class.
Question 2 · Multiple choice · 1 mark
Which language is procedure-oriented?
- (a) Java
- (b) C++
- (c) C
- (d) All three equally
Answer: (c) C
C++ and Java are object-oriented.
Question 3 · Multiple choice · 1 mark
The extension of a C++ source file is
- (a)
.c - (b)
.cpp - (c)
.java - (d)
.html
Answer: (b)
.cppC files use
.c.- (a)
Question 4 · Multiple choice · 1 mark
The smallest individual unit of a program is a
- (a) class
- (b) program
- (c) file
- (d) token
Answer: (d) token
Keywords, identifiers, literals, operators, punctuators.
Question 5 · Assertion and reason · 1 mark
Assertion (A): Encapsulation protects data.
Reason (R): Encapsulation binds data and functions into a class, so only its functions can reach the data.
- (a) Both A and R are true, and R is the correct explanation of A.
- (b) Both A and R are true, but R is not the correct explanation of A.
- (c) A is true, but R is false.
- (d) A is false, but R is true.
Answer: (a) Both A and R are true, and R is the correct explanation of A.
This is data hiding.
Question 6 · Short answer · 2 marks
Write any two escape sequences and their purposes.
Answer
\n— new line;\t— horizontal tab (also\a— beep).Question 7 · Short answer · 2 marks
Define polymorphism.
Answer
The ability of one name or operator to take many forms, e.g.
+adding numbers and joining strings.Question 8 · Short answer · 3 marks
Explain three advantages of OOP.
Answer
Reusability through inheritance; data security through encapsulation; easy maintenance because the program models real objects.
Question 9 · Long answer · 5 marks
Differentiate between C and C++.
Answer
C is procedure-oriented; C++ is object-oriented. C was developed by Dennis Ritchie (1972); C++ by Bjarne Stroustrup (1979). C has no classes or objects; C++ has them. C++ supports inheritance, polymorphism and encapsulation; C does not. C uses
scanf()/printf(); C++ usescin/cout(extensions.cand.cpp).Question 10 · Long answer · 5 marks
Write a C++ program to accept the length and breadth of a rectangle and display its area and perimeter.
Answer
#include <iostream> using namespace std; int main() { float l, b, area, peri; cout << "Enter length and breadth: "; cin >> l >> b; area = l * b; peri = 2 * (l + b); cout << "Area = " << area << endl; cout << "Perimeter = " << peri << endl; return 0; }
Study the whole chapter
22 step-by-step lessons, all 110 practice questions with hints, flashcards and mock tests for MBOSE Class X Computer Science.