-->

OOP MCQ UNIT 2 SECOND PAGE


 


Id 101

Question Which of the following operator(s) can not be overloaded

A .*

B ::

C ?:

D All of the above

Answer D

Marks 1

Unit II


Id 102

Question Which of the following is true about this pointer?

A It is passed as a hidden argument to all function calls

B It is passed as a hidden argument to all non-static function calls

C It is passed as a hidden argument to all static functions

D None of the above

Answer B

Marks 1

Unit II


Id 103

Question Predict the output of following C++ program.

#include<iostream>

using namespace std;

class Test

{private:

 int x;

public:

 Test(int x = 0) { this->x = x; }

 void change(Test *t) { this = t; }

 void print() { cout <<"x = "<<x <<endl; }

};

int main()

{

 Test obj(5);

 Test *ptr = new Test (10);

 obj.change(ptr);

 obj.print();

 return 0;

}

A x = 5

B x = 10

C Compiler Error

D Runtime Error

Answer C

Marks 2

Unit II


Id 104

Question Which of the followings is/are automatically added to every class, if we do not write our 

own.

A Copy Constructor

B Assignment Operator

C A constructor without any parameter

D All of the above

Answer D

Marks 2

Unit II


Id 105

Question What is the output of following program?

#include<iostream>

using namespace std;

class Point {

 Point() { cout <<"Constructor called"; }

};

int main()

{

 Point t1; return 0;

}

A Compiler Error

B Runtime Error

C Constructor called

D Segmentation Fault

Answer A

Marks 1

Unit II


Id 106

Question What will be the output of following program?

#include <iostream>

using namespace std;

class Test

{

public:

 Test() { cout <<"Hello from Test() "; }

} a;

int main()

{

 cout <<"Main Started ";

 return 0;

}

A Main Started

B Main Started Hello from Test()

C Hello from Test() Main Started

D Compiler Error: Global objects are not allowed

Answer C

Marks 2

Unit II


Id 107

Question Which of the following operators are overloaded by default by the compiler?

1) Comparison Operator ( == )

2) Assignment Operator ( = )

A Both 1 and 2

B Only 1

C Only 2

D None of the two

Answer C

Marks 1

Unit II


Id 108

Question A normal C++ operator that acts in a special way on newly defined data types is called 

_______

A Encapsulated

B Overloaded

C Classified

D Inherited

Answer B

Marks 1

Unit II


Id 109

Question The correct function name for overloading the addition + operator is __

A Operator _+

B Operator :+

C Operator (+)

D Operator +

Answer D

Marks 1

Unit II


Id 110

Question Which of the following operators cannot be overloaded?

A → operator

B . operator

C [ ] operator

D &operator

Answer B

Marks 1

Unit II


Id 111

Question Which of the following operators cannot be overloaded?

A +

B -

C [ ]

D ::

Answer D

Marks 1

Unit II


Id 112

Question Pick the incorrect statement from the following

A The overloaded operators follow the syntax rules of original operator.

B Only existing operators can be overloadedC Overloaded operator must have at least one operand of its class type

D Overloaded operators can change the meaning of the original operator

Answer D

Marks 1

Unit II


Id 113

Question For operators to be overloaded as non static member functions:

A Both binary and unary operators take one argument.

B Binary operators can have one argument and unary operators can not have any

C Neither binary nor unary operators can have arguments

D Binary operators can have two arguments and unary operators can have one

Answer B

Marks 1

Unit II


Id 114

Question Which of the following is an operator function?

A Member overloading

B Function overloading

C Operator overloading

D None of these

Answer C

Marks 1

Unit II


Id 115

Question Operator overloading means _______

A Giving new meaning to existing operator without changing its original

Meaning

B Making C++ operators to work with objects

C Making new types of operator

D Both a and b

Answer D

Marks 1

Unit II


Id 116

Question For overloading =+ implicitly _______

A + and = operators need to be overloaded implicitly

B Only + operator need to be overloaded implicitly

C Only = operator need to be overloaded implicitly

D The += operator cannot be overloaded implicitly

Answer D

Marks 1

Unit II


Id 117

Question Overloading a postfix increment operator by means of a member function takes-------

A No argument

B One argument

C Two arguments

D Three Arguments

Answer A

Marks 1

Unit II


Id 118

Question If you overload only prefix operator ++ then the postfix ++ operator is ______

A Does not work

B Works arbitrarily

C Works naturally

D Works as if prefix ++ operator

Answer D

Marks 1

Unit II


Id 119

Question When compiler decides binding of an overloaded member then it is called________

A Static binding

B Dynamic binding

C Local binding

D None of these

Answer A

Marks 1

Unit II


Id 120

Question One can redefine the working of _______ to work with objects.

A Preprocessor directives

B White space characters

C Standard operators

D None of these

Answer C

Marks 1

Unit II


Id 121

Question Choose the correct option:

I. When you overload <<operator the >>operator automatically gets

overloaded

II. You can overload unary operator to work with binary operatorA Only I is true

B Only II is true

C Both I and II are true

D Neither I nor II are true

Answer D

Marks 1

Unit II


Id 122

Question Choose the correct option

I.If you do not want to make use of operator overloading, you can achieve that effect 

using user defined function

II. The sizeof operator can be overloaded

A Only I is true

