DAT 305 Week 5 Apply – Course Post-Assessment Quiz

0 items
DAT 305 Week 5 Apply - Course Post-Assessment Quiz
DAT 305 Week 5 Apply – Course Post-Assessment Quiz
$15.00
  • Description

DAT 305 Week 5 Apply – Course Post-Assessment Quiz

Which of the following statements is true?

Removing an element from a linked list is faster than adding an element to a linked list.

Traversing a linked list has the same complexity as removing an element from a list.

Traversing a linked list has the same complexity as adding an element to a list.

Removing and adding an element to a linked list has the same complexity as a traversing operation.

a. 2 and 4

b. 4

c. 1

d. 1 and 3

What is the maximum number of comparisons that can take place in bubble sort? Assume that there are n elements in the array.

a. (1/2)n(n-1)

b. (1/2)(n-1)

c. (1/4)(n-1)

d. (1/4)n(n-1)

What will be the output of the following program?

a. value1

value2

b. A Runtime Exception will be thrown.

c. null

null

d. value2

value2

What will be the output of the following program?

a. null

null

b. value1

value2

c. A Runtime Exception will be thrown.

d. value2

value2

What will be the output of the following program?

a. A NullPointer Exception will be thrown.

b. value1

value2

c. value1

d. value1

null

Which of the following is an advantage of chained hash table (external hashing) over the open addressing scheme?

a. Deletion is easier.

b. Space utilization is less.

c. The worst-case complexity of search operations is less.

d. None of the above.

The given definition describes which of the following terms?

Search or exhaustive search, also known as generate and test, is a very general problem-solving technique and algorithmic paradigm that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem’s statement.

a. Brute-Force

b. Dynamic programming

c. Greedy algorithm

d. Divide and conquer

Consider the following string: KOTMAALE, and pattern to be matched: AALE. By how many positions will the first shift be performed, using the bad character and good prefix rules?

a. 2

b. 4

c. 1

d. 3

What is a graph without self loops and parallel edges called?

a. A directed cycle graph

b. A cycle graph

c. A complete graph

d. A simple graph

Which of the following are the worst-case running times of insertion sort, merge sort, and quick sort respectively?

a. O(nlog(n)), O(nlog(n)), and O(n^2)

b. O(n^2), O(n log(n)), and O(n log(n))

c. O(n^2), O(n log n), and O(n^2)

d. O(n^2), O(n^2), and O(n log(n))

What is the knapsack value for the given input?

value = [ 20, 5, 10, 40, 15, 25 ]

weight = [1, 2, 3, 8, 7, 4 ]

W = 10

a. 60

b. 35

c. 115

d. 40

Which of the following algorithms is a greedy algorithm?

Merge sort

Quick sort

Insertion sort

Bubble sort

a. Merge sort and quick sort

b. Insertion sort and bubble sort

c. Quick sort and insertion sort

d. None

What data structure is a prime number used with?

a. Hash table

b. Stack

c. Array

d. Queue

For the starting permutation [3, 57, 64, 54, 1, 35, 98], what are the steps to bubble sort into a sorted arrangement of [1, 3, 35, 54, 57, 64, 98]?

a. [1, 3, 35, 54, 57, 64, 98] -> [3, 54, 1, 35, 57, 64, 98] -> [3, 57, 64, 54, 1, 35, 98] -> [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [1, 3, 35, 54, 57, 64, 98]

b. [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 64, 54, 1, 35, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [3, 54, 1, 35, 57, 64, 98]

c. [3, 57, 64, 54, 1, 35, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [3, 54, 1, 35, 57, 64, 98] -> [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98]

d. [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 64, 54, 1, 35, 98] -> [3, 1, 35, 54, 57, 64, 98] -> [1, 3, 35, 54, 57, 64, 98] -> [3, 57, 54, 1, 35, 64, 98] -> [3, 54, 1, 35, 57, 64, 98]

How is prime factorization a hard problem?

a. Multiplying prime numbers is difficult

b. Finding the prime factors multiplied for a number is hard

c. Prime factorization uses division

d. Prime factorization is NP-complete

When do we use an adjacency list?

a. For a hash table

b. For a graph that is undirected

c. When sorting a list

d. When searching through a list for an element

Which data structure is used to convert an infix expression to prefix or postfix?

a. Linked list

b. Priority queue

c. Hash table

d. Stack

Which algorithm sorts the following list [5 3 9 7] using the steps of: [5 3 9 7] -> [3 5 9 7] -> [3 5 9 7] -> [3 5 7 9] -> [3 5 7 9]?

a. Bubble sort

b. Insertion sort

c. Binary search

d. Merge sort

What is the Big-O for an algorithm that takes two arrays of equal size n, and returns true if the arrays are disjoint—no elements in common—by taking an element from the first array and then checking if it is in the second array?

a. O(n^2)

b. O(2^n)

c. O(n!)

d. O(n^3)

For the array [ 99 3 57 93 8 9 7 71 1 ], what is the array arrangement after the first step in the insertion sort?

a. [ 3 99 57 93 8 9 7 71 1 ]

b. [ 57 3 99 93 8 9 7 71 1 ]

c. [ 99 3 57 93 8 9 7 71 1 ]

d. [ 1 3 57 93 8 9 7 71 99 ]

What do Prim’s algorithm and Kruskal’s algorithm do after they take a graph?

a. Remove all cycles or loops from the graph

b. Find the average weight of the edges

c. Create a shortest path from the graph

d. Construct a minimum spanning tree

What is the worst-case performance of the merge sort algorithm on a sorted list of elements?

a. O(n)

b. O(n log n)

c. O(n^2)

d. O(n^3)

What is the algorithm used in the following code?

a. Graph

b. Recursive

c. Greedy

d. Dynamic programming

For the string text “The cat in the hat is fat on the mat now!” and the search pattern “dog” along with a performance operation of O(1), what is the search time using the Boyer-Moore algorithm?

a. O(45)

b. O(9)

c. O(42)

d. O(126)

What is represented by O(n) to Ω(n) to Θ(n)?

a. Measures of linear algorithm performance

b. Results of computing recurrence relations

c. Asymptotically tighter bounds on algorithm performance

d. Different functions for the hash table’s hash function