0% found this document useful (0 votes)
17 views43 pages

Quiz 2

Uploaded by

thonhse172835
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)
17 views43 pages

Quiz 2

Uploaded by

thonhse172835
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/ 43

10:04 20/7/24 Quiz 2

Question 1
Not yet answered
Marked out of 1.0

Encoding the string "aaabbccddddddeee" with Huffman. Please indicate the size of the output string?

a. 128 bits
b. 16 bits
c. 24 bits
d. 36 bits

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 1/43
10:04 20/7/24 Quiz 2

Question 2
Not yet answered
Marked out of 1.0

Apply Kruskal's Minimum Spanning Tree (MST) to the following graph:

Select false statement:

a. The algorithm have consideration to edges be, de and cd but does not add them to MST.
b. bc is not added to MST because it forms a cycle with ac and ac.
c. cf is the latest edge added to MST.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 2/43
10:04 20/7/24 Quiz 2

Question 3
Not yet answered
Marked out of 1.0

Which of the following algorithms can be used to detect cycle of a graph?

a. Depth First Traversal


b. Minimum Spanning Tree
c. Graph coloring
d. Union-Find

Question 4
Not yet answered
Marked out of 1.0

What is the tightest Big-O running time to calculate the Flesch readability score in the EfficientDocument class, where n is the length of the
document, assuming you DO NOT include the time it takes to initialize the numSyllables, numWords, and numSentences variables (i.e. do not
include the time taken by processText)?

a. O( n )
b. O(n^2)
c. O(1)

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 3/43
10:04 20/7/24 Quiz 2

Question 5
Not yet answered
Marked out of 1.0

A hash table of length 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 been inserted in the table? (Assume that
Linear probing was used to resolved collision)

a. 46, 42, 34, 52, 23, 33


b. 46, 34, 42, 23, 52, 33
c. 42, 46, 33, 23, 34, 52
d. 34, 42, 23, 52, 33, 46

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 4/43
10:04 20/7/24 Quiz 2

Question 6
Not yet answered
Marked out of 1.0

Given the character frequencies


B : 32%
C : 28%
D : 16%
E : 6%
F : 18%
Using Huffman encoding, what is the code for character D? (Suppose that when constructing a sub tree from 2 nodes we always place
node with higher frequency on the left; and the left branch of a node gets value 0, the right one gets value 1)

a. 100
b. 001
c. 01
d. 101

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 5/43
10:04 20/7/24 Quiz 2

Question 7
Not yet answered
Marked out of 1.0

A chained hash table has an array size of 512. What is the maximum number of entries that can be placed in the table?

a. 1024
b. None of the others
c. 511
d. 256
e. 512

Clear my choice

Question 8
Not yet answered
Marked out of 1.0

Which the sorting technique always makes recursive calls to sort pieces that are about half the size of the original array?

a. Merge sort.
b. Radix sort.
c. Heap sort.
d. Quick sort.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 6/43
10:04 20/7/24 Quiz 2

Question 9
Not yet answered
Marked out of 1.0

Select correct statement:

a. If there are N items, the bubble sort makes exactly N*N comparisons.
b. A copy is three times as fast as a swap.
c. In a particular sorting situation, if swaps take much longer than comparisons, the selection sort is about twice as fast as the
bubble sort.
d. The bubble sort always ends up comparing every item with every other item.

Clear my choice

Question 10
Not yet answered
Marked out of 1.0

Which of the following Sorting algorithms use Divide and Conquer strategy?

a. Radix sort
b. Heap sort
c. Bubble sort
d. Quick sort

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 7/43
10:04 20/7/24 Quiz 2

Question 11
Not yet answered
Marked out of 1.0

Use Dijkstra’s algorithm to find shortest paths from vertex A to others in the following graph:

Which vertex is chosen in iteration 4 of the algorithm?

a. E
b. F
c. D
d. C

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 8/43
10:04 20/7/24 Quiz 2

Question 12
Not yet answered
Marked out of 1.0

Which of the following data structures are the most suites for handling the minimum (maximum) weighted distances?

a. Stack
b. Priority Queue
c. Linked list
d. Queue

Clear my choice

Question 13
Not yet answered
Marked out of 1.0

Which of the following data structures does not suitable for implementing Huffman algorithm?

a. Singly linked list.


b. Heap.
c. Doubly linked list.
d. Queue.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 9/43
10:04 20/7/24 Quiz 2

Question 14
Not yet answered
Marked out of 1.0

Consider the list of eight integers below: 6, 4, 9, 10, 8, 3, 7, 5