B Only II is true

C Both I and II are true

D Neither I nor II are true

Answer A

Marks 1

Unit II


Id 123

Question The array subscript operator [] when overloaded cannot ______

A Take user defined objects are operands

B Take float as an operand

C Take multiple values inside (for example: [5,7] )

D None of these

Answer C

Marks 1

Unit II


Id 124

Question The prototype of overloaded cast operator functions do not _______

A specify the type they convert to

B specify the return type

C need to be defined inside the class whose objects are being converted

D none of these

Answer B

Marks 1

Unit II


Id 125

Question Which of the following operators cannot be overloaded ?

A +=

B <<

C ?:

D FUNCTION CALL()

Answer C

Marks 1

Unit II


Id 126

Question Which of the following operators cannot be overloaded ?

A ::

B Sizeof

C Conditional operator ?:

D All of these

Answer D

Marks 1

Unit II



Id 127

Question The overloading the function operator________.

A requires class with overloaded operators

B makes use of parameterized constructor

C allows to create objects that are syntactically like functions

D none of these

Answer A

Marks 1

Unit II


Id 128

Question Choose the incorrect statement from the following.

A Constructors can be overloaded.

B Only existing operators must be overloaded

C the overloaded operators must follow the syntax rules of the original operator

D The overloaded operators must have atleast one operand of its class type

Answer B

Marks 1

Unit II


Id 129

Question Overloading without explicit arguments to an operator function is called______.

A unary operator

B binary operator

C nested class

D none of these

Answer AMarks 1

Unit II


Id 130

Question In binary overloaded function which are overloaded through friend function take_______

A three explicit arguments

B two explicit arguments

C one explicit argument

D no argument

Answer B

Marks 1

Unit II


Id 131

Question In binary overloaded function which are overloaded through member function 

take__________

A three explicit arguments

B two explicit arguments

C one explicit argument

D no argument

Answer C

Marks 1

Unit II


Id 132

Question The unary operators are overloaded by member function then it takes ______

A three explicit arguments

B two explicit arguments

C one explicit argument

D no argument

Answer D

Marks 1

Unit II


Id 133

Question Choose the correct choice.

I. All the operators in C++ can be overloaded.

II. We can change the basic meaning of operator while overloading it.

A Only I is true

B Only II is true

C Both I and II are true

D Neither I nor II are true

Answer D

Marks 1

Unit 2


Id 134

Question Which of the following operator can be overloaded through friend function ?

A ::

B +

C =

D ->

Answer B

Marks 1

Unit II


Id 135

Question The name of the operator function that overloads the / symbol is________.

A operator /()

B /op()

C / operator()

D op/()

Answer A

Marks 1

Unit II


Id 136

Question In binary operator overloaded operator function the second operand should be______.

A passed by value

B Implicit

C passed by reference

D none of these

Answer C

Marks 1

Unit II


Id 137

Question Function overloading is run time polymorphisms

A True

B False

C

D

Answer B

Marks 1

Unit II


Id 138

Question Following overloaded operator cannot be inherited by derived class_______.

A >

B =C *

D /

Answer B

Marks 1

Unit II


Id 139

Question Choose the correct choice.

A The conditional operator can be overloaded

B While overloading using the friend function the binary operator requires one argument

C Operator precedence cannot be changed

D None of these

Answer C

Marks 1

Unit II


Id 140

Question Which of the following operator can be overloaded through friend function ?

A ()

B []

C ->

D *

Answer D

Marks 1

Unit II


Id 141

Question When we overload we want to______.

A compare and copy object

B assign one object to another

C compare two objects

D test for equality

Answer B

Marks 1

Unit II


Id 142

Question Operator overloading is also called one form of polymorphism because_______.

A the overloaded operators have many forms

B the overloaded operators can be declared virtual

C the overloaded function can perform various tasks depending upon the type of object

D None of these

Answer C

Marks 1

Unit II


Id 143

Question Overloading means

A two or more methods in the same class that have same name

B calling the method which has actual parameters

C two or more methods having same name but present in different class

D none of these

Answer C

Marks 1

Unit II


Id 144

Question The inheritance mechanism provides meaning of deriving______

A new operator from exciting one

B new function from exciting one

C new class from exciting one

D all of these

Answer C

Marks 1

Unit II


Id 145

Question A class derived from the exciting class is known as______

A new class

B Inheritee

C derived class

D none of these

Answer C

Marks 1

Unit II


Id 146

Question The derived class is derived from__________

A derived class

B base class

C both a&b

D none of these

Answer B

Marks 1

Unit 2


Id 147

Question Which of the following can be derived from base class in inheritace ?

A data members

B member function

C both a&b

D none of theseAnswer C

Marks 1

Unit II


Id 148

Question The inheritance is described as a _____ relationship

A has a

B is a

C association

D none of these

Answer B

Marks 1

Unit II


Id 149

Question Which of the following allows you to create derived class that inherits properties from 

more than one base class ?

A multilevel inheritance

B multiple inheritance

C single inheritance

D Hybrid inheritance

Answer B

Marks 1

Unit II


Id 150

Question The principle by which the knowledge of general category can be applied to more 

specific objects is called _____

A polymorphism

B overriding

C inheritance

D none of these

Answer A

Marks 1

Unit II



0 Comments