0% found this document useful (0 votes)
11 views6 pages

Sample Exam

algorimth

Uploaded by

Tuyên Phạm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Sample Exam

algorimth

Uploaded by

Tuyên Phạm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

HANOI UNIVERSITY OF SCIENCE AND FINAL EXAM OF SEMESTER I/2022-2023

TECHNOLOGY Module: DATA STRUCTURES AND


SCHOOL OF ELECTRICAL AND ALGORITHMS (ET2101E)
ELECTRONICS ENGINEERING Date: Mar/16/2023 - 12:30
Duration: 90 minutes
Sample no.: 1 Pages: 6 (Paper documents allowed. Write directly on this sheet.)
Signatures Lecturer in charge: Group leader:

Student name: ..................................... Student ID: .................................... Signature: ...................

(Number of questions: 60)

1. In the software development process, in 5. Is this graph cyclic?


which step(s) are algorithms used?
a) Analysis
b) Design
c) Testing
d) Evolution
e) Implementation
2. Given an array [13, 14, 12, 11, 16, 15]. a) True
Rewrite the values of this array after make it a b) False
Max Heap.
6. If edge <i,j> is present in a directed graph
................................................................. G, then edge <j,i> also is?
a) True
3. How many swap operations does the
Bubble Sort algorithm need to sort the array b) False
[26, 34, 27, 32, 20, 24, 28, 22, 30, 21] in 7. List the first 5 visited nodes in order when
ascendant order? traversing this graph starting from G using
Dijkstra algorithm
.................................................................
4. Given a tree as in the figure. Which node is
visited right after node g when traversing the
tree with DFS method in LVR order?

..................................................................
8. There may exist only one spanning tree for
a graph?
a) True
b) False
.................................................................
Test form no. 1 - Page 1/6
9. After 4 steps of the Selection Sort
algorithm in ascendant order, an array becomes
[21, 22, 23, 24, 30, 27, 29, 26, 28]. Rewrite the
values of this array after 3 next step(s).

.................................................................
10. Given two elements a and b in a linked list,
write the expression to check if a is the previous
element of b

.................................................................
11. Given a stack with the elements added in
the following order: <2, 7, 8, 3, 4, 7>. Rewrite ..................................................................
the elements of this stack after doing Pop 2
times, then Push 5 and 9 respectively. 17. What is the asymptotic complexity of
finding the next element (assumed existing) of
................................................................. a given element in a singly-linked list?
a) O(i^2)
12. Linked lists are more efficient than arrays
in accessing a random element? b) O(n)
a) True c) O(1)
b) False d) O(i)
13. What is the depth of the following tree? e) O(n+i)
f) O(n^2)
18. The linear complexity for a problem with
size of n is
a) O(1)
b) O(n^2)
c) O(n)
19. What is needed to traverse a graph using
the iterative DFS method?
a) A stack
.................................................................
b) A queue
14. The constant complexity for a problem
with size of n is c) A linked list
a) O(n^2) 20. Which one(s) of the following sequences
b) O(n) is/are possibly visited when traversing this
graph starting from D using BFS method?
c) O(1)
15. Write the expression to check if a given
element e is not the 2nd last element

.................................................................
16. Given a tree as in the figure. Which node is
visited right before node k when traversing the
tree with DFS method in LRV order?

Test form no. 1 - Page 2/6


a) D A C G E B F 26. What is the asymptotic complexity of an
algorithm with 2n^2 + 3log(m) operations?
b) D A F G B E C
a) O(log(m))
c) D A C G B F E
b) O(n^2)
d) D A C G B E F
c) O(n^2 + log(m))
21. In a queue, the Dequeue operation allows
27. What is the memory asymptotic
to
complexity of the in-place (not using auxiliary
a) Remove the element at the tail
memory) Merge Sort algorithm?
b) Add an element to the tail a) O(n^2)
c) Remove the element at the head b) O(log(n))
d) Add an element to the head c) O(n)
22. In a Hash Table, the keys of elements must d) O(1)
not duplicate?
28. The number of hash values
a) True
a) Can be determined by the programmer
b) False
b) Equals the number of elements
23. List all the nodes that are reacheable from
c) Is fixed by the algorithm
D
29. Given a Self Organizing List [21, 18, 22,
19, 17, 23, 20] using the Move-to-Front
method. Rewrite the values of this list after
respectively searching the following values: 21,
18, 20, 18, 17.

