-
We can have ________ type of member functions in a class.
- Public
- Private
- Protected
- All of the given
-
Which of the following is NOT casting operator in C++ standard?
- static_cast
- var_cast
- dynamic_cast
- reinterpret_cast
-
Which of the following types of Inheritance is used to model "Implemented in terms of" relationship?
- Public
- Private
- Protected
- Confidential
-
In case of protected inheritance, public members of base class will be ________ in derived class?
- private
- public
- protected
- hidden
-
In C++ by default access of classes is ________.
- Private
- Protected
- Public
- None of the given
-
If there is a pointer p to objects of a base class , and it contains the address of an object of a derived class, and both classes contain a virtual member function, ding(), then the statement p->ding(); will cause the version of ding() in the ________ class to be executed.
- base
- derived
- virtual
- implemented
-
Suppose we have defined derived class copy constructor but have not defined base class copy constructor then compiler will,
- Use base class default constructor
- Generate base class copy constructor itself
- Use base class assignment operator
- None of the given
-
In case of private inheritance, private members of base class will be ________ in derived class.
- private
- public
- protected
- hidden
-
A template argument is preceded by the keyword ________.
- vector
- class
- template
- type*
-
________ Binding means that target function for a call is selected at compile time.
- Static
- Dynamic
- Automatic
- None of the given
-
In case of public inheritance, protected members of base class will be ________ in derived class.
- private
- public
- Protected
- hidden
-
A template provides a convenient way to make a family of
- variables and data members
- functions and classes
- classes and exceptions
- programs and algorithms
-
Function overriding is done in context of,
- Single class
- Single derived class
- Single base class
- Derived and base class
-
Which of the following is TRUE.
- Derived class pointer can be used as Base class pointer
- Base class pointer can be used as Derived class pointer
- Both of these options
- None of the given
-
The default inheritance mode is,
- Public inheritance
- Protected inheritance
- Private inheritance
- None of the given
-
In Protected Inheritance the public members of base class become ________ in derived class.
- Public
- Private
- Protected
- None of the given
-
In resolution order compiler search firstly ________.
- Generic Template
- Partial Specialization
- Complete Specialization
- Ordinary function
-
Compiler generated copy constructor performs ________.
- Shallow copy
- Deep copy
- Both Shallow and Deep copy
- None of the given
-
A pure virtual function is a virtual function that
- causes its class to be abstract.
- returns nothing.
- is used in a derived class.
- takes no arguments.
-
Methodologies to the development of reusable software relate to ________.
- Structure programming
- procedural programming
- generic programming
- None of the given
-
In C++ generic programming is done using ________.
- Procedures
- Packages
- Templates
- None of the given
-
Consider the code below,
class class1{
private:
void func1();
};
class class2 : private class1 {
};
Function func1 of class1 is ________ in class2.- public
- protected
- private
- None of the given
-
When derived class has user defined assignment operator.
- Compiler itself calls base class assignment operator.
- Compiler itself calls base class copy constructor.
- Compiler itself calls base class default constructor.
- Compiler does nothing.
-
A Child class can call constructor of its parent class through,
- Its constructor initialization list
- Its constructor body
- Both from its constructor initialization list or body
- Can not call the constructor of its parent class
-
Consider the code below,
class class1{
public:
int i;
};
class class2 : public class1 {
};
Then int member i of class1 is ________ in class2.- public
- protected
- private
- None of the given
-
Consider the code below,
class class1{
protected:
int i;
};
class class2 : private class1 {
};
Then int member i of class1 is ________ in class2.- public
- protected
- private
- None of the given
-
Static casting is,
- Implicit way of calling base class functions from derived class
- Explicit way of calling base class functions from derived class
- Both of the given
- None of the given
-
How many objects of a given class may be constructed in an application?
- Only one per constructor.
- As many as the application asks for
- Only one per class
- One object per variable
-
The other name of specialization is ________.
- Restriction
- Extension
- Dependency
- Subtyping
-
How can we differentiate between constructors and destructors?
- Destructors have a return type but Constructors do not have return type.
- Destructors can't be defined by the programmer, but Constructors can be defined by the programmer.
- Destructors are preceded with a tilde (~) symbol, and constructors are not preceded with any symbol.
- Destructors are exactly same as Constructors in syntax.
-
How many entities are there in the following scenario?
Ali lives in the house that is near the tree and he also drives his car.- 1
- 2
- 3
- 4
-
Which of the following is True about Destructor?
- It is used to free memory that is allocated through dynamic allocation.
- Free memory allocated using new operator by over self in destructor.
- It is used to perform house keeping operations.
- All of the given
-
How many objects are involved in the N-ary association?
- More than 1
- More than 2
- More than 3
- More than 4
-
Which of the following can be the behavior of an object "Usman"?
- Name
- Age
- Address
- Eat
-
In C++, Composition is a relationship between ________ and ________ objects.
- Parent, child
- Base, derived
- Whole, part
- All of the given
-
If you have three classes in a C++ program A, B, and C where class A inherits from class B, then class ________ contains all the characteristics of class ________.
- B, A
- A, B
- A, C
- B, C
-
In case when we define the function outside the class then we must use the keyword ________ to make the function inline.
- requestin
- inlineout
- inline
- defineinline
-
Mermaid is an example of:
- Single inheritance
- Polymorphism
- Specialization
- Multiple Inheritance
-
Assignment operators are:
- Left associative
- Right associative
- Left and right associative
- Non associative
-
Generalization is ________ approach.
- Bottom-up
- Top-bottom
- Right-Left
- Left-Right
-
The ________ tells the compiler what task the function will be performing.
- Function declaration
- Function calling
- Function definition
- None of the given
-
Suppose str1, str2 and str3 are objects of class String. Choose appropriate declaration of overloaded assignment operator for the following statement to work correctly.
- void operator =(const String &);
- String& operator =(const String &);
- String& overload =(const String &);
- void op =(const String &);
-
In operator overloading, which of the following operator takes one or no argument.
- ++
- *
- %
- <<
-
Class is blueprint of ________.
- Interface
- Class
- Objects
- Model
-
Polymorphism makes the system:
- reusable
- flexible
- faster
- All of the given
-
If class B inherits from class A then it contains all characteristics of ________.
- Class B
- Class A
- No inheritance
- None of the given
-
What is meant by multiple inheritance?
- Deriving a base class from derived class
- Deriving a derived class from base class
- Deriving a derived class from more than one base class
- None of the given
-
In C++, which of the following operator can only be overloaded as a member function of the class?
- Equality Operator: ==
- Inequality Operator: !=
- Function Operator: ()
- Stream Extraction Operator: >>
-
Insertion operator is ________ associative.
- Right to Left
- Left to Right
- Left to Left
- Right to Right
-
In expression c1*c2+c3-c4 which of the following will be executed in first order?
- c1*c2
- c2+c3
- c3-c4
- c1-c4
-
Suppose for a class String, assignment operator is overloaded with following declaration.
void operator =(const String &);
What will happen when we will write following statement in main()?
str1 = str2 = str3;
Where, str1, str2 and str3 are objects of class String.- Program will compile successfully.
- Compiler will generate compile time error.
- Run time error will be generated.
- None of the given
-
Identify the abstract class from the given statement:
"Vehicle class is base class. Bus, Car, and Truck are derived classes"- Vehicle
- Bus
- Car
- Truck
-
Which of the following operators operate on one operand?
- Binary Operators
- Unary Operators
- Ternary Operator
- All of the given
-
Subtyping means that derived class is behaviorally ________ with the base class.
- Same
- Compatible
- Different
- Incompatible
-
In ________, Base class can't always be replaced by the derived class.
- Aggregation
- Inheritance
- Specialization
- Extension
-
The overloaded '-' operator for Complex class will be called with reference to ________ in the following statement
Complex C3 = C1 - C2;- Complex
- C1
- C2
- C3
-
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
-
In polymorphism, messages can be interpreted in different ways depending upon the ________ class.
- base
- derived
- sender
- receiver
-
Suppose there is an object of type Person, which of the following can be considered as one of its attributes?
- Name
- Eat
- Work
- Sleep
-
Which of the following is True about class?
- It is a mechanism in C++ to realize objects in a program.
- It is concrete implementation of objects in C++
- It is used to create new types in C++ according to our requirement
- All of the given
-
In C++, which of the following keywords works only with constructors?
- const
- static
- explicit
- virtual
-
Choose correct declaration of overloaded stream insertion operator for class String as non-member friend function.
- friend ostream & operator << ();
- friend void & operator << (ostream & os);
- friend void operator << (const String & rhs);
- friend ostream & operator << (ostream & os, const String & s);
-
Which of the following classes are used by Amphibious vehicle to inherit characteristics?
- Land Vehicle
- Water Vehicle
- Both Land & Water Vehicle
- None of the given
-
Constructors have ________ return type.
- int
- char
- void
- no
-
The other name of specialization is ________.
- Restriction
- Extension
- Dependency
- Subtyping
-
________ is represented by a line with an unfilled diamond head towards the container.
- Inheritance
- Association
- Aggregation
- Composition
-
________ remain in memory even when all objects of a class have been destroyed.
- Static Variables
- Instance Variables
- Primitive Variables
- None of the given
-
Static Data Member is declared ________.
- Inside the class
- Outside the class
- Inside main() method
- None of the given
-
A good model is ________ related to a real life problem.
- Loosely
- Openly
- Closely
- Not
-
In which of the following OOP paradigm objects cannot exist independently?
- Polymorphism
- Inheritance
- Aggregation
- Composition
-
In order to make any function constant, keyword const is placed at the ________ of the parameter list.
- Beginning
- Middle
- End
- None of the given
-
"Student registers Course and Teacher teaches the Course." is an example of:
- Binary Association
- Two way Association
- Ternary Association
- N-ary Association
-
Which of the following can be the attribute of an object "Ali"?
- Eat
- Walk
- Sleep
- Address
-
Consider the statement "room has chair" Which of the following type of association exists between room and chair?
- Inheritance
- Composition
- There is no association
- Aggregation
-
We can access a private static variable through:
- Static data member
- Static member function
- Global data member
- None of the given
-
Abstraction provides information according to ________.
- User perspective
- Owner perspective
- Random information
- All information
-
Which of the following concept is more close to encapsulation?
- Exception Handling
- Inheritance
- Polymorphism
- Information Hiding
-
How the information hidden within an object can be accessed?
- Through its interface
- Through its private data members
- Through its private member functions
- Through both public and private members
-
________ defines the order of evaluation of an operator in an expression.
- Operator Associativity
- Operator Precedence
- Arity of Operators
- None of the given
-
Which of the following is the correct syntax of declaring static variable "count" of type int?
- static count int;
- static int count;
- int static count;
- int count static;
-
Defining a function in class body, the compiler treats that function as:
- User defined function
- Static function
- Recursive function
- Inline function
-
What is the output of the following code?
int main()
{
int const x = 10;
cout << ++x;
return 0;
}- 10
- 11
- Error
- None of the given
-
Which of the following statements best describes the Constructor?
- Constructor is used to modify constant data members of the class.
- Constructor is used to delete the objects of a class.
- Constructor is used to initialize the data members of a class.
- All of the given
-
Consider the following code segment:
class test
{
int a;
int b;
int c;
public:
test():b(5).c(a).a(b){}
}
What will the value of variables a, b, and c after instantiating an object of above class?- 5, 5, 5
- 5, Junk value, 5
- Junk value, 5, Junk value
- Junk value, 5, 5
-
Which of the following is a strong relationship?
- Inheritance
- Composition
- Association
- Polymorphism
Thanks everone