GATE CS 2022 (Forenoon) — Question 21

Programming in CPointers, Multi-Dimensional Arrays, StructuresMCQ1 mark · −1/3 if wrongMedium

What is printed by the following ANSI C program?
c
1#include<stdio.h>
2int main(int argc, char *argv[ ])
3{
4    int x = 1, z[2] = {10, 11};
5    int *p = NULL;
6    p = &x;
7    *p = 10;
8    p = &z[1];
9    *(&z[0] + 1) += 3;
10    printf("%d, %d, %d\n", x, z[0], z[1]);
11    return 0;
12}
13
  1. A
    1, 10, 11
  2. B
    1, 10, 14
  3. C
    10, 14, 11
  4. D
    10, 10, 14
Practise the full 2022-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAWhat rank do your marks get?GATE score, likely All-India Rank and qualifying marks for your category.
Practise more on Pointers, Multi-Dimensional Arrays, StructuresTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group