Time Left - 15:00 mins

GATE 2022: Data Structure and Programming Quiz-2

Attempt now to get your rank among 379 students!

Question 1

Assume a matrix is stored in a linear in row major order. Base address of A is 0 and each element takes 1 word. Find the location of A[–2] [50].

Question 2

Consider the following statements on Array :
S1 : Array is static in nature whose size needs to be declared first.
S2 : Increasing the size of array takes O(n) time.
Now choose the correct option :

Question 3

Consider a two dimensional array A[1…10][3…8] that is column index ranges from 3 to 8 and row index ranges from 1 to 10. 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 4

Consider the below given code :
void XYZ(int a[R][C])
  {
      for (int j = 0; j < C; j++)
    {
        for (int i = 0; i < R/2; i++)
         swap(a[i][j], a[R- i - 1][j]);
    }
 }
A 2D array is passed as parameter to the above function XYZ. The operation done by the function XYZ on the array is :

Question 5

Assume that an upper triangular matrix A [0... 99, 0 ...99] is stored in a linear array C of size 5050 with row major order. If A[0, 0] is stored in C[0], find the index of C where A[70, 90] is stored in it.

Question 6

Consider a lower triangular matrix which is stored in form of an array in the system. The lower triangular array is as follows :

A[25…..85 , 25…..85]

The Base address starts from 1000 and size of each element in the array is 10 . If this lower triangular matrix is stored in row major order then the location of element a[60][55] in the stored array is ____________.

  • 379 attempts
  • 3 upvotes
  • 1 comment
Jul 23GATE & PSU CS

Posted by:

Priya UpadhyayPriya UpadhyayMember since Sep 2020
Priya Upadhyay
Share this quiz   |