Page 1

UNIT-7 Q.1 Is a linked list a linear or non-linear data structure? (a) Linear (b) Non-linear (c) Can’t say (d) None Q.2 How can I search for data in a linked list? (a) Non-linear search (b) Linear search (c) Can’t say (d) None Q.3 What is each entry in a linked list called? (a) Element (b) Node (c) Value (d) None Q.4 The value of the first linked-list index is ____________ (a) –1 (b) 0 (c) 1 (d) none Q.5 ____________ form of access is used to add and remove nodes from a queue. (a) FIFO (b) LIFO (c) FILO (d) None Q.6 New nodes are added to the ____________ of the queue. (a) front (b) back (c) middle (d) none Q.7 A dequeue (or double-ended queue) is a sequence of elements with the property that elements can be added, inspected, and removed at ____________ (a) either end (b) one end (c) both ends (d) none Q.8 What is the benefit of using a queue linked list? (a) Queue for scheduling (b) Queue is faster than stack (c) Both (d) None Q.9 The StackLinkedList class inherits the LinkedList class (a) True (b) False (c) Can’t say (d) None Q.10 The stack top is initialized to____________ value. (a) 0 (b) 1 (c) –1 (d) none Q.11 Convert the infix expression (A – B) * C + D to postfix. (a) A B – C * D + (b) AB-CD+* (c) AB–CD*+ (d) none Q.12 Entries in a stack are ‘ordered’. What is the meaning of this statement? (a) A collection of stacks can be sorted. (b) Stack entries may be compared with the ‘<’ operation.











(c) The entries must be stored in a linked list. (d) There is a first entry, a second entry, and so on. The operation for adding an entry to a stack is traditionally called (a) add (b) append (c) insert (d) push The operation for removing an entry from a stack is traditionally called (a) delete (b) peek (c) pop (d) remove Which of the following stack operations could result in stack underflow? (a) is_empty (b) pop (c) push (d) Two or more of the above answers Which of the following applications may use a stack? (a) A parentheses balancing program (b) Keeping track of local variables at run time (c) Syntax analyzer for a compiler (d) All of the above In the linked-list implementation of the stack class, where does the push method place the new entry on the linked list? (a) At the head (b) At the tail (c) After all other entries that are greater than the new entry (d) After all other entries that are smaller than the new entry Convert (6 + 2) * 5 – 8 / 4 into postfix. (a) 62+584/–* (b) 62+5*84–/ (c) 6 2 + 5 * 8 4 / – (d) None Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent polish notation. (a) –^*+ABC–DE+FG (b) ^ – * +ABC – DE + FG (c) ^*–+ABC–DE+FG (d) None Convert the expression ((A + B) * C – (D – E) ^ (F + G)) to equivalent reverse polish notation. (a) AB+C*DE-FG+^– (b) AB+CDE*--FG+^ (c) AB + C * DE - - FG + ^ (d) None The minimum number of queues needed to implement the priority queue are (a) one (b) two (c) can’t say (d) none In tree construction which is the suitable efficient data structure? (a) Array (b) Linked list (c) Stack (d) Queue 106

Q.23 The first operation performed on a stack is____________ (a) deletion (b) insertion (c) both (d) none Q.24 Stack is said to be overflow when____________ (a) top=max–1 (b) top=max (c) top=–1 (d) none Q.25 The process of allocating memory at run time is called____________ (a) run time allocation (b) compile time allocation (c) dynamic memory allocation (d) both a and c Q.26 Local variables are stored in____________ (a) stack (b) heap (c) memory (d) none Q.27 Operations performed on a linked list is/are____________ (a) traversing the list (b) inserting an item (c) creating a list (d) All the above Q.28 The free memory region is called____________ (a) heap (b) stack (c) both (d) none Q.29 A block of memory can be requested at run time using____________ (a) malloc (b) calloc (c) both (d) none Q.30 Multiple blocks of memory can be allocated using____________ (a) malloc (b) calloc (c) can’t say (d) both Q.31 Memory space must be explicitly released in dynamic run-time allocation. (a) True (b) False (c) Can’t say (d) None Q.32 Realloc is used for____________ (a) Reallocation of memory (b) free memory space (c) none (d) can’t say Q.33 A double-linked list is said to be empty when____________ (a) rear=front–1 (b) rear =front=0 (c) rear=front (d) none Q.34 A double-linked list is said to be overflow when____________ (a) rear=front (b) rear>=max–1 (c) none Q.35 Evaluate the postfix expression 22*1+ (a) 6 (b) 4 107














