Question 70

One of the disadvantages of pass by reference is that the called function may inadvertently corrupt the caller's data. This can be avoided by

  1. APassing pointers
  2. BDeclaring the formal parameters constant
  3. CDeclaring the actual parameters constant
  4. DAll of the above
Show answerHide answer

Correct answer: (B) Declaring the formal parameters constant

Explanation

Declaring the formal (reference) parameters as const lets the function read the caller's data without being able to modify it.

From DSSSB TGT Computer Science Practice Set 1

This is question 70 of DSSSB TGT Computer Science Practice Set 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.