GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2024 set2

GATE 2024 set2 · CS · MCQ · 2 marks · Programming and Data Structures › C Programming Fundamentals

GATE 2024 set2 Computer Science and Information Technology question: What is the output of the following C program? code

What is the output of the following C program?

#include <stdio.h>
int main() {
    double a[2]={20.0, 25.0}, *p, *q;
    p = a;
    q = p + 1;
    printf("%d,%d", (int)(q - p), (int)(*q - *p));
    return 0;}
  1. (A)

    4, 8

  2. (B)

    1, 5

  3. (C)

    8, 5

  4. (D)

    1, 8

Show answer

Official answer: B

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion