GATE-Programming Methodology

GATE-Programming Methodology
81. If an operator is normally defined to be only unary, then you
  • may overlaod it to be binary
  • must overload it to be binary
  • may not overload it to be binary
  • may not overload it
Show Answer
82. When you overload an operator for use with your classes, you
  • must use the overloaded operator for the usual purpose
  • should use the overloaded operator for the usual purpose
  • may not use the overloaded operator for the usual purpose
  • may not overload operators that have a usual purpose
Show Answer
83. You overload an operator by naming it a
  • variable
  • built-in-type
  • function
  • class
Show Answer
84. Assuming you have properly overloaded the ! operator for a Number class, and that a and b are two members of the Number class, which expression is legal?
  • !a
  • b!
  • a!b
  • all of these
Show Answer
85. To perform multiple arithmetic operations in a single statement, overloaded operator functions should return
  • void
  • a copy of the values passed to them
  • an object of the class type
  • address of the function
Show Answer
86. Which of the following is the best function prototype for an overloaded .......... for a Number class ?
  • number operator-(const Number & num);
  • Number & operator-(int num);
  • int Number (operator-();
  • void operator-(Number & num);
Show Answer
87. The programming language feature that allows the same operation to be carried out differently depending on the object is
  • polymorphism
  • inheritance
  • allocation
  • mangling
Show Answer
88. Specifically, overloading involves
  • one function with a variety of arguments
  • multiple functions defined with the same name
  • one function with multiple names
  • multiple functions with different names.
Show Answer
89. A usable function header for an overloaded operator for a Number class is
  • Number operator >>(istream & in, Number & num)
  • intream & operator>>(istream & in, const Number & num)
  • friend instream & operator>>(instream & in, Number & num)
  • istream & operator>>(istream & in, Number & num)
Show Answer
90. If the >> operator is overloaded properly for use for input with a number class, and a and b are member of the Number class, which of the following statement is allowed ?
  • cin >> a;
  • cin >> a,b
  • both (a) and (b)
  • None of these
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test