Time Left - 10:00 mins

GATE CS 2018 - Data Structures Quiz 2

Attempt now to get your rank among 1077 students!

Question 1

When are linked lists considered linear data structures?

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

The following C function takes a singly-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers 1,2,3,4,5,6,7 in the given order. What will be the contents of the list after the function completes execution?
struct node {
int value;
struct node *next;
} ;
void rearrange {struct node *list){
struct node *p, *q;
int temp;
if (! list | | ! list -> next) return;
p = list; q = list -> next;
while (q)
{
temp = p -> value; p -> value = q - > value;
q -> value = temp; p = q -> next;
q = p ? p -> next : 0;
}
}

Question 4

Consider a two-dimensional array with elements stored in the form of lower triangular matrix. How many elements must be crossed to read A[4, 2] from the array A[–6, ..., +8, –6,..., +8] whose base address is 1000? (Assume elements are stored in row major order.)

Question 5

In an Arrays of 2N elements that is both 2-ordered and 3-ordered, what is the maximum number of positions that an element can be from its position if the Arrays were 1-ordered?

Question 6

A one dimensional Arrays A has indices 1.... 75. Each element is a string and takes up three memory words. The Arrays is stored at location 1120 decimal. The starting address of A [49] is
  • 1077 attempts
  • 10 upvotes
  • 26 comments
Jun 25GATE & PSU CS