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
51. You can bestow friendship on
- a function that is a meber of another class
- several functions that are members of another class
- all functions that are members of another class
- all of these
52. You can bestow friendship on all members of another class by
- making each function a friend
- making a friend of the entire class
- either( a) or (b)
- none of these
53. You need to display two private data members from one object of a class. You would
- create a member function to preserve data hiding
- create a friend function to implement object oriented programming
- create both friend and member functions fo give the programmer a choice
- not create a function, but just display the data members directly.
54. A function that can access private members of a class, even though it is not a member of the class itself, is
- a friend
- an inline function
- a private function
- never allowed in object-oriented programming.
55. Select the correct statement of the following ?
- When you create a function, you can declare it to by a friend function.
- When you create a friend function, you must include the friend keyword in the function header.
- nonscallar types
- cryptic code
56. Select the correct statement of the following ?
- A class declaration must state which functions will be its friends
- Afriend function must declare to which classes it will be a friend
- both (a ) and (b)
- none of these
57. A function can
- be granted friendship by a class you create
- declare itself to be a friend of you class
- grant friendship to alother function
- grant friendship to a class create
58. When a nonmember function needs to refer to instances of two different classes, then
- only one class may grant friendship to the function
- both classes must grant friendship to the funcion
- either class may grant friendship to the function
- neigher class may grant friendship to the function
59. When a nonmber function needs to refer to instances of two different classes, then you must
- store the classes in separate files
- meke the classes friends of the one another
- make a forward reference to one of the classes
- make a forward reference to both of the classes
60. A forward reference
- defines a class
- eliminates the need to define a class
- acknowledgtes the existence of a a class
- is illegal in object-oriented programming.