1
GATE CSE 2026 Set 2
Numerical
+2
-0

Consider the following ANSI-C program.

#include <stdio.h>

int main( ) {

    int *ptr, a, b, c;

    a=5; b=11; c=20;

    ptr=&a; *ptr=c; ptr=&c;

    a=*(&b); c=*ptr-a;

    printf("%d",c);

    return(0);

}

The output of this program is $\_\_\_\_$ . (answer in integer)

Note: Assume that the program compiles and runs successfully.

Your input ____
2
GATE CSE 2024 Set 2
MCQ (Single Correct Answer)
+2
-0.66

What is the output of the following C program?


#include <studio.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;}
A

4,8

B

1,5

C

8,5

D

1,8

3
GATE CSE 2021 Set 2
MCQ (Single Correct Answer)
+2
-0.66

Consider the following ANSI C program:

#include <stdio.h>

#include <stdlib.h>

struct Node{

int value;

struct Node ⋆next;};

int main(){

struct Node ⋆boxE, ⋆head, ⋆boxN; int index = 0;

boxE = head = (struct Node ⋆) malloc (sizeof(struct Node));

head -> value = index;

for (index = 1; index <=3; index++){

boxN = (struct Node ⋆) malloc(sizeof(struct Node));

boxE -> next = boxN;

boxN -> value = index;

boxE = boxN; }

for (index = 0; index <= 3; index++) {

printf("value at index %d is %d\m", index, head -> value);

head = head -> next;

printf("value at index %d is %d\n", index + 1, head -> value);}}

Which one of the statement below is correct about the program ?

A
It has a missing return which will be reported as an error by the compiler.
B
It dereferences an uninitialized pointer that may result in a run-time error.
C
Upon execution, the program goes into an infinite loop.
D
Upon execution, the program creates a linked-list of five nodes.
4
GATE CSE 2019
Numerical
+2
-0
Consider the following C program:

       #include < stdio.h >
       int main()
       {
           int a[] = {2, 4, 6, 8, 10} ;
           int i, sum = 0, *b = a + 4 ;
           for (i = 0; i < 5; i++)
                 sum = sum + (*b - i) - *(b - i) ;
           printf ("%d\n", sum) ;
           return 0 ;
        }

The output of the above C program is _________.
Your input ____

GATE CSE Subjects

Browse all chapters by subject

Software Engineering
Web Technologies