Time Left - 15:00 mins

GATE 2020: Programming & Data Structures Quiz 2 (App update required to attempt this test)

Attempt now to get your rank among 1248 students!

Question 1

Given a 2D integer array as arr[0-99][0-99] , with base address of 900.  A user decides to fill data from arr[15][0] instead of arr[0][0]. So he fills entries arr[15][0], arr[15][1] , arr[15][2] , ………….. , arr[15][99] , then again from arr[16][0] , arr[16][1] , arr[16][2] and so on. Given that size of integer is 4 Bytes and row major ordering is used. What is the address of 121st entry ? (entries counted as 1 , 2 , 3 and so on)

Question 2

Let A be a square matrix of size n × n. Consider the following pseudo code. What is the expected output?
C = 100
for i = 1 to n do
for j = 1 to n do
{
Temp = A [i] [j] + C;
A [i] [j] = A [j] [i];
A [j] [i] = Temp – C;
}
for i = 1 to n do
for j = 1 to n do
output (A [i] [j])}

Question 3

Let s be a sorted array of n integers. Let t(n) denote the time taken for the most efficient algorithm to determine if there are two elements with sum less than1000 in s. Which of the following statements is true?

Question 4

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 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

Which of the following C expressions access the (i, j)th entry of an (mn) matrix strored in column major order?
  • 1248 attempts
  • 1 upvote
  • 7 comments
Apr 6GATE & PSU CS