My Report (&Account)

Data Structure Online Test


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

Here is the complete list of test quizzes on Data Structure.

1. Given only a single array of size 10 and no other memory is available. Which of the following operation is not feasible to implement (Given only push and pop operation)?

Question 1 of 50

2. Construct a binary tree using inorder and level order traversal given below.
Inorder Traversal: 3, 4, 2, 1, 5, 8, 9
Level Order Traversal: 1, 4, 5, 9, 8, 2, 3

Question 2 of 50

3. When executing a sequence of Unions, a node of rank r must have at least 2r descendants.

Question 3 of 50

4. Consider the following piece of code in C++. What does the following code implement?

#include <iostream>   
using namespace std;
int main()
{
    int *arr_vla;
    int size;
    cout<<"Enter the size of variable length array: ";
    cin>>size;
    arr_vla = new int [size];
    for (int i = 0; i < size; i++)
    {
        cout<<"Enter the integers to be inserted in the variable length array: ";
        cin>>arr_vla[i];
    }
    for(int i = 0; i < size; i++)
    {
        cout<<arr_vla[i]<<"  ";
    }
    cout<<endl;
    return 0;
}

Question 4 of 50

5. Consider the following algorithm to insert an element in a triply linked list.

insertelement(data)
{
    create a node with given data.
    if the linked list is empty
    {
        _____________
        _____________
    }
    if the given node is less than the head
    {
        link the nodes through address and adjust the tail
    }
    if the given node is not less than the head
    {
        if the given node is equal to the head
        {
            new node is inserted on top of the head    
        }
        else
        {
            traverse the linked list to find an element greater than the node and insert in front of the node     
        }   
    } 
}

Which of the following option is best suited to fill the blank?

Question 5 of 50

6. If there are more than 1 topological sorting of a DAG is possible, which of the following is true.

Question 6 of 50

7. Given the Node class implementation, select one of the following that correctly inserts a node at the tail of the list.

public class Node
{
	protected int data;
	protected Node prev;
	protected Node next;
	public Node(int data)
	{
		this.data = data;
		prev = null;
		next = null;
	}
	public Node(int data, Node prev, Node next)
	{
		this.data = data;
		this.prev = prev;
		this.next = next;
	}
	public int getData()
	{
		return data;
	}
	public void setData(int data)
	{
		this.data = data;
	}
	public Node getPrev()
	{
		return prev;
	}
	public void setPrev(Node prev)
	{
		this.prev = prev;
	}
	public Node getNext
	{
		return next;
	}
	public void setNext(Node next)
	{
		this.next = next;
	}
}
public class DLL
{
	protected Node head;
	protected Node tail;
	int length;
	public DLL()
	{
		head = new Node(Integer.MIN_VALUE,null,null);
		tail = new Node(Integer.MIN_VALUE,null,null);
		head.setNext(tail);
		length = 0;
	}
}

Question 7 of 50

8. Which of the following is true for a Hash tree?

Question 8 of 50

9. What is the time complexity of Uttkonen’s algorithm?

Question 9 of 50

10. What is the time complexity of the code that uses merge sort for determining the number of inversions in an array?

Question 10 of 50

11. What is the number of words that can be formed from the given Directed Acyclic Word Graph?
The number of words that can be formed from the given Directed Acyclic Word Graph is 4

Question 11 of 50

12. If a Graph Structured Stack contains {1,2,3,4} {1,5,3,4} {1,6,7,4} and {8,9,7,4}, what would be the source and sink vertices of the DAC?

Question 12 of 50

13. How many extra nodes are there in Full K-ary tree than complete K-ary tree?

Question 13 of 50

14. Pushing an element into stack already having five elements and stack size of 5, then stack becomes ___________

Question 14 of 50

15. Which of the following data clustering algorithm uses suffix tree in search engines?

Question 15 of 50

16. All paths and cyclic graphs are bipartite graphs.

Question 16 of 50

17. What is the space complexity of a linear queue having n elements?

Question 17 of 50

18. What is a memory efficient double linked list?

Question 18 of 50

19. Matrix A when multiplied with Matrix C gives the Identity matrix I, what is C?

Question 19 of 50

20. For the given expression tree, write the correct postfix expression.
The given expression tree gives the infix expression a+b*c

Question 20 of 50

21. Which of the following is the correct function definition for quadratic probing?

Question 21 of 50

22. What will be the auxiliary space complexity of the following code?

#include <bits/stdc++.h> 
using namespace std; 
void func1(int arr[], int n) 
{ 
	int k = arr[0], i; 
	for (i = 0; i < n - 1; i++) 
		arr[i] = arr[i + 1]; 

	arr[i] = k; 
} 

void func(int arr[], int d, int n) 
{ 
	for (int i = 0; i < d; i++) 
		func1(arr, n); 
} 

void printArray(int arr[], int n) 
{ 
	for (int i = 0; i < n; i++) 
		cout << arr[i] << " "; 
} 

int main() 
{ 
	int arr[] = { 1, 2, 3, 4, 5}; 
	int n = sizeof(arr) / sizeof(arr[0]); 

    int d = 3;
	func(arr, d, n); 
	printArray(arr, n); 

	return 0; 
} 

Question 22 of 50

23. Which of the following techniques offer better cache performance?

Question 23 of 50

24. Every Directed Acyclic Graph has at least one sink vertex.

Question 24 of 50

25. Which of the following is not a disadvantage to the usage of array?

Question 25 of 50

26. What will be the time complexity of the following code?

