Professional Documents
Culture Documents
Qus 2
Qus 2
From the answer group below, select the correct combination of the answers to be inserted
in ___A___ through ___C___ in the program.
The function fizzBuzz receives a value that is given as an argument, and returns “Divisible
by 3” if the value is divisible by 3 but is not divisible by 5, “Divisible by 5” if the value is
divisible by 5 but is not divisible by 3, and “Divisible by 3 and 5” if the value is divisible by
3 and 5. Otherwise, it returns “Not divisible by 3 or 5”.
[Program]
○ string: fizzBuzz(integer: num)
string: result
if (num is divisible by ___A___ )
result ← "Divisible by ___A___ "
elseif (num is divisible by ___B___ )
result ← "Divisible by ___B___ "
elseif (num is divisible by ___C___ )
result ← "Divisible by ___C___ "
else
result ← "Not divisible by 3 or 5"
endif
return result
Answer group
A B C
a) 3 3 and 5 5
b) 3 5 3 and 5
c) 3 and 5 3 5
d) 5 3 3 and 5
e) 5 3 and 5 3
-5-