GATE CS 2024, set 2 · Question 13 · Programming and Data Structures · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

Consider the following C program. Assume parameters to a function are evaluated from right to left .
#include <stdio.h> int g(int p) { printf("%d", p); return p; } int h(int q) { printf("%d", q); return q; } void f(int x, int y) { g(x); h(y); } int main() { f(g(10),h(20)); }
Which one of the following options is the CORRECT output of the above C program?

  1. (A) 20101020
  2. (B) 10202010
  3. (C) 20102010
  4. (D) 10201020
Answer

Answer (A)

Answer from the official GATE CS 2024 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes