GATE-Programming Methodology
GATE-Programming Methodology
91. Assume num= 8;. The value of the expressionnum ++ is ...........
- 7
- 8
- 9
- impossible to tell
92. If the ++ operator is overloaded properly, to operator ++ () function returns
- a copy of an incremented member of a class
- a copy of an incremented data item
- a reference to a class member data item
- the this pointer
93. If the ++ operator is overloaded properly, the operator++ () function returns
- a copy of an incremented member of a class
- a copy of an incremented data item
- a reference to a class member data item
- the this pointer
94. To overload a prefix ++ for a Number class, an appropriate function header is
- Number & Number :: operator ++(Number & num)
- Number & Number ::operator ++(int)
- Number & Number :: operator ++(int)
- This Number :: operator ++ (Number & Num)
95. The << operator is used for output only when
- it is used as a binary operator
- it is used as a unary operator
- cout is to the left
- you write a function to overload it.
96. Object-oriented programmers primarily focus on
- procedures to be performed
- the step-by-step statements needed to solve a problem
- objects and the tasks that must be performed with those objects
- the physical orientation of objects within a program.
98. Using an overloaded << operator for a class
- is the only way to display values of data members of a class
- works correctly only if all data members private
- aloows output statements within a program that uses the class to become simpler
- is possible only if >> operator is overloaded as well
99. Which of the following is the best prototype to overload the << operator for a Number class?
- ostream & << (ostream & out, const Number & num)
- friend ostream & operator <<(ostream & out const Number & num);
- Number & operator <<(ostream & out, const Number & num);
- friend ostream operator<<(const. Number & num)
100. If you use an = operator with classes, then
- you must have overloaded it
- you may have overloaded it
- you must not have overloaded it
- equal cannot be used with classes.