..................................................................
30. Which one(s) of the following operations
are of a stack?
a) Enqueue
b) Push
.................................................................
c) Dequeue
24. At most, how many iterations are needed to d) Pop
find a value in an array of 200 elements using
the Binary Search algorithm? 31. Nút lá của cây là nút
a) Has the most number of children
................................................................. b) Does not have any child
25. What is the asymptotic complexity of c) Has the most number of parents
finding the previous element (assumed
existing) of a given element in a singly-linked d) Does not have parent
list? 32. Which complexity(-ies) does an algorithm
a) O(n) with 13n^2 + 14n operations satisfy?
b) O(n^2) a) O(2n^2)
c) O(n+i) b) O(n^2 + n)
d) O(i^2) c) O(n)
e) O(i) d) O(n^2)
f) O(1) e) O(2^n)

Test form no. 1 - Page 3/6


33. Which data structure is last-in-first-out 39. What is needed to traverse a tree using the
(LIFO)? iterative BFS method?
a) Linked list a) A queue
b) Stack b) A linked list
c) Tree c) A stack
d) Hash table 40. There can be many leaf nodes in a tree?
a) True
e) Queue
b) False
34. What pairs of elements are examined by
the Bubble Sort algorithm? 41. Given a Binary Search Tree as in the
a) Pairs of two adjacent elements figure. How many nodes are visited to find the
value 25?
b) Pairs of two arbitrary elements
35. What is the asymptotic complexity of
accessing the i-th element in a linked list?
a) O(n)
b) O(i+n)
c) O(i)
d) O(1)
36. The elements of a linked list are
contiguously in memory?
a) True
b) False
37. Given a Binary Search Tree as in the ..................................................................
figure. Write the nodes visited in order when
searching for the value 12. 42. What is the memory asymptotic
complexity of the standard (using auxiliary
memory) Merge Sort algorithm?
a) O(n)
b) O(n^2)
c) O(log(n))
d) O(1)
43. Does the Linear Search algorithm require
the array to be sorted first?
a) True
b) False
44. Given two elements a and b in a linked list,
write the expression to check if a is the 2nd next
element of b

................................................................. ..................................................................

38. For a given array of values, there are many 45. List all the nodes that are reacheable from
Binary Search Trees that can be established? B
a) True
b) False

Test form no. 1 - Page 4/6


49. A Hash Table is used to
a) Improve the efficiency in storing data
b) Improve the efficiency in searching data
50. Is the tree given in the figure a Binary
Search Tree?

.................................................................
46. List the first 5 visited nodes in order when
traversing this graph starting from C using
Dijkstra algorithm

..................................................................

................................................................. 51. The root node of a tree


a) Has the most number of children
47. What is the asymptotic complexity of
b) Does not have any child
traversing a linked list of n elements from the
beginning to the end? c) Does not have parent
a) O(1) d) Has the most number of parents
b) O(log(n)) 52. When does the Heap Sort algorithm
c) O(n^2) establishes a Max Heap or Min Heap?
a) At every step
d) O(n)
b) Only once at the beginning
48. Which one(s) of the following sequences
is/are possibly visited when traversing this 53. Is a connected acyclic graph a tree?
graph starting from C using BFS method? a) True
b) False
54. There can be many root nodes in a tree?
a) True
b) False
55. What is the time asymptotic complexity of
a) C E D G A F A B the Quicksort algorithm in the worst case?
a) O(1)
b) C G D E A F A B
b) O(n^2)
c) C B D E A A F G
c) O(log(n))
d) C G D E A A F B
d) O(n)

Test form no. 1 - Page 5/6


56. Given a queue with the elements added in 17, 15, 12, 22, 14, 23, 25, 10, 21]. Rewrite the
the following order: <22, 21, 24, 25>. Rewrite values of this array after 3 next step(s).
the elements of this queue after doing Dequeue
2 times, then Enqueue a value of 23. ..................................................................

................................................................. 59. Does the Binary Search algorithm require


the array to be sorted first?
57. An element in a doubly-linked list a) True
a) Points to the next element b) False
b) Points to the next and the previous 60. Arrays are more efficient than linked lists
elements in using memory?
c) Points to the previous element a) True
58. After 4 steps of the Insertion Sort algorithm b) False
in descendant order, an array becomes [26, 19,

--------- End ---------

Test form no. 1 - Page 6/6

You might also like