#include <bits/stdc++.h> 
using namespace std; 
void func(int arr[], int left, int right) 
{ 
    if (left >= right) 
    return; 
      
    int temp = arr[left];  
    arr[left] = arr[right]; 
    arr[right] = temp; 
      
    func(arr, left + 1, right - 1);  
}      

void printArray(int arr[], int size) 
{ 
    for (int i = 0; i < size; i++) 
    cout << arr[i] << " "; 
} 

int main() 
{ 
	int arr[] = {1,2,3,4}; 
	int n = sizeof(arr) / sizeof(arr[0]); 
	func(arr, 0, n-1); 
	printArray(arr, n); 
	return 0; 
} 

Question 26 of 50

27. What is the time complexity for converting decimal to binary numbers?

Question 27 of 50

28. What is the fundamental operation on leftist heap?

Question 28 of 50

29. Given the pseudo code, state whether the function for merging of two heap is correct or not?

		mergeTree(p,q)
    		if p.root.value <= q.root.value
        	return p.addTree(q)
    		else
        	return q.addTree(p)

Question 29 of 50

30. The roots of the elements of the subtrees are smaller than the root of the heap.

Question 30 of 50

31. What is the condition for priority of a node in a treap?

Question 31 of 50

32. Array is divided into two parts in ____________

Question 32 of 50

33. Which of the following is a self - balancing binary search tree?

Question 33 of 50

34. What is the time complexity for deleting the string to form a new string in the rope data structure?

Question 34 of 50

35. What are different ways of implementing free lists and which is simple among them?

Question 35 of 50

36. How many types of the merge are available in skew heaps?

Question 36 of 50

37. What is the time complexity for finding a maximum and minimum integer in Van Emde Boas data structure?

Question 37 of 50

38. In which of the following self - balancing binary search tree the recently accessed element can be accessed quickly?

Question 38 of 50

39. What is the space complexity of the in-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes)

Question 39 of 50

40. Is it true that splay trees have O(logn) amortized complexity ?

Question 40 of 50

41. What is the condition for two elements arr[i] and arr[j] to form an inversion?

Question 41 of 50

42. How many top trees are there in a tree with single vertex?

Question 42 of 50

43. Can leaf node be called child node in a K-ary tree?

Question 43 of 50

44. Which of the following are used as an internal operation in Top tree?

Question 44 of 50

45. Can suffix tree be used in bioinformatics problems and solutions.

Question 45 of 50

46. Select the appropriate code which reverses a word.

Question 46 of 50

47. An error is thrown if the character ‘\n’ is pushed in to the character stack.

Question 47 of 50

48. In the given figure, find ‘?’.
B is initially the right child of X then rotated right side

Question 48 of 50

49. Suppose X is the starting symbol of the given grammar with the following transition rules. Compute the value of X as the root of the parse tree for the expression: 3 & 4 % 7.
X → X1 & B | B {X.value = X1.value + B.value, X.value = B.value}
B → B1 % D | D {B.value = B1.value * D.value, B.value = D.value}
D → num {D.value = num.value}

Question 49 of 50

50. Elements in an array are accessed _____________

Question 50 of 50


 

Topic wise Test Quizzes on Data Structure

Data Structure tests, quizzes, and exams are great ways to learn and test your Data Structure skills. Whether you’re a beginner or experienced, challenge and boost your confidence with our engaging online quizzes on Data Structure Basics, Linked List, Stack, Queue, Expression Conversions, Arrays Types, List Types, Binary Tree, B-Tree, Trees, Heap, Trie, Hash Table and Graph Data Structure. Start the Data Structure online test now!

Data Structure Basic Quiz

Abstract Data Types Quiz

Expression Evaluation Quiz

Arrays Types Quiz

Types of Lists Quiz

Binary Tree Quiz



Data Structure Certification Test

Data Structure Certification Test is a free certification exam. However, you need to score an A grade in each of the "Certification Level Tests 1 to 10" to be eligible to take part in this certification test. So, take all the "10 Tests" starting from Certification Level 1 upto Level 10, before taking the final Certification test.


Level 1 to 10 Tests:
Total Questions: 25, Total Time: 30 min, Correct Answer: 2 points, Wrong Answer: -1 point

Certification Test:
Total Questions: 50, Total Time: 1 hour, Correct Answer: 2 points, Wrong Answer: -1 point

Data Structure Internship Test

If you scored either Grade A* or Grade A in our Data Structure Internship Test, then you can apply for Internship at Sanfoundry in Data Structure.


Total Questions: 50, Total Time: 1 hour, Correct Answer: 2 points, Wrong Answer: -1 point

Data Structure Job Test

It is designed to test and improve your skills for a successful career, as well as to apply for jobs.


Total Questions: 50, Total Time: 1 hour, Correct Answer: 2 points, Wrong Answer: -1 point

Note: Before you get started on these series of online tests, you should practice our collection of 1000 MCQs on Data Structure .

Sanfoundry Scoring & Grading System

Sanfoundry tests and quizzes are designed to provide a real-time online exam experience. Here is what you need to know about them.

  • Scoring System: You get 2 points for each correct answer but lose 1 point for every wrong answer.
  • Grading System: Your grade depends on your final score and can be one of the following:

    • Grade A* - Genius (100%)
    • Grade A - Excellent (80% to 99%)
    • Grade B - Good (60% to 80%)
    • Grade C - Average (40% to 60%)
    • Grade D - Poor (0% to 40%)
advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.