Brevet (DNB) 2024 — Mathematics general stream, Asie 18 juin 2024 — exercise 5 : Scratch Algorithmics (official exam paper)
Statement
The following program is given.
Reminder: the block « point in direction 90 » means that the sprite is facing to the right.
Main script:
When the green flag is clicked ; go to $x : -100$, $y : 0$ ; point in direction 90 ; clear all ; set the variable « side » to 80 ; run the block « Pattern ».
Block « Pattern »:
Define « Pattern » ; pen down ; repeat 3 times: move « side » steps then turn left 120 degrees ; repeat 3 times: move « side » steps then turn right 120 degrees ; pen up.
In this exercise, no justification is expected.
1. At which coordinates is the sprite positioned just after clicking the green flag?
2. Taking 1 cm for 20 steps, draw to full scale the figure obtained by running the main script.
3. The main script is modified in three different ways. Match each script with the corresponding figure.
Script 1: When the green flag is clicked ; go to $x : -100$, $y : 0$ ; point in direction 90 ; clear all ; set « side » to 80 ; repeat 3 times: run « Pattern », then move 100 steps.
Script 2: When the green flag is clicked ; go to $x : -100$, $y : 0$ ; point in direction 90 ; clear all ; set « side » to 80 ; repeat 3 times: run « Pattern », then set « side » to « side $\times 1,2$ ».
Script 3: When the green flag is clicked ; go to $x : -100$, $y : 0$ ; point in direction 90 ; clear all ; set « side » to 80 ; repeat 3 times: run « Pattern », then turn left 120 degrees.
Figure A: three overlapping patterns with the same starting vertex and oriented to the right, with increasing sizes; each pattern is made of two equilateral triangles joined by their common horizontal base, one above and one below.
Figure B: three identical patterns aligned horizontally from left to right; each pattern is made of two equilateral triangles joined by their common horizontal base, one above and one below.
Figure C: the three patterns are rotated by 120 degrees with respect to one another and form a figure with central symmetry made up of six equilateral triangles around a central point, with the outline of a regular hexagon and segments connecting the center to the six vertices.
4. In this question we focus on script no. 2.
a. How many times is the block « pattern » executed?
b. What is the value of the variable « side » at the end of this script?
⏳ Solution not generated yet
Open this statement in Expert Maths AI: the step-by-step solution is computed on demand, checked by a second resolution, then published here for everyone.
📝 See the solutionHave a similar exercise? Get it solved step by step, for free.
🧮 Solve my exercise