Time Left - 16:00 mins

Pointers and Arrays-II Starter Quiz-2

Attempt now to get your rank among 65 students!

Question 1

What will be the address of the arr[2][3] if arr is a 2-D long array of 4 rows and 5 columns and the starting address of the array is 2000? Assume the size of an element is 4B. (use row-major)

Question 2

Consider a two dimensional array A[2…15][3…10] that is column index ranges from 3 to 10 and row index ranges from 2 to 15 Now suppose element are arranged in column major order. If Base address of A is 1000 then address of element A[5][7] will be __.(Assume size of each element is 1).

Question 3

Let A be a three-dimensional array declared as follows:
A: array [2 ..... 10] [15 ..... 25] [10 ..... 21]
Assuming that each integer takes four byte. The array in stored in row major order and the first element of the array is stored at location 100, what is the address of the element A[5] [17] [16] ________.

Question 4

Consider the following C-fragment where size of int is 1 B (Assume starting address of array is 1000)

int main ( )

{

int S[6] = {10, 20, 30, 40, 50, 60};

int * Str = (int *) (&S + 1);

print*('% d", Str);

}

The output generated by above code is _________.

Question 5

Consider the following code:

Which of the following statement is incorrect regarding pointers?

Question 6

Identify the function prototype given in the following:
“array of N pointers to functions, returning pointers to functions and returning pointer to integer”

Question 7

The most appropriate matching for the following pairs:

List I :

a. m=malloc(5); m=NULL;

b. free (n); n value =5;

c. char *p; *p= 'a';

List II :

1) using a dangling pointer

2) Lost memory

3) using an uninitialized pointer

  • 65 attempts
  • 0 upvotes
  • 0 comments
Jul 15GATE & PSU CS