GATE-Programming Methodology Questions and Answers

Take Exam

Programming methodology in C++ focuses on structured and object-oriented approaches to problem-solving using efficient algorithms and modular coding. For GATE aspirants and placement candidates, programming questions and answers on this topic often involve analyzing code behavior, debugging, and implementing logic using OOP principles like inheritance, polymorphism, and encapsulation. This section provides GATE-oriented C++ programming methodology questions with answers, enabling learners to practice concepts such as recursion, data abstraction, and error handling. Practicing these C++ questions helps in mastering both academic and placement-level programming skills.

GATE-Programming Methodology

Showing 10 of 105 questions

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 Report

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 Report

83. You overload an operator by naming it a

  • variable
  • built-in-type
  • function
  • class
Show Answer Report

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 Report

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 Report

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 Report

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 Report

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 Report

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 Report

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 Report
Questions and Answers for Competitive Exams Various Entrance Test