Sei sulla pagina 1di 11

ASSURE CAMPUS

STEP UP
DATA STRUCTURES TECHNICAL QUESTIONS
1.What is data structure? Answer: A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data. 2. List out the areas in which data structures are applied extensively? Answer: The name of areas are:

Compiler Design, Operating System, Database Management System, Statistical analysis package, Numerical Analysis, Graphics, Artificial Intelligence, Simulation

3.What are the major data structures used in the following areas : RDBMS, Network data model & Hierarchical data model. Answer: The major data structures used are as follows:

RDBMS - Array (i.e. Array of structures) Network data model - Graph Hierarchical data model - Trees

4. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? Answer: The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type. 5 Minimum number of queues needed to implement the priority queue? Answer: Two. One queue is used for actual storing of data and another for storing priorities. 6 What is the data structures used to perform recursion? Answer: Stack. Because of its LIFO (Last In First Out) property it remembers its 'caller' so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used. 7 What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms? Answer: Polish and Reverse Polish notations. Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP
8 Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix and Postfix notations. Answer: Prefix Notation: ^ - * +ABC - DE + FG Postfix Notation: AB + C * DE - - FG + ^ 9 How many null branches are there in a binary tree with 20 nodes? Answer: 21 Let us take a tree with 5 nodes (n=5)

It will have only 6 A binary tree with n nodes has exactly n+1 null nodes.

(ie,5+1)

null

branches.

10 What are the methods available in storing sequential files? Answer: The methods available in storing sequential files are:

Straight merging, Natural merging, Polyphase sort, Distribution of Initial runs.

11 How many different trees are possible with 10 nodes ? Answer: 1014 For example, consider a tree with 3 nodes(n=3), it will have the maximum combination of 5 different (ie, 23 - 3 = 5) trees.

ii iii iv v Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP
In If there are n nodes, there exist 2n-n different trees. 12 List out few of the Application of tree data-structure? Answer: The list is as follows:

general:

The manipulation of Arithmetic expression, Symbol Table construction, Syntax analysis.

13 List out few of the applications that make use of Multilinked Structures? Answer: The applications are listed below:

Sparse matrix, Index generation.

14 In tree construction which is the suitable efficient data structure? Answer: Linked list is the efficient data structure.

15 What is the type of the algorithm used in solving the 8 Queens problem? Answer: Backtracking

16.In an AVL tree, at what condition the balancing is to be done? Answer: If the 'pivotal value' (or the 'Height factor') is greater than 1 or less than -1.

17.What is the bucket size, when the overlapping and collision occur at same time? Answer: One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. This results in the overlapping of values.

Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP

18.Traverse the given tree using Inorder, Preorder and Postorder traversals.

Answer:

Inorder : D H B E A F C I G J Preorder: A B D H E C F G I J Postorder: H D E B F I J G C A

19.There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have formed a full binary tree? Answer: In There are 2n-1 nodes in a full binary tree. 15. general:

By the method of elimination: Full binary trees contain odd number of nodes. So there cannot be full binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree. So the correct answer is 15. 20.In the given binary tree, using array you can store the node 4 at which location?

Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP

Answer: At location 6 1 2 3 4 5

Root LC1 RC1 LC2 RC2 LC3 RC3 LC4 RC4 where LCn means Left Child of node n and RCn means Right Child of node n 21.For the given graph, draw the DFS and BFS?

Answer:

BFS: A X G H P E M Y J DFS: A X H P E Y M J G

22.Classify the Hashing Functions based on the various methods by which the key value is found. Answer: The list of Hashing functions is as follows:

Direct method Subtraction method Modulo-Division method Digit-Extraction method Mid-Square method Folding method Pseudo-random method

Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP
23.What are the types of Collision Resolution Techniques and the methods used in each of the type? Answer: The types of Collision Resolution Techniques are:

Open addressing The methods used include: Overflow block Closed addressing The methods used include: Linked list Binary tree

(closed (open

hashing) hashing)

24.In RDBMS, what is the efficient data structure used in the internal storage representation? Answer: B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes. 25.Draw the B-tree of order 3 created by inserting the following data arriving in sequence - 92 24 6 7 11 8 22 4 5 16 19 20 78 Answer:

26.What is a spanning Tree? Answer: A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized. 27.Does the minimum spanning tree of a graph give the shortest distance between any 2 specified nodes? Answer: No. Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn't mean that the distance between any two nodes involved in the minimum-spanning tree is minimum. 28.Convert the given graph with weighted edges to minimal spanning tree.

Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP

Answer: the equivalent minimal spanning tree is:

29.Whether Linked List is linear or Non-linear data structure? Answer: According to Access strategies Linked According to Storage Linked List is a Non-linear one. 30.Draw a binary Tree for the expression : A * B - (C + D) * (P / Q) Answer:

list

is

linear

one.

31.How is the front of the queue calculated in data structure? The front of the queue is calculated by front = (front+1) % size. 32.What does each entry in the Link List called? Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP
Each entry in a linked list is called a node. Think of a node as an entry that has three sub entries. One sub entry contains the data, which may be one attribute or many attributes. Another points to the previous node, and the last points to the next node. When you enter a new item on a linked list, you allocate the new node and then set the pointers to previous and next nodes. 33. What is Linked List in data structure? Linked List is one of the fundamental data structures. It consists of a sequence of nodes, each containing arbitrary data fields and one or two (links) pointing to the next and/or previous nodes. A linked list is a self-referential datatype because it contains a pointer or link to another data of the same type. Linked lists permit insertion and removal of nodes at any point in the list in constant time, but do not allow random access. 34.What member function places a new node at the end of the linked list? The appendNode() member function places a new node at the end of the linked list. The appendNode() requires an integer representing the current data of the node. 35. How is any Data Structure application is classified among files? A linked list application can be organized into a header file, source file and main application file. The first file is the header file that contains the definition of the NODE structure and the LinkedList class definition. The second file is a source code file containing the implementation of member functions of the LinkedList class. The last file is the application file that contains code that creates and uses the LinkedList class.

36. Which file contains the definition of member functions? Definitions of member functions for the Linked List class are contained in the LinkedList.cpp file. 37.What are the major data structures used in the following areas : RDBMS, Network data model & Hierarchical data model? 1. RDBMS Array (i.e. Array of structures) 2. Network data model Graph 3. Hierarchical data model Trees. 38.Difference between calloc and malloc in data structures? malloc: allocate n bytes calloc: allocate m times n bytes initialized to 0. 39.What is the quickest sorting method to use? The answer depends on what you mean by quickest. For most sorting problems, it just doesn't matter how quick the sort is because it is done infrequently or other operations take significantly more time anyway. Even in cases in which sorting speed is of the essence, there is no one answer. It depends on not only the Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP
size and nature of the data, but also the likely order. No algorithm is best in all cases. There are three sorting methods in this author's toolbox that are all very fast and that are useful in different situations. Those methods are quick sort, merge sort, and radix sort. 40.How can I search for data in a linked list? Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list's members can be accessed is sequentially. Sometimes it is quicker to take the data from a linked list and store it in a different data structure so that searches can be more efficient. 41. What is the heap in data structures? The heap is where malloc(), calloc(), and realloc() get memory. Getting memory from the heap is much slower than getting it from the stack. On the other hand, the heap is much more flexible than the stack. Memory can be allocated at any time and deallocated in any order. Such memory isn't deallocated automatically; you have to call free(). Recursive data structures are almost always implemented with memory from the heap. Strings often come from there too, especially strings that could be very long at runtime. If you can keep data in a local variable (and allocate it from the stack), your code will run faster than if you put the data on the heap. Sometimes you can use a better algorithm if you use the heap faster, or more robust, or more flexible. Its a tradeoff. If memory is allocated from the heap, its available until the program ends. That's great if you remember to deallocate it when you're done. If you forget, it's a problem. A memory leak is some allocated memory that's no longer needed but isn't deallocated. If you have a memory leak inside a loop, you can use up all the memory on the heap and not be able to get any more. (When that happens, the allocation functions return a null pointer.) In some environments, if a program doesn't deallocate everything it allocated, memory stays unavailable even after the program ends. 42. What is the easiest sorting method to use in data structures? The answer is the standard library function qsort(). It's the easiest sort by far for several reasons: It is already written. It is already debugged. It has been optimized as much as possible (usually). Void qsort(void *buf, size_t num, size_t size, int (*comp)(const void *ele1, const void *ele2)); 43. What is the bucket size, when the overlapping and collision occur at same time? One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. This results in the overlapping of values. 44. What are the major data structures used in the following areas : network data model & Hierarchical data model. Ans: RDBMS Array (i.e. Array of structures) Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP
Network data Hierarchical data model Trees model Graph 45. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? Ans: The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type. 46.Minimum number of queues needed to implement the priority Ans: Two. One queue is used for actual storing of data and another for storing priorities. queue?

47.What is the data structures used to perform recursion? Ans: Stack. Because of its LIFO (Last In First Out) property it remembers its caller so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used. 48.What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix? Ans: Polish and Reverse Polish notations. 49.Convert the expression ((A + B) * C (D E) ^ (F + G)) to equivalent Prefix and Postfix notations. Ans:PrefixNotation: ^*+ABCDE+FG PostfixNotation: AB + C * DE FG + ^ 50.Sorting is (a)Insertion (b)Selection (c)Exchange (d) Deletion not possible by using which of the following methods?

Ans:(d)Deletion. Using insertion we can perform insertion sort, using selection we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting methods). But no sorting method can be done just using deletion. 51.List out Ans: The Symbol Syntax analysis. few manipulation of the Application of Table of Arithmetic tree data-structure? expression, construction,

Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

ASSURE CAMPUS

STEP UP
52. List out few of the applications Ans: Sparse matrix, Index generation. that make use of Multilinked Structures?

Address: 132-C, Zone-I, M.P. Nagar, Bhopal-11 Ph: 0755-4700097, 8120139750 Email: visionstepup@gmail.com

Potrebbero piacerti anche