GATE CS 2018 (Forenoon) — Question 12

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

Consider the following C program.
c
1#include<stdio.h>
2struct Ournode{
3 char x,y,z;
4};
5
6int main(){
7 struct Ournode p = {'1', '0', 'a'+2};
8 struct Ournode *q = &p;
9 printf ("%c, %c", *((char*)q+1), *((char*)q+2));
10 return 0;
11}
12
The output of this program is:
  1. A
    0, c
  2. B
    0, a+2
  3. C
    '0', 'a+2'
  4. D
    '0', 'c'
Practise the full 2018-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAFree All-India Mock — every SundayA full GATE CS paper, exactly 180 minutes, ranked across India with your GATE score.
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