GATE | GATE CS 2019 | Question 27
Consider the following C program:
#include <stdio.h> int jumble(int x, int y) { x = 2 * x + y; return x; } int main() { int x = 2, y = 5; y = jumble(y, x); x = jumble(y, x); printf("%d\n", x); return 0; } |
chevron_right
filter_none
The value printed by program is __________ .
Note: This was Numerical Type question.
(A) 26
(B) 2
(C) 5
(D) 12
Answer: (A)
Explanation:
#include <stdio.h> int jumble(int x, int y) { x = 2 * x + y; return x; } int main() { int x = 2, y = 5; y = jumble(y, x); x = jumble(y, x); printf("%d\n", x); return 0; } |
chevron_right
filter_none
Intially x = 2, y = 5;
jumble (5, 2) is called and y will updated as 12
jumble (12, 2) is called and x will updated as 26
Final value of x = 26
So, option (A) is correct.
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 1999 | Question 36
- GATE | GATE CS Mock 2018 | Question 39
- Top 5 Topics for Each Section of GATE CS Syllabus
- How to prepare in Last 10 days to score high in GATE?
- Aptitude | GATE IT 2006 | Question 7
- Aptitude | GATE IT 2006 | Question 8
- GATE | GATE CS 2013 | Question 1
- GATE | GATE CS 2013 | Question 3
- GATE | GATE CS 2013 | Question 4
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 6
- GATE | GATE CS 2013 | Question 7
- GATE | GATE CS 2013 | Question 8
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 65



