NEW
Font size
WorksheetsdataStructure
Total questions: 14
Worksheet time: 7mins
The postfix expression of the infix expression a+b-c*d is
abc-d*+
abcd*-+
abcd+-*
+-*abcd
The prefix expression of the infix expression a+b-c*d is
abc-d*+
abcd*-+
abcd+-*
+a-b*cd
In a circular queue of size 7 if front index=5 and rear index =3 then ___ enqueue operations has been performed.
5
7
11
12
In a circular queue of size 7 if front index=5 and rear index =3 then ___ dequeue operations has been performed.
5
7
11
12
What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
Prints all nodes of linked lists
Prints all nodes of linked list in reverse order
Prints alternate nodes of Linked List
Prints alternate nodes in reverse order
Which of the following points is/are true about Linked List data structure when it is compared with array
Arrays have better cache locality that can make them better in terms of performance.
It is easy to insert and delete elements in Linked List
Random access is not allowed in a typical implementation of Linked Lists
The size of array has to be pre-decided, linked lists can change their size any time.
All the Above
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is
log 2 n
n/2
log 2(n-1)
n
Which one of the following is an application of Stack Data Structure?
Managing function calls
The stock span problem
Arithmetic expression evaluation
All the above
Let A be a square matrix of size n x n. Consider the following program. 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]);
The matrix A itself
Transpose of matrix A
Adding 100 to the upper diagonal elements and subtracting 100 from diagonal elements of A
None of the above
O(1) means computing time is
constant
linear
Quadratic
cubic
Sorting which works well for small set of datas are
Quick sort
Selection sort
Merge Sort
count sort
In the following code, after the loop is terminated,ptr points to_________________?
ptr=start;
while(ptr!=NULL)
{
ptr=ptr->next;
}
last node
last but one done
NULL
none of the above
I dont know
In the following code, after the loop is terminated,ptr points to_________________?
ptr=start;
while(ptr->next!=NULL)
{
ptr=ptr->next;
}
NULL
last node
last but one node
none of the above
I dont know
What will be the output of the following code, if list contains 6 nodes?
ptr=start;
x=0;
while(ptr!=NULL)
{
x++;
ptr=ptr->next;
}
printf("x=%d",x);
x=6
x=5
x=7
I dont know
