Unit Iii Linear Data Structures: Syllabus
Unit Iii Linear Data Structures: Syllabus
SYLLABUS:
Arrays and its representations – Stacks and Queues – Linked lists – Linked list-based
implementation of Stacks and Queues – Evaluation of Expressions – Linked list based
polynomial addition
12.In a stack, if a user tries to remove an element from empty stack it is called
a)Underflow
b)Empty collection
c)Overflow
d)Garbage Collection
Answer:a
13.Pushing an element into stack already having five elements and stack size of 5, then stack
becomes
a)Overflow
b)Crash
c)Underflow
d)User flow
14.Entries in a stack are “ordered”. What is the meaning of this statement?
a)A collection of stacks is sortable
b)Stack entries may be compared with the ‘<‘ operation
c)The entries are stored in a linked list
d)There is a Sequential entry that is one by one
Answer:d
16.Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the
algorithm analyzes: (()(())(())) are:
a)1
b)2
c)3
d)4 or more
Answer:c
17.Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right
parentheses (in some order).
The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the
computation?
a)1
b)2
c)3
d)4 or more
Answer:b
19.Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm to
convert the expression from infix to postfix notation.
The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion
of this expression?
a)1
b)2
c)3
d)4
Answer: d
20.The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
a)AB+ CD*E – FG /**
b)AB + CD* E – F **G /
c)AB + CD* E – *F *G /
d)AB + CDE * – * F *G /
Answer: c
21.The data structure required to check whether an expression contains balanced parenthesis is?
a)Stack
b)Queue
c)Array
d)Tree
Answer:a
22.What data structure would you mostly likely see in a non recursive implementation of a recursive
algorithm?
a)Linked List
b)Stack
c)Queue
d)Tree
Answer:b
23.The process of accessing data stored in a serial access memory is similar to manipulating data on
a
a)Heap
b)Binary Tree
c)Array
d)Stack
Answer:d
31.Convert the following infix expressions into its equivalent postfix expressions (A + B ⋀D)/(E – F)+G
a)(A B D ⋀ + E F – / G +)
b)(A B D +⋀ E F – / G +)
c)(A B D ⋀ + E F/- G +)
d)(A B D E F + ⋀ / – G +)
Answer:a
33.Which of the following statement(s) about stack data structure is/are NOT correct?
a)Linked List are used for implementing Stacks
b)Top of the Stack always contain the new node
c)Stack is the FIFO data structure
d)Null link is present in the last node at the bottom of the stack
Answer: c
37.Assume that the operators +,-, X are left associative and ^ is right associative.
The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix
expression a
+ b X c – d ^ e ^ f is
a)abc X+ def ^^ –
b)abc X+ de^f^ –
c)ab+cXd – e ^f^
d)-+aXbc^ ^def
Answer:b
38.If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is
the order of removal?
a)ABCD
b)DCBA
c)DCAB
d)ABDC
Answer:b
39.A linear list of elements in which deletion can be done from one end (front) and insertion can
take place only at the other end (rear) is known as a ?
a)Queue
b)Stack
c)Tree
d)Linked list
Answer:a
42.If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what
order will they be removed?
a)ABCD
b)DCBA
c)DCAB
d)ABDC
Answer:a
43.A data structure in which elements can be inserted or deleted at/from both the ends but not in
the middle is?
a)Queue
b)Circular queue
c)Dequeue
d)Priority queue
Answer: c
44.A normal queue, if implemented using an array of size MAX_SIZE, gets full when
a)Rear = MAX_SIZE – 1
b)Front = (rear + 1)mod MAX_SIZE
c)Front = rear + 1
d)Rear = front
Answer: a
47.A linear collection of data elements where the linear node is given by means of pointer is called?
a)Linked list
b)Node list
c)Primitive list
d)Unordered list
Answer: a
48.Consider an implementation of unsorted singly linked list. Suppose it has its representation with a
head pointer only.
Given the representation, which of the following operation can be implemented in O(1) time?
i)Insertion at the front of the linked list
ii)Insertion at the end of the linked list
iii)Deletion of the front node of the linked list
iv)Deletion of the last node of the linked list
a)I and II
b)I and III
c)I, II and III
d)I, II and IV
Answer: b
49.In linked list each node contain minimum of two fields. One field is data field to store the data
second field is?
a)Pointer to character
b)Pointer to integer
c)Pointer to node
d)Node
Answer: c
50.What would be the asymptotic time complexity to add a node at the end of singly linked list, if
the pointer is initially pointing to the head of the list?
a)O(1)
b)O(n)
c)θ(n)
d)θ(1)
Answer: c
51.What would be the asymptotic time complexity to insert an element at the front of the linked list
(head is known)?
a)O(1)
b)O(n)
c)O(n2)
d)O(n3)
Answer: a
52.What would be the asymptotic time complexity to find an element in the linked list?
a)O(1)
b)O(n)
c)O(n2)
d)O(n4)
Answer: b
53.What would be the asymptotic time complexity to insert an element at the second position in the
linked list?
a)O(1)
b)O(n)
c)O(n2)
d)O(n3)
Answer: a
54.The concatenation of two list can performed in O(1) time. Which of the following variation of
linked list can be used?
a)Singly linked list
b)Doubly linked list
c)Circular doubly linked list
d)Array implementation of list
Answer: c
55.What kind of linked list is best to answer question like “What is the item at position n?”
a)Singly linked list
b)Doubly linked list
c)Circular linked list
d)Array implementation of linked list
Answer: d
60.Which of the following points is/are not true about Linked List data structure when it is compared
with array?
a)Arrays have better cache locality that can make them better in terms of performance
b)It is easy to insert and delete elements in Linked List
c)Random access is not allowed in a typical implementation of Linked Lists
d)Access of elements in linked list takes less time than compared to arrays
Answer: d
61.Which of the following statements are not correct with respect to Singly Linked List(SLL) and
Doubly Linked List(DLL)?
a)Complexity of Insertion and Deletion at known position is O(n) in SLL and O(1) in DLL
b)SLL uses lesser memory per node than DLL
c)DLL has more searching power than SLL
d)Number of node fields in SLL is more than DLL
Answer: d
62.Which of the following data structures can be used for parentheses matching?
a)n-ary tree
b)queue
c)priority queue
d)Stack
Answer: d
64.Which of the following data structures can be used for parentheses matching?
a)n-ary tree
b)queue
c)priority queue
d)stack
Answer:d
66.In linked list implementation of queue, if only front pointer is maintained, which of the following
operation take worst case linear time?
a)Insertion
b)Deletion
c)To empty a queue
d)Both Insertion and To empty a queue
Answer: d
67.In linked list implementation of a queue, where does a new element be inserted?
a)At the head of link list
b)At the centre position in the link list
c)At the tail of the link list
d)At any position in the linked list
Answer: c
68.In linked list implementation of a queue, front and rear pointers are tracked. Which of these
pointers will change during an insertion into a NONEMPTY queue?
a)Only front pointer
b)Only rear pointer
c)Both front and rear pointer
d)No pointer will be changed
Answer: b
69.In linked list implementation of a queue, front and rear pointers are tracked. Which of these
pointers will change during an insertion into EMPTY queue?
a)Only front pointer
b)Only rear pointer
c)Both front and rear pointer
d)No pointer will be changed
Answer: c
70.In case of insertion into a linked queue, a node borrowed from the list is inserted in the queue.
a)AVAIL
b)FRONT
c)REAR
d)NULL
Answer: a
71.In linked list implementation of a queue, from where is the item deleted?
a)At the head of link list
b)At the centre position in the link list
c)At the tail of the link list
d)Node before the tail
Answer: a
72.In linked list implementation of a queue, the important condition for a queue to be empty is?
a)FRONT is null
b)REAR is null
c)LINK is empty
d)FRONT==REAR-1
Answer: a
73.The essential condition which is checked before insertion in a linked queue is?
a)Underflow
b)Overflow
c)Front value
d)Rear value
Answer: b
74.The essential condition which is checked before deletion in a linked queue is?
a)Underflow
b)Overflow
c)Front value
d)Rear value
Answer: a
79.What is the time complexity to insert a node based on position in a priority queue?
a)O(nlogn)
b)O(logn)
c)O(n)
d)O(n2)
Answer: c
80.What is a dequeue?
a)A queue with insert/delete defined for both front and rear ends of the queue
b)A queue implemented with a doubly linked list
c)A queue implemented with both singly and doubly linked lists
d)A queue with insert/delete defined for front side of the queue
Answer: a
81.What is the time complexity of deleting from the rear end of the dequeue implemented with a
singly linked list?
a)O(nlogn)
b)O(logn)
c)O(n)
d)O(n2)
Answer: c
82.A Double-ended queue supports operations such as adding and removing items from both the
sides of the queue. They support four operations like addFront(adding item to top of the queue),
addRear(adding item to the bottom of the queue), removeFront(removing item from the top of the
queue) and removeRear(removing item from the bottom of the queue). You are given only stacks to
implement this data structure. You can implement only push and pop operations. What are the total
number of stacks required for this operation?(you can reuse the stack)
a)1
b)2
c)3
d)4
Answer: b
83.You are asked to perform a queue operation using a stack. Assume the size of the stack is some
value ‘n’ and there are ‘m’ number of variables in this stack. The time complexity of performing
deQueue operation is (Using only stack operations like p ush and pop)(Tightly bound).
a)O(m)
b)O(n)
c)O(m*n)
d)Data is insufficient
Answer: a
84.Consider you have an array of some random size. You need to perform dequeue operation. You
can perform it using stack operation (push and pop) or using queue operations itself (enQueue and
Dequeue).
The output is guaranteed to be same. Find some differences?
a)They will have different time complexities
b)The memory used will not be different
c)There are chances that output might be different
d)No differences
Answer: a
85.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)?
a)Push
b)Pop
c)Enqueue
d)Returntop
Answer: c
86.Given an array of size n, let’s assume an element is ‘touched’ if and only if some operation is
performed on it(for example, for performing a pop operation the top element is ‘touched’). Now you
need to perform Dequeue operation. Each element in the array is touched atleast?
a)Once
b)Twice
c)Thrice
d)Four times
Answer: d
87.To implement a stack using queue(with only enqueue and dequeue operations), how many
queues will you need?
a)1
b)2
c)3
d)4
Answer: b
91.In a stack, if a user tries to remove an element from empty stack it is called
a)Underflow
b)Empty collection
c)Overflow
d)Garbage Collection
Answer: a
92.Pushing an element into stack already having five elements and stack size of 5, then stack
becomes
a)Overflow
b)Crash
c)Underflow
d)User flow
Answer: a
95.Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the
algorithm analyzes: (()(())(())) are:
a)1
b)2
c)3
Answer: c
96.Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right
parentheses (in
some order).
The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the
computation?
a)1
b)2
c)3
d)4
Answer: b
98.Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm to
convert the expression from infix to postfix notation.
The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion
of this
expression?
a)1
b)2
c)3
Answer: d
100.The data structure required to check whether an expression contains balanced parenthesis is?
a)Stack
b)Queue
c)Array
d)Tree
Answer: a
101.What data structure would you mostly likely see in a non recursive implementation of a
recursive algorithm?
a)Linked List
b)Stack
c)Queue
d)Tree
Answer: b
102.The process of accessing data stored in a serial access memory is similar to manipulating data on
a
a)Heap
b)Binary Tree
c)Array
d)Stack
Answer: d
113.Which of the following statement is incorrect with respect to infix to postfix conversion
algorithm?
a)operand is always placed in the output
b)operator is placed in the stack when the stack operator has lower precedence
c)parenthesis are included in the output
d)higher and equal priority operators follow the same condition
Answer: c
114.In infix to postfix conversion algorithm, the operators are associated from?
a)right to left
b)left to right
c)centre to left
d)centre to right
Answer: b
115.A linear list of elements in which deletion can be done from one end (front) and insertion can
take
place only at the other end (rear) is known as a ?
a)Queue
b)Stack
c)Tree
d)Linked list
Answer: a
116.The data structure required for Breadth First Traversal on a graph is?
a)Stack
b)Array
c)Queue
d)Tree
Answer: c
118. A data structure in which elements can be inserted or deleted at/from both the ends but not in
the middle is?
a)Queue
b)Circular queue
c)Dequeue
d)Priority queue
Answer: c
119.A normal queue, if implemented using an array of size MAX_SIZE, gets full when
a)Rear = MAX_SIZE – 1
b)Front = (rear + 1)mod MAX_SIZE
c)Front = rear + 1
d)Rear = front
Answer: a