100% found this document useful (1 vote)
208 views10 pages

Quiz - 2 (Page 2 of 4)

The document contains 20 multiple choice questions from an online quiz. It provides the questions, possible answer choices for each question, and fields to save answers. The questions cover topics such as recursion, algorithms, and number theory.

Uploaded by

AN NINH NGUYEN
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
100% found this document useful (1 vote)
208 views10 pages

Quiz - 2 (Page 2 of 4)

The document contains 20 multiple choice questions from an online quiz. It provides the questions, possible answer choices for each question, and fields to save answers. The questions cover topics such as recursion, algorithms, and number theory.

Uploaded by

AN NINH NGUYEN
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/ 10

21/6/2021 Quiz_2 (page 2 of 4)

Question 11
Answer saved
Marked out of 1.00

Let f( n ) = f(n/3) + 2 and f(1) = 3, where n is divisible by 3.


Find f(27).

Select one:
a. None of the others
b. 27
c. 6
d. 3
e. 9

Clear my choice

Question 12

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 1/10
21/6/2021 Quiz_2 (page 2 of 4)

Answer saved
Marked out of 1.00

Suppose that f( n ) = f(n/2) + 3, when n is an even positive integer, and f(1) = 1. 
Find f(64).

Select one:
a. 21
b. 15
c. 16
d. 19

Clear my choice

Question 13
Answer saved
Marked out of 1.00

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 2/10
21/6/2021 Quiz_2 (page 2 of 4)

a ed out o .00

How many positive integers between 1 and 100 inclusive are divisible by 5 or 7?

Select one:
a. 28
b. None of the others
c. 34
d. 32

Clear my choice

Question 14
Answer saved
Marked out of 1.00

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 3/10
21/6/2021 Quiz_2 (page 2 of 4)

Give a big-O estimate for the number of additions used in the following algorithm:
procedure sum(n: positive integer)
s := 0
for i := 1 to n
for j := 1 to n
s := s + i + j

Select one:
a. O
b. O(logn)
c. O(n2)
d. O(2n)

Clear my choice

Question 15
Answer saved
Marked out of 1.00

Give a recursive de nition of the function g( n ) = (-1)n, n = 1, 2, 3, ...

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 4/10
21/6/2021 Quiz_2 (page 2 of 4)

Which one is true?


(i)   g( n+1) = -g( n ) if n > 1, and g(1) = -1
(ii) g( n ) = -g(n-1) if n > 1, and g(1) = -1

Select one:
a. Neither (i) nor (ii)
b. Both (i) and (ii)
c. (ii) only
d. (i) only

Clear my choice

Question 16
Answer saved
Marked out of 1.00

The password for a quiz was encrypted using the function f(p) = (p + 5) mod 26. If the result is “GZ”, nd the quiz password.

Select one:

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 5/10
21/6/2021 Quiz_2 (page 2 of 4)

Se ect o e:
a. BU
b. CV
c. BT
d. TV
e. None of the others

Clear my choice

Question 17
Answer saved
Marked out of 1.00

Suppose that a “word” is any string of seven letters of the alphabet, with repeated letters allowed. 
How many words begin with AB or end with B?

Select one:
6

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 6/10
21/6/2021 Quiz_2 (page 2 of 4)

a. 26
b. None of these
c. 25 + 26 - 24
d. 27 - (25 + 26)
5 6
e. 2 + 2

Clear my choice

Question 18
Answer saved
Marked out of 1.00

Determine the complexity of the following algorithm.


procedure giaithuat(a1, a2, a3, ..., an: positive integers)
k:=0
for i: =1 to n do
       if ai < ai+1 then k:= k +1

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 7/10
21/6/2021 Quiz_2 (page 2 of 4)

print(k)

Select one:
a. O
b. O(1)
c. O(logn)
d. None of the others

Clear my choice

Question 19
Answer saved
Marked out of 1.00

How many positive integers not exceeding 1000 are not divisible by either 4 or 6?

a. 667
b. 665
c. 663
d. 670

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 8/10
21/6/2021 Quiz_2 (page 2 of 4)

Clear my choice

Question 20
Answer saved
Marked out of 1.00

Give a recursive de nition of the function f( n ) = 2019, n = 1, 2, 3, ...

Select one:
a. f( n ) = 2019 if n > 1, and f(1) = 2019
b. f( n ) = f(n-1) if n > 1, and f(1) = 2019
c. f( n ) = f(n-1) - 1 if n > 1, and f(1) = 2019
d. f( n ) = f(n-1) if n > 0, and f(1) = 2019
e. None of the others

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 9/10
21/6/2021 Quiz_2 (page 2 of 4)

Clear my choice

 

https://lms-hcmuni.fpt.edu.vn/mod/quiz/attempt.php?attempt=16763&cmid=4185&page=1 10/10

You might also like