0% found this document useful (0 votes)
135 views29 pages

Concept Review - Chapter 1-10

The document covers concepts related to logic including logical expressions and operations, sets, functions, algorithms, and integers. It includes definitions of logical and set theory concepts, examples of logical expressions, and multiple choice questions testing understanding of topics covered.
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)
135 views29 pages

Concept Review - Chapter 1-10

The document covers concepts related to logic including logical expressions and operations, sets, functions, algorithms, and integers. It includes definitions of logical and set theory concepts, examples of logical expressions, and multiple choice questions testing understanding of topics covered.
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/ 29

Concept Review – chapter 1- LOGIC

• p ∨ q (disjunction of p and q): the proposition “p or q,” which is true if and only
if at least one of p and q is ___.
• p → q (p implies q): the proposition “if p, then q,” which is ___ if and only if p is
true and q is false.
• ___ is a compound proposition that is always true.
• ¬q → ¬p is logically ___ to p → q.
• ∀xP(x) is true if and only if P(x) is true for ___ x in the domain.
• The proposition p  q is ____ p → q.
• State the De Morgan’s Laws.
• 𝑝𝑞𝑟 
̅̅̅̅̅̅̅̅̅̅̅

Multiple choice questions


1. Given the propositions:
p = “you drive at more than 80km/h”
q = “you get a speeding ticket”
Express the sentence into a logical expression.
“You get a speeding ticket if you drive at more than 80km/h”
a. q  p
b. p  q
c. q  p
d. q  p
2. Given the propositions:
p = “this computer program is correct” and
q = “it does not produce error message during translation”.
Express the following sentence into a logical expression:
“A necessary condition for this computer program to be correct is that it does not
produce error message during translation”.
a. q  p
b. p  q
c. q  p
d. q  p
3. Which proposition is logically equivalent to p  (r  q) ?
a. p  q  r
b. (p v r)  q
c. p v r v q
d. None of these
4. Which of the following propositions is true? (x denotes a real number).
(i) x[(x  1)  (x2  1)]
(ii) x[(x  1)  (x2  1)]
(iii) x[(x  1)  (x2  1)]
5. Let T(x, y) = “the student x takes the class y”, where x represents a student in a
university, and y represents a class.
Translate the logical expression into a sentence:
xyT(x,y)
Answer:
6. Which of the following is the negation of the proposition:
xy (M(x, y)  N(x, y))?

(i) xy (N(x, y)  M(x, y))


(ii) xy (M(x, y)  N(x, y))
(iii)xy (N(x, y)  M(x, y))
(iv) xy (N(x, y)  M(x, y))
7. Given the premises:
(1) If I eat spicy foods, then I have strange dreams.
(2) I have strange dreams if there is thunder while I sleep.
(3) I did not have strange dreams.
Which conclusion can be drawn?
8. Which proposition is equivalent to (p  q)  (p  q)?
(i) p
(ii) q
(iii) p
(iv) F

9. Let L(x, y) be the statement “ x is a friend of y”


Translate the statement “Anybody except one person is a friend of Leo”
10. Which argument is Valid?

a. Any hardworking student is good in class. An is not good in class. Therefore An was not
working hard.
b. Anyone in class understands logics. An is a student in class. Therefore An understands
logics.
c. Any computer science major must take Discrete Mathematics. An is taking Discrete
Mathematics. Therefore An is a computer science major.
d. Any student of FPT university lives in the dorm. An is living in a house. Therefore An is
not a student of FPT university.
Concept review – Chapter 2- SETS, FUNCTIONS, SUMS
• b  A means b is a/an ____ of the ____ A.
• If every element of S is also an element of T, we say S is a ____ of T.
• The ___ set  is the set with ____ elements.
• A ∪ B: the ____ of A and B.
• A ∩ B: the ____ of A and B.
• A − B (the difference of A and B): the set containing elements that are in A ___ in B.
• A ⊕ B (the symmetric difference of A and B): the set containing elements in ____ A and
B.
• A function from A to B maps ____ element of A to ____ element of B.
• If a function is both onto and one-to-one, it is called a ____.
• If a function is a bijection, it has an ____ function. It’s also called an invertible function.

Some multiple choice questions

1. Let U = {a, b, c, d, e, f, g, h, i, j}. The bit string representing the subset {a, c, d, g, h, i} is
____
a. 10 1110 1110
b. 10 1101 1110
c. 10 1100 1011
d. 10 1100 1110
2. Let U = {a, b, c, d, e, f, g, h, i, j}.
Given the subsets A = {a, c, d, e, i}, B = {a, f, g, h, j}. The bit string representing the
subset A - B is_______
a. 01 0110 0010
b. 00 1011 0010
c. 00 1110 0010
d. 00 0111 1010
3. Let R be the set {(a, b) | a - 1 = b}, where a and b are in {-2, -1, 0, 1, 2}. How many
elements does R have? (or in other words, what is the cardinality of R?)
a. 4
b. 3
c. 2
d. 1
4. The set A has n elements, B has n+1 elements. Assume that A  B has 42 elements. Find
n.
Answer: n = 6
5. Given the sequence {an, n = 1, 2, …}: an = 1 + 2 + 3 + … + n. Find a7 – a6.
a. 7
b. 6
c. 1
d. n
e. None of these
6. Given the sequence {an, n = 1, 2, …} where an equals the number of 1 bits in the
binary format of n. Find a11.
a. 0
b. 1
c. 2
d. 3
e. 4
f. None of these
7.

8. Which statement is FALSE?


a. A  A = 
b. A  A = A
c. A  𝐴̅ = U, where U is the universal set.
9.

Answer: (i)
10.

a. f is onto but not one-to-one.


b. f is a bijection.
c. f is one-to-one but not onto.
d. None of these.
11.

a. f is one-to-one but not onto.


b. f is onto but not one-to-one.
c. f is both one-to-one and onto.
d. f is neither one-to-one nor onto.

12. Find the composite function (fg)(x) = f(g(x)), where f(x) = x + 2018 and g(x) = x2018.
a. (x+2018)2018
b. x2018 + 2018
c. x2018(x+2018)
d. None of these
13. Given A = {1, 2}. Find A - P(A). (Recall that P(A) is the power set of A)
a. 
b. A
c. {  }
d. None of these
14. Given A = {1, 2}, find A  P(A).
a. A
b. 
c. {  }
d. None of these
15. How many elements does the set P({1, 2, 3, 4, 5, 6, 7, 8}) have?
a. 8
b. 16
c. 256
d. None of these
16.

Answer: (i)
17.

Answer: (0 – 1) + (0-2) + (0-3) + (1-1) + (1-2) + (1-3) + (2 – 1) + (2-2) + (2-3)


18.

10 11 20  21
Answer: 
2 2
19. Which sum is largest?
Concept Review – Chapter 3 – ALGORITHMS & INTEGERS

• f (x) is ___ if f(x) is both O(g(x)) and (g(x))


• The linear search has ___ worst case time complexity.
• The binary search has ___ worst case time complexity.
• The bubble and insertion sorts have ___ worst case time complexity.
• If there is an integer c such that ac = b, we say a ___ b and write ___.
• If a mod m = b mod m, we say a and b are ____ modulo m.
• gcd(a, b): ___ of two integers a, b.
• lcm(a, b): ___ of two integers a and b.
• If a and b are positive integers, then gcd(a, b)·lcm(a, b) = ___.
• If gcd(a, b) = 1, then a and b are called ____.
• If the function f(p) = (p + 13) mod 26 is used to encrypt a message, then ____ is used to
decrypt this encoded message.
• If a and b are integers and r = a mod b, then gcd(a, b) = ___.

Some multiple choice questions

1. Given f(x) = x2 and g(x) = 3x + 2018. Consider the statements:


(i) f(x) is O(g(x))
(ii) g(x) is O(f(x))

Which statement is TRUE?

a. (i) only
b. (ii) only
c. Both
d. None
(√𝑥 8 +𝑥 4 +1 +1)(𝑙𝑜𝑔𝑥+3)
2. Find the least integer k such that is O(xk).
𝑥 2 +1
a. 1
b. 2
c. 3
d. 4
e. None of these
3. Which function is (xlogx)?
a. 2018x
b. x2/2018
c. 20182018
d. All of the above
4. Given f(x) = 3x2 + 12x + 2 and g(x) = x3
Which statement is True?
a. f(x) is O(g(x))
b. f(x) is (g(x))
c. f(x) is (g(x))
d. None of these
5. Suppose a mod 4 = 3 and b mod 8 = 7, find ab mod 4.
a. 1
b. 2
c. 3
d. 21
e. 9
6. Which of the following integers are congruent to 13 modulo 7?
a. -6
b. -1
c. 1
d. 7
e. None of these
7. Consider the algorithm:
procedure giaithuat(a1, a2, …, an : integers)
count:= 0
for i:= i to n do
if ai > 0 then count: = count + 1
print(count)
Give the best big-O complexity for the algorithm above.
a. O(n)
b. O(logn)
c. O(1)
d. O(n2)
e. None of these
8. Consider the algorithm:
procedure GT(n : positive integer)
F:=1
for i:= 1 to n do
F: = F * i
Print(F)
Give the best big-O complexity for the algorithm above.
a. O(n)
b. O(logn)
c. O(1)
d. O(n2)
e. None of these
9. Find the base 7 expansion of 186
a. 354
b. 331
c. 413
d. 271
e. None of these
10. Find the binary format of (1011)3.
a. 11110
b. 11111
c. 100000
d. 10101
e. None of these
11. Suppose pseudo-random numbers are produced by using:
xn+1 = (3xn + 5) mod 7.
If x3 = 5, find x2 and x4.
Answer: x4 = 6, x2 = 0
12. Suppose pseudo-random numbers are produced by using:
xn+1 = (3xn + 7) mod 13 and the seed x1 = 1.
Find x3 and x4.
Answer: x3 = 11 and x4 = 1.
13. Use the function f(x) = (x + 17) mod 26 to encrypt the message CV.
Answer: TM
14. Suppose the password for a quiz has been encoded using the function f(p) = (p + 13)
mod 26.
If the result is TA, find the password for the quiz.
Answer: GN
15. Which pair of integers are relatively prime?
a. (17, 51)
b. (5, 24)
c. (11, 121)
d. (37, 111)
e. None of the others
16. If a, b are positive integers such that gcd(a, b) = 5 and ab = 120, find lcm(a, b).
a. 24
b. 600
c. 120
d. 5
e. None of the others
17. Consider the bubble sort algorithm:
bubblesort(a1, a2, ..., an: integers)
for i:= 1 to n-1
for j:= 2 to n-i
if aj+1 < aj then swap(aj, aj+1)

If the input is [3, 1, 4, 5, 2], what is the result after the second pass (i = 2)?

a. [1, 2, 3, 4, 5]
b. [1, 3, 2, 4, 5]
c. [2, 1, 3, 4, 5]
d. [1, 3, 2, 5, 4]
e. None of these
18. Consider the Linear search algorithm:
procedure linear search(x: integer, a1, a2,..., an: distinct integers)
i := 1
while (i ≤ n and x  ai )
i := i + 1
if i ≤ n then location := i
else location := 0
return location

Given the sequence an: 3, 1, 5, 7, 4, 6


How many comparisons required for searching x = 7?
a. 7
b. 9
c. 11
d. 13
e. None of these
Chapter 4 – Induction & Recursion
Review questions

1. Find a recursive definition for an = 1 + (-1)n, n = 0, 1, 2, ...


(i) a0 = 2 and an = an-2, for n > 0
(ii) a0 = 2, a1 = 0 and an = an-2, for n > 1
(iii) a0 = 0, a1 = 2 and an = an-2, for n > 1
2. Find a recursive definition for the set of positive integers NOT divisible by 3.
(i) 1 is in S, if x is in S then x + 1 and x + 2 are in S
(ii) 1 is in S, if x is in S then x + 3 is in S
(iii) 1, 2 are in S, if x is in S then x + 3 is in S
3. Study the set S of bit strings defined recursively by:
String 1 belongs to S
If string x belongs to S, then string 11x belongs to S
Which statement is true?
(i) 111 11  S
(ii) 111111  S
a. (i) only
b. (ii) only
c. Both
d. None
4. Let f(n) = f(n/3) + 2 and f(1) = 3, where n is divisible by 3.
Find f(27).
Answer: 7
5. A recursive definition for the sequence f(n) = n, for n = 1, 2, 3, … is:
a. f(1) = 1, f(n) = n+ f(n-1) for n>1
b. f(n) = f(n-1) +1 for all n ≥ 1
c. f(1) = 1 and f(n) = f(n-1) +1 for all n > 1
d. f(1) = 1, f( n ) = n for all n>1
e. None of the others
6. Consider the recursive algorithm:
procedure giaithuat(n : positive integer, a: real number)
if n = 1 then giaithuat(n,a): = a
else giaithuat(n, a) = giaithuat(n-1, a) + a
What is the output if n = 4, a = 2.5?
a. 8
b. 16
c. 10
d. None of these
7. Consider the set A of bit strings defined recursively by
1∈A

if x ∈ A, then x11 ∈ A

Which of the following strings is in A?

a. The empty string , the string with no symbols.


b. String 11
c. String 111
d. String 1111
8. To prove the statement " 6 divides n3 - n for all integers n ≥ 0", the mathematical induction
method is used as the following:
(1) The statement is true for n = 0
(2) Suppose ____, the statement is true, that is, "6 divides k3 - k"
(3) We have, (k+1)3 - (k+1) = (k3 + 3k2 + 3k + 1) - (k + 1) = k3 - k + 3(k2 + k).

As 6 divides k3 - k (assumption, step 2) and 3(k2 + k) is a multiple of 6, we conclude that


(k+1)3 - (k+1) is also a multiple of 6.

(4) By induction, 6 divides n3 - n for all integers n ≥ 0.

Fill in the blank at step (2).

a. there exist an integer k ≥ 0


b. for every integer k ≥ 0
c. there are some integers k ≥ 0

9. n is any positive integer, which statements are true?

(i) 12 + 32 + 52 + ... + (2n-1)2 = n3

(ii) 1! + 2! + ... + n! = (n+1)! – 1

a. (i)
b. (ii)
c. None
d. Both
9. Find f (2018) if f (n) = - f(n - 3) and f (0) = 1, f (1) = 4, f(2) = 6.
a. 1
b. 4
c. 6
d. -1
e. -4
f. -6
10. Give a recursive definition of the set A = {…, -7, -4, -1, 2, 5, 8, …}
(i) 2 ∈ A; if x ∈ A then x + 3 ∈ A or x – 3 ∈ A
(ii) -1 ∈ A; if x ∈ A then x + 3 ∈ A or x – 3 ∈ A

Which is true?

a. (i)
b. (ii)
c. None
d. Both
Concept Review – Chapter 5-7. COUNTING

1. How many different function from {a, {a}, b, {a, b}} to {x, y, {z}, y}?
a. 34
b. 43
c. 12
d. Only one
e. 44
2. How many different one-to-one function from {a, b, c} to {00, 01, 10, 11}?
a. 34
b. 43
c. 4·3·2
d. Only one
3. Suppose that a “word” is any string of seven letters of the alphabet, with repeated letters
allowed.
How many words begin with A or B and end with A or B?
a. 2.265
b. 4.265
c. 266
d. None of these
4. Suppose that a “word” is any string of seven letters of the alphabet, with repeated letters
allowed. How many words begin with a vowel or end with a vowel?
Answer: (5·266 + 5·266 - 25·265)
5. A club with 20 women and 17 men needs to choose three different members to be
president, vice president, and treasurer. In how many ways is this possible if women will
be chosen as president and vice president and a man as treasurer?
a. 20 · 19 · 17
b. 37 · 36 · 35
c. 20 · 17 · 16
d. None of these
6. Find the number of subset of {1, 2, 3, 4, 5, 6} that contain 3.
a. 26
b. 25
c. 5
d. None of these
7. Suppose a restaurant serves a “special dinner” consisting of soup, salad, entree, dessert,
and beverage. The restaurant has five kinds of soup, three kinds of salad, ten entrees, five
desserts, and four beverages. How many different special dinners are possible? (Two
special dinners are different if they differ in at least one selection.)
a. 5 · 3 · 10· 5· 4
b. 5 + 3 + 10 + 5 + 4
c. 25
d. None of these
8. A professor teaching a Discrete Math course gives a multiple choice quiz that has ten
questions, each with four possible responses: a, b, c, d. How many ways for a student to
complete the test? (Assume that no answers are left blank.)
a. 40
b. 104
c. 410
d. None of these
9. How many integers between 100 and 1000 inclusive that are divisible by 7 or 13?
a. 142 + 75 – 9
b. 142 + 75
c. 143 + 75 – 9
d. None of these
10. Suppose f (n) = 4 f (n/2) if n is divisible by 2, and f (1) = 2. Find f (8).
a. 226
b. 128
c. 256
d. 64
e. None of these
11. You take a job that pays $55,000 annually. How much do you earn 15 years from now if
you receive a three percent raise each year?
a. 55,000·1.0315
b. 55,000·0.0315
c. 55,000·1.1315
d. 55,0001.03
e. None of these
Concept Review – Chapter 8 - Relations
• A binary relation from a set A to a set B is a ____ of ____.
• There are ____ different relations on a set with n elements.
• (a, b)  R means a ___ b.
• (a, b)  R if and only if (b, a)  ___.
• (a, b)  R if and only if (b, a)  ___.
• If there are some element a in A such that (a, a)  R, then R is ___.
• If there are some element a in A such that (a, a)  R, then R is ___.
• If there are some a, b, c in A such that aRb, bRc and ____, then R is not transitive.
• A relation on a set A is called a/an ___ if it is reflexive, symmetric and transitive.

Multiple choice questions

1. If R = {(a, b), (b, c), (c, c)}, how many ordered pairs are there in R2?
a. 1 b. 2 c. 3 d. 4 e. none of these
2. A company makes four kinds of products. Each product has a size code, a weight code,
and a shape code. The following table shows these codes:
Size Code Weight Code Shape Code
42 27 42
27 38 13
13 12 27
42 38 38
Find which of the three codes is a primary key.
a. size code
b. weight code
c. shape code
d. No primary key
3. If X = (Fran Williams, 617885197, MTH 202, 248B West), find the projection P1,3(X).
a. (Fran Williams, MTH 202)
b. (617885197, 248B West)
c. (Fran Williams, 617885197)
d. None of these
4. Suppose R = {(a, b), (b, b), (c, a)} and S = {(a, c), (b, c)} are relations on {a, b, c}.
Construct RoS.
a. {(a, c); (b, c)}
b. {(a, a); (b, a)}
c. {(a, a); (b, a); (b, c)}
d. None of these
5. Let R = {(x, y) | x – y = 5 or y = x + 5} and S = {(x, y) | x – y = 5} are relations on the set
of integers. Which one is true?
(i) R is symmetric
(ii) S is symmetric
a. (i)
b. (ii)
c. None
d. Both
6. Given a matrix of a relation R

Consider the statements:


(i) R is symmetric
(ii) R is reflexive
Which one is true?
a. (i)
b. (ii)
c. None
d. Both
7. Given a matrix of a relation R

Consider the statements:


(i) R is symmetric
(ii) R is antisymmetric
Which one is true?
a. (i)
b. (ii)
c. None
d. Both
8.
a. Yes, no, yes
b. Yes, no, no
c. No, yes, yes
d. No, no, yes
e. None of the others
9. Which relations are equivalence relations on {1, 2, 3, 4}?
R = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (1, 3), (4, 4)}
S = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)}
a. S
b. R
c. Both
d. None
10. How many ordered pairs in the equivalence relation corresponding to the partition {a},
{b, d}, {c} of {a, b, c, d}?
a. 3
b. 4
c. 5
d. 6
e. None of the others
11. How many different relations from {a, b, c} to {1, 2}?
a. 6
b. 8
c. 9
d. 26
e. None of these
12. How many different relations on {a, b} containing the pair (a, b)?
a. 1
b. 8
c. 4
d. 16
e. None of these
Concept review – Chapter 9- GRAPHS
• ____ is an undirected graph with no multiple edges or loops.
• Two vertices are called ____ if there is an edge between them.
• An edge is ___ with a vertex if the vertex is an endpoint of that edge.
• ____ of a vertex in an undirected graph is the number of edges incident with this vertex
with loops counted twice.
• ____ is a path that does not contain an edge more than once.
• ____ is a path of length n ≥ 1 that begins and ends at the same vertex.
• ____ is the undirected graph with n vertices where each pair of vertices is connected by
an edge.
• Graph Km,n has ____ edges and ____ vertices.
• Graph Wn has ____ edges and ____ vertices.
• A matrix representing a graph using the adjacency of vertices is called ____ of the graph.
• A matrix representing a graph using the incidence of edges and vertices is called ____ of
the graph.
• A graph with vertex set that can be partitioned into subsets V1 and V2 so that each edge
connects a vertex in V1 and a vertex in V2 is called a/an ____ graph.
• A circuit that contains every edge of a graph exactly once is called a/an ____.
• A path in a graph that passes through each vertex exactly once is called a/an ____.

Multiple choice questions

1. How many edges are there in an undirected graph with degree sequence 5, 5, 4, 3, 2,
1, 1, 1, 0?
a. 21
b. 20
c. 10
d. 11
e. No such a graph.
2. Which degree sequence corresponds to a simple graph?
(i) 5, 4, 3, 2, 1
(ii) 5, 5, 4, 2, 1, 1
a. (i)
b. (ii)
c. None
d. Both
3. Which graph corresponds to the following adjacency matrix?
a. K6
b. C6
c. W6
d. Q3
e. None of these
4. How many 1-entries in the adjacency matrix of graph K3,5?
a. 15
b. 30
c. 8
d. None of these
5. Cn is bipartite if and only if
a. n is an integer.
b. n is an even integer.
c. n is an odd integer.
d. No such n.
6. Are these two graphs isomorphic?

Answer: yes (d-6 e-5 g-1 f-2 c-3 a-7 b-4)


7. Consider the graph shown below.
(i) Does it have an Euler circuit?
(ii) Does it have an Euler path?
a. (i) Yes (ii) Yes
b. (i) Yes (ii) No
c. (i) No (ii) Yes
d. (i) No (ii) No
8. Consider the graph shown below.
(i) Does it have a Hamilton circuit?
(ii) Does it have a Hamilton path?

a. (i) Yes (ii) Yes


b. (i) Yes (ii) No
c. (i) No (ii) Yes
d. (i) No (ii) No
9. Consider the graph shown below.
(i) Does it have a Hamilton circuit?
(ii) Does it have a Hamilton path?
a. (i) Yes (ii) Yes
b. (i) Yes (ii) No
c. (i) No (ii) Yes
d. (i) No (ii) No
10. Consider the graph shown below.
(i) Does it have an Euler circuit?
(ii) Does it have an Euler path?

a. (i) Yes (ii) Yes


b. (i) Yes (ii) No
c. (i) No (ii) Yes
d. (i) No (ii) No

11. Every Euler circuit for K9 has length ________.


a. 18
b. 9
c. 45
d. 36
e. None of these
12. Which graphs given by adjacency matrices below are bipartite?
G H
a. G
b. H
c. Both
d. None
13. List all positive integers m and n such that Km,n has a Hamilton circuit.
a. m = n.
b. m = n > 1.
c. m and n are even and > 1.
d. m and n are odd.
e. None of these
14. Every Euler circuit for W7 has length ________.
a. 7
b. 8
c. 14
d. W7 has no an Euler circuit.
15. How many cut vertices does the graph below have?

a. 0
b. 1
c. 2
d. 3
e. 4
16. How many paths of length 2 from a to c in the graph below?
a. 3
b. 6
c. 9
d. 12
17. How many paths of length 3 from b to c?

a. 6
b. 9
c. 12
d. 15
e. None of these (40 paths)
18. Use Dijkstra's Algorithm to find the shortest path length between the vertices b and
z in this weighted graph. How many vertices are not used?

a. 1
b. 2
c. 3
d. 4
e. None of these
Concept review – Chapter 10 - TREES
• A tree is a connected undirected graph with no ____.
• An m-ary tree is a tree with the property that every internal vertex has ____ children.
• A full m-ary tree is a tree with the property that every internal vertex has ____ children.
• A tree with n nodes has ____ edges.
• A full m-ary tree with i internal vertices has ____ nodes and ____ leaves.
• A code that has the property that the code of a character is never a prefix of the code of
another character is called a ____.
• ____ is a listing of the vertices of an ordered rooted tree defined recursively - the root is
listed, followed by the first subtree, followed by the other subtrees in the order they occur
from left to right.
• ____ is the form of an expression obtained from a preorder traversal of the tree
representing this expression.
• ____ is the form of an expression obtained from a post-order traversal of the tree
representing this expression.

Multiple choice questions

1. A full binary tree with 99 internal vertices has ____ edges.


a. 99
b. 198
c. 100
d. 199
e. 98
2. A full 5-ary tree with 45 leaves has ____ internal vertices.
a. 11
b. 12
c. 13
d. 14
e. None of these
3. Construct a binary search tree for the words: TIME, AND, TIDE, WAIT, FOR, NO,
MAN. How many comparisons are used to locate the word “MAN”?
a. 2
b. 3
c. 4
d. None of these (6)
4. How many comparisons are used to locate the word “ending” in the binary search
tree for the words of the sentence “A bad beginning makes a bad ending”?
e. 2
f. 3
g. 4
h. None of these
5. Which codes are prefix codes?
(i) A: 010 B: 101 C: 1101 D: 1011
(ii) A: 01 B: 111 C: 101 D: 1101
a. (i)
b. (ii)
c. None
d. Both
6. Which codes are prefix codes?
(i) A: 01 B: 101 C: 1101 D: 0011
(ii) A: 11 B: 1011 C: 1101 D: 1110
a. (i)
b. (ii)
c. None
d. Both
7. Consider the coding scheme: t: 001, e: 101, a: 11, n: 0111.
What is the message represented by 10111001?
a. tea
b. eat
c. net
d. an
e. None of these
8. What is the code for the word “keep” if the coding scheme is represented by the
following tree?

a. 1000010011110
b. 1010001001111
c. 00100111101101
d. 110000100111110
e. None of these
9. What is the average number of bit required to encode the word “nobody” using
Huffman coding algorithm?
a. 2.15
b. 2.25
c. 2
d. 2.5
e. None of these (14/6)
10. What is the average number of bit required for each letter when using Huffman
coding algorithm to encode the word “success”?
a. 13/7
b. 15/7
c. 2
d. 16/7
e. None of these
11. Use Huffman coding to encode these symbols with given frequencies: a: 0.20, b:
0.10, c: 0.15, d: 0.25, e: 0.30. What is the average number of bits required to encode a
character?
Answer: 2.25 bits/symbol
12. Find the value of the expression + - 7 * 2 1 / 3 1
a. 4
b. 6
c. 8
d. 10
e. None of these
13. Find the value of the expression 5 4 - 3 6 3 /  7 - *.
a. 2
b. 4
c. 6
d. 8
e. None of these
14. Find the postfix form of the expression (2*x + y)/(x – 3*y).
a. 2 x * y + x 3 y * / /
b. 2 * x y + x 3 / y * /
c. / + * 2 x y / x * 3 y
d. None of these

You might also like