Quiz
Design
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (45)
1Suppose a stack is to be implemented with a linked list instead of an array. What would be the effect on the time complexity of the push and pop operations of the stack implemented using linked list (assuming stack is implemented efficiently)?
- AO(1) for insertion and O(1) for deletion
- BO(1) for insertion and O(n) for deletion
- CO(n) for insertion and O(n) for deletion
- DO(n) for insertion and O(1) for deletion
2The keys 12,18,13,2,3,23,5 and 15 are inserted into to initially empty hash table of lenght 10 using open addressing with hash function h(k) = k mod 10 and linear probing. What is the resultant hash table?

- AC
- BA
- CB
- DD
3The maximum number of binary trees that can be formed with three untabeled nodes is:
- A5
- B4
- C3
- D1
4A hash table of lenght 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below.
Which one of the following choices gives a possible order in which the key values could have beem inserted in the table?- A42,46,33,23,34,52
- B46,34,42,23,52,33
- C34,42,23,52,33,46
- D46,42,34,52,23,33
5What is the worst case possible height of Red-Black tree? Assume base of Log as 2 in all options
- A2log(n+1)
- Bостальных вариков не видно, лол, просто запомни 1 правильный ответ
6Consider the following function that takes reference to head of a Doubly Linked List as a parameter. Assume that a node of doubly linked list has previous pointer as a "prev" and next pointer as a "next".
Assume that reference of head of following doubly linked list is passed above function 1<->2<->3<->4<->5<->6. What should be the modified linked list after the function call?- A5<->4<->3<->2<->1<->6
- B2<->1<->4<->3<->6<->5
- C6<->5<->4<->3<->1<->2
- D6<->5<->4<->3<->2<->1
7Consider the following nested representation of binary trees indicates y and z are the left right subtrees, respectively, of node x. Note that y and z may be NULL or further nested. Which of the following represents a valid binary tree?
- A(1 (2 3 4)(5 6 7))
- B(1 (2 3 4)5 6) 7)
- C(1 (2 3 NULL)(4 5))
- D(1 2(4 5 6 7))
8In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is
- Alog (2n-1)
- Blog 2n
- Cn/2
- Dn
9A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (top1 < top2) point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for "stack.full" is
- Atop1 = top2-1
- B(top1 = MAXSIZE/2) or (top2=MAXSIZE)
- Ctop1 + top2 = MAXSIZE
- D(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)
10The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is:
- A2*(h+1)
- B2^h-1
- C2^(h+1)-1
- D2^(h-1)-1
11Consider the function f showed below:
For a given linked list p, the function f returns 1 if and only if:- Athe elemets in the list are sorted in non-increasing order of data value
- Bthe list is empty or has exactly one element
- Cnot all elements in the list have the same data value
- Dthe elemets in the list are sorted in non-decreasing order of data value
- Eда нихуя не видно, ну сорян чё. прост ответ запомнишь)
12What of the following points is/are true about Linked List data structure when it is compared with array
- Athe size of array has to be pre-decided, linked lists can change their size any time
- Brandom access is not allowed in a typical implementation of Linked Lists
- Cit is easy to insert and delete elements in Linked List
- Dall of the answers
- Earrays have better cache locality that can make them better in terms of performance
13Consider a standart Circular Queue "q" implementation (which has the same condition for Queue Full and Queue Empty) whose size is 11 and the elemets of the queue are q[0],q[1],q[2] .... q[10]. The front and rear pointers are initialized to point at q[2]. In which position will the ninth element be added?
- Aq[10]
- Bq[0]
- Cq[1]
- Dq[9]
14A function f defined on stacks of intefers satisfiers the following properties f(∅) = 0 and f (push (S,i) = max (f(S,0) + i for all stacks S and integers i
If a stack S contains the integers 2,-3,2,-1,2 in order from bottom to top, what is f(S)?- A3
- Bвообще хз чё там за ответы, сорян
15What of the following is true about linked list implementation of stack?
- Ain push operation, if new nodes are inserted at the begginning of linked list, then in pop operation, nodes must be removed from end
- Bin push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the begginning
- Cboth of the above
- Dnone of the above
16Level of a node is distance from root to that node. For example, level of root is 1 and levels of left and right children of root is 2. The maximum number of nodes on level i of a binary trees is
In the following answers, the operator "^" indicates power- A2^(i-1)
- B2^[(i+1)/2]
- C2^i
- D2^(i+1)
17Consider n elements that are equally distributed in each stack, elements of it are arranged in ascending order (min is at the top in each of the stack and then increasing downwards). Given a queue of size n in which we have to put all n elements in increasing order. What will be the time complexity of the best known algorithm?
- AO(n*k)
- BO(k^2)
- CO(n logk)
- DO(n^2)
18Which of the following is true about Red Black Trees?
- Aat least one children of every black node is red
- Ba leaf node may be red
- Croot may be red
- Dthe path from the root to the furthest leaf is no more than twice as long as the path from the root to the nearest leaf
19What is the output of the following function for start pointing to first node of following linked list? 1->2->3->4->5->6
- A1 4 6 6 4 1
- B1 3 5 5 3 1
- C1 3 5 1 3 5
- D1 2 3 5
20What does the following function do for given Linked List with first node as "head"?
- Aprints all nodes of linked lists
- Bprints all nodes of linked list in reverse order
- Cprints alternate nodes in reverse order
- Dprints alternate nodes of Linked List
21Which of the following operations are used by Red-Black trees to maintain balance during insertion/deletion?
a) Recoloring of nodes
b) Rotation (Left and Right)- Aonly b
- Bneither a nor b
- Cboth a and b
- Donly a
22A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0, the root is stored at X[1]. For a node stored at X[i], the left child, if any, is stored in X[2] and the right child, if any, in X[2i+1]. To be able to store any binary tree on n vertices the minimum size of X should be
- A2n+1
- B2^n-1
- Clog2n
- Dn
23A circularly linked is used to represent a Queue. A single variable p is used to access the Queue. To which node should p point such that both the operations enQueue and deQueue can be performed in constant time?
- Anot possible with a single pointer
- Bfront node
- Cnode next to front
- Drear node
24Which of the following is true about linked list implementation of queue?
- Ain push operation, if new nodes areinserted at the begginning of linkes list, then in pop operation, nodes must be removed from end
- Bin push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the begginning
- Cboth of the above
- Dnone of the above
25A weight-balanced tree is a binary tree in which for each node. The number of nodes in the left sub tree is at least half and at most twice the number of nodes in the right sub tree. The maximum possible height (number of nodes of the path from the root to the farthest leaf) of such a tree on n nodes is best described by which of the following?
- Alog 2n
- Blog 4/3n
- Clog 3n
- Dlog 3/2n
26Stack is also called as
- Afirst in first out
- Blast in last out
- Cnone of the mentioned
- Dlast in first out
- Efirst in last out
27.... is the component of data structure
- Anone of the mentioned
- Balgorithms
- Cstorage structures
- Doperations
- Eall of the mentioned
28Inserting an item into the stack when stack is not full is called ..... Operation and deletion of item form the stack, when stack is not empty is called ..... operation
- Anone of the mentioned
- Bdelete, insert
- Cinsert, delete
- Dpop, push
- Epush, pop
29.
- A1,6,2 and 7
- B11 and 12
- C2
- D1,6,2,7 and 9
- E1,6 and 2
30Here is a binary tree.
If we visit the nodes of this tree using a inorder traversal, in what order will the nodes be visited?- A1 2 6 4 9 3 7 8 5
- B4 2 9 1 8 3 5 6 7
- C1 2 4 9 6 3 8 5 7
- D4 9 2 8 5 3 7 6 1
- E1 2 3 4 5 6 7 8 9
31.... is a pile in which items are added at one end and removed from the other
- Aqueue
- Bstack
- Clist
- Dhash tables
- Enone of the above
32.... is very useful in situation when data have to be stored and then retrieved in reverse order
- Aqueue
- Blist
- Clinked list
- Dhash-tables
- Estack
33Which data structures allows deleting data elements from and inserting at rear?
- Astack
- Bhash-tables
- Cbinary search tree
- Dqueues
- Edequeues
34Which of the following data structure can't store the non-homogeneous data elements?
- Apointers
- Brecords
- Cstacks
- Darrays
- Equeues
35Assuming that the hash function for a table works well, and the size of the hash table is reasonably large compared to the number of items in the table, the expected (average) time needed to find an item in a hash table containing n items is
- AO(n)
- BO(log n)
- CO(1)
- DO(sqrt (n))
- EO(nlog n)
36What is the asymptotic runtime for traversing all nodes in a binary search tree with n nodes and printing them in order?
- AO(log(n))
- BO(n)
- CO(sqrt(n))
- DO(n*logn)
- EO(n^2)
37Which of the following is non-linear data structure?
- Anone of the mentioned
- Blist
- Ctrees
- Dstrings
- Estacks
38Which of the following data structure is linear type?
- Astack
- Bgraph
- Cbinary tree
- Dtrees
- Ered-black tree
39To represent hierarchical relationship between elements. Which data structure is suitable?
- Atree
- Bgraph
- Cnone of the mentioned
- Ddequeue
- Estack
40Given a binary search tree; which traversal type would print the values in the nodes in sorted order?
- Anone of the above
- Bpostorder
- Cinorder
- Dpreorder
- Eall of the mentioned
41Which of the following statements about binary trees is NOT true?
- Aevery node has at most two children
- Bevery non-empty tree has exactly one root node
- Cevery binary tree has at least one node
- Devery non-root node has exactly one parent
- Enone of the mentioned is true
42Are there any dynamic memory management errors in the following code?
- Ayes, a memory leak
- Byes, both a memory leak and misuse of a dangling pointer
- Cno, there are no errors
- Dyes, a dangling chad
- Eyes, misuse of a dangling pointer
43What is the expected time required to search for a value in a binary search tree containing n nodes? (You should make reasonable assumptions about the structure of the tree)
- AO(1)
- BO( n logn)
- CO(n)
- DO(n^2)
- EO(log n)
44There are several factors that affect the efficiency of lookup operations in a hash table. Which of the following is not one of those factors?
- Aall of the above factors affect the efficiency of hash table lookups
- Bsize of elements stored in the hash table
- Cnumber of buckets in the hash table
- Dnumber of elements stored in the hash table
- Equality of the hash function
45One difference between a queue and a stack is:
- Aqueues require linked lists, but stacks do not
- Bstacks require linked lists, but queues do not
- Cqueues use two ends of the structure; stacks use only one
- Dstacks use two ends of the structure, queues use only one
- Enone of the mentioned
Information
- Description
- Quiz on Design, created by Zara Klak on 30/05/2019.
- Author
- Zara Klak
- Language
- English
- Views
- 97
- Rating
- No ratings yet Rate this quiz