Free Online Test – Data Structure Basic
Data Structure  Basic
Submit Now
0 of 10 questions completed
Questions:
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
Information
Instruction:
 Total number of questions : 10.
 Time alloted : 30 minutes.
 Each question carry 1 mark, no negative marks.
 DO NOT refresh the page.
 All the best 🙂
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 10 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 Marks, (0)
Average score 

Your score 

Categories
 Not categorized 0%
 DS 0%
Pos.  Name  Entered on  Marks  Result 

Table is loading  
No data available  
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 Answered
 Review

Question 1 of 10
1. Question
1 MarksFollowing is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing.
void fun(int n) { Stack S; // Say it creates an empty stack S while (n > 0) { // This line pushes the value of n%2 to stack S push(&S, n%2); n = n/2; } // Run while Stack S is not empty while (!isEmpty(&S)) printf("%d ", pop(&S)); // pop an element from S and print it }

Question 2 of 10
2. Question
1 MarksThe following postfix expression with single digit operands is evaluated using a stack:
8 2 3 ^ / 2 3 * + 5 1 * 
Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:

Question 3 of 10
3. Question
1 MarksLet S be a stack of size n >= 1. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform n pop operations. Assume that Push and Pop operation take X seconds each, and Y seconds elapse between the end of one such stack operation and the start of the next operation. For m >= 1, define the stacklife of m as the time elapsed from the end of Push(m) to the start of the pop operation that removes m from S. The average stacklife of an element of this stack is

Question 4 of 10
4. Question
1 MarksWe are given a set of n distinct elements and an unlabeled binary tree with n nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree?

Question 5 of 10
5. Question
1 MarksHow many distinct binary search trees can be created out of 4 distinct keys? 
Question 6 of 10
6. Question
1 MarksSuppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the inorder traversal sequence of the resultant tree?

Question 7 of 10
7. Question
1 MarksLet 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]);

Question 8 of 10
8. Question
1 MarksConsider an array consisting of –ve and +ve numbers. What would be the worst time comparisons an algorithm can take in order to segregate the numbers having same sign altogether i.e all +ve on one side and then all ve on the other ?

Question 9 of 10
9. Question
1 MarksWhat is the time complexity of Build Heap operation. Build Heap is used to build a max(or min) binary heap from a given array. Build Heap is used in Heap Sort as a first step for sorting. 
Question 10 of 10
10. Question
1 MarksThe elements 32, 15, 20, 30, 12, 25, 16 are inserted one by one in the given order into a Max Heap. The resultant Max Heap is.