f(p,p) का वापसी मान क्या है, यदि p का मान कॉल से पहले 5 से प्रारंभ किया जाता है? ध्यान दें कि पहला पैरामीटर संदर्भ द्वारा पारित किया जाता है, जबकि दूसरा पैरामीटर मान द्वारा पारित किया जाता है।

int f (int &x, int c) {

     c = c - 1;

      if (c == 0) return 1;

      x = x + 1;

      return f(x,c) * x;

}

This question was previously asked in
GATE CS 2013 Official Paper
View all GATE CS Papers >
  1. 3024
  2. 6561
  3. 55440
  4. 161051

Answer (Detailed Solution Below)

Option 2 : 6561
Free
GATE CS Full Mock Test
65 Qs. 100 Marks 180 Mins

Detailed Solution

Download Solution PDF

सही उत्तर विकल्प 2 है

व्याख्या:

चूँकि c को मान से पारित किया जाता है और x को संदर्भ द्वारा पारित किया जाता है, सभी कार्यों में x की एक ही प्रति होगी, लेकिन c की अलग-अलग प्रतियां होंगी।

कोड:

int f (int &x, int c) {

c = c - 1;

if (c == 0) return 1;

x = x + 1;

return f(x,c) * x;

}

फंक्शन कॉल

 

तो, उत्तर 6561 है 

Latest GATE CS Updates

Last updated on Jan 8, 2025

-> GATE CS 2025 Admit Card has been released on 7th January 2025.

-> The exam will be conducted on 1st February 2025 in 2 shifts.

-> Candidates applying for the GATE CE must satisfy the GATE Eligibility Criteria.

-> The candidates should have BTech (Computer Science). Candidates preparing for the exam can refer to the GATE CS Important Questions to improve their preparation.

-> Candidates must check their performance with the help of the GATE CS mock tests and GATE CS previous year papers for the GATE 2025 Exam.

More Pointer Questions

Hot Links: teen patti apk happy teen patti teen patti tiger teen patti neta