What is the list after it has just been partitioned by the first step of quicksort and a pivot value is chosen as the first element of the list?
(sorting from smallest to largest). Assume that selecting largest element of the array is ignored.

a. 3, 4, 5, 6, 8, 10, 7, 9
b. 3, 4, 5, 6, 7, 8, 10, 9
c. 3, 4, 6, 5, 8, 10, 7, 9
d. 3, 4, 5, 6, 8, 7, 9, 10

Clear my choice

Question 15
Not yet answered
Marked out of 1.0

Does a higher or lower Flesch Index Score indicate simpler text?

a. The lower the Flesch Index Score, the simpler the text and the easier it is to read.
b. The higher the Flesch Index Score, the simpler the text and the easier it is to read.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 10/43
10:04 20/7/24 Quiz 2

Question 16
Not yet answered
Marked out of 1.0

Which of the following graphs looks most like the graph you (should have) produced in part 2 of the programming assignment? We are
looking for you to compare the shapes of the functions only--these graphs are much smoother than what you would have seen. Also,
ignore the specific numbers, and concentrate on the shapes and the relationship between the two lines. Note that the correct answer
assumes that you have correctly implemented your two Document classes and your DocumentBenchmarking class.
a.

b.

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 11/43
10:04 20/7/24 Quiz 2

c.

d.

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 12/43
10:04 20/7/24 Quiz 2

a. a
b. d
c. b
d. c

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 13/43
10:04 20/7/24 Quiz 2

Question 17
Not yet answered
Marked out of 1.0

In run-length encoding algorithm, a run is defined as …

a. a sequence of identical characters.


b. number of different characters in the input.
c. amount of time required to the compression algorithm.
d. size of the result of encoding input data.

Clear my choice

Question 18
Not yet answered
Marked out of 1.0

In the algorithm for spelling suggestions in this week's assignment, there was a hash set to mark Strings as visited. What is the BEST ANSWER
for why we used the visited set?

a. So that our exploration was of a tree of words, and if we had a word repeated, it wouldn't be a tree anymore.
b. To avoid exploring all the possible String mutations for an individual String more than once.
c. To avoid testing to see if a mutated String was a real word (and hence a spelling suggestion) more than once.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 14/43
10:04 20/7/24 Quiz 2

Question 19
Not yet answered
Marked out of 1.0

Which of the following statements about the shortest path finding algorithm of Dijkstra is true?

a. It's complexity is O(|V|), where |V| is number of vertices of the graph.


b. All of the others.
c. It can be applied to graphs have negative weights.
d. It is label-setting algorithm.

Clear my choice

Question 20
Not yet answered
Marked out of 1.0

Select incorrect statement about Adaptive Huffman Coding:

a. The sibling property is described as each node has a sibling (except for the root) and the breadth-first right-to-left tree traversal
generates a list of nodes with nonincreasing frequency counters.
b. Adaptive Huffman coding can be applied to any kind of file.
c. If Adaptive Huffman coding is used to compress execute file, output file is much smaller than the original.
d. If the sibling property is violated, Huffman tree has to be restructured to restore this property.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 15/43
10:04 20/7/24 Quiz 2

Question 21
Not yet answered
Marked out of 1.0

Which of the following is the appropriate description of the “selection sort” algorithm?

a. The element with the smallest value is determined and swapped for the first element, and then the smallest value of the
unsorted elements is determined and swapped for the second-to-the-first element. This operation is repeated in the same
way.
b. Two adjacent elements are repeatedly compared and swapped if the first element is larger than the second. This operation is
repeated until all elements are arranged in an orderly fashion.
c. Each set of the elements extracted at regularintervals is sorted, and then the interval is further decreased. The operation is
repeatedly performed until the interval becomes 1.
d. An intermediate reference value is determined, and then the elements are divided into two groups of “larger” values and
“smaller”values. This operation is recursively repeated.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 16/43
10:04 20/7/24 Quiz 2

Question 22
Not yet answered
Marked out of 1.0

When a hash table becomes too full, which of the following is required to resize the table?

a. Add extra space at the end of the existing hash table and leave the old keys in place.
b. Create a new table which is larger than the original table. Then bulk copy keys from one table to the other (i.e. if a key is in location X
in the original table, it remains in position X in the new table).

c. Create a new table which is larger than the original table. Then individually reinsert each key from the old table into the new table
(i.e. if a key is in location X in the original table, it may or may not be in position X in the new table).

Clear my choice

Question 23
Not yet answered
Marked out of 1.0

Which of the following algorithms in graphs can be implemented by extending Depth First Search algorithm?

