Solved MCQs: OOP in C++ (ICT.Ed.426) | BICTE 2nd Semester [TU 2082]

Following our previous post on Digital Logics, here is the complete solution for the Object-Oriented Programming with C++ (ICT.Ed.426) examination paper for the BICTE 2nd Semester (2022 Batch).

Understanding C++ concepts like inheritance, polymorphism, and memory management is crucial for this course. Below are the correct answers and detailed explanations for the Group “A” objective questions.

Group “A”: Attempt All Questions

1. In C++, a function within a class is called…

  • a. Member function
  • b. Global function
  • c. Friend function
  • d. Inline function

Correct Answer: a. Member function Explanation: Functions declared inside a class definition are referred to as member functions (or methods) because they are members of that class.

2. A normal C++ operator that acts in special ways on newly defined data types is said to be…

  • a. Function overloading
  • b. Operator overloading
  • c. Type conversion
  • d. Polymorphism

Correct Answer: b. Operator overloading Explanation: Operator overloading allows you to redefine how standard operators (like +, -, *) work with user-defined data types (objects).

3. Which of the following is true for multiple inheritance in C++?

  • a. It cannot be used with virtual functions
  • b. It automatically resolves all conflicts
  • c. C++ does not support multiple inheritance
  • d. It can cause ambiguity without scope resolution

Correct Answer: d. It can cause ambiguity without scope resolution Explanation: This often refers to the “Diamond Problem,” where a class inherits from two classes that share a common ancestor. Without proper handling (like virtual inheritance or scope resolution), the compiler faces ambiguity.

4. Protecting data from access by unauthorized functions is called…

  • a. Data Hiding
  • b. Inheritance
  • c. Abstraction
  • d. Encapsulation

Correct Answer: a. Data Hiding Explanation: While Encapsulation is the wrapping of data and functions together, Data Hiding is the specific concept of restricting access to that data (usually using private or protected keywords) to prevent unauthorized modification.

5. What is scope resolution operator?

  • a. . (dot operator)
  • b. -> (arrow operator)
  • c. :: (double colon)
  • d. ; (semicolon)

Correct Answer: c. :: (double colon) Explanation: The double colon :: is used to define a function outside a class or to access a global variable/namespace when there is a local conflict.

6. What header file must you include with your program to use setw and endl?

  • a. stdio.h
  • b. iomanip
  • c. iostream
  • d. fstream

Correct Answer: b. iomanip Explanation: While endl is available in <iostream>, the setw (set width) manipulator specifically requires the <iomanip> (Input/Output Manipulation) header file.

7. Assuming var1 starts with the value 10, what will the following code fragment print out? cout << var1--; cout << --var1; cout << ++var1;

  • a. 10 8 9
  • b. 10 9 9
  • c. 9 8 8
  • d. 11 10 9

Correct Answer: a. 10 8 9 Explanation:

  1. var1-- (Post-decrement): Prints 10 first, then var1 becomes 9.
  2. --var1 (Pre-decrement): var1 becomes 8, then prints 8.
  3. ++var1 (Pre-increment): var1 becomes 9, then prints 9.

8. If three objects of a class are defined, how many copies of that class data items and member functions are stored in memory?

  • a. 1 copy of data, 1 copy of functions
  • b. 3 copies of data, 3 copies of functions
  • c. 3 copies of data, 1 copy of functions
  • d. 1 copy of data, 3 copies of functions

Correct Answer: c. 3 copies of data, 1 copy of functions Explanation: Each object needs its own unique variables (data) to store its state, but they all share the same code for member functions to save memory.

9. How can a compiler call the appropriate function in overloaded function?

  • a. By function name only
  • b. By return type only
  • c. By argument types and number
  • d. By scope resolution

Correct Answer: c. By argument types and number Explanation: Function overloading is resolved by the “Function Signature,” which consists of the number and types of arguments passed. The return type is ignored in overload resolution.

10. What will be printed by the code below? namespace X { int var = 5; } namespace Y { int var = 10; } using namespace X; int main() { cout << var; return 0; }

  • a. 10
  • b. 5
  • c. Compilation error
  • d. 0

Correct Answer: b. 5 Explanation: The line using namespace X; brings the variables from namespace X into the current scope. Therefore, when cout << var is called, it refers to X::var, which is 5.

Why Choose Noted Insights?

At NotedInsights.com, we’re committed to providing you with an enriching learning experience. Our platform offers a wide array of notes, syllabi, model questions, and study materials from diverse faculties of bachelor’s degree programs. With our user-friendly interface and regularly updated content, you’ll always stay at the forefront of your studies.

Explore more resources on our platform and enhance your academic journey today!

Stay Connected:

Follow us on social media for the latest updates, study tips, and educational insights.

Contact Us: Do you have questions or suggestions? Feel free to reach out to our team.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top