Array and Pointer: GATE CS Previous Year Questions

Array and Pointer · Programming in C

54 questions · asked in 22 of 27 years (2000–2026)

MCQ 39 · MSQ 1 · NAT 141-mark 34 · 2-mark 20

2000Questions per year2026

Questions 11–15 of 54

Q11GATE 2021 (Session 2)1 markMCQ−0.33 if wrong
Consider the following ANSI C program.
 #include <stdio.h>
int main( ) 
{
    int arr[4][5];
    int  i, j;
    for (i=0; i < 4; i++) 
  {
        for (j=0; j < 5; j++) 
        {
            arr[i][j] = 10 * i + j;
        }
    }
    printf("%d", *(arr[1]+9));
    return 0;
}
What is the output of the above program?

Q12GATE 20201 markNAT
Consider the following C program.
    #include <stdio.h>
    int main ()  {
        int  a[4] [5] = {{1, 2, 3, 4, 5},
                        {6, 7,8, 9, 10},
                        {11, 12, 13, 14, 15},
                        {16, 17,18, 19, 20}};
        printf("%d\n", *(*(a+**a+2)+3));
        return(0);
    }
The output of the program is _______.

Q13GATE 20191 markNAT
Consider the following C program:

#include <stdio.h>
 int main(){
  int arr[] = {1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip = arr + 4;
  printf("%d\n", ip[1]);
  return 0;
}
The number that will be displayed on execution of the program is _________ .

Q14GATE 20192 marksNAT
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 above C program is __________ . Note: This was Numerical Type question.

Q15GATE 20181 markMCQ−0.33 if wrong
Consider the following C program.
#include <stdio.h>
struct Ournode{
char x,y,z;
};
int main(){
struct Ournode p = {'1', '0','a'+2};  
struct Ournode *q = &p;
printf("%c,%c",*((char*)q+1),*((char*)q+2));
return 0;
}  
The output of this program is:

Keep practising

Topics in Programming in C

All CS topics ›