(c) 5 (d) 7 Convert a$b*c-d+e/f/(g+h) into a postfix expression. (a) ab$cd-* ef/gh+/+ (b) ab$c*d-ef/gh/++ (c) ab$c*d-ef/gh+/+ (d) None A circular queue is said to be underflow when____________ (a) (rear+1)%max=front (b) (front+1)%max=rear (c) rear=front (d) none A ___________ is a way of organizing data that considers not only the items stored, but also their relationship to each other. (a) linked list (b) data structure (c) both (d) none The areas in which data structures are applied extensively are (a) Numerical Analysis, (b) Graphics, (c) Artificial Intelligence (d) All A circular queue is said to be overflow when____________ (a) (rear+1)%max=front (b) (front+1)%max=rear (c) rear=front (d) none The highest precedence operator is____________ (a) $ (b) ^ (c) * (d) () Among the following which is fastest to implement? (a) Array (b) Linked list (c) Depends on application (d) Both a and b To place the elements in a particular place ____________ is used. (a) array (b) linked list (c) both (d) canâ&#x20AC;&#x2122;t say In an input restricted deque elements are insert from____________ (a) left (b) right (c) either side (d) none Convert abc$+ into infix. (a) a$b+c (b) a+b$c (c) a$bc+ (d) None The data structures used to perform recursion are (a) queue (b) stacks (c) both (d) none Evaluate the postfix expression 23+5*. (a) 11 (b) 25 (c) 13 (d) None Stacks are used in____________ (a) calculators (b) computers 108

(c) both (d) none Q.49 Convert ab$c*d-ef/gh+/+ into infix. (a) a*b$c-d+e/f/(g+h) (b) a$b*c+d-e/f/(g+h) (c) a$b*c-d+e/f/(g+h) (d) none Q.50 Structures which contain a member field that points to the same structure type are called-____________ (a) self-referential structure (b) recursive structure (c) both (d) none Answers 1. (a) 2. (b) 3. (b) 4. (d) 5. (a) 6. (b) 7. (c) 8. (c) 9. (a) 10. (c) 11. (a) 12. (d) 13. (d) 14. (c) 15. (a) 16. (d) 17. (a) 18. (c) 19. (b) 20. (c) 21. (b) 22. (b) 23. (b) 24. (a) 25. (d) 26. (a) 27. (d) 28. (a) 29. (c) 30. (b) 31. (a) 32. (a) 33. (a) 34. (b) 35. (c) 36. (c) 37. (a) 38. (b) 39. (d) 40. (a) 41. (d) 42. (c) 43. (b) 44. (b) 45. (b) 46. (b) 47. (b) 48. (c) 49. (c) 50. (a) Q.51 Which of the following is the feature of stack? All operations are at one end and it cannot reuse its memory Ans: Any element can be accessed from it directly. Q.52 When stacks created, they areâ&#x20AC;Ś Ans: initially empty Q.53 What is time required to insert an element in a stack with linked implementation? Ans: (log 2n) Q.54 The time taken for addition of an element in a queue is Ans: (log n) Q.55 When is a linear queue said to be empty? Front==rear Ans: Front=rear Q.56 When queues are created, they are Ans: initially empty Q.57 What is the type of algorithm used in solving the 8 Queens problem? (a) Queues (b) Semaphores (c) Backtracking (d) Dijkstra Q.58 In which data structure, elements can be added or removed at either end, but not in 109

the middle? (a) Linked List (b) Double ended Queue (c) stack (d) none Q.59 Which sort shows the best average behavior? (a) Quick sort (b) Bubble sort (c) Insertion sort (d) Heap sort Q.60 Which data structure is needed to convert infix notations to post fix notations? (a) stack (b) queue (c) linked list (d) d-queue Q.61 What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm? (a) queue (b) linked list (c) stack (d) double linked list Miscellaneous Questions Q.1 What is a data structure? Ans: 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. Q.2 List 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 Q.3 What are the major data structures used in the following areas: RDBMS, Network data model and Hierarchical data model? Ans: RDBMS-Array (i.e., Array of structures) Network data model-Graph Hierarchical data model-Trees Q.4 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 and pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. A void pointer is capable of storing a pointer to any type as it is a generic pointer type. Q.5 What is the minimum number of queues needed to implement the priority queue? Ans: Two. One queue is used for actual storing of data and another for storing priorities. Q.6 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 110

function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, an explicit stack is to be used. Answers 57. (c) 61. (c)

58. (b)

59. answer missing


60. (a)


UNIT-7 106 107 108 109 110 function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures ar...

Read more
Read more
Similar to
Popular now
Just for you