Which of the following is not a feature of Object-Oriented Programming (OOP)?
Answer: d) Assembly programming
Which of the following is used to define a class in C++?
Answer: a) class
Which of the following operators is used for dynamic memory allocation in C++?
Answer: a) new
In C++, which of the following is a type of constructor?
Answer: d) All of the above
What is the purpose of the this
pointer in C++?
Answer: a) To refer to the current object
What does the destructor in C++ do?
Answer: b) Destroys object when it goes out of scope
Which of the following operators can be overloaded in C++?
Answer: d) All of the above
What is inheritance in C++?
Answer: b) A process of deriving new class from an existing class
Which of the following is true about virtual functions in C++?
private
Answer: a) A virtual function can be overridden in a derived class
Which function is used to read data from a file in C++?
Answer: d) ifstream::read()
What is the purpose of a template in C++?
Answer: a) To define a function or class that works with any data type
Which of the following is used for operator overloading in C++?
Answer: a) operator
Which of the following is the correct way to declare a function that returns a reference to an integer in C++?
Answer: a) int &function()
What is the output of the following C++ code?
class Test { public: void display() { cout << "Hello, World!"; } }; int main() { Test obj; obj.display(); return 0; }
Answer: b) "Hello, World!"
What will happen if we try to delete a pointer that was not created using new
?
Answer: b) Runtime error
Note/Caution: studentsbizz.com does not promise a job or an interview in exchange for money. Fraudsters may ask you to pay under the pretext of a registration fee or refundable fee, but please be aware that legitimate employers will not require such payments.