1.

The following function Check() is a part of some class. What will the function Check() return when the values of both ‘m’ and ‘n’ is equal to 5? Show the dry run/working.int Check (int m, int n) { if(n = = 1) return - m --; else return + + m + Check (m, -- n); }

Answer»

The value of m and n are 5 which is not equal to 1. It is, for this reason, the first if block is not executed as a result it will jump to the else part where the value of m will be 6 and n will be 4. As m is having Pre Increment operator so the value of m is changed to 6 and the value of n to 4 as it is the Pre Decrement operator.



Discussion

No Comment Found

Related InterviewSolutions