Computer
Question: A member function having the same name as that of a class and a ~ sign with it is called?
- 1. Getter
- 2. Constructor
- 3. Destructor
- 4. Setter
Question: We can get only one unique value which can be used by all the objects of that class by the use of?
- 1. Static variables
- 2. Dynamic variables
- 3. Instance variables
- 4. Data members
Question: Suppose obj1 and obj2 are two objects of a user defined class A. An + operator is overloaded to add obj1 and obj2 using the function call obj1+obj2. Identify the correct function prototype against the given call?
- 1. A operator + ( A &obj);
- 2. int + operator();
- 3. int operator (plus) ();
- 4. A operator(A &obj3);
Question: The keyword that is used that the variable can not change state?
- 1. const
- 2. static
- 3. friend
- 4. private
Question: Assume a class C with objects obj1, obj2, and obj3. For the statement obj3 = obj1 – obj2 to work correctly, if the overloaded – operator must?
- 1. Take two arguments
- 2. Create a named temporary object
- 3. Return a value
- 4. Take four arguments
Question: Which of the following operators always takes no argument if overloaded?
- 1. –
- 2. /
- 3. +
- 4. ++
Question: The main function of scope resolution operator (::) is,?
- 1. To define a data member
- 2. To define an object
- 3. To link the definition of an identifier to its declaration
- 4. All of the above
Question: What is a class?
- 1. A class is a section of computer memory containing objects
- 2. A class is a section of the hard disk reserved for object oriented programs
- 3. A class is the part of an object that contains the variables
- 4. A class is a description of a kind of object
Question: Which one of the following features of OOP is used to derive a class from another?
- 1. Polymorphism
- 2. Data hiding
- 3. Encapsulation
- 4. Inheritance
Question: A C++ class is similar to?
- 1. Structure
- 2. Header file
- 3. Library file
- 4. None of the above