Which of the following is a correct statement?
1. Composition is a strong type of association between two classes with full ownership
2.Composition is a strong type of association between two classes with partial ownership.
3.Composition is a weak type of association between two classes with partial ownership.
4. Composition is a weak type of association between two classes with strong ownership.
Answer:1
Posted Date:-2022-07-04 03:26:26
1. By overloading new operator
2.By making an empty private new operator.
3.By making an empty private new and new[] operators
4.By overloading new operator and new[] operators
Answer 31.Yes
2.No
3.none
4.all
Answer 21.Compiler Error
2.5
3.10
4.none of the above
Answer 21.A non-zero value
2.0
3.Compiler Error
4.Runtime Error
Answer 11.Compiler Error
2.Run-time Crash
3. No Error
4.None
Answer 31.When local variable’s name is same as member’s name, we can access member using this pointer.
2.To return reference to the calling object
3.Can be used for chained function calls on an object
4.All of the above
Answer 41. A. When an object of the class is returned by value.
2.When an object of the class is passed (to a function) by value as an argument.
3.When an object is constructed based on another object of the same class
4.All of the above
Answer 41.Overloads
2.Friendships
3.Inherits
4.Overrides
Answer 41.inaccessible
2.accessible
3.protected
4.public
Answer 11. Static function
2.Friend function
3.Const function
4.Virtual function
Answer 21.All 1, 2, and 3
2.Only 1 and 3
3.Only 1 and 2
4.Only 2 and 3
Answer 21. Both 1 and 2
2.Only 1
3.Only 2
4. Neither 1 nor 2
Answer 31.All objects of a class share all data members of class
2.Objects of a class do not share non-static members. Every object has its own copy.
3.Objects of a class do not share codes of non-static methods, they have their own copy
4.None of the above
Answer 41.Static methods cannot be overloaded.
2.Static data members can only be accessed by static methods.
3. Non-static data members can be accessed by static methods.
4.Static methods can only access static members (data and methods)
Answer 41.Postfix ++
2.Comparison Operator
3.Insertion Operator <<
4.Prefix++
Answer 31. Constructor
2.Destructor
3.Data members
4.Virtual methods
Answer 31.Copy Constructor
2.Assignment Operator
3.A constructor without any parameter
4.All of the above
Answer 41.The member functions of the class generating friendship can access the members of the friend class.
2.All member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.
3. Class friendship is reciprocal to each other.
4. Class friendship is reciprocal to each other.
Answer 21.Compiler Error
2.Constructor called Constructor called
3.Constructor called
4.None of the above
Answer 31. the class of which it is member
2. the object of which it is a member
3. the public part of its class
4. the private part of its class
Answer 11.0
2.Garbage Value
3.Compiler Error
4.None of These
Answer 31.C++ doesn’t allow both operators to be overloaded in a class
2. A postfix ++ has a dummy parameter
3.A prefix ++ has a dummy parameter
4.By making prefix ++ as a global function and postfix as a member function.
Answer 21.int *arr = new int *[10];
2.int **arr = new int *[10];
3.int *arr = new int [10];
4.Not Possible
Answer 41.A function can only be declared a friend by a class itself.
2.Friend functions are not members of a class, they are associated with it.
3.Friend functions are members of a class.
4.It can have access to all members of the class, even private ones.
Answer 31. not of class type itself
2.class type itself
3.a destructor of class type
4.a destructor not of class type
Answer 21.Only 1, 2 and 3
2.Only 1, 2 and 4
3.All
4.Only 1, 3 and 4
Answer 31.2
2.3
3.4
4.5
Answer 21.x = 20; ref = 30
2.x = 20; ref = 20
3.x = 10; ref = 30
4.x = 30; ref = 30
Answer 11.Compiler Error
2.Runtime Error
3.Constructor called
4.None of the above
Answer 11. 10
2.0
3.20
4.Compiler Error
Answer 41.Compiler Error
2.5
3.Garbage Value
4.None of these
Answer 11.All members of a structure are public and structures don’t have constructors and destructors
2.Members of a class are private by default and members of struct are public by default. When deriving a struct from a class/struct, default access-specifier for a base class/struct is public and when d
3.All members of a structure are public and structures don’t have virtual functions
4.All of the above
Answer 21. 2
2.4
3.2 or 4
4.Based on the number of bits in the system
Answer 41.a copy of the object is created.
2.a copy of the reference is created.
3.a copy of the reference is not created.
4.it is illegal to assign one object reference variable to another object reference variable.
Answer 21. Constant
2.Structure
3.Array
4. Header file
Answer 41.Assignment operator function
2.Copy Constructor
3.Destructor
4.Parameterized constructor
Answer 21.Inheritance
2.Polymorphism
3.Encapsulation
4.None of the above
Answer 21. Composition is a strong type of association between two classes with full ownership
2.Composition is a strong type of association between two classes with partial ownership.
3.Composition is a weak type of association between two classes with partial ownership.
4. Composition is a weak type of association between two classes with strong ownership.
Answer 11.References cannot be NULL
2.A reference must be initialized when declared
3. Once a reference is created, it cannot be later made to reference another object; it cannot be reset.
4.References cannot refer to constant value
Answer 41.Every class containing abstract method must be declared abstract.
2. Abstract class can directly be initiated with ‘new’ operator.
3.Abstract class can be initiated.
4. Abstract class does not contain any definition of implementation.
Answer 21.(1)
2.(2), (4) C.
3. (2), (3), (4)
4. (4)
Answer 31.Must be declared in public section of class.
2. Virtual function can be static.
3.Virtual function should be accessed using pointers.
4.Virtual function is defined in base class.
Answer 21. 1 and 3
2.2 and 3
3.1 and 2
4.All 1, 2 and 3
Answer 41. It is passed as a hidden argument to all function calls
2.It is passed as a hidden argument to all non-static function calls
3.It is passed as a hidden argument to all static functions
4.None of the above
Answer 21.Virtual functions are functions that can be overridden in derived class with the same signature.
2. Virtual functions enable run-time polymorphism in a inheritance hierarchy.
3.If a function is ‘virtual’ in the base class, the most-derived class implementation of the function is called according to the actual type of the object referred to, regardless of the declared typ
4.All of the above
Answer 41.new
2.delete
3.Conversion Operator
4.All of the above
Answer 31.Both 1 and 2
2.Only 1
3.Only 2
4. None of the two
Answer 31. (Member Access or Dot operator)
2.?: (Ternary or Conditional Operator)
3.:: (Scope Resolution Operator
4.All of the above
Answer 41.postfix
2.unary
3.shift
4.equality
Answer 4