Wednesday, 19 September 2012

DS Interview Questions-2


21. What are the disadvantages of linear list?
Ans:
i) We cannot reach any of the nodes that precede node (p)
ii) If a list is traversed, the external pointer to the list must be persevered in order to reference the list again.

22. Define circular list?
Ans: 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

23. What are the disadvantages of circular list?
Ans:
i) We can’t traverse the list backward
ii) If a pointer to a node is given we cannot delete the node

24. Define double linked list?
Ans: It is a collection of data elements called nodes, where each node is divided into three parts
i) An info field that contains the information stored in the node
ii) Left field that contain pointer to node on left side
iii) Right field that contain pointer to node on right side

25. Is it necessary to sort a file before searching a particular item ?
Ans: 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.

26. What are the issues that hamper the efficiency in sorting a file?
Ans: The issues are
i) Length of time required by the programmer in coding a particular sorting program
ii) Amount of machine time necessary for running the particular program
iii)The amount of space necessary for the particular program.

27. Calculate the efficiency of sequential search?
Ans: 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).

28. Is any implicit arguments are passed to a function when it is called?
Ans: 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.

29. Parenthesis is never required in Postfix or Prefix expressions, why?
Ans: 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

30. List out the areas in which data structures are applied extensively?
Ans: 
  • Compiler Design
  • Operating System
  • Database Management System
  • Statistical analysis package
  • Numerical Analysis
  • Graphics
  • Artificial Intelligence
  • Simulation

No comments:

Post a Comment