GATE-Programming Methodology Questions and Answers
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
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.
97. If the <<operator has been overloaded appropriately for the class Number, and a and b are members of the Numbers class, then which statement is legal ?
- cout<<a;
- cout<<a<<b;
- both (a) and (b)
- none of these
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.