GATE-Programming Methodology Questions and Answers

Practice Mode
Showing 10 of 105 questions
Q61
If four classes had the same friend function, you would forward declare
  • A nothing
  • B one class
  • C two classes
Answer: Option D
Explanation: three classes
Q62
A friend function
  • A receives a this pointer for the class that makes it a friend
  • B receives a this pointer for any class that uses it
  • C receives a this pointer for any class object passes to it
  • D does not have a this pointer for the class that makes it a friend
Answer: Option D
Q63
The generic type in a template function
  • A must be T
  • B can be T
  • C cannot be T for functions you create, but may be for C + +, a built -in function
  • D cannot be T.
Answer: Option B
Q64
When a function tries to access an object's private data member
  • A if the function is a member function, then access is approved
  • B if the function is a friend function, then access is denied
  • C both (a ) and (b)
  • D None of these
Answer: Option A
Q65
The prototypes for friend functions are most often listed in the
  • A private declaration section
  • B public declaration section
  • C implementation section
  • D none of thses
Answer: Option D
Q66
A dumb terminal has
  • A prototypes for all functions that are friends of a class are listed with the other function prototypes
  • B outside the class definition, but within the same file
  • C in the class declaration section
  • D in the class implementation section
Answer: Option C
Q67
A class may
  • A not have friends
  • B have one friend
  • C have one friend function and one friend class
  • D have any number of friends
Answer: Option D
Q68
You use data hiding when you create
  • A inline functions
  • B private class members
  • C nonscalar types
  • D cryptic code
Answer: Option B
Q69
Classes can bestow friendship on
  • A nonmember functions
  • B functions that are members of other classes
  • C both (a) and (b )
  • D none of these
Answer: Option B
Q70
You may grant friendship to
  • A no member functions of other classes
  • B one member function from one other class
  • C one member function each from as many classes as appropriate
  • D as many member functions of other classes as appropriate
Answer: Option D
Questions and Answers for Competitive Exams Various Entrance Test