UGRD CS6202 Algorithms and Complexity Midterm Exam

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Question 1

Complete
Mark 1.00 out of 1.00

Flag question

Question text
A greedy algorithm is a simple, intuitive algorithm that is used in optimization
problems.
Select one:
True
False

Question 2
Complete
Mark 4.00 out of 4.00

Flag question

Question text
Finding A Safe Edge:

Every 2 disjoint subsets of vertices must be connected by at least _____. Answer 1


one edge

An edge is a light edge crossing a cut iff its weight is minimum over all
edges_______ the cut.
Answer 2
crossing

Answer 3
A cut (S,V-S) is a partition of vertices into ________ sets S and V-S.
disjoint

Edge (u,v)ÎE crosses cut (S, V-S) if one __________ is in S and the other Answer 4
is in V-S. endpoint

Question 3
Complete
Mark 3.00 out of 3.00
Flag question

Question text
Steps to print codes from Huffman Tree:
Traverse the tree formed starting from the root . Maintain an auxiliary array.
While moving to the left child, write 0 to the array . While moving to
the right child , write 1 to the array. Print the array when a leaf node is
encountered.

left child right node

Question 4
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Build one tree A ; Start from arbitrary root r, at each step, add light edge
connecting VA to V- VA (greedy).

Select one:
a.
Prim's algorithm

b.
Huffman's algorithm

Question 5
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Robert Boyer and J Strother Moore established the BM algorithm in 1977 .
1976 1978

Question 6
Complete
Mark 0.00 out of 1.00

Flag question

Question text
PRNGs are suitable for applications where many random numbers are required
and where it is useful that the same sequence can be replayed easily.
Select one:
True
False

Question 7
Complete
Mark 1.00 out of 1.00

Flag question

Question text
An optimization problem is the problem of finding the best solution from all
feasible solutions

Select one:
True
False

Question 8
Complete
Mark 2.00 out of 2.00

Flag question

Question text
How Computers Generate Random Numbers
Computers generate random number for everything from cryptography to video
games and gambling . There are two categories of random numbers — “true”
random numbers and pseudorandom numbers — and the difference is important
for the security of encryption systems.

video games

Question 9
Complete
Mark 2.00 out of 2.00

Flag question

Question text
How PRNG works?
Linear Congruential Generator is most common and oldest algorithm for
generating pseudo-randomized numbers. The generator is defined by the
recurrence relation:

generator sequential generator

Question 10
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Pattern matching in computer science is the checking and locating of specific
sequences of data of some pattern among raw data or a sequence of tokens.
Select one:
True
False

Question 11
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Quick Sort is also based on the concept of Divide and Conquer , just like merge
sort. But in quick sort all the heavy lifting (major work) is done while dividing the
array into subarrays, while in case of merge sort, all the real work happens
during merging the subarrays .

partition-exchange elements

Question 12
Complete
Mark 3.00 out of 3.00

Flag question

Question text
Characteristics of PRNG :
 A given sequence of numbers can be reproduced at a later date
if the starting point in the sequence is known. Answer 1
Deterministic

 PRNG can produce many numbers in a short time and is


advantageous for applications that need many numbers. Answer 2
Efficient

 It means that the sequence will eventually repeat itself.


Answer 3
Periodic

Question 13
Complete
Mark 1.00 out of 1.00

Flag question

Question text
The __________ takes a 'backward' approach: the pattern string (P) is aligned with
the start of the text string (T), and then compare the characters of a pattern
from right to left, beginning with the rightmost character.

Select one:
a.
Boyer-Moore algorithm

b.
Brute force algorithm

c.
KMP algorithm

Question 14
Complete
Mark 1.00 out of 1.00

Flag question
Question text
Binary sea
Answer is a more efficient search algorithm which relies on the
elements in the list being sorted.

Question 15
Complete
Mark 2.00 out of 2.00

Flag question

Question text
Child node in a binary tree on the left is termed as left child node and node in
the right is termed as the right child node .

right child vertex left child vertex

Question 16
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Starts with each vertex being its own component. It repeatedly merges two
components into one by choosing the light edge that crosses the cut between
them.

Select one:
a.
Kruskal's algorithm

b.
Dijkstra's Algorithm

c.
Huffman trees

Question 17
Complete
Mark 2.00 out of 2.00

Flag question

Question text
Components of KMP Algorithm:
A pattern encapsulates knowledge about how the pattern matches Answer 1
against the shift of itself. Prefix Function (?)

With string 'S,' pattern 'p' and prefix function 'Π' as inputs, find the
occurrence of 'p' in 'S' and returns the number of shifts of 'p' after
which occurrences are found. Answer 2
KMP Matcher

Question 18
Complete
Mark 2.00 out of 2.00

Flag question

Question text
A full binary tree which is also called as proper binary tree or 2-tree is a tree in
which all the node other than the leaves has exact two children.

complete binary tree root

Question 19
Complete
Mark 1.00 out of 1.00

Flag question

Question text
A complete binary tree is a binary tree in which at every level, except possibly
the last, has to be filled and all nodes are as far left as possible.

Select one:
True
False

Question 20
Complete
Mark 1.00 out of 1.00

Flag question

Question text
A binary tree is a special type of tree in which every node or vertex has either
no child node or one child node or two child nodes.

Select one:
True
False

Question 21
Complete
Mark 1.00 out of 1.00

Flag question

Question text
It maintains a set S of vertices whose final shortest - path weights from the
source s have already been determined. That's for all vertices v ∈ S; we have d
[v] = δ (s, v).
Select one:
a.
Kruskal's algorithm

b.
Dijkstra's Algorithm

c.
Prim's algorithm

Question 22
Complete
Mark 0.00 out of 1.00

Flag question

Question text
Linear search is the most basic kind of search method. It involves checking each
element of the list in turn, until the desired element is found.

Select one:
True
False

Question 23
Complete
Mark 3.00 out of 3.00

Flag question

Question text
String Matching Preliminaries
The longer string in which we are searching for the Text
pattern. Answer 1
The string that we seek Pattern
Answer 2
An instance of the pattern within the text. Target
Answer 3
Question 24
Complete
Mark 3.00 out of 3.00

Flag question

Question text
How does pattern matching work?
Pattern Matching works by "reading " through text strings to match patterns
that are defined using Pattern Matching Expressions, also known
as regular expressions . The behavior for wildcard characters is overridden by
the behavior assigned to the same character(s) under Regular Expression
Reference.

pattern matching match patterns

Question 25
Complete
Mark 3.00 out of 3.00

Flag question

Question text
In the figure below, the root node 8 has two children 3 and 10; then this two
child node again acts as a parent node for 1 and 6 for left parent node 3 and 14
for right parent node 10. Similarly, 6 and 14 has a child node.
vertex right child node left child node

Question 26
Complete
Mark 1.00 out of 1.00

Flag question

Question text
A good suffix is a suffix that has matched successfully.

Select one:
True
False

Question 27
Complete
Mark 0.00 out of 1.00

Flag question

Question text
Prefix Codes, means the codes (bit sequences) are assigned in such a way that
the code assigned to one character is not the prefix of code assigned to any
other character.
Select one:
a.
Dijkstra's Algorithm

b.
Huffman's algorithm

c.
Huffman trees

Question 28
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Linear search is the most basic kind of search method. It involves checking each
element of the list in turn, until the desired element is found.

Binary search search tree

Question 29
Complete
Mark 1.00 out of 1.00

Flag question

Question text
It refers to a programming style that does not include any shortcuts to improve
performance, but instead relies on sheer computing power to try all possibilities
until the solution to a problem is found.
Select one:
a.
Boyer-Moore Algorithm

b.
Brute Force Algorithms

c.
Knuth-Morris-Pratt (KMP)Algorithm

Question 30
Complete
Mark 1.00 out of 1.00

Flag question

Question text
Pseudo Random Number Generator (PRNG) refers to an algorithm that uses
mathematical formulas to produce sequences of random numbers.
Select one:
True
False

Question 31
Complete
Mark 2.00 out of 2.00

Flag question

Question text
Searching algorithms that perform this task:

 It requires a sorted input list, and checks for the value in the
middle of the list, repeatedly discarding the half of the list which Answer 1
contains values which are definitely either all larger or all smaller binary search,
than the desired value.

Answer 2
 It simply checks the values in sequence until the desired value is linear search
found.

You might also like