MCQ CPP
MCQ CPP
4. Function having same name but differs either in different number of arguments or type of
arguments or order of arguments such process of writing function is called function ________
1. overloading
2. overriding
3. both 1 and 2
4. none of above
Answer: 1
7. The values stored in data members of the object called as _________ of object.
1. state
2. behavior
3. identity
4. none of above
Answer: 1
11. Every function may not be replace by complier , rather it avoids replacement in certain
cases like ____ may not be replaced
1. function containing switch , loop
2. recursion
3. both 1 and 2
4. none of above
Answer: 3
14. C++ supports all data types provided by C language and C++ adds data types
1. bool
2. wchar_t
3. both 1 and 2
4. none of above
Answer: 3
15. when the call to the function resolved at compile time it is called as compile time
polymorphism. And it is achieved by using ___________.
1. function overloading
2.operator overloading
3.function overriding
4.both 1 and 2
Answer: 4
16. Removal of small object do not affect big object it is called as_____
1. association
2. aggregation
3. containment
4. none of above
Answer: 1
17. Removal of small object affects big object it is called as__________
1. association
2. aggregation
3. containment
4. none of above
Answer: 2
19. function which gets called depending on type of object rather than type of pointer such
type of function is called as_____.
1. virtual function
2. static function
3. const function
4. global function
Answer: 1
20. Class which contains at least one pure virtual function such type of class is called as
called ______
1. abstract class
2. concreate class
3. both 1 and 2
4. none of above
Answer: 1
21. Storing address of derived class object into bas class pointer. Such concept is called as
________
1. up casting.
2. down casting
3. object slicing
4. none of above
Answer: 1
22. storing address of base class object into derived class pointer is called as _________
1. up casting.
2. down casting
3. object slicing
4. none of above
Answer: 2
23. when we assign derived class object to the base class object at that time base class
portion which is available in derived class object is assign to the base class object. Such
slicing (cutting) of base class portion from derived class object is called __________
1. up casting.
2. down casting
3. object slicing
4. none of above
Answer: 3
24. pointer pointing to memory which is not available such type of pointer is called as _______
1. dangling pointer.
2. null pointer
3. huge pointer
4. far pointer
Answer: 1
27. when object goes out of scope which function is automatically invoked?
1. static
2. friend
3. exception handler
4. destructor
5. constructor
answer : 4
28. The mechanism by which one class aquries the properties of another class is called
as_____
1. encapsulation
2. data hiding
3. abstraction
4. inheritance
Answer: 4
29. when a derived class inherits from more than one base classes it is called as ____
1. multilevel inheritance
2. single inheritance
3. multiple inheritance
4. hybrid inheritance
5. hierarchical inheritance
Answer: 3
30. one base class more than one dreived classes such type of inheritance is called as ___
1. multilevel inheritance
2. single inheritance
3. multiple inheritance
4. hybrid inheritance
5. hierarchical inheritance
Answer: 5
31. when single inheritance have mutiple levels it is called as ________
1. multilevel inheritance
2. single inheritance
3. multiple inheritance
4. hybrid inheritance
5. hierarchical inheritance
Answer: 1
32. one base class have only one derived class is called as______
1. multilevel inheritance
2. single inheritance
3. multiple inheritance
4. hybrid inheritance
5. hierarchical inheritance
Answer: 2
33. which statement is not correct about static member function of the class?
1. static member function can be called by object of that class
2. static member function can be called without creating object of that class ie by class name
only
3. static member function can be called by non static member function.
4. static function can not access only static data member
Answer: 4
37 .statements:
i have many roles in life teacher, employee, student, cricket player and many more.
Identify the object oriented conecpt used in above statement.
1. abstraction
2. polymorphism
3. data hiding
4. composition
5. inheritance
Answer: 2
38. which of the following statement is false with respect to default constructor
1. The default constructor does not take any argruments.
2. the default constructor can be use as a copy constructor
3.ther default constructor is used to intialize object
4. the compliler will genrate its own default constructor when programer dont provide any
type of constructor.
Answer: 2
39. #include<iostream>
using namespace std;
int main(int argc , char *argv[], char *envp[])
{
int a=5;
int &b=a;
int c=10;
b=c;
cout<<a<< " "<<b<<endl;
c=20;
cout<<a<< " "<<b<<endl;
return 0;
}
1. 10 10
20 20
2. 10 5
20 20
3. 5 10
20 20
4. 10 10
10 10
Answer :4
40 ____ is a member function that is declared with in base class and redefined by a derived
class.
1. constructor
2. destructor
3. static function
4. friend function
5. virtual function
Answer: 5
42 . class is a _________
1. build in type
2. user define type
3. reference type
4. premitive type
Answer: 2
43. which of the following statments not true about destructor
1. it is a member function
2. it is used to finalize object
3. it does not have any return value
4. it does not have any parameter
5. it accept class object as parameter
Answer : 5
45. what will be correct declaration for calculate() as a pure virtual function?
1. virtual void calculate();
2. virtual void calculate()=0;
3. void calculate()=0;
4. virtual calculate();
Answer: 2
[email protected] 9881144174