Question Text: Find The Output Value of N If Input A 200. Procedure XYZ (A: Integer) N: 0 While A 0
Question Text: Find The Output Value of N If Input A 200. Procedure XYZ (A: Integer) N: 0 While A 0
Question Text: Find The Output Value of N If Input A 200. Procedure XYZ (A: Integer) N: 0 While A 0
1
Not answered
Marked out of 1.00
Flag question
Question text
while a 0
n: = n + (a mod 2)
a: =
Print( n )
Answer:
Feedback
Question 2
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 3
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Answer 1
2x 4
Answer 2
2x3.ln(x) 9
Answer 3
(x3 - x2 + x - 1)3 Does not exist
Feedback
The correct answer is: 2x → Does not exist, 2x3.ln(x) → 4, (x3 - x2 + x - 1)3 → 9
Question 4
Not answered
Marked out of 1.00
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
Answer:
Feedback
Question 5
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 6
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. (i)
b. None of the other choices is correct
c. (ii)
d. Both (i), (ii).
Feedback
Question 7
Not answered
Marked out of 1.00
Flag question
Question text
When using the modular exponentiation algorithm to compute 6 6 mod 13, the remainders
computed by successively squaring are:
Select one:
a. Các lựa chọn còn lại đều sai.
b. 10, 9
c. 1, 6, 36
d. 6, 10, 9
Feedback
Flag question
Question text
Answer:
Feedback
Question 9
Not answered
Marked out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
1*1! + 2*2! + 3*3! + ... + n*n! = (n+1)!-1 for all n positive integer.
Then the proposition is also true for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... Answer 1
+ (k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+ Choose...
(k+1)*(k+1)! = (k+2)!-1
Answer 2
Assume the proposition is true for n = k. Choose...
Answer 3
By induction, the proposition is true for all n positive integers. Choose...
Answer 4
The proposition is true for n = 1 because 1*1! = 2!-1. Choose...
Feedback
The correct answer is: Then the proposition is also true for n = k + 1 because: 1*1! + 2*2!+
3*3!+ ... + (k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+(k+1)*(k+1)! =
(k+2)!-1 → Step 3, Assume the proposition is true for n = k. → Step 2, By induction, the
proposition is true for all n positive integers. → Step 4, The proposition is true for n = 1
because 1*1! = 2!-1. → Step 1
Question 10
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 11
Not answered
Marked out of 1.00
Flag question
Question text
If n = 0 then
pow(a,n):= 1
else
pow(a,n):= a.pow(a,n-1)
Print(pow(a,n))
Answer:
Feedback
Question 12
Not answered
Marked out of 1.00
Flag question
Question text
while
begin
i := i + 1
total := total + i
end
Select one:
a. total=i(i + 1)/2 and
b. total=n(n + 1)/2 and
c. total=n(n + 1)/2 and
d. total=i(i + 1)/2 and
Feedback
Question 13
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 14
Not answered
Marked out of 1.00
Flag question
Question text
Select one:
a. None of the other choices is correct
b.
c.
d.
e.
Feedback
Question 15
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
S:=S + i + j
24
Answer:
Feedback
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
47
Answer:
Feedback
Question 3
Complete
Mark 0.67 out of 1.00
Flag question
Question text
is O( ) Answer 1
No
is Yes
O(nlog(n )) Answer 2
is O( ) Answer 3
Yes
Feedback
The correct answer is: is O( ) → No, is O(nlog(n )) → No, is O(
) → Yes
Question 4
Not answered
Marked out of 1.00
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
Answer:
Feedback
Question 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (i), (ii).
b. (ii), (iii).
c. (i), (ii), (iii).
d. (ii).
e. None of the other choices is correct
Feedback
Question 7
Complete
Mark 0.00 out of 1.00
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 846 and b = 238?
4
Answer:
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
5646
Answer:
Feedback
Question 9
Complete
Mark 0.25 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) Answer 1
= 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 Step 2
Answer 2
By induction, the proposition is true for all n positive integer. Step 4
Answer 3
The proposition is true for n = 1 because 1 = 1*2/2. Step 3
Feedback
The correct answer is: Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... +
(k+1) = 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 → Step 3, By induction, the
proposition is true for all n positive integer. → Step 4, The proposition is true for n = 1
because 1 = 1*2/2. → Step 1, Assume the proposition is true for n = k. → Step 2
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find f(4) if
2
Answer:
Feedback
Question 11
Complete
Mark 0.00 out of 1.00
Flag question
Question text
4
Answer:
Feedback
Flag question
Question text
i := 1
total := 1
while i < n
begin
i := i + 1
total := total + i
end
Select one:
a. total=i(i+1)/2 and i less than or equal n
b. total=(n+1) và i less than or equal n
c. total=n(n+1)/2 and i less than n
d. total=i(i+1)/2 and i less than n
Feedback
Question 13
Complete
Mark 0.00 out of 1.00
Flag question
Question text
How many positive integers not exceeding 1000 and are divisible by 3 or 5?
468
Answer:
Feedback
Question 14
Not answered
Marked out of 1.00
Flag question
Question text
A young pair of rabbits (one of each sex) is placed on an island. A pair of rabbits does not
breed until they are 2 month old. After they are 2 month old they will produce 3 pairs of
rabbits each month. Find the number of pairs of rabbits after 6 months.
Answer:
Feedback
Question 15
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
while a 0
n: = n + (a mod 2)
a: =
Print (n )
5
Answer:
Feedback
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Given the algorithm to find the maximum element of a list (studied in the textbook).
If the input is the sequence 1, 4, 5, 2, 7, 9, 3, then all the values of the variable Max are:
Select one:
a. Các lựa chọn còn lại đều sai
b. 1, 4, 5, 2, 7, 9
c. 1, 5, 7, 9
d. 1, 4, 5, 7, 9
e. 4, 5, 7, 9
Feedback
Question 3
Complete
Mark 0.00 out of 1.00
Flag question
Question text
3n is O(n+log(n )) No
Answer 1
n+log(n ) is Yes
O(log(n )) Answer 2
No
n+log(n ) is O(n ) Answer 3
Feedback
The correct answer is: 3n is O(n+log(n )) → Yes, n+log(n ) is O(log(n )) → No, n+log(n ) is O(n )
→ Yes
Question 4
Complete
Mark 0.00 out of 1.00
Flag question
Question text
3
Answer:
Feedback
Question 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
0
Answer:
Feedback
Question 6
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Let m=23 32 58 135 và n = 25 33 55112. Choose correct statements:
(i) gcd(m, n) = 24 1390.
(ii) gcd(m, n) = 23 33 53
(iii) lcm(m, n) = 25 33 58 112 135
(iv) lcm(m, n) = 23 32 55 112 135
Select one:
a. (i), (iii).
b. None of the other choices is correct
c. (i), (iv).
d. (ii), (iv).
e. (ii), (iii).
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
When using the modular exponentiation algorithm to compute 2 7 mod 7, the remainders
computed by successively squaring are:
Select one:
a. 1, 2, 4
b. 2, 4, 2
c. 2, 4, 6
d. Các lựa chọn còn lại đều sai.
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
4607
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 2
The proposition is true for n = 1 because 1 = 12. Step 1
Answer 3
By induction, the proposition is true for all n positive integer. Step 4
Answer 4
Assume that the proposition is true for n = k. Step 2
Feedback
The correct answer is: Then the proposition is also true for n = k + 1 because: 1 + 3 + 5 + ... +
(2(k+1) - 1) = 1 + 3 + 5 + ... + (2k - 1) + (2k+1) = k2 + 2k + 1 = (k+1)2 → Step 3, The proposition
is true for n = 1 because 1 = 12. → Step 1, By induction, the proposition is true for
all n positive integer. → Step 4, Assume that the proposition is true for n = k. → Step 2
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find a5 .
70
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
else
gcd(a, b) = gcd( b mod a, a)
4
Answer:
Feedback
The correct answer is: 4
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
total := total + i
i := i + 1
end
With the initial assertion "n = 6", find the final assertion "total =?"
15
Answer:
Feedback
Question 13
Complete
Mark 1.00 out of 1.00
Flag question
Question text
How many phone numbers consisting of 4 distinct digits that end with a 0?
504
Answer:
Feedback
Question 14
Complete
Mark 0.00 out of 1.00
Flag question
Question text
A person deposited 1000 000 VND in a bank at the rate of 1%/month. Find the interest in
the 7th month.
1061520
Answer:
Feedback
Question 15
Complete
Mark 1.00 out of 1.00
Flag question
Question text
121
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
end
Find output value of S if input n = 4.
100
Answer:
Feedback
Question 2
Complete
Mark 0.00 out of 1.00
Flag question
Question text
m:=aj
for k:=i+1 down to j+1 do
ak:=ak-1
aj:=m
If input = 3, 2, 4, 7, 1, 6, 5, after running the outer loop with i = 3, the order of the elements
in the list is:
Select one:
a. 2, 3, 4, 7, 1, 5, 6
b. 2, 3, 4, 1, 7, 5, 6
c. Các lựa chọn còn lại đều sai
d. 2, 3, 7, 4, 1, 5, 6
e. 2, 3, 4, 7, 1, 6, 5
Feedback
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
2 0
Answer 1
2
x(x+1) Answer 2
x+ln(x 1
) Answer 3
Feedback
Question 4
Not answered
Marked out of 1.00
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
Answer:
Feedback
Question 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (i), (ii), (iii).
b. (i), (ii).
c. (ii), (iii).
d. None of the other choices is correct
e. (ii).
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
When using the modular exponentiation algorithm to compute 3 10 mod 7, the remainders
computed by successively squaring are:
Select one:
a. 3, 4, 2, 1
b. 1, 3, 2, 4
c. 3, 2, 4, 2
d. Các lựa chọn còn lại đều sai.
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
223
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 3
The proposition is true for n = 1 because 1 = 12. Step 1
Answer 4
Assume that the proposition is true for n = k. Step 2
Feedback
The correct answer is: Then the proposition is also true for n = k + 1 because: 1 + 3 + 5 + ... +
(2(k+1) - 1) = 1 + 3 + 5 + ... + (2k - 1) + (2k+1) = k2 + 2k + 1 = (k+1)2 → Step 3, By induction,
the proposition is true for all n positive integer. → Step 4, The proposition is true for n = 1
because 1 = 12. → Step 1, Assume that the proposition is true for n = k. → Step 2
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find a5 .
16
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
11
Answer:
Feedback
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
i := i + 1
total := total + i
end
With the initial assertion "n = 6", find the final assertion "total =?"
21
Answer:
Feedback
Question 13
Complete
Mark 0.00 out of 1.00
Flag question
Question text
10
Answer:
Feedback
Question 14
Complete
Mark 0.00 out of 1.00
Flag question
Question text
No
Answer 1
Yes
Answer 2
Yes
Answer 3
No
Answer 4
Feedback
Question 15
Not answered
Marked out of 1.00
Flag question
Question text
Question 1
Complete
Mark 0.00 out of 1.00
Flag question
Question text
procedure XYZ(a1,...,an: integers)
k:=0
for i:=1 to n do
if ai mod 2 = 0 then k:=k+ai
38
Answer:
Feedback
Question 2
Complete
Mark 0.00 out of 1.00
Flag question
Question text
The Binary search algorithm (studied in the textbook) successively divide the list into two
sublists.
procedure BinarySearch (a1<a2<...<an, x: integers)
while (i<j)
m:=
if x>am then i:=m+1
else j:=m
if x = ai then location:= i
else location:=0
If input = 2, 4, 5, 7, 8, 9, 10, 13 and x = 6, after the third time of dividing into sublists, the
sublist to be considered is:
Select one:
a. 7
b. 5
c. 7, 8
d. 5, 7
e. Các lựa chọn còn lại đều sai
Feedback
Question 3
Complete
Mark 0.67 out of 1.00
Flag question
Question text
2n is O(log n ) Answer 1
No
Feedback
The correct answer is: 2n is O(log n ) → No, 2log n is O (n ) → Yes, nlog(n ) is O(n ) → No
Question 4
Not answered
Marked out of 1.00
Flag question
Question text
if (i < n) then output := i
else output := 0
Let n = 500. Count the number of additions in the worst case.
Answer:
Feedback
Question 5
Complete
Mark 0.00 out of 1.00
Flag question
Question text
-21
Answer:
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (i), (iii).
b. None of the other choices is correct
c. (i), (iv).
d. (ii), (iii).
e. (ii), (iv).
Feedback
Question 7
Complete
Mark 0.00 out of 1.00
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 1982 and b = 1872?
4
Answer:
Feedback
Flag question
Question text
2131
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 1
The proposition is true for n = 1 because 1 = 1*2/2. Step 1
Answer 2
Assume the proposition is true for n = k. Step 2
Answer 3
By induction, the proposition is true for all n positive integer. Step 4
Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) Answer 4
= 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 Step 3
Feedback
The correct answer is: The proposition is true for n = 1 because 1 = 1*2/2. → Step 1,
Assume the proposition is true for n = k. → Step 2, By induction, the proposition is true for
all n positive integer. → Step 4, Then the proposition is also true for n = k + 1 because: 1 +
2+ 3+ ... + (k+1) = 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 → Step 3
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find a4.
3968
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
else
fac(n ):= n*fac(n-1)
print(fac(n ))
Find output if n = 5.
120
Answer:
Feedback
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
while
begin
i := i + 1
total := total + i
end
With the initial assertion "n = 6", find the final assertion "total = ?"
28
Answer:
Feedback
Question 13
Complete
Mark 0.00 out of 1.00
Flag question
Question text
How many positive integers not exceeding 100 and are divisible by neither 5 nor 7?
34
Answer:
Feedback
Question 14
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a.
b. None of the other choices is correct
c.
d.
e.
Feedback
Question 15
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Given = 2.f(\sqrt{n}) + log_2n, f(2) = 1" alt="f = 2.f(\sqrt{n}) + log_2n, f(2) = 1"
src="https://cmshn.fpt.edu.vn/filter/tex/pix.php/33b55803ab1cc70500d5f8f8dc28859c.p
ng" />. Find f(16).
12
Answer:
Feedback
Question 1
Complete
Mark 0.00 out of 1.00
Flag question
Question text
procedure XYZ(a1,...,an: integers)
k:=0
for i:=1 to n do
if ai mod 2 = 0 then k:=k+ai
38
Answer:
Feedback
Question 2
Complete
Mark 0.00 out of 1.00
Flag question
Question text
The Binary search algorithm (studied in the textbook) successively divide the list into two
sublists.
procedure BinarySearch (a1<a2<...<an, x: integers)
while (i<j)
m:=
if x>am then i:=m+1
else j:=m
if x = ai then location:= i
else location:=0
If input = 2, 4, 5, 7, 8, 9, 10, 13 and x = 6, after the third time of dividing into sublists, the
sublist to be considered is:
Select one:
a. 7
b. 5
c. 7, 8
d. 5, 7
e. Các lựa chọn còn lại đều sai
Feedback
Question 3
Complete
Mark 0.67 out of 1.00
Flag question
Question text
2n is O(log n ) Answer 1
No
Feedback
The correct answer is: 2n is O(log n ) → No, 2log n is O (n ) → Yes, nlog(n ) is O(n ) → No
Question 4
Not answered
Marked out of 1.00
Flag question
Question text
if (i < n) then output := i
else output := 0
Let n = 500. Count the number of additions in the worst case.
Answer:
Feedback
Question 5
Complete
Mark 0.00 out of 1.00
Flag question
Question text
-21
Answer:
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (i), (iii).
b. None of the other choices is correct
c. (i), (iv).
d. (ii), (iii).
e. (ii), (iv).
Feedback
Question 7
Complete
Mark 0.00 out of 1.00
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 1982 and b = 1872?
4
Answer:
Feedback
Flag question
Question text
2131
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 1
The proposition is true for n = 1 because 1 = 1*2/2. Step 1
Answer 2
Assume the proposition is true for n = k. Step 2
Answer 3
By induction, the proposition is true for all n positive integer. Step 4
Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) Answer 4
= 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 Step 3
Feedback
The correct answer is: The proposition is true for n = 1 because 1 = 1*2/2. → Step 1,
Assume the proposition is true for n = k. → Step 2, By induction, the proposition is true for
all n positive integer. → Step 4, Then the proposition is also true for n = k + 1 because: 1 +
2+ 3+ ... + (k+1) = 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 → Step 3
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find a4.
3968
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
else
fac(n ):= n*fac(n-1)
print(fac(n ))
Find output if n = 5.
120
Answer:
Feedback
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
while
begin
i := i + 1
total := total + i
end
With the initial assertion "n = 6", find the final assertion "total = ?"
28
Answer:
Feedback
Question 13
Complete
Mark 0.00 out of 1.00
Flag question
Question text
How many positive integers not exceeding 100 and are divisible by neither 5 nor 7?
34
Answer:
Feedback
Question 14
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a.
b. None of the other choices is correct
c.
d.
e.
Feedback
Question 15
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Given = 2.f(\sqrt{n}) + log_2n, f(2) = 1" alt="f = 2.f(\sqrt{n}) + log_2n, f(2) = 1"
src="https://cmshn.fpt.edu.vn/filter/tex/pix.php/33b55803ab1cc70500d5f8f8dc28859c.p
ng" />. Find f(16).
12
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
procedure XYZ(a1,...,an: integers)
k:=0
for i:=1 to n do
if ai mod 2 = 0 then k:=ai
12
Answer:
Feedback
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
2
Answer 1
3
Answer 2
1
Answer 3
Feedback
Question 4
Complete
Mark 1.00 out of 1.00
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
12
Answer:
Feedback
Question 5
Complete
Mark 0.00 out of 1.00
Flag question
Question text
-18
Answer:
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (ii).
b. None of the other choices is correct
c. (i), (ii), (iii).
d. (i), (ii).
e. (ii), (iii).
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 1982 and b = 1872?
3
Answer:
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find octal expansion of (ABC)16.
5274
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 1
Assume that the proposition is true for n = k. Step 2
Answer 2
By induction, the proposition is true for all n positive integer. Step 4
Answer 3
The proposition is true for n = 1 because 1 = 12. Step 1
Feedback
The correct answer is: Assume that the proposition is true for n = k. → Step 2, By induction,
the proposition is true for all n positive integer. → Step 4, The proposition is true for n = 1
because 1 = 12. → Step 1, Then the proposition is also true for n = k + 1 because: 1 + 3 + 5
+ ... + (2(k+1) - 1) = 1 + 3 + 5 + ... + (2k - 1) + (2k+1) = k2 + 2k + 1 = (k+1)2 → Step 3
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Given the sequence
128
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
12
Answer:
Feedback
Question 12
Complete
Mark 0.00 out of 1.00
Flag question
Question text
i := i + 1
total := total + i
end
With the initial assertion "n = 6", find the final assertion "total =?"
15
Answer:
Feedback
Question 13
Complete
Mark 0.00 out of 1.00
Flag question
Question text
10
Answer:
Feedback
Question 14
Complete
Mark 1.00 out of 1.00
Flag question
Question text
A person deposited 1000 000 VND in a bank at the rate of 1%/month. Find
the interest after 10 month.
Question 15
Complete
Mark 1.00 out of 1.00
Flag question
Question text
20
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
procedure XYZ(a1,...,an: integers)
k:=0
for i:=1 to n do
if ai mod 2 = 0 then k:=ai
12
Answer:
Feedback
Flag question
Question text
If input = 3, 2, 4, 7, 1, 6, 5, after the first pass (with i = 1), the order of the elements in the
list is:
Select one:
a. 2, 3, 4, 1, 5, 6, 7
b. Các lựa chọn còn lại đều sai
c. 2, 3, 1, 4, 5, 6, 7
d. 2, 3, 1, 4, 6, 5, 7
e. 2, 3, 4, 1, 6, 5, 7
Feedback
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
No
is O( ) Answer 1
Yes
is O( ) Answer 2
No
is O( ) Answer 3
Feedback
Question 4
Complete
Mark 0.00 out of 1.00
Flag question
Question text
else i := 2i
23
Answer:
Feedback
Question 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
A sequence of pseudorandom numbers is generated as follows
x0 = 4
xi = ( 6xi–1 + 5 ) mod 13 if i > 0
Find x6 .
7
Answer:
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (ii)
b. Both (i), (ii).
c. (i)
d. None of the other choices is correct
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
When using the modular exponentiation algorithm to compute 6 6 mod 13, the remainders
computed by successively squaring are:
Select one:
a. 10, 9
b. Các lựa chọn còn lại đều sai.
c. 6, 10, 9
d. 1, 6, 36
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
1334
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) Answer 2
= 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 Step 3
Answer 3
By induction, the proposition is true for all n positive integer. Step 4
Answer 4
The proposition is true for n = 1 because 1 = 1*2/2. Step 1
Feedback
The correct answer is: Assume the proposition is true for n = k. → Step 2, Then the
proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) = 1 + 2+ 3+ ... + k + (k+1) =
k(k+1)/2+(k+1) = (k+1)(k+2)/2 → Step 3, By induction, the proposition is true for
all n positive integer. → Step 4, The proposition is true for n = 1 because 1 = 1*2/2. → Step
1
Question 10
Complete
Mark 0.00 out of 1.00
Flag question
Question text
64
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
else
f(n) := 2*f(n-1) + 1
Select one:
a. f(n) = 2n – 1
b. f(n) = 2n – 1
c. f(n) = 2n – 1
d. f(n) = n
Feedback
Question 12
Complete
Mark 0.00 out of 1.00
Flag question
Question text
while
begin
i := i + 1
total := total + i
end
Select one:
a. total=i(i + 1)/2 and
b. total=n(n + 1)/2 and
c. total=i(i + 1)/2 and
d. total=n(n + 1)/2 and
Feedback
Question 13
Complete
Mark 1.00 out of 1.00
Flag question
Question text
In English alphabet, how many strings of 4 distinct characters that start with A?
13800
Answer:
Feedback
Question 14
Complete
Mark 1.00 out of 1.00
Flag question
Question text
A young pair of rabbits (one of each sex) is placed on an island. A pair of rabbits does not
breed until they are 2 month old. After they are 2 month old they will produce 3 pairs of
rabbits each month. Find the number of pairs of rabbits after 5 months.
19
Answer:
Feedback
Flag question
Question text
241
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
while a 0
n: = n + (a mod 2)
a: =
Print (n )
5
Answer:
Feedback
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
44
Answer:
Feedback
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
6
(x2 + x - 1)3 Answer 1
x.ln(x) 2
Answer 2
Does not exist
ex Answer 3
Feedback
The correct answer is: (x2 + x - 1)3 → 6, x.ln(x) → 2, ex → Does not exist
Question 4
Not answered
Marked out of 1.00
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
Answer:
Feedback
Question 5
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Consider an encryption scheme using the function f(p) = 7p+3 mod 26.
Find the message produced from the message [13, 14, 0, 0, 2, 4].
Select one:
a. [1, 3, 19, 19, 7, 3]
b. [8, 3, 9, 9, 23, 12]
c. [7, 2, 13, 13, 12, 10]
d. [15, 2, 1, 1, 18, 2]
e. [16, 23, 3, 3, 17, 5]
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. None of the other choices is correct
b. (i), (iii).
c. (ii), (iv).
d. (ii), (iii).
e. (i), (iv).
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 846 and b = 238?
5
Answer:
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (111100010)2
b. (111000010)2
c. (101100010)2
d. (111101010)2
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
1*1! + 2*2! + 3*3! + ... + n*n! = (n+1)!-1 for all n positive integer.
Answer 1
The proposition is true for n = 1 because 1*1! = 2!-1. Step 1
Then the proposition is also true for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... Answer 2
+ (k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+ Step 3
(k+1)*(k+1)! = (k+2)!-1
Answer 3
By induction, the proposition is true for all n positive integers. Step 4
Answer 4
Assume the proposition is true for n = k. Step 2
Feedback
The correct answer is: The proposition is true for n = 1 because 1*1! = 2!-1. → Step 1, Then
the proposition is also true for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... + (k+1)*(k+1)! = 1*1! +
2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+(k+1)*(k+1)! = (k+2)!-1 → Step 3, By induction,
the proposition is true for all n positive integers. → Step 4, Assume the proposition is true
for n = k. → Step 2
Question 10
Not answered
Marked out of 1.00
Flag question
Question text
Find a6 .
Answer:
Feedback
Question 11
Complete
Mark 0.00 out of 1.00
Flag question
Question text
8
Answer:
Feedback
Question 12
Complete
Mark 0.00 out of 1.00
Flag question
Question text
i := 1
total := 1
while i < n
begin
i := i + 1
total := total + i
end
Select one:
a. total=n(n+1)/2 and i less than n
b. total=i(i+1)/2 and i less than n
c. total=(n+1) và i less than or equal n
d. total=i(i+1)/2 and i less than or equal n
Feedback
Question 13
Not answered
Marked out of 1.00
Flag question
Question text
How many positive integers not exceeding 1000 and contains at least a 7?
Answer:
Feedback
Question 14
Not answered
Marked out of 1.00
Flag question
Question text
The number of bacteria triples every hour. If the initial number of bacteria is 50, find the
number of bacteria after 5 hours.
Answer:
Feedback
Question 15
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
end
Find output value of S if input n = 4.
100
Answer:
Feedback
Question 2
Not answered
Marked out of 1.00
Flag question
Question text
Answer:
Feedback
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
1
4x+5 Answer 1
3
Answer 2
2
xln(x) Answer 3
Feedback
Question 4
Complete
Mark 1.00 out of 1.00
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
6
Answer:
Feedback
Question 5
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Consider an encryption scheme using the function f(p) = 7p+3 mod 26.
Find the message produced from the message [11, 13, 3, 3, 1, 8].
Select one:
a. [1, 6, 17, 17, 2, 9]
b. [2, 21, 23, 23, 11, 12]
c. [2, 7, 1, 1, 8, 2]
d. [2,16, 24, 24, 10, 7]
e. [2, 4, 19, 19, 3, 17]
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. (ii)
b. (i)
c. None of the other choices is correct
d. Both (i), (ii).
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
When using the modular exponentiation algorithm to compute 3 10 mod 7, the remainders
computed by successively squaring are:
Select one:
a. 3, 2, 4, 2
b. 3, 4, 2, 1
c. Các lựa chọn còn lại đều sai.
d. 1, 3, 2, 4
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
4727
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
1*1! + 2*2! + 3*3! + ... + n*n! = (n+1)!-1 for all n positive integer.
Answer 1
Assume the proposition is true for n = k. Step 2
Answer 2
By induction, the proposition is true for all n positive integers. Step 4
Then the proposition is also true for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... Answer 3
+ (k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+ Step 3
(k+1)*(k+1)! = (k+2)!-1
Answer 4
The proposition is true for n = 1 because 1*1! = 2!-1. Step 1
Feedback
The correct answer is: Assume the proposition is true for n = k. → Step 2, By induction, the
proposition is true for all n positive integers. → Step 4, Then the proposition is also true
for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... + (k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+
(k+1)*(k+1)! = (k+1)!-1+(k+1)*(k+1)! = (k+2)!-1 → Step 3, The proposition is true for n = 1
because 1*1! = 2!-1. → Step 1
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find f(4) if
2
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
else
f(a,n) := 2*f(a,n-1) – a
Select one:
a. f(a, n) = (2n – 1)a
b. f(a, n) = na
c. f(a, n) = 2na – a
d. f(a, n) = a
Feedback
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
while
begin
i := i + 1
total := total + i
end
With the initial assertion "n = 6", find the final assertion "total = ?"
28
Answer:
Feedback
Question 13
Not answered
Marked out of 1.00
Flag question
Question text
How many positive integers not exceeding 100 and are divisible by neither 6 nor 9?
Answer:
Feedback
Question 14
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. None of the other choices is correct
b.
c.
d.
Feedback
Flag question
Question text
11
Answer:
Feedback
Question 1
Complete
Flag question
Question text
Feedback
Flag question
Question text
a. 45 , 2 , 1 , 0
b. 43 , 2 , 1 , 0
c. 44 , 0 , 0 , 0
d. 43 , 2 , 0 , 5
Feedback
Question 3
Complete
Flag question
Question text
Find the smallest integer n such that f(x) = O(xn).
x+ln(x 1
) Answer 1
2 0
Answer 2
x(x+1) Answer 3 2
Feedback
Question 4
Complete
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
Feedback
Question 5
Complete
Flag question
Question text
Feedback
Question 6
Complete
Flag question
Question text
a. (ii), (iv).
b. (ii), (iii).
c. (i), (iii).
e. (i), (iv).
Feedback
Question 7
Complete
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 2765 and b = 2196?
3
Answer:
Feedback
Question 8
Complete
Flag question
Question text
Feedback
Question 9
Complete
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 1
By induction, the proposition is true for all n positive integer. Step 4
Answer 2
The proposition is true for n = 1 because 1 = 1*2/2. Step 1
Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) = 1 + 2+ Answer 3
Step 3
3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2
Answer 4
Assume the proposition is true for n = k. Step 2
Feedback
The correct answer is: By induction, the proposition is true for all n positive integer. → Step
4, The proposition is true for n = 1 because 1 = 1*2/2. → Step 1, Then the proposition is also
true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) = 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) =
(k+1)(k+2)/2 → Step 3, Assume the proposition is true for n = k. → Step 2
Question 10
Complete
Flag question
Question text
Find a5
32
Answer:
Feedback
Question 11
Complete
Question text
Feedback
Question 12
Complete
Flag question
Question text
Question 13
Complete
Flag question
Question text
How many positive integers not exceeding 100 and are divisible by neither 3 nor 5?
41
Answer:
Feedback
Question 14
Complete
Flag question
Question text
A young pair of rabbits (one of each sex) is placed on an island. A pair of rabbits does not
breed until they are 2 month old. After they are 2 month old they will produce 2 pairs of
rabbits each month. Find the number of pairs of rabbits after 6 months.
40
Answer:
Feedback
The correct answer is: 21
Question 15
Complete
Flag question
Question text
79
Answer:
Feedback
Question 1
Complete
Flag question
Question text
while a 0
n: = n + (a mod 2)
a: =
Print( n )
3
Answer:
Feedback
Question 2
Complete
Flag question
Question text
a. 43 , 0 , 1 , 2
b. 42 , 1 , 1 , 3
c. 42 , 1 , 0 , 8
d. 41 , 4 , 0 , 3
Feedback
Flag question
Question text
nlog(n ) is No
Answer 2
O(n )
No
2n is O(log n ) Answer 3
Feedback
The correct answer is: 2log n is O (n ) → Yes, nlog(n ) is O(n ) → No, 2n is O(log n ) → No
Question 4
Complete
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
18
Answer:
Feedback
Question 5
Complete
Flag question
Question text
Feedback
Question 6
Complete
Question text
a. (i), (ii).
b. (ii).
d. (ii), (iii).
Feedback
Question 7
Complete
Flag question
Question text
When using the modular exponentiation algorithm to compute 2 7 mod 7, the remainders
computed by successively squaring are:
Select one:
b. 1, 2, 4
c. 2, 4, 2
d. 2, 4, 6
Feedback
Question 8
Complete
Flag question
Question text
Feedback
Question 9
Complete
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 1
By induction, the proposition is true for all n positive integer. Step 4
Answer 2
The proposition is true for n = 1 because 1 = 12. Step 1
Then the proposition is also true for n = k + 1 because: 1 + 3 + 5 + ... + (2(k+1) - 1) Answer 3
= 1 + 3 + 5 + ... + (2k - 1) + (2k+1) = k2 + 2k + 1 = (k+1)2 Step 3
Answer 4
Assume that the proposition is true for n = k. Step 2
Feedback
The correct answer is: By induction, the proposition is true for all n positive integer. → Step
4, The proposition is true for n = 1 because 1 = 12. → Step 1, Then the proposition is also
true for n = k + 1 because: 1 + 3 + 5 + ... + (2(k+1) - 1) = 1 + 3 + 5 + ... + (2k - 1) + (2k+1)
= k2 + 2k + 1 = (k+1)2 → Step 3, Assume that the proposition is true for n = k. → Step 2
Question 10
Complete
Flag question
Question text
Find a6 .
64
Answer:
Feedback
Question 11
Complete
Flag question
Question text
Feedback
Question 12
Complete
Flag question
Question text
Feedback
Question 13
Complete
Flag question
Question text
How many positive integers less than 1000 and contains at least a 0?
162
Answer:
Feedback
Question 14
Complete
Mark 0.75 out of 1.00
Flag question
Question text
No
Answer 1
Yes
Answer 2
Yes
Answer 3
No
Answer 4
Feedback
Question 15
Complete
Flag question
Question text
Given = 2.f(\sqrt{n}) + log_2n, f(2) = 1" alt="f = 2.f(\sqrt{n}) + log_2n, f(2) = 1"
src="https://cmshn.fpt.edu.vn/filter/tex/pix.php/33b55803ab1cc70500d5f8f8dc28859c.p
ng" />. Find f(16).
12
Answer:
Feedback
Question 1
Complete
Flag question
Question text
Feedback
Question 2
Complete
Flag question
Question text
Find the output of:
Greedy Change-Making Algorithm
Input: 1069 cents
Output: The total number of coins using: Quarters, Dimes, Nickles, Pennies
48
Answer:
Feedback
Question 3
Complete
Flag question
Question text
x.ln(x) 2
Answer 2
Feedback
Question 4
Complete
Question text
begin
p: = p * c
y: = y + ai*p
end
12
Answer:
Feedback
Question 5
Complete
Flag question
Question text
Let a = -213 div 13 and b = -213 mod 13. Find a+b.
-9
Answer:
Feedback
Question 6
Complete
Flag question
Question text
a. (i), (ii).
b. (ii).
c. (ii), (iii).
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
When using the modular exponentiation algorithm to compute 2 7 mod 7, the remainders
computed by successively squaring are:
Select one:
a. 2, 4, 2
c. 2, 4, 6
d. 1, 2, 4
Feedback
Question 8
Complete
Flag question
Question text
Feedback
The correct answer is: 4607
Question 9
Complete
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
1*1! + 2*2! + 3*3! + ... + n*n! = (n+1)!-1 for all n positive integer.
Answer 1
Assume the proposition is true for n = k.
Step 2
Answer 2
The proposition is true for n = 1 because 1*1! = 2!-1.
Step 1
Answer 3
By induction, the proposition is true for all n positive integers.
Step 4
Then the proposition is also true for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... + Answer 4
(k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+(k+1)*(k+1)! = Step 3
(k+2)!-1
Feedback
The correct answer is: Assume the proposition is true for n = k. → Step 2, The proposition is
true for n = 1 because 1*1! = 2!-1. → Step 1, By induction, the proposition is true for all n
positive integers. → Step 4, Then the proposition is also true for n = k + 1 because: 1*1! +
2*2!+ 3*3!+ ... + (k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+
(k+1)*(k+1)! = (k+2)!-1 → Step 3
Question 10
Complete
Question text
Find a5 .
70
Answer:
Feedback
Question 11
Complete
Flag question
Question text
b. a*n
c. an
d. a*(n-1)
Feedback
Question 12
Complete
Flag question
Question text
while
begin
i := i + 1
total := total + i
end
With the initial assertion "n = 6", find the final assertion "total = ?"
28
Answer:
Feedback
Flag question
Question text
How many positive integers not exceeding 1000 and are divisible by 2 or 5?
400
Answer:
Feedback
Question 14
Complete
Flag question
Question text
No
Answer 1
Yes
Answer 2
Yes
Answer 3
No
Answer 4
Feedback
Question 15
Complete
Flag question
Question text
40
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
procedure XYZ(a1,...,an: integers)
k:=0
for i:=1 to n do
if ai mod 2 = 0 then k:=k+ai
Question 2
Complete
Mark 1.00 out of 1.00
Flag question
Question text
The Binary search algorithm (studied in the textbook) successively divide the
list into two sublists.
i:=1
j:=n
while (i<j)
m:=
if x>a then i:=m+1
m
else j:=m
if x = a then location:= i
i
else location:=0
If input = 2, 4, 5, 7, 8, 9, 10, 13 and x = 6, after the second time of dividing into
sublists, the sublist to be considered is:
Select one:
a. Các lựa chọn còn lại đều sai
b. 7, 8, 9
c. 5, 7
d. 2, 4, 5
e. 5, 7, 8
Feedback
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
3n is O(n+log(n )) Yes
Answer 1
n+log(n ) is No
O(log(n )) Answer 2
Yes
n+log(n ) is O(n ) Answer 3
Feedback
The correct answer is: 3n is O(n+log(n )) → Yes, n+log(n ) is O(log(n )) → No, n+log(n ) is O(n )
→ Yes
Question 4
Not answered
Marked out of 1.00
Flag question
Question text
if (i < n) then output := i
else output := 0
Let n = 100. Count the number of additions in the worst case.
Answer:
Feedback
Question 5
Complete
Mark 0.00 out of 1.00
Flag question
Question text
-6
Answer:
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Select one:
a. None of the other choices is correct
b. (i), (iii).
c. (ii), (iv).
d. (ii), (iii).
e. (i), (iv).
Feedback
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 846 and b = 238?
5
Answer:
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
5725
Answer:
Feedback
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... + (k+1) Answer 1
= 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 Step 3
Answer 2
The proposition is true for n = 1 because 1 = 1*2/2. Step 1
Answer 3
Assume the proposition is true for n = k. Step 2
Answer 4
By induction, the proposition is true for all n positive integer. Step 4
Feedback
The correct answer is: Then the proposition is also true for n = k + 1 because: 1 + 2+ 3+ ... +
(k+1) = 1 + 2+ 3+ ... + k + (k+1) = k(k+1)/2+(k+1) = (k+1)(k+2)/2 → Step 3, The proposition is
true for n = 1 because 1 = 1*2/2. → Step 1, Assume the proposition is true for n = k. → Step
2, By induction, the proposition is true for all n positive integer. → Step 4
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Find a4.
3968
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
9
Answer:
Feedback
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
i := 1
total := 1
while i < n
begin
i := i + 1
total := total + i
end
Select one:
a. total=n(n+1)/2 and i less than n
b. total=(n+1) và i less than or equal n
c. total=i(i+1)/2 and i less than or equal n
d. total=i(i+1)/2 and i less than n
Feedback
Question 13
Complete
Mark 0.00 out of 1.00
Flag question
Question text
In English alphabet, how many strings of 4 distinct characters that do not contain A ?
13800
Answer:
Feedback
Question 14
Complete
Mark 1.00 out of 1.00
Flag question
Question text
A person deposited 1000 000 VND in a bank at the rate of 1%/month. Find
the interest after 6 month.
Question 15
Complete
Mark 1.00 out of 1.00
Flag question
Question text
121
Answer:
Feedback
Question 1
Complete
Flag question
Question text
while a 0
n: = n + (a mod 2)
a: =
Print( n )
3
Answer:
Feedback
Question 2
Complete
Flag question
Question text
a. 39 , 3 , 0 , 3
b. 40, 0 , 1 , 3
c. 40 , 1 , 0 , 0
d. 40 , 1 , 0 , -2
Feedback
Flag question
Question text
Answer 2
1
Answer 3
3
Feedback
Question 4
Complete
Flag question
Question text
procedure f(a1,a2,…,an)
t : = 1
i : = 1
Feedback
Question 5
Complete
Flag question
Question text
-2
Answer:
Feedback
Question 6
Complete
Flag question
Question text
b. (i)
d. (ii)
Feedback
Question 7
Complete
Flag question
Question text
How many divisions are needed when using Euclidean algorithm to find the greatest
common divisor of a = 1982 and b = 1872?
3
Answer:
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Feedback
Question 9
Complete
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Then the proposition is also true for n = k + 1 because: 1 + 3 + 5 + ... + (2(k+1) - 1) Answer 1
= 1 + 3 + 5 + ... + (2k - 1) + (2k+1) = k2 + 2k + 1 = (k+1)2 Step 3
Answer 2
The proposition is true for n = 1 because 1 = 12. Step 1
Answer 3
By induction, the proposition is true for all n positive integer. Step 4
Feedback
The correct answer is: Then the proposition is also true for n = k + 1 because: 1 + 3 + 5 + ... +
(2(k+1) - 1) = 1 + 3 + 5 + ... + (2k - 1) + (2k+1) = k2 + 2k + 1 = (k+1)2 → Step 3, The proposition
is true for n = 1 because 1 = 12. → Step 1, By induction, the proposition is true for
all n positive integer. → Step 4, Assume that the proposition is true for n = k. → Step 2
Question 10
Complete
Flag question
Question text
Find a5 .
16
Answer:
Feedback
Question 11
Complete
Flag question
Question text
Feedback
Question 12
Complete
Flag question
Question text
Feedback
Question 13
Complete
Flag question
Question text
10
Answer:
Feedback
Question 14
Complete
Flag question
Question text
Select one:
a.
b.
e.
Feedback
Question 15
Complete
Flag question
Question text
11
Answer:
Feedback
Question 1
Complete
Mark 1.00 out of 1.00
Flag question
Question text
procedure XYZ(a1,...,an: integers)
k:=0
for i:=1 to n do
if ai mod 2 = 0 then k:=k+ai
Find output value of k if input is 1, 2, 3, 7, 8, 6, 9, 12, 11.
28
Answer:
Feedback
Question 2
Complete
Mark 0.00 out of 1.00
Flag question
Question text
Given the algorithm to find the maximum element of a list (studied in the textbook).
If the input is the sequence 4, 1, 5, 2, 3, 9, 7, then all the values of the variable Max are:
Select one:
a. 4, 5, 9
b. 1, 4, 5, 2, 9, 7
c. Các lựa chọn còn lại đều sai
d. 4, 5, 9, 7
e. 4, 1, 5, 9
Feedback
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
is O( ) Answer 1
No
is No
O(nlog(n )) Answer 2
is O( ) Answer 3
Yes
Feedback
The correct answer is: is O( ) → No, is O(nlog(n )) → No, is O(
) → Yes
Question 4
Complete
Mark 1.00 out of 1.00
Flag question
Question text
begin
p: = p * c
y: = y + ai*p
end
Let n = 10. Count the number of additions.
45
Answer:
Feedback
Question 5
Complete
Mark 1.00 out of 1.00
Flag question
Question text
15
Answer:
Feedback
Question 6
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Question 7
Complete
Mark 1.00 out of 1.00
Flag question
Question text
When using the modular exponentiation algorithm to compute 3 10 mod 7, the remainders
computed by successively squaring are:
Select one:
a. 1, 3, 2, 4
b. Các lựa chọn còn lại đều sai.
c. 3, 2, 4, 2
d. 3, 4, 2, 1
Feedback
Question 8
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Question 9
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
Answer 1
The proposition is true for n = 1 because 1 = 12. Step 1
Answer 2
By induction, the proposition is true for all n positive integer. Step 4
Answer 3
Assume that the proposition is true for n = k. Step 2
Feedback
The correct answer is: The proposition is true for n = 1 because 1 = 12. → Step 1, By
induction, the proposition is true for all n positive integer. → Step 4, Assume that the
proposition is true for n = k. → Step 2, Then the proposition is also true for n = k + 1
because: 1 + 3 + 5 + ... + (2(k+1) - 1) = 1 + 3 + 5 + ... + (2k - 1) + (2k+1) = k2 + 2k + 1 =
(k+1)2 → Step 3
Question 10
Complete
Mark 1.00 out of 1.00
Flag question
Question text
Given the sequence
128
Answer:
Feedback
Question 11
Complete
Mark 1.00 out of 1.00
Flag question
Question text
10
Answer:
Feedback
Question 12
Complete
Mark 1.00 out of 1.00
Flag question
Question text
total := total + i
i := i + 1
end
With the initial assertion "n = 6", find the final assertion "total =?"
15
Answer:
Feedback
Question 13
Complete
Mark 1.00 out of 1.00
Flag question
Question text
How many bit strings of length 6 that either start with an 1 or end with 0?
48
Answer:
Feedback
Question 14
Complete
Mark 0.00 out of 1.00
Flag question
Question text
A young pair of rabbits (one of each sex) is placed on an island. A pair of rabbits does not
breed until they are 2 month old. After they are 2 month old they will produce 2 pairs of
rabbits each month. Find the number of pairs of rabbits after 5 months.
4
Answer:
Feedback
Question 15
Complete
Mark 1.00 out of 1.00
Flag question
Question text
241
Answer:
Feedback
Flag question
Question text
procedure XYZ(a1,...,an: integers)
k:=0
for i:=1 to n do
if ai mod 2 = 0 then k:=ai
Find output value of k if input is 1, 2, 3, 7, 8, 6, 9, 12, 11.
28
Answer:
Feedback
The correct answer is: 12
Question 2
Complete
Flag question
Question text
a. 2, 3, 4, 5, 1, 6
b. 2, 3, 1, 4, 5, 6
c. 2, 1, 4, 3, 5, 6
d. 2, 3, 4, 1, 5, 6
Feedback
Question 3
Complete
Mark 1.00 out of 1.00
Flag question
Question text
2x3.ln(x) 4
Answer 3
Feedback
The correct answer is: (x3 - x2 + x - 1)3 → 9, 2x → Does not exist, 2x3.ln(x) → 4
Question 4
Complete
Flag question
Question text
Feedback
Question 5
Complete
Flag question
Question text
9
Answer:
Feedback
Question 6
Complete
Flag question
Question text
Let m=75 1112 1390 and n = 24 73 1114. Choose correct statements:
(i) gcd(m, n) = 24 1390
(ii) gcd(m, n) = 73 1112
(iii) lcm(m, n) = 24 75 1114 1390
Select one:
a. (i), (ii).
d. (ii).
e. (ii), (iii).
Feedback
Question 7
Complete
Flag question
Question text
When using the modular exponentiation algorithm to compute 6 6 mod 13, the remainders
computed by successively squaring are:
Select one:
a. 6, 10, 9
d. 10, 9
Feedback
Question 8
Complete
Flag question
Question text
5535
Answer:
Feedback
Question 9
Complete
Flag question
Question text
Rearrange the steps in the correct order of a proof by induction of the proposition
1*1! + 2*2! + 3*3! + ... + n*n! = (n+1)!-1 for all n positive integer.
Answer 1
The proposition is true for n = 1 because 1*1! = 2!-1.
Step 1
Then the proposition is also true for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... + Answer 2
(k+1)*(k+1)! = 1*1! + 2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+(k+1)*(k+1)! = Step 3
(k+2)!-1
Answer 3
Assume the proposition is true for n = k. Step 2
Answer 4
By induction, the proposition is true for all n positive integers. Step 4
Feedback
The correct answer is: The proposition is true for n = 1 because 1*1! = 2!-1. → Step 1, Then
the proposition is also true for n = k + 1 because: 1*1! + 2*2!+ 3*3!+ ... + (k+1)*(k+1)! = 1*1! +
2*2!+ 3*3!+ ... + k*k!+(k+1)*(k+1)! = (k+1)!-1+(k+1)*(k+1)! = (k+2)!-1 → Step 3, Assume the
proposition is true for n = k. → Step 2, By induction, the proposition is true for all n positive
integers. → Step 4
Question 10
Complete
Flag question
Question text
Find a6 .
32
Answer:
Feedback
The correct answer is: 32
Question 11
Complete
Flag question
Question text
a. f(n) = 2n – 1
b. f(n) = n
c. f(n) = 2n – 1
d. f(n) = 2n – 1
Feedback
Question 12
Complete
Question text
while
begin
i := i + 1
total := total + i
end
Select one:
Feedback
Question 13
Complete
Flag question
Question text
How many positive integers not exceeding 100 and are divisible by 3 but not by 5?
27
Answer:
Feedback
Question 14
Complete
Flag question
Question text
A person deposited 1000 000 VND in a bank at the rate of 1%/month. Find the interest in
the 10th month.
10936
Answer:
Feedback
Question 15
Complete
Flag question
Question text
6
Answer:
Feedback
How many positive integers not exceeding 100 and are divisible by neither 2 nor 5?
60
Answer:
Feedback
Question 15
Complete
Flag question
Question text
19
Answer:
Feedback