GATE-Programming Methodology Questions and Answers

Practice Mode
Showing 10 of 105 questions
Q101
If the subscript operator has been correctly overloaded for a Number class to accept an integer value, and num is a member of the number class, which of the following statements is correct ?
  • A [num]rr;
  • B num[[44]'
  • C num=[[44];
  • D num 44;
Answer: Option C
Q102
Which of the following statements is true ?
  • A The subscript operator may take only one argument
  • B The parentheses operator may take only one argument
  • C The subscript operator may take
  • D None of these
Answer: Option B
Q103
The >> operator
  • A may be overloaded for input
  • B must be overloaded if there will be input to classes
  • C must be overloaded if the << operator is overloaded.
  • D may be overloaded for input, but not for shifting bits
Answer: Option A
Q104
When the >> operator is overloaded for input, one parameter that should be passed to the functions is a
  • A reference to istream
  • B referece to ostram
  • C copy of istream
  • D copy of ostream
Answer: Option A
Q105
To overload a post fix ++ fir a Number class, an appropriate function header is
  • A Number & Number :: operator ++(Number & num)
  • B number & Number:: operator ++9int)
  • C Number & Number :: operator ++()
  • D Number:: operator ++ (Number & num).
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test