Study Material

Bihar STET C++ Notes with Questions Answer

Read the important current affairs of 15 July 2026 for SSC, Banking, UPSC, Railway and all competitive exams.

29 Sep 2026 5 Min Read Quizer Team 25 Views

29

September 2026

Part 1: High-Yield Revision Notes (Quick Theory)

1. Fundamentals of Object-Oriented Programming (OOPs)

OOPs is a programming paradigm that models real-world entities using objects.

  • Class: A user-defined data type that binds data members (variables) and member functions (methods) into a single unit. It acts as a blueprint or template.

  • Object: An instance of a class. It is a dynamic real-world entity that allocates memory when created.

  • 4 Pillars of OOPs:

    1. Encapsulation: Wrapping data members and functions into a single unit (class). Helps achieve data hiding through private access modifiers.

    2. Abstraction: Hiding complex internal implementation details and displaying only essential features to the user (achieved using Abstract Classes and Interfaces).

    3. Inheritance: The mechanism by which an existing class (Base Class) allows a new class (Derived Class) to acquire its properties and behaviors, promoting code reusability.

    4. Polymorphism: The ability of a message or function call to exhibit different behaviors based on context ("One interface, multiple implementations").

2. Access Modifiers & Class Scope

Access modifiers dictate the accessibility of class members within or outside the class scope:

  • Private (private): Members are accessible only within the class itself (Default access modifier for C++ classes).

  • Protected (protected): Members are accessible inside the class and its derived (child) classes, but hidden from the outside world.

  • Public (public): Members are accessible from anywhere in the program.

3. Constructors & Destructors

  • Constructor: A special member function automatically executed when an object is instantiated. It shares the exact same name as the class and has no return type (not even void).

    • Default Constructor: Takes no arguments.

    • Parameterized Constructor: Takes arguments to initialize custom values during object creation.

    • Copy Constructor: Initializes an object using values from an existing object of the same class (Syntax: ClassName(const ClassName &obj)).

  • Destructor: Automatically executes when an object goes out of scope to release allocated memory. It uses the exact same name as the class, preceded by a tilde symbol (~ClassName()). It takes no parameters and cannot be overloaded.

4. Inheritance & Access Visibility

                       Inheritance Types in C++
                                  |
    +-----------+-----------+-----+-----+-----------+
    |           |           |           |           |
 Single     Multiple   Multilevel    Hierarchical  Hybrid

Member Access Visibility Under Inheritance Modes:

Base Class AccessPublic Inheritance (public)Protected Inheritance (protected)Private Inheritance (private)
PrivateNot Inherited (Inaccessible)Not Inherited (Inaccessible)Not Inherited (Inaccessible)
ProtectedProtected in DerivedProtected in DerivedPrivate in Derived
PublicPublic in DerivedProtected in DerivedPrivate in Derived

Diamond Problem: Occurs in Multiple Inheritance when two parent classes inherit from the same base class, causing ambiguity in the derived class. Resolved using virtual base classes.

5. Polymorphism & Virtual Functions

Polymorphism is broadly categorized into two types:

  1. Compile-time (Static) Polymorphism: Solved at compile time via Early / Static Binding.

    • Function Overloading: Multiple functions in the same scope with the same name but different parameter lists (type, count, or order).

    • Operator Overloading: Redefining existing C++ operators for user-defined types (Operators that cannot be overloaded: ., ::, ?:, sizeof, .*).

  2. Run-time (Dynamic) Polymorphism: Solved at run time via Late / Dynamic Binding.

    • Function Overriding: Redefining a base class function in a derived class using the virtual keyword.

    • Pure Virtual Function: A function with no implementation body in the base class (Syntax: virtual void display() = 0;).

    • Abstract Class: A class containing at least one Pure Virtual Function. It cannot be instantiated (objects cannot be created).

6. Dynamic Memory Allocation & Pointers

  • new Operator: Dynamically allocates memory on the Heap.

  • delete Operator: Deallocates memory previously allocated on the Heap (e.g., delete ptr; or delete[] arr;).

  • this Pointer: An implicit pointer available inside non-static member functions pointing directly to the invoking object's memory address.

  • Friend Function: A non-member function granted explicit access to a class's private and protected members using the friend keyword.

Part 2: Top 35 Important MCQs (With Solutions)

  1. What is the default access modifier for members in a C++ class?

    • Answer: private (Note: Default access in a C++ struct is public).

  2. Who created the C++ programming language?

    • Answer: Bjarne Stroustrup (AT&T Bell Labs, 1979).

  3. Which OOP principle is primarily used to achieve Data Hiding?

    • Answer: Encapsulation

  4. A class containing at least one Pure Virtual Function is called an:

    • Answer: Abstract Class

  5. Which of the following is the correct syntax for a Pure Virtual Function in C++?

    • Answer: virtual void display() = 0;

  6. What is the return type of a Constructor in C++?

    • Answer: Constructors do not have any return type (not even void).

  7. Which symbol precedes the class name to declare a Destructor?

    • Answer: Tilde symbol (~)

  8. What is the standard parameter format for a Copy Constructor in C++?

    • Answer: Pass by reference with const (e.g., ClassName(const ClassName &obj)).

  9. When a single derived class inherits directly from two or more base classes, the inheritance is called:

    • Answer: Multiple Inheritance

  10. Which keyword is used to resolve the 'Diamond Problem' ambiguity in Multiple Inheritance?

    • Answer: virtual (Virtual Base Class)

  11. Run-time Polymorphism (Dynamic Binding) is achieved in C++ using:

    • Answer: Virtual Functions (Function Overriding)

  12. Which of the following is an example of Compile-time Polymorphism?

    • Answer: Function Overloading and Operator Overloading

  13. Which of the following C++ operators CANNOT be overloaded?

    • Answer: Scope Resolution Operator (::), Sizeof (sizeof), Member Access Operator (.), Ternary Operator (?:)

  14. Which operator is used to allocate memory dynamically on the heap in C++?

    • Answer: new operator

  15. What is the correct syntax to free memory dynamically allocated for an array in C++?

    • Answer: delete[] ptr;

  16. Which implicit pointer holds the address of the currently invoking object?

    • Answer: this pointer

  17. Which function can access the private and protected members of a class despite not being a member function?

    • Answer: Friend Function (declared using the friend keyword)

  18. Function Overloading resolution is based on differences in the function's:

    • Answer: Function Signature (parameter list types, order, or number). Return type alone is not sufficient.

  19. Which header file must be included for standard input and output stream operations in C++?

    • Answer:

  20. What are cout and cin in C++?

    • Answer: Pre-defined Objects (cout is an instance of ostream, cin is an instance of istream).

  21. Protected members of a Base Class become private in a Derived Class under which inheritance mode?

    • Answer: Private Inheritance (private)

  22. Redefining a Base Class function in a Derived Class with the exact same signature is known as:

    • Answer: Function Overriding

  23. Why should a Base Class destructor be declared as virtual when using polymorphic behavior?

    • Answer: To ensure the Derived Class destructor executes first, preventing memory leaks during dynamic object deletion.

  24. Templates in C++ represent which programming paradigm?

    • Answer: Generic Programming (Writing type-independent reusable code)

  25. Which three keywords form the structure of Exception Handling in C++?

    • Answer: try, catch, and throw

  26. What mechanism does the C++ compiler use internally to resolve Virtual Function calls dynamically?

    • Answer: Virtual Method Table (vtable) and vptr pointer.

  27. How many Destructors can a single class possess?

    • Answer: Exactly ONE (Destructors cannot be overloaded).

  28. What is the primary operational difference between a struct and a class in C++?

    • Answer: Members of a struct are public by default, whereas members of a class are private by default.

  29. Which statement is true regarding Static Member Variables in C++?

    • Answer: A single copy is created and shared across all instantiated objects of that class.

  30. Static Member Functions in C++ can directly access:

    • Answer: Only static data members and other static member functions (this pointer is unavailable).

  31. What does the term "Class Instantiation" mean?

    • Answer: Creating an Object of that class.

  32. Which C++ stream class is specifically used to perform file output (write) operations?

    • Answer: ofstream

  33. What is the primary function of the Scope Resolution Operator (::)?

    • Answer: Accessing global variables or defining member functions outside the class declaration.

  34. Every C++ program begins its execution from which function?

    • Answer: main() function

  35. Early binding (Static Binding) takes place during:

    • Answer: Compile time

Why This Content Matters

This content is prepared to help students and competitive-exam aspirants understand important topics, revise key information, and strengthen their exam preparation.

  • Quickly revise important facts and concepts
  • Improve General Knowledge and exam awareness
  • Support preparation for competitive and government exams
  • Build a consistent and effective study routine
Quizer Team
About the Author

Quizer Team

The Quizer Team creates exam-focused educational content, current affairs, general knowledge, study notes, and preparation resources to help students and competitive-exam aspirants learn, practice, and stay updated.

Educational Content Exam Focused Learning Resources

Related Post

Study Material
30 Sep 2026 22
Read More
Study Material
30 Sep 2026 15
Read More
Study Material
30 Sep 2026 12
Read More