Uploaded by sammie cao

mad-tai-lieu-ne

advertisement
lOMoARcPSD|25505700
MAD - tai lieu ne
Proficiency in survival craft (University of Transportation HCMC)
Studocu is not sponsored or endorsed by any college or university
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
Question 1:
Which of these code is prefix code?
A. a: 101, b: 110, c: 10, d: 11
B. a: 101, b: 100, c: 10, d: 11
C. a: 101, b: 100, c: 110, d: 11
D. a: 101, b: 100, c: 00, d: 111
Question 2:
Given the algorithm
ProcedureLN(m,n : interger)
while(m != n)
if m > n then m:=m-n
else n:n-m;
Print(m)
If m=36, n=44, what is the output of the algorithm?
Choose 1 answer:
A. 5
B. 8
C. 7
D. 6
E. 4
Question 3: (đề thiαΊΏu)
Recall some rules of interface
Modus ponens
p ^ (p →q) →q
Modus tollens
-q ^ (p →q) → -p
Hypothetical syllogism
(p →q) ^ (q →r) → (p→r)
Disjunctive syllogism
[(p v q) ^ -p] →q
Determine the rule used in the argument:
Choose 1 answer:
A. Modus ponens
B. Hypothetical syllogism
C. None of the other choice is correct
D. Disjunctive syllogism
E. Modus tollens
Question 4:
Given a sequence {an} satisfying the recurrence relation
a1 = 1, an = an-1 +3n for n = 2,3,…
Find a4.
Choose 1 answer:
A. 118
B. 112
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
C. 114
D. None of the other choice is correct
E. 116
Question 6:
Given the Euclidean Algorithm
produce gcd(a, b: positive interger)
x:= a
y:= b
while y > 0
r:= x mod y
x:= y
y:=r
Return x {x is gcd(a,b)}
If a=16, b=573, after the second iteration of the loop, ___________
A. x=35, y=13
B. x=13, y=3
C. x=35, y=16
D. x=16, y=13
E. None of the other choice is correct
Question 7:
Convert (1110011100)2 into octal expansion
(i)
(1634)8
(ii) (7160)8
(iii) (32130)8
(iv) (3634)8
Choose 1 answer:
A. (iii)
B. (ii)
C. None of the other choice is correct
D. (i)
E. (iv)
Question 8:
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
Are these two graphs isomorphic? If not, what is the reason?
A. No, they are not isomorphic because they do not have the same number of triangles
B. No, they are not isomorphic becaise they do not have the same number of edges
C. Yes, they are isomorphic
D. No, they are not isomorphic becaise they do not have the same number of vertices if
degree 2
E. None of the other choice is correct
Question 9:
Let C(x) = “x has a cat,”
D(x) = “x has a dog,”
F(x) = “x has a ferret,”
Let the domian consist of all students in your class.
Express the sentence
“No student in your class has a cat, a dog, and a ferret.”
In terms of C(x), D(x), F(x), quantifiers, and logical connectives.
(i)
∃x C(x) ^ D(x) ^ F(x)
(ii) ∃x –C(x) ^ -D(x) ^ -F(x)
(iii) ∀x C(x) ^ D(x) ^ F(x)
(iv) ∀x -C(x) ^ -D(x) ^ -F(x)
Choose 1 answer:
A. (ii)
B. (iv)
C. (iii)
D. (i)
Question 10:
Let A,B be sets. Find the truths values of the propositions
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
(i)
𝐴 ∪ (𝐴 ∩ 𝐡) = (𝐴) ∪ 𝐡
(ii) 𝐴 ∩ (𝐴 ∩ 𝐡) = (𝐴 ∩ 𝐡)
Choose 1 answer:
A. False, true
B. True, false
C. False, false
D. True, true
Question 11:
Draw a binary search for the sentence
'The quick brown fox jumps over the lazy dog'
How many comparisons are needed to locate the word 'lazy'?
A. 7
B. 6
C. 8
D. 5
E. 4
Question 12:
Let a=296 div 19, b=-125 div 19. Find a-b.
A. 20
B. 22
C. 21
D. 23
E. None of other choices is correct
Question 13:
How many vertices in a full binary tree with 50 leaves?
A. None of other choices is correct
B. 101
C. 99
D. 51
E. 100
Question 14:
Given the set S contained in Z defined recursively as follows:
Which of the following element belong to S.
Choose 1 answer:
A. 22
B. 23
C. 21
D. 15
Question 16:
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
Given the algorithm:
procedure TT(n: integer)
sum:=0
i:=0
j:=0
while( i< √𝑛)
sum:=sum+1
i:=i+1
while(j< √𝑛/2)
j:=j+1
sum:=sum+1
Print(sum)
If n=9 , how many additions are requierd?
A. 10
B. 14
C. 8
D. 6
E. 12
Question 17:
Let x be real number.Chose the correct statement.
A. None of orther
B. (iii)
C. (ii)
D. (i)
E. (iv)
Question 18:
For which n>2 does the graph Wn have Euler circuits.
A. all n>2 and even
B. all n>2
C. all n>2 and odd
D. None of the other choices is correct
Question 20:
Find the output of the following algorithm when n=4.
procedure ABC(n.P:integer)
P:=1;
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
for j:=1 to n
begin
if(j mod 2 = 0) then
P:= P+j
else P:=P*j
end
A. 13
B. 10
C. 24
D. None of the other choices is correct
Question 21:
Find the exponent of 3 in the prime factorization of 10!.
A. 4
B. 3
C. 5
D. 2
E. None of the other choices is correct
Question 22:
Which rooted trees are full 3-ary?
A. None of the other choices is correct
B. (ii) and (iii)
C. () and (iii)
D. (ii)
E. (i), (ii) and (iii)
Question 23:
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
A sequence of pseudo-random numbers are generated using the Linear congruential method
X0 = 1
Xn+1 = (3xn + 4) mod 7
Find x3.
A. 2
B. None of the other choices is correct
C. 4
D. 16
Question 24:
Let f(x) = x²log(x) and g(x) = xlog(x4).
Choose the correct statements:
(i) f(x) = O(g(x))
(ii) g(x) = O(f(x))
A. (ii)
B. (i)
C. Both (i) and (ii)
D. None of the other choices is correct
Question 25:
The degree sequence of W7 is________
A. 6, 1, 1, 1, 1, 1, 1
B. 6, 3, 3, 3, 3, 3, 3
C. 6, 2, 2, 2, 2, 2, 2
D. 7, 3, 3, 3, 3, 3, 3, 3
E. 7, 2, 2, 2, 2, 2, 2, 2
Question 26:
A complete bipartite graph with 10 vertices can have at most_____
A. 21 edges
B. 24 edges
C. 25 edges
D. 28 edges
E. None of the other choices
Question 27:
Let u, v be two vertices of the graph K2,2, one on each side. How many paths of length 4
between u and v?
A. 4
B. None of the other choices is correct
C. 8
D. 0
E. 2
Question 28:
Suppose L(x,y) is the statement
"Student x solves question y correctly".
Translate the statement into logical expression
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
"For any question in the exam, there are at least two students who solve it correctly and at least
one student who does not"
A. None of the other choices is correct
B. (ii)
C. (iv)
D. (i)
E. (iii)
Question 29:
Let P(n) be the statement "3n = 1". The domain consists of all non-negative integers.
A. (iii)
B. None of the other choices
C. (ii)
D. (i)
Question 30:
Give a recursive definition of the sequence
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
A. (iv)
B. (ii)
C. (iii)
D. (i)
E. None of the other choices
Question 31:
Choose a tuple of values of p, q, r such that the proposition
(p → q) ∧ r
is True.
A. None of the mentioned
B. p=F, q=T, r=F
C. p=q=r=F
D. p=T, q=F, r=T
E. p=F, q=F, r=T
Question 32:
Suppose that f(n) = f(n/5)+2n³ when n is a positive integer divisible by 5.
Give a big-O estimate for f(n) if f is an increasing function.
(i) O(n5)
(ii) O(n³)
(iii) O(n³logn)
(iv) O(nlog5)
(v) O(nlog³)
Choose 1 answer:
A. (iii)
B. (iv)
C. (v)
D. (i)
E. (ii)
Question 33:
How many positive integers less than 12 that are relatively prime to 12?
A. 4
B. 3
C. 5
D. 6
Question 34:
Find the truth value of each of the following propositions, where x represents a real number.
(M) ∀x[(x >= 1) → (x2 >= 1)]
(N) ∀x[(x >= 1) κ“₯ (x2 >= 1)]
(P) ∀x[(x >= 1) α΄  (x2 >= 1)]
Choose 1 answer:
A. Only (M) is True
B. All of (M). (N) and (P) are True
C. Only (N) is True
D. Only (P) is True
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
E. None of the other choices is correct
Question 35:
Which of the following sets is the power set of
(i) {Ø,{a},{Ø,a}}
(ii) {Ø,{a},{0},{a,Ø}}
(iii) {0, {a},{0},{a,{0}}}
(iv) {0, {a,Ø}}
Choose 1 answer:
A. (iv)
B. (iii)
C. (i)
D. (ii)
Question 36:
How many strings consisting of 4 decimal digits among them exactly three digits are 3?
A. 10
B. 35
C. None of the other choices is correct
D. 36
E. 40
Question 37:
Find the postfix notation of the expression
x + (( x * y + x ) / y)
A. x x y * x + y / +
B. x x y * + x y / +
C. None of the other choices is correct
D. + + x * x y / x y
Question 38:
Which of the following algorithms are recursive?
(i)
procedure ABC(n, P: integers)
P :=0;
for j = 1 to n
begin
if (j mod 2 = 0) then
P:= P - j;
else P: =P + j;
end
(ii)
procedure ABC(n, P: integer)
P :=1;
for j := 1 to n
begin
if (j mod 2 = 0) then
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
P:= P + j;
else P :=P * j;
end
Choose 1 answer:
A. None of them
B. Only (1)
C. Only (ii)
D. Both of them
Question 39:
Compute
A. -9
B. 0
C. -12
D. None of the other choices is correct
E. -6
Question 40:
Given the propositions
p = "You have the flu",
q ="You miss the final examination", and
r = "You pass the course".
Express the following sentence into a logical expression
"If you have the flu but you don't miss the final examination, then you pass the course".
(i)
(p ∨ ¬q) → r
(ii) (¬p ∨ q) → r
(iii) (p ∧ ¬q) → r
(iv) (¬p ∧ q) → r
Choose 1 answer:
A. (ii)
B. (iii)
C. (iv)
D. (i)
Question 41:
Consider the functions from Z x Z --> Z given by
f (m, n) = m + 2n
g (m, n) = 2m + 2n + 1
h (m, n) = m - n
Which functions are onto?
(Choose 1 answer)
A. Only f
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
B. Only g
C. f and h
D. None of the other choices is correct
E. g and h
Question 42:
Delete all the edges that are incident to v6 to obtain a new graph.
How many connected components in the new graph?
(Choose 1 answer)
A. 4
B. None of the other choices is correct
C. 3
D. 2
E. 5
F. 1
Question 43:
Given the recursive algorithm
Procedure AL (x: interger, n: positive integer)
If n = 1 then AL (x, n) = x
else AL (x, n) = AL (x, n - 1) + x
Find the value of AL (3, 6).
(Choose 1 answer)
A. 18
B. 12
C. 6
D. 9
E. None of the other choices is correct
Question 44:
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
Find the shortest path from A to H
(See picture)
(Choose 1 answer)
A. A – C – F – E – H
B. A – C – F – H
C. A – B – C – F – H
D. A – D – C – F – E - H
E. A – B – E – H
Question 45:
Find the negation of the following proposition
“Messi both scored and assisted yesterday.”
(Choose 1 answer)
A. Messi did not score or Messi did not assist yesterday.
B. Messi assisted but did not score yesterday.
C. Messi scored but did not assist yesterday.
D. Messi did not score and also did not assist yesterday.
Question 46:
Find the negation of the proposition
(Choose 1 answer)
(See picture)
Downloaded by sammie cao (huyenhyomin@gmail.com)
lOMoARcPSD|25505700
A.
B.
C.
D.
E.
(i)
(iii)
(iv)
None of the other choices is correct
(ii)
Question 47:
How many different spanning trees does K2,2 have?
(Choose 1 answer)
A. 3
B. 4
C. 1
D. 2
Question 48:
Given a pseudo graph G with incident matrix
How many loops does G have?
(Choose 1 answer)
A. None of the other choices is correct
B. 5
C. 0
D. 1
E. 3
Question 49:
Compute the value of the prefix notation
(Choose 1 answer)
A. 5
B. -1
C. -15
D. 0
E. None of the other choices is correct
Question 50:
How many 8-digits numbers that are divisible by 10?
(Choose 1 answer)
A. None of the other choices is correct
B. 9 000 001
C. 10 000 000
D. 10 000 001
E. 9 000 000
Downloaded by sammie cao (huyenhyomin@gmail.com)
Download