a. Cycle detection.
b. All of the others.
c. The Chinese Postman Tour
d. Finding the shortest path (Dijkstra algorithm)

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 17/43
10:04 20/7/24 Quiz 2

Question 24
Not yet answered
Marked out of 1.0

What data structure can be used to check if a syntax has balanced paranthesis ?

a. list
b. stack
c. queue
d. tree

Clear my choice

Question 25
Not yet answered
Marked out of 1.0

What is the tightest Big-O running time to calculate the Flesch readability score the first time in the EfficientDocument class, where n is the
length of the document, assuming you include the time it takes to initialize the numSyllables, numWords, and numSentences variables?
Note that this is not necessarily the running time that you saw when you plotted the graph of your EfficientDocument running time when you
did your benchmarking. That time included the time to initialize the numSyllables, numWords and numSentences variables.

a. O(n^2)
b. O( n )
c. O(1)

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 18/43
10:04 20/7/24 Quiz 2

Question 26
Not yet answered
Marked out of 1.0

What is the best definition of a collision situation in a hash table?

a. Two entries are identical except for their keys.


b. Two entries with the exact same key have different hash values.
c. Two entries with different data have the exact same key.
d. Two entries with different keys have the same exact hash value.

Clear my choice

Question 27
Not yet answered
Marked out of 1.0

In a weighted graph, the minimum spanning tree tries to minimize ………..

a. the total weight of edges connecting all the vertices.


b. the total weight of the edges from the starting vertex to a specified vertex.
c. the number of edges connecting all the vertices.
d. the number of edges from the starting vertex to a specified vertex.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 19/43
10:04 20/7/24 Quiz 2

Question 28
Not yet answered
Marked out of 1.0

The “prime number division remainder” method is a well-known hashing algorithm. In this method, a key value is divided by a number
N, and the remainder which is also called a hash value is used directly as an index into the hash table. N is the largest prime number
less than or equal to the size of the table. When the table size is 20, which of the following is the correct hash value calculated from
the key value 136? Here, a prime number is one that cannot be divided evenly by any other number except one (1). 2, 3, 5, 7, 11, and
13 are the first few prime numbers.

a. 0
b. 16
c. 3
d. 1
e. None of the others.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 20/43
10:04 20/7/24 Quiz 2

Question 29
Not yet answered
Marked out of 1.0

Which of the following is a reason why hash tables are a good choice for storing and retrieving data?

a. They store data in sorted order so it is easy to find the minimum and maximum element
b. They are very fast in practice for finding items in a set
c. They are very space efficient compared to binary search trees and linked lists

Clear my choice

Question 30
Not yet answered
Marked out of 1.0

What is output if using LZW algorithm with the table initialized with the letters x, y, z encode the string “xyxyzxxy”?

a. 1 2 4 3 1 4
b. 4 4 3 1 1 2
c. 124352
d. 1 2 1 2 3 1 1 2

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 21/43
10:04 20/7/24 Quiz 2

Question 31
Not yet answered
Marked out of 1.0

Select true / false statement in regarding to graph representation:


a. If our task is to process vertices adjacent to a vertex v, then the adjacency list requires only deg(v) steps, whereas the adjacency
matrix requires |V| steps.
b. Inserting or deleting a edge requires linked list maintenance for an adjacency list (if such an implementation is used); for a matrix, it
requires only changing 0 to 1 for insertion, or 1 to 0 for deletion, in one cell of the matrix.

a. a and b are false


b. a is true and b is false
c. a is false and b is true
d. a and b are true

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 22/43
10:04 20/7/24 Quiz 2

Question 32
Not yet answered
Marked out of 1.0

In order to sort the sequence “98, 12, 4, 56, 34, 23” in ascending order by Bubble Sort algorithm, how many exchange operations are
required?

a. 11
b. 9
c. 7

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 23/43
10:04 20/7/24 Quiz 2

d. 5
Clear my choice

Question 33
Not yet answered
Marked out of 1.0

The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of length 10 using open addressing with hash
function h(k) = k mod 10 and linear probing. What is the resultant hash table?

a. B
b. C
c. A
d. D

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 24/43
10:04 20/7/24 Quiz 2

Question 34
Not yet answered
Marked out of 1.0

Using the coalesced hashing to put the following values in a table with 10 elements:
A5, A2, A3, B5, A9, B2, B9, C2
Using the extraction method to extract the number as the key.
What is the chain to begin with A5?

a. A5-A2-A3
b. A5-B2-C2
c. A5-B5-A9-B9
d. A5-B5

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 25/43
10:04 20/7/24 Quiz 2

Question 35
Not yet answered
Marked out of 1.0

In .................................. algorithm, each vertex v is visited and then each unvisited vertex adjacent to v is visited. If a vertex v has no
adjacent vertices or all of its adjacent vertices have been visited, we backtrack to the predecessor of v. The traversal is finished if this
visiting and backtracking process leads to the first vertex where the traversal started. If there are still some unvisited vertices in the
graph, the traversal continues restarting for one of the unvisited vertices.

a. Breath First Search


b. None of the others
c. Depth First Search

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 26/43
10:04 20/7/24 Quiz 2

Question 36
Not yet answered
Marked out of 1.0

Quick sort algorithm is an example of

a. Dynamic Programming
b. Greedy approach
c. Improved binary search
d. Divide and conquer

Clear my choice

Question 37
Not yet answered
Marked out of 1.0

What is the worst case time complexity of linear search algorithm?

a. O(logn)
b. O( n )
c. O(1)
d. Ο(n^2)

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 27/43
10:04 20/7/24 Quiz 2

Question 38
Not yet answered
Marked out of 1.0

Use Dijkstra’s algorithm to find shortest paths from vertex C to others in the following graph:

What is “current distance of A“ after executing of the algorithm end?

a. inifinity
b. 35
c. 40
d. 0

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 28/43
10:04 20/7/24 Quiz 2

Question 39
Not yet answered
Marked out of 1.0

Suppose that you place 180 elements in a hash table with an array size of 200. What is the load factor?

a. 0.9
b. 0.75
c. 0.5
d. 1.45

Clear my choice

Question 40
Not yet answered
Marked out of 1.0

In a min-heap:

a. parent nodes have values less than or equal to their childs


b. both statements are wrong
c. parent nodes have values greater than or equal to their childs
d. both statements are true

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 29/43
10:04 20/7/24 Quiz 2

Question 41
Not yet answered
Marked out of 1.0

Which of the following is true of searching for an element in a Hash Table that is implemented using linear probing (you may assume a Hash
Table that is ~70% full)?

a. Worst case is O(1)


b. Average case is O(1)
c. Average case is log( n )

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 30/43
10:04 20/7/24 Quiz 2

Question 42
Not yet answered
Marked out of 1.0

Apply Floyd algorithm to the following graph:

Which of the following statements is false?

a. The shortest path from vertex a to vertex e is zero.


b. abce is not shortest path from a to e.
c. We can find shortest paths from any vertex to others in this graph.
d. In initial weighted matrix, distances from e to others are infinity.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 31/43
10:04 20/7/24 Quiz 2

Question 43
Not yet answered
Marked out of 1.0

When the bubble sort algorithm is used for sorting the dataset (23, 43, 56, 12, 87, 14, 87, 15, 90, 23, 10) in descending order, how many
data exchanges occur during the first iteration of outer loop?

a. 7
b. 9
c. 10
d. 8

Clear my choice

Question 44
Not yet answered
Marked out of 1.0

Which of the following Sorting algorithms have complexity of O( n ) in best case ?

a. Insertion sort
b. Selection sort
c. Buble sort
d. All of the others.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 32/43
10:04 20/7/24 Quiz 2

Question 45
Not yet answered
Marked out of 1.0

An array contains the elements shown below:


7 8 26 44 13 23 98 57
What would be the value of the elements in the array after two pass of the heap sort algorithm.

a. 26 13 23 7 8 44 57 98
b. 7 8 13 23 26 44 57 98
c. 57 26 44 7 13 8 23 98
d. 44 26 23 7 13 8 57 98

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 33/43
10:04 20/7/24 Quiz 2

Question 46
Not yet answered
Marked out of 1.0

Use Dijkstra’s algorithm to find shortest paths from vertex A to others in the following graph:

What is “current distance of F“ after iteration 3 of the algorithm?

a. 95
b. 70
c. infinity
d. 20

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 34/43
10:04 20/7/24 Quiz 2

Question 47
Not yet answered
Marked out of 1.0

Given a raw message 'BBBUUUUBBBUUBBBBBUU' (without single quote). Run the run-length encoding algorithm for that message,
what is the output?

a. 3B4U4B3U2B5UU2
b. 3B4U3B2U5B2U
c. 3B4U3B2U5B2UU
d. 3B4U3B2U5B

Clear my choice

Question 48
Not yet answered
Marked out of 1.0

In your benchmarking of the DictionaryBST structure, you probably found that the time to find words did not significantly increase as the
Dictionary got larger. Which of the following is the most likely reason for this behavior?

a. log( n ) is sufficiently small and grows sufficiently slowly that other factors (e.g. memory use) had a bigger effect on the running time
than the size to find the word in the dictionary.

b. We were measuring the best case performance of the dictionary, which does not change as the dictionary size grows.
c. The running time to find an element in a balanced BST is O(1) so we would not expect the running time to get larger as the dictionary
got bigger.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 35/43
10:04 20/7/24 Quiz 2

Question 49
Not yet answered
Marked out of 1.0

After two passes of a sort algorithm, the following array:


47 3 21 32 56 92
has been rearranged as shown below:
3 21 47 32 56 92
Which sorting algorithm is being used?

a. selection sort.
b. bubble sort.
c. all of them.
d. insertion sort.

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 36/43
10:04 20/7/24 Quiz 2

Question 50
Not yet answered
Marked out of 1.0

Select true / false statement in regarding to graph representation:


a. There are n possible adjacency matrices for the same graph.
b. Multigraphs can be represented in the following adjacency matrix:
aij = number of edges between vi and vj

a. a and b are false


b. a and b are true
c. a is false and b is true
d. a is true and b is false

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 37/43
10:04 20/7/24 Quiz 2

Question 51
Not yet answered
Marked out of 1.0

The best technique when the amount of data is not well known is ……

a. double hashing.
b. quadratic probing.
c. separate chaining.
d. linear probing.

Clear my choice

Question 52
Not yet answered
Marked out of 1.0

Maximum number of nodes in a binary tree with height k, where root is height 0, is

a. (2^(k+1)) -1
b. (2^k) -1
c. (2^(k-1)) -1
d. (2^k) +1

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 38/43
10:04 20/7/24 Quiz 2

Question 53
Not yet answered
Marked out of 1.0

Suppose you are doing a breadth-first search of a graph with n vertices, using a queue implemented with a static array. What is the
minimum number of elements of this array?

a. n
b. n - 1
c. n+1
d. 2n

Clear my choice

Question 54
Not yet answered
Marked out of 1.0

What is output if using LZW algorithm with the table initialized with the letters a, b, c encode the string “ababcaab”?

a. 4 4 3 1 1 2
b. 1 2 1 2 3 1 1 2
c. 124352
d. 1 2 4 3 1 4

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 39/43
10:04 20/7/24 Quiz 2

Question 55
Not yet answered
Marked out of 1.0

Find the average length LHuf for the letters X, Y, and Z and their probabilities .05, .05 and .9 respectively.

a. 2.3
b. 1.75
c. None of the others.
d. 0.8
e. 1.1

Clear my choice

Question 56
Not yet answered
Marked out of 1.0

You want to place 1000 elements in a hash table using linear probing, and you would like an average numbers of trials for successful
search two elements. How big does the array of hash table need to be?

a. 1250
b. 500
c. 1000
d. 1500

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 40/43
10:04 20/7/24 Quiz 2

Question 57
Not yet answered
Marked out of 1.0

Select incorrect statements about the shortest path algorithm:

a. Dijkstra’s algorithm cannot be applied to undirected weighted graphs.


b. Dijkstra’s algorithm is sort of label-setting.
c. Dijkstra’s algorithm is used to graphs which have positive weight.
d. Dijkstra’s algorithm finds the shortest path from one specified vertex to all other vertices.

Clear my choice

Question 58
Not yet answered
Marked out of 1.0

What is the tightest Big-O running time to calculate the Flesch readability score for the BasicDocument class, where n is the length of the
document?

a. O(n^3)
b. O(1)
c. O( n )

d. O(n^2)

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 41/43
10:04 20/7/24 Quiz 2

Question 59
Not yet answered
Marked out of 1.0

Select incorrect statement about restrictions need to be imposed on the prospective codes:

a. Each codeword may be corresponds to one or many symbols.


b. The length of the codeword for a given symbol A should not exceed the length of the codeword of a less probable symbol B.
c. There should not be any unused short codewords either as stand-alone encodings or as prefixes for longer codewords.
d. Decoding should not require any look ahead.

Clear my choice

Question 60
Not yet answered
Marked out of 1.0

Consider a hash table of size seven, with starting index zero, and a hash function h(x)= (3x + 4) mod 7. Assuming the hash table is
initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using linear
probing? Note that ‘_’ denotes an empty location in the table.

a. 1, _, _, _, _, _,3
b. 8, _, _, _, _, _, 10
c. 1, 10, 8, _, _, _, 3
d. 1, 8, 10, _, _, _, 3

Clear my choice

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 42/43
10:04 20/7/24 Quiz 2

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=948262&cmid=44309#question-1059461-3 43/43

You might also like