Properties
Question 1 |
Which among the following is the correct way of declaring object of a class
Classname objectname;
| |
Class classname obj objectname; | |
Class classname obj objectname; | |
Classname obj objectname |
Question 1 Explanation:
The correct way of declaring object of a class is
Classname objectname;
For example ,let there be some class of name Area. So we can declare object of Area class like,
Area A1;
For example ,let there be some class of name Area. So we can declare object of Area class like,
Area A1;
Question 2 |
How many objects can be created in a single class?
1 | |
2 | |
3 | |
as many as required |
Question 2 Explanation:
An object is nothing but an instance of a class. A class can have as many instances as required. There is no restriction on the number of objects a class can have.
Question 3 |
Which one of the following CAN NOT be a friend
function | |
class | |
object | |
operator function |
Question 3 Explanation:
The function is not in the scope of the class to which it has been declared as a friend. It cannot be called using the object as it is not in the scope of that class. It can be invoked like a normal function without using the object.
Question 4 |
If a class C is derived from class B which is derived from class A, all though public inheritance, then a class C member function can access
protected and public data in C and B
| |
protected and public data only C | |
private data in A and B
| |
protected data in A and B |
Question 5 |
Function overloading in C++ is
A group function with the same name
| |
all have the same numbers and type of arguments
| |
functions with same name and same numbers and same type of arguments
| |
None of the given options |
Question 5 Explanation:
Function Overloading is defined as the process of having two or more function with the same name, but different in parameters is known as function overloading in C++. In function overloading, the function is redefined by using either different types of arguments or a different number of arguments.
Question 6 |
Run-time polymorphism is achieved by
friend function | |
virtual function
| |
operator overloading | |
function overloading |
Question 6 Explanation:
Run-time polymorphism is achieved by function overriding.
Question 7 |
The operator that cannot be overloaded is
++ | |
:: | |
0 | |
~ |
Question 7 Explanation:
There are 4 operators that cannot be overloaded in C++. They are :: (scope resolution), . (member selection), . * (member selection through pointer to function) and ?: (ternary operator).
Question 8 |
The keyword friend does not appear in
the class allowing access to another class | |
the class desiring access to another class | |
the private section of a class
| |
the public section of a class |
Question 9 |
Method overriding can be prevented by using final as a modifier at ______.
The start of the class. | |
The start of method declaration. | |
The start of derived class. | |
The start of the method declaration in the derived class. |
Question 9 Explanation:
Method overriding can be prevented by using final as a modifier at the start of method declaration.
Question 10 |
Which of the following statements is true about C++ language?
C++ supports multiple inheritance | |
C++ does not support operator overloading. | |
C++ supports dynamic polymorphism
| |
C++ supports interface definitions. | |
Both A and D |
Question 10 Explanation:
C++ supports multiple inheritance.
C++ supports operator overloading.
C++ supports static polymorphism.
C++ supports interface definitions.
C++ supports operator overloading.
C++ supports static polymorphism.
C++ supports interface definitions.
Question 11 |
Friend functions have access to
Private and protected members | |
Public members only | |
Private members only | |
None |
Question 11 Explanation:
A friend function of a class is defined outside that class' scope but it has the right to access all private and protected members of the class.
Question 12 |
___________ is a class which implement lower level business abstractions required to manage the business domain class :
User interface class | |
System class | |
Business domain class | |
Process class |
Question 12 Explanation:
Process class is a class which implement lower level business abstractions required to manage the business domain class.
Question 13 |
Which of the following is not specified in Abstract data type?
Type | |
Set of operations on that type | |
How the type is implemented | |
(A) and (B) |
Question 13 Explanation:
An ADT does not specify how the data type is implemented.
Question 14 |
A subclass having more than one super class is called __________ .
Category | |
Classification | |
Combination | |
Partial participation |
Question 14 Explanation:
A subclass having more than one super class is called category.
Question 15 |
Which of the following operators cannot be overloaded in C/C++ ?
Bitwise right shift assignment | |
Address of | |
Indirection | |
Structure reference |
Question 15 Explanation:
→ We can’t overload structure reference in C and C++.
→ Bitwise right shift assignment(>>), Address of(&) and Indirection(*) can be overloaded in C and C++.
→ The . (dot) operator and the → (arrow) operator are used to reference individual members of classes, structures, and unions.
→ Bitwise right shift assignment(>>), Address of(&) and Indirection(*) can be overloaded in C and C++.
→ The . (dot) operator and the → (arrow) operator are used to reference individual members of classes, structures, and unions.
Question 16 |
Which one of the following is correct for overloaded functions in C++ ?
Compiler sets up a separate function for every definition of function. | |
Compiler does not set up a separate function for every definition of function. | |
Overloaded functions cannot handle different types of objects. | |
Overloaded functions cannot have same number of arguments. |
Question 16 Explanation:
→ Function overloading allows you to use the same name for different functions, to perform, either same or different functions in the same class.
→ Compiler sets up a separate function for every definition of function.
→ Two ways to use overloaded function is
1. By changing number of Arguments.
2. By having different types of argument.
→ Compiler sets up a separate function for every definition of function.
→ Two ways to use overloaded function is
1. By changing number of Arguments.
2. By having different types of argument.
Question 17 |
In a object oriented software design, ‘Inheritance’ is a kind of __________ .
relationship | |
module | |
testing | |
optimization |
Question 17 Explanation:
→ Inheritance refers to a particular relationship that two or more classes can share.
→ Polymorphism refers to a particular feature of classes that define an inheritance relationship.
→ Polymorphism refers to a particular feature of classes that define an inheritance relationship.
Question 18 |
The data hiding is taken care by :
Abstraction | |
Encapsulation | |
Modularity | |
Inheritance |
Question 18 Explanation:
→ Abstraction is used for hiding the unwanted/important data and giving relevant data.
→ It only focus on what the object does instead of how it does it.