PCBWay

Question 1. What Is Data Structure?

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.

Question 2. What Are The Goals Of Data Structure?

It must rich enough in structure to reflect the actual relationship of data in real world. The structure should be simple enough for efficient processing of data.

Question 3. What Does Abstract Data Type Mean?

Data type is a collection of values and a set of operations on these values. Abstract data type refer to the mathematical concept that define the data type. It is a useful tool for specifying the logical properties of a data type.

ADT consists of two parts

  1. Values definition
  2.  Operation definition

Example:-The value definition for the ADT RATIONAL states that RATIONAL value consists of two integers, second doesn’t equal to zero.

The operator definition for ADT RATIONAL includes the operation of creation (make rational) addition, multiplication and test for equality.

Question 4. What Is The Difference Between A Stack And An Array?

STACK:

  • Stack is a ordered collection of items.
  •  Stack is a dynamic object whose size is constantly changing as items are pushed and popped.
  • Stack may contain different data types.
  • Stack is declared as a structure containing an array to hold the element of the stack, and an integer to indicate the current stack top within the array.

ARRAY:

  • Array is an ordered collection of items.
  • Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array.
  • It contains same data types.
  • Array can be home of a stack i.e. array can be declared large enough for maximum size of the stack.

Question 5. What Do You Mean By Recursive Definition?

The definition which defines an object in terms of simpler cases of itself is called recursive definition.

Question 6. What Is Sequential Search?

In sequential search each item in the array is compared with the item being searched until a match occurs. It is applicable to a table organized either as an array or as a linked list.

Question 7. What Actions Are Performed When A Function Is Called?

  • When a function is called arguments are passed.
  •  local variables are allocated and initialized.
  •  transferring control to the function.

Question 8. What Actions Are Performed When A Function Returns?

Return address is retrieved.
ii) Function’s data area is freed.
iii) Branch is taken to the return address.

Question 9. What Is A Linked List?

A linked list is a linear collection of data elements, called nodes, where the linear order is given by pointers. Each node has two parts first part contain the information of the element second part contains the address of the next node in the list.

Question 10. What Are The Advantages Of Linked List Over Array (static Data Structure)?

The disadvantages of array are:

  • unlike linked list it is expensive to insert and delete elements in the array.
  • One can’t double or triple the size of array as it occupies block of memory space.

In linked list

  • each element in list contains a field, called a link or pointer which contains the address of the next element.
  • Successive element’s need not occupy adjacent space in memory.

Question 11. We Apply Binary Search Algorithm To A Sorted Linked List, Why?

No we cannot apply binary search algorithm to a sorted linked list, since there is no way of indexing the middle element in the list. This is the drawback in using linked list as a data structure.

Question 12. What Do You Mean By Free Pool?

Pool is a list consisting of unused memory cells which has its own pointer.

Question 13. What Do You Mean By Garbage Collection?

It is a technique in which the operating system periodically collects all the deleted space onto the free storage list. It takes place when there is minimum amount of space left in storage list or when CPU is ideal. The alternate method to this is to immediately reinsert the space into free storage list which is time consuming.

Question 14. What Do You Mean By Overflow And Underflow?

When new data is to be inserted into the data structure but there is no available space i.e. free storage list is empty this situation is called overflow. When we want to delete data from a data structure that is empty this situation is called underflow.

Question 15. What Are The Disadvantages Array Implementations Of Linked List?

The no of nodes needed can’t be predicted when the program is written.
ii) The no of nodes declared must remain allocated throughout its execution.

Question 16. What Is A Queue?

A queue is an ordered collection of items from which items may be deleted at one end (front end) and items inserted at the other end (rear end). It obeys FIFO rule there is no limit to the number of elements a queue contains.

Question 17. What Is A Priority Queue?

The priority queue is a data structure in which the intrinsic ordering of the elements (numeric or alphabetic)

Determines the result of its basic operation. It is of two types:

  1. Ascending priority queue- Here smallest item can be removed (insertion is arbitrary).
  2.  Descending priority queue- Here largest item can be removed (insertion is arbitrary).

Question 18. What Are The Disadvantages Of Sequential Storage?

  • Fixed amount of storage remains allocated to the data structure even if it contains less element.
  • No more than fixed amount of storage is allocated causing overflow.

Question 19. What Are The Disadvantages Of Representing A Stack Or Queue By A Linked List?

  • A node in a linked list (info and next field) occupies more storage than a corresponding element in an array.
  • Additional time spent in managing the available list.

Question 20. What Is Dangling Pointer And How To Avoid It?

After a call to free(p) makes a subsequent reference to *p illegal, i.e. though the storage to p is freed but the value of p(address) remain unchanged .so the object at that address may be used as the value of *p (i.e. there is no way to detect the illegality).Here p is called dangling pointer.

To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesn’t reference a storage location it is a pointer that doesn’t point to anything.

Question 21. What Are The Disadvantages Of Linear List?

  • We cannot reach any of the nodes that precede node (p).
  • If a list is traversed, the external pointer to the list must be persevered in order to reference the list again.

Question 22. Define Circular List?

In linear list the next field of the last node contain a null pointer, when a next field in the last node contain a pointer back to the first node it is called circular list.

Advantages – From any point in the list it is possible to reach at any other point.

Question 23. What Are The Disadvantages Of Circular List?

  • We can’t traverse the list backward.
  • If a pointer to a node is given we cannot delete the node.

Question 24. Define Double Linked List?

It is a collection of data elements called nodes, where each node is divided into three parts:

  1. An info field that contains the information stored in the node.
  2. Left field that contain pointer to node on left side.
  3. Right field that contain pointer to node on right side.

Question 25. Is It Necessary To Sort A File Before Searching A Particular Item ?

If less work is involved in searching a element than to sort and then extract, then we don’t go for sort.

If frequent use of the file is required for the purpose of retrieving specific element, it is more efficient to sort the file.

Thus it depends on situation.

Question 26. What Are The Issues That Hamper The Efficiency In Sorting A File?

The issues are:

Length of time required by the programmer in coding a particular sorting program.

Amount of machine time necessary for running the particular program. The amount of space necessary for the particular program .

Question 27. Calculate The Efficiency Of Sequential Search?

The number of comparisons depends on where the record with the argument key appears in the table.

If it appears at first position then one comparison
If it appears at last position then n comparisons
Average=(n+1)/2 comparisons
Unsuccessful search n comparisons
Number of comparisons in any case is O (n).

Question 28. Is Any Implicit Arguments Are Passed To A Function When It Is Called?

Yes there is a set of implicit arguments that contain information necessary for the function to execute and return correctly. One of them is return address which is stored within the function’s data area, at the time of returning to calling program the address is retrieved and the function branches to that location.

Question 29. Parenthesis Is Never Required In Postfix Or Prefix Expressions, Why?

Parenthesis is not required because the order of the operators in the postfix /prefix expressions determines the actual order of operations in evaluating the expression.

Question 30. List Out The Areas In Which Data Structures Are Applied Extensively?

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

Question 31. What Are The Major Data Structures Used In The Following Areas : Network Data Model & Hierarchical Data Model?

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

32. If You Are Using C Language To Implement The Heterogeneous Linked List, What Pointer Type Will You Use?

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.

Question 33. Minimum Number Of Queues Needed To Implement The Priority Queue?

Two. One queue is used for actual storing of data and another for storing priorities.

Question 34. What Is The Data Structures Used To Perform Recursion?

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.

Question 35. What Are The Notations Used In Evaluation Of Arithmetic Expressions Using Prefix And Postfix Forms?

Polish and Reverse Polish notations.

Question 36. Convert The Expression ((a + B) * C – (d – E) ^ (f + G)) To Equivalent Prefix And Postfix Notations?

Prefix Notation:

^ – * +ABC – DE + FG

postfix Notation:

AB + C * DE – – FG + ^

Question 37. List Out Few Of The Application Of Tree Data-structure?

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

Question 38. List Out Few Of The Applications That Make Use Of Multilinked Structures?

Sparse matrix, Index generation.

Question 39. What Is The Type Of The Algorithm Used In Solving The 8 Queens Problem?

Backtracking.

Question 40. In An Avl Tree, At What Condition The Balancing Is To Be Done?

If the ‘pivotal value’ (or the ‘Height factor’) is greater than 1 or less than –1.

Question 41. There Are 8, 15, 13, 14 Nodes Were There In 4 Different Trees. Which Of Them Could Have Formed A Full Binary Tree?

In general: There are 2n-1 nodes in a full binary tree. 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.

Question 42. In Rdbms, What Is The Efficient Data Structure Used In The Internal Storage Representation?

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.

Question 43. What Is A Spanning Tree?

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.

Question 44. Does The Minimal Spanning Tree Of A Graph Give The Shortest Distance Between Any 2 Specified Nodes?

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 minimal-spanning tree is minimum.

Question 45. Difference Between Calloc And Malloc ?

malloc: allocate n bytes.
calloc: allocate m times n bytes initialized to 0.

Question 46. What Are The Major Data Structures Used In The Following Areas : Rdbms, Network Data Model & Hierarchical Data Model?

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

Question 47. Which File Contains The Definition Of Member Functions?

Definitions of member functions for the Linked List class are contained in the LinkedList.cpp file.

Question 48. 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.

Question 49. 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.

Question 50. What Is Linked List ?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.