ID | Qus | A | B | C | D | Ans |
1 | Inheritance is a way to | organize data | pass arguments to objects of classes | add features to existing classes without rewriting them | improve data-hiding and encapsulation | C |
2 | To convert from a user-defined class to a basic type, you would most likely use | a built-in conversion operator | a one-argument constructor | an overloaded = operator | a conversion operator that‘s a member of the class | C |
3 | A C++ class is similar to -------------------- | Structure | Header File | Library File | None of the given | A |
4 | a‘A static member function can be called, even when a class is not __________ | Declared | Define | Instantiated | Called | C |
5 | Which one of the following features of OOP is used to derive a class from another? | Encapsulation | Polymorphism | Data hiding | Inheritance | D |
6 | What is a class? | A class is a section of computer memory containing objects | A class is a section of the hard disk reserved for object oriented programs | A class is the part of an object that contains the variables | A class is a description of a kind of object | D |
7 | The main function of scope resolution operator (::) is, | To define an object | To define a data member | To link the definition of an identifier to its declaration | All of the given | B |
8 | Which of the following operators always takes no argument if overloaded? | / | - | + | ++ | D |
9 | Assume a class C with objects obj1, obj2, and obj3. For the statement obj3 = obj1 - obj2
to work correctly, if the overloaded - operator must | take two arguments | return a value | create a named temporary object | take four arguments | A |
10 | The keyword that is used that the variable can not change state? | static | const | friend | private | B |
11 | 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? | A operator + ( A &obj); | int + operator(); | int operator (plus) (); | A operator(A &obj3); | C |
12 | We can get only one unique value which can be used by all the objects of that class by the use of, | static variables | dynamic variables | instance variables | data members | A |
13 | A member function having the same name as that of a class and a ~ sign with it is called, | Constructor | Getter | Setter | Destructor | D |
14 | Using encapsulation we can achieve | Information hiding | Least interdependencies among modules | Implementation independenc | All of given options | D |
15 | The >= operator can be overloaded | True | False | NA | NA | A |
16 | A static member function cannot be declared | Static | Implicit | Explicit | Virtual | B |
17 | Static variables act like a global variable in the context or scope of the class | True | False | NA | NA | A |
18 | The compiler won‘t object if you overload the * operator to perform division | True | False | NA | NA | A |
19 | We can use "this" pointer in the constructor in the body and even in the initialization list
of any class if we are careful | True | False | NA | NA | B |
20 | Which operator can not be overloaded? | The relation operator ( >= ) | Assignment operator ( = ) | Script operator ( [] ) | Conditional operator (? : ) | D |
21 | An overloaded operator always requires one less argument than its number of operands | True | False | NA | NA | B |
22 | A generalization-specialization relation between classes are implemented using | data hiding | friend classes | encapsulation | inheritance | D |
23 | In OOP a class is an example of _____ | Data Type | Abstract Type | User Defined Type | None of the given | C |
24 | Identify which of the following overloaded operator function‘s declaration is appropriate
for the given call? Rational_number_1 + 2.325 Where Rational_number_1 is an object of user defined class Rational_number | Rational_number operator+( Rational_number & obj); | Rational_number operator+(double& obj); | Rational_number operator+(Rational_number &obj, double& num); | operator+(double& obj); | B |
25 | A class can be identified from a statement by ------------- | Noun | Pronoun | Verb | Adverb | A |
26 | The members of a class that can be accessed without creating the object of the class is called | Private member | Data Member | Public Member | Static | D |
27 | Suppose there is an object of type Person, which of the following can be considered as one of its attributes | Name | Age | Work() | Both Name and Age | D |
28 | What a derived class can add? | New data members | New member functions and New friend functions | New constructors and destructor | All of given | D |
29 | ________ is/are used to access information hidden within an object? | Interface | Private data members | Private member functions | Both public and private members | A |
30 | this pointers are not accessible for static member functions | True | False | NA | NA | A |
|