1. In which of the following, different forms of a single entity exist?
- Composition y
- Aggregation
- Polymorphism
- Encapsulation
2. Encapsulation means
- Extending the behavior of a class in another class
- Data and behavior are tightly coupled within an object y
- One entity takes all the attributes and operations of the other
- Taking out the common features and put those in a separate class
3. The technique in which we visualize our programming problems according to real life’s problems is called ___
- Structure Programming
- Object Oriented Programming
- Procedural Programming
- Sequential Programming
4. There is no need of “is a” or “is a kind of” relationship in Generalization.
- True
- False
5. If only one behavior of a derived class is incompatible with base class, then it is
- Generalization
- Specialization
- Extension
- Encapsulation
6. The process of hiding unwanted details from users is called __
- Protection
- Encapsulation y
- Argumentation
- Abstraction
7. ___ is automatically called when the object is created.
- member function
- object
- constructor
- None
8. ___ provide the facility to access the data member.
- accesser function
- private function
- inline function
- None
9. The concept of derived classes is involved in
- inheritance
- encapsulation
- structure
- array
10. Which part of an object exhibits its state?
- Data y
- Operations
- Any public part
- Any private part
- organize data
- pass arguments to objects of classes
- add features to existing classes without rewriting them y
- improve data-hiding and encapsulation
- Dangling pointer
- Memory leakage
- All of given y
- System crash
- True y
- False
- Static
- Implicit
- Explicit
- Virtual y
- Static variables y
- Instance variables
- Primitive variables
- None
- Object member
- non-member y
- data member
- None
- Friendship is one way only y
- Friendship is two way only
- No friendship between classes
- Any kind of friendship
- True y
- False
- Rational_number operator+(Rational_number&obj);
- Rational_number operator+(double&obj); y
- Rational_number operator+(Rational_number&obj, double&num);
- operator+(double&obj);
- The relation operator (>=)
- Assignment operator (=)
- Script operator([])
- Conditional operator(?:) y
- Class is created
- Object is defined
- Object is initialized
- Object is created y
22. Consider the following code segment:
class test
{
int a;
int b;
int c;
public:
test();b(5).c(a).a(b){}}
- 5, 5, 5
- 5, Junk value, 5
- Junk value, 5, Junk value
- Junk value, 5, 5 y
23. If you do not initialize static variable of int type then it is automatically initialized with ___
- 0 y
- 1
- Null
- None
24. In Object Oriented programming, objects communicate with each other through ___
- Messages
- Data members y
- Voice chat
- Ports
25. If we are create array of objects through new operator, then
- We can call overloaded constructor through new
- We can’t call overloaded constructor through new
- We can call default constructor through new
- None y
26. When a base class can be replaced by the derived class then it is called
- sub-typing y
- super-typing
- Generalization
- Specialization
27. ___ and ___ methods can not be declared virtual.
- Private, Static
- Private, Public
- Static, Public y
- None
28. Separation of implementation from interface provides the facility to restrict the ___ from direct access.
- Data Member
- Data Function
- Class
- None y
29. We can access a private static variable through:
- Static data member y
- Static member function
- Global data member
- None
30. Consider the call given below of an overloaded operator “+”
Rational_number_1 + Rational_number_2
Where Rational_number_1 and Rational_number_2 are two objects of Rational_number class (a user defined class). Identify which of the above two objects will be passed as an argument to the overloaded operator function?
- Rational_number_1
- None
- Both Rational_number_1 & Rational_number_2
- any of the two objects, randomly y
31. Static member can not be called with the class name.
- True
- False y
32. In a class declaration, data or functions designated private are accessible
- to any function in the program
- only if you know the password
- to member functions of that class y
- only to public members of the class
33. The ___ keyword tells the compiler to substitute the code within the function definition for every instance of a function call
- virtual
- inline y
- instance
- None
34. The >= operator can’t be overloaded.
- True y
- False
35. Main advantage of inheritance is:
- Better understanding y
- Less understanding
- Reuse
- Less complexity
36. An instance of user defined type is called ___
- Object y
- Class
- Variable
- Program
37. If a class involves dynamic memory allocation, then:
- Default copy constructor, shallow copy is implemented
- User defined copy constructor, shallow copy is implemented y
- Default copy constructor, deep copy is implemented
- User defined copy constructor, deep copy is implemented
38. Information hiding can be achieved through ___
- Encapsulation, Inheritance
- Encapsulation, Polymorphism y
- Encapsulation, Abstraction
- Encapsulation, Overloading
39. In programming, where the actual actions are coded is called:
- Function declaration y
- Function calling
- Function definition
- None
40. Which of the following will happen when a constant function tries to change the value of data members of the class?
- Compiler will allow changing data members
- Program will be executed successfully
- Compile time error will occur y
- Run time error will occur
41. Which of the following features of OOP is used to derive a class from another?
- Encapsulation
- Polymorphism
- Data hiding
- Inheritance y
42. Suppose there is an object of type Person, which of the following can be considered as one of its attributes?
- Name y
- Eat
- Work
- Sleep
43. The ability to derive a class from more than one classes is called.
- Single inheritance
- Encapsulation
- Multiple inheritance y
- Polymorphism
44. Without using Deep copy constructor. A ___ problem can occur.
- System crash
- Memory Leakage
- Dangling pointer
- All of given y
45. Aggregation is implemented using pointer.
- True y
- False
46. Which of the following is directly related to polymorphism?
- Overriding y
- Constant members
- Static members
- None
47. Which of the following is the way to extract common behavior and attributes from the given classes and make a separate class of those common behaviors and attributes?
- Generalization
- Sub-typing y
- Specialization
- Extension
48. We can allocate dynamic memory allocation through ___ key word.
- Static
- Global
- New y
- Constant
49. Which of the following is an advantage of OOP?
- OOP makes it easy to re-use the code
- It provides an ability to create one user defined data type by extending the other
- It provides the facility of defining Abstract data types through which real world entities can be defined better
- All of given y
50. Three main characteristics of “Object Oriented Programming” are
- Encapsulation, inheritance, polymorphism y
- polymorphism, overloading, overriding
- encapsulation, inheritance, dynamic binding
- None
51. In ___ sender of a message does not need to know exact class of the receiver.
- Inheritance
- Encapsulation
- Overloading
- None y
52. Which of the following is not a major element in an object model?
- Abstraction
- Encapsulation y
- Persistance
- Hierarchy
53. Member functions defined inside a class declaration are ___ by default.
- Visible
- Public y
- Private
- Protected
54. Consider the following class:
class A
{
int a, b, c;
public:
A():b(10),c(0),a(7){}};
Choose the correct order of initialization of above data members.
- a, c, b
- b, a, c
- a, b, c
- c, a, b
55. If a class A inherits from class B, then class A is called ___
- Child class
- Base class
- Parent class y
- Super class
56. We can create array of objects if we have a user defined constructor.
- True
- False
57. A class has ___ destructor.
- No
- One
- Two
- Three
58. ___ is creating objects of one class inside another class.
- Association
- Composition
- Aggregation
- Inheritance
59. Constant data members can be initialized by using:
- Constant Member Function
- Non-constant Member Function
- Member initializer List
- Class
60. The sub-object’s life is not dependant on the life of master class in ___
- Composition
- Aggregation
- Separation
- None
61. When we create objects, then space is allocated to:
- Member functions
- Access specifier
- Data members
- None
62. The dot operator (or class member access operator) connects the following two entities (reading from left to right):
- A class member and a class object
- A class object and a class
- A class and a member of that class
- A class object and a member of that class
63. In object oriented programming, disadvantage of inheritance include:
- It provides a useful conceptual framework
- It avoids rewriting a certain piece of code
- It facilitates the class libraries
- It provides independence of classes
64. An abstract class shows ___ behavior.
- Overriding
- Specific
- General
- Overloading
65. If some of objects exhibit identical characteristics, then they belong to:
- Different classes
- Multiple classes
- Same class
- Abstract class
66. Through interface we access object’s ___
- States
- Data members
- Behavior
- Class
67. Object can be declared constant with the use of Constant keyword.
- True
- False
68. If we extend our model, and the rest of model is not affected, then it is called ___
- Consistency
- Flexibility
- Efficiency
- Reusability