HKICO 2019-2020 - Heat - Blockly

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

HONG KONG INTERNATIONAL

COMPUTATIONAL OLYMPIAD
HEAT ROUND 2019 - 2020 (HONG KONG REGION)

Blockly
Time allowed: 60 minutes
Question Paper
Instructions to Contestants:
1. Each contestant should have ONE Question-Answer Book which CANNOT be taken away.
2. There are a total of 20 questions in this Question-Answer Book. Two points for correct answers. No points
for incorrect answers. ONE penalty point will be deducted for incorrect answers.
3. All answers should be written on ANSWER SHEET.
4. During the contest, NO calculators can be used for PRIMARY GROUP but calculators can be used for
SECONDARY GROUP.
5. All figures in the paper are not necessarily drawn to scale.
6. This Question-Answer Book will be collected at the end of the contest.

THIS Question-Answer Book CANNOT BE TAKEN AWAY.


DO NOT turn over this Question-Answer Book without approval of the examiner.
Otherwise, contestant may be DISQUALIFIED.
Multiple Choice Questions (1st ~20th) (Two points for correct answers. No points for incorrect answers. ONE
penalty point will be deducted for incorrect answers.)

1. Which of the following is which Blockly cannot do?

A. Programming
B. Making games
C. Machine learning
D. Wash dishes
E. None of the above

2. Which of the following block categories does not exist in Blockly?

A. Math
B. Logic
C. Loops
D. Variables
E. None of the above

3. Where can you do programming with Blockly on?

A. A mobile phone
B. A television
C. A fridge
D. A sofa
E. None of the above

4. What is Blockly maintained by?

A. MIT
B. Space X
C. Google
D. Github
E. None of the above
5. Refer to the following code:

What is the value of „number‟ after executing this code? (What is the number printed?)

A. 0
B. 1
C. 2
D. 3
E. 4

6. Notice the gap as indicated in the image below:

What does the gap suggest?

A. No meaning
B. More blocks can be filled in place
C. The reddish color block does not fit in the green block
D. Some block is missing and must be filled in
E. None of the above

7. Following is the code (Javascript) generated by the block

Which of the following codes/blocks gives the most similar effect as above?

A.

B.
C.

D.
E. None of the above
8. What is the difference between the two blocks?

A. No difference
B. One would print another would not print
C. One would print twice another would only print once
D. Both code do nothing because 2 never equals to 1 nor 3
E. None of the above

9. What would the following block evaluates to? If false, why?

A. True
B. False, because 1 is not an even number
C. False, because 1+1 is not an even number
D. False, because there is no “if” block
E. None of the above

10. What is the value of the following block?


A. No value, because „123‟ do not have upper case
B. 123, because „123‟ to upper case is still „123‟
C. 3, because length of „123‟ is 3
D. 123, because value of „123‟ is 123
E. None of the above

11. The following code is generated by the block:

Would the values of the list ALWAYS be the same? Why?

A. Yes, there is a chance the values in the list repeat even they are random integer from 1 to 5
B. Yes, only one random integer is used in the list
C. No, the values are random integer from 1 to 5
D. No, the list must the the combination of 1,2,3,4,5
E. None of the above

Refer to the following block and the respective code (Javascript) for question 12 to 14:
12. Why “letter #” shown in the block is 1 but it is 0 in the code?

A. Blockly made a mistake


B. In Javascript/code, 1 is equal to 0
C. In Javascript/code, string index starts with 0
D. In the block, there is a hidden 0 behind the 1
E. None of the above

13. What is the printed output?

A. 0
B. 1
C. 3
D. A
E. d

14. Would removing the text block “dsf” change the output? Why?

A. Yes, the output would change because input „text‟ is changed


B. Yes, the output would change to nothing because the code no longer works
C. No, the output would not change because „dsf‟ do not have length
D. No, the output would not change because set text to only looks for string
E. None of the above

15. Refer to the following block and the respective code:

The code doesn‟t output anything, why?

A. Actually „0‟ is printed but it‟s 0 so we cannot see


B. There is an error because number does not have function „charAt‟
C. “Hello World” is too long
D. Variable “text” is spelled wrong and the code cannot interpret variable with wrong names
E. None of the above

16. What is the output of the following code? Why?


以下程序的輸出為?為甚麼?

A. The code would result in error because negative number does not have remainder
B. 0, because erroneous code would give default value „0‟
C. 3 because remainder of 23 ÷ 10 is 3
D. -3 because remainder of -23 ÷ 10 is -3
E. None of the above

Refer to the following code for question 17 to 19:

17. What should be input when prompted in order to get the output of “you are good at math!”? Why?

A. Nothing because you are already good at math


B. x because x stands for variable that could be any value, the value must fit the answer
C. 0 because it is the solution
D. 2 because it would make the comparison statement become true
E. None of the above

18. Which of the following is the correct modification so that user will keep being prompted when the input is
not the desired one?

A.

B.

C.
D.
E. None of the above

19. Does the following code achieve the same result as in question 17? If not, Why?

A. Yes, the two code behaves the same


B. No, nothing is printed in else condition
C. No, functions should not be used, also the empty function would break the code
D. No, the two functions would not work because they are defined differently and used differently
E. None of the above

20. What is the expected output of the following code?

A. 3
B. 9
C. 150
D. 170
E. None of the above

~ End of Paper ~

You might also like