GATE CSE C Programming Practice Test – Array & Pointer | Set 1

Questions 86-90 of 100

Your score 0/100 0 answered
Correct 0 Incorrect 0 Unanswered 100 Accuracy 0%

Question 86

NAT · Numerical Answer 2 mark

Consider a 2D integer array A of dimensions 10 x 20 stored in row-major order starting at base address 1000. If each integer occupies 4 bytes, calculate the memory address of element A[4][5].

Answers for question 86

Question 87

NAT · Numerical Answer 1 mark

What is the output printed by the following code?

C
#include <stdio.h>
int main(void) {
    int a[] = {2, 4, 6, 8, 10};
    int *p = a + 1;
    int *q = a + 4;
    printf("%d", (int)(q - p));
    return 0;
}
Answers for question 87

Question 88

NAT · Numerical Answer 1 mark

What is the return value of main()?

C
#include <stdio.h>
int main(void) {
    int arr[5] = {1, 2, 3, 4, 5};
    int sum = 0;
    for (int *p = arr; p < arr + 5; p++) {
        sum += *p;
    }
    return sum;
}
Answers for question 88

Question 89

NAT · Numerical Answer 1 mark

What is the output of the following C program?

C
#include <stdio.h>
int main(void) {
    int arr[] = {4, 20, 30, 40};
    int *p = arr;
    printf("%d", *(p + 1) - *p);
    return 0;
}
Answers for question 89

Question 90

NAT · Numerical Answer 1 mark

What is the output of the following C program?

C
#include <stdio.h>
int main(void) {
    int arr[] = {5, 25, 30, 40};
    int *p = arr;
    printf("%d", *(p + 1) - *p);
    return 0;
}
Answers for question 90
Scroll to Top