wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Quiz 1 Introduction to Algorithm

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

Proof that 3^n - 1 is a multiple of 2 for n>=1.

Based on the question, choose the correct answer for induction base case.

a)

3^1 - 1 = 2

b)

3^2 - 1 = 8

c)

3^k - 1 = 2^k

d)

3^k - 1 = 2^n

2.

Based on the following list of preference (from most favor to least favor), define the perfect matching from w to v.

v1: w1 w2 w3

v2: w2 w3w1

v3: w3w2 w1

w1: v1 v2 v3

w2: v2 v1 v3

w3: v2 v1 v3

a)

(v1,w1), (v2,w2), (v3, w3)

b)

(v1, w2), (v2, w3), (v3, w1)

c)

(v1, w3), (v2, w1), (v3, w2)

d)

No answer

3.

A program is having the running time as: 1+2+3+...+n, this means that the f(n) is

a)

n+1

b)

n(n+1)/2

c)

n++

d)

n-1

4.

Which of the following is a part of an algorithm?

a)

input

b)

output

c)

steps to be carried out in order to accomplish the task

d)

All the options

5.

The essential characteristics of algorithm are: finiteness, effectiveness and (a)   .

6.

Algorithm must be

a)

programming language dependent

b)

programming language independent

c)

either of the above

d)

none of the above

7.

George obtains offer from company B. He accepts the offer. However, his favorite is actually company A. One week later, company A offers George the opportunity. Since Jimmy prefers company A, so he rejects company B although he has accepted the offer. In the view of stable matching, this is a/an

a)

breaking down

b)

stable matching

c)

unethical rejection

d)

human right

e)

ethical rejection

8.

Suppose we are looking at a matching of men and women returned by the Gale‐Shapely algorithm. The matching contains (m, w) and (m’, w’). A stability occurs in a matching when:

(select all that applicable)

a)

m prefers w’ more than w

b)

w’ prefers m less than m’

c)

m prefers w’ more than w and w prefers m’ less than m

d)

m prefers w’ more than w and w’ prefers m more than m’

e)

m’ prefers w more than w’ and w prefers m less than m’

9.

This equation 2^(2 log⁡ n ) is equivalent to

a)

4 log n

b)

2 log n^2

c)

n^2

d)

log n^2

10.

Arrange the following steps into a proper sequence where the purpose is to find the maximum value in an array.

1. Search and compare the other elements in the array

2. Return Max element

3. Given an array of all integer elements

4. Stop when complete visit each element in the array

5. If an element is greater than the Max, replace it

6. Assign a variable Max = first element in the array

a)

The correct sequence is: 3, 1, 6, 5, 4, 2

b)

The correct sequence is: 3, 6, 1, 5, 4, 2

c)

The correct sequence is: 6, 5, 3, 1, 4, 2

d)

The correct sequence is: 1, 3, 5, 6, 4, 2