Grade 10
/ Algorithms 15 exercises (including 0 corrected)
- General study of algorithms (4 exercices)
- First use of algoBox (4 exercices)
- Algorithm creation (2 exercices)
- Drawing of curves (2 exercices)
- Observation of the law of large numbers (2 exercices)
- Dichotomy (1 exercice)
Lire les nombresAetBTant que Le reste de la di-vision deAparBvaut 0?Le PGCD estBˆAprend pour valeurBˆBprend pour valeurrOn e∑ectue la division euclidienne deAparBSortiedeboucle
Lire le nombrexA`cher 1Pouriallant de 2 àxLe reste de la division euclidiennedexpariest vaut 0?A`che " - "A`cheiFin de l’algorithmeSortiedebouclesOuiNon
E.3069
1
The
command
floor
is
used
to
obtain
the
integer
part
of
a
number;
suppose
the
variable
a
has
the
value
3.1415926535
a
Give
the
value
of
floor(a*10)
.
b
Deduce
the
command
to
obtain
the
default
value
of
a
to
the
nearest
tenth
;
to
the
nearest
hundredth.
2
Determine
the
remainders
of
the
following
Euclidean
di-visions
:
a
10
par
3
b
33
par
5
c
27
par
4
d
69
par
8
The
command
a
%
b
returns
the
remainder
of
the
Eu-clidean
division
of
a
by
b
:
e
What
can
be
the
values
of
a
%2
?
of
2
%
a
?
f
Using
a
conditional
structure,
write
an
algorithm
that
asks
for
the
input
of
a
value
and
then
displays
the
sen-tences
ˇthis
number
is
pairı
or
ˇ
this
number
is
impair
ı
as
appropriate.
3
The
command
sqrt(2)
returns
the
square
root
of
the
number
2:
a
Write
an
algorithm
asking
the
user
for
four
numbers
representing
the
coordinates
of
two
points,
and
return-ing
the
distance
separating
these
two
points.
b
Modify
the
algorithm
so
that
it
displays
the
default
value
of
this
distance
to
the
nearest
tenth.
E.3044
1
Enter
the
algorithm
below
in
the
programming
language
of
your
choice
:
For
a
ranging
from
1
to
25
x
←
a
×
a
End
For
2
By
a
step-by-step
execution
of
this
algorithm,
give
the
set
of
values
that
will
be
assigned
to
the
variable
x
.
E.3068
1
Enter
the
algorithm
below
in
the
programming
language
of
your
choice
:
a
←
0
As
long
as
a<100
x
←
A%2
If
x=0
Then
y
←
a
End
If
a
←
a+1
End
As
long
as
2
When
executing
the
step-by-step
algorithm,
what
are
dif-ferent
values
assigned
to
the
variable
y
.
3
Modify
this
algorithm
so
that
the
variable
y
is
succes-sively
assigned
all
multiples
of
13
less
than
100
.
E.3070
1
Enter
the
algorithm
below
in
the
programming
language
of
your
choice
:
Function
f(a)
a
←
a
As
long
as
a>=1
a
←
a
−
1
End
While
Return
a
2
a
Make
a
call
to
the
function
f
with
each
of
the
fol-lowing
values
:
1
;
2
;
3
;
4
;
9
;
10
b
What
is
the
role
of
the
function
f
?
3.
Algorithm
creation
E.3071
The
diagram
below
shows
Euclid’s
algorithm.
Build
this
algorithm
using
algoBox.
E.3090
Consider
the
algorithm
below
where
the
variables
x
and
i
are
of
type
number:
https://chingmath.fr
sacados/3069
sacados/3044
sacados/3068
sacados/3070
sacados/3071
Lire les nombresAetBTant que Le reste de la di-vision deAparBvaut 0?Le PGCD estBˆAprend pour valeurBˆBprend pour valeurrOn e∑ectue la division euclidienne deAparBSortiedeboucle
sacados/3090
Lire le nombrexA`cher 1Pouriallant de 2 àxLe reste de la division euclidiennedexpariest vaut 0?A`che " - "A`cheiFin de l’algorithmeSortiedebouclesOuiNon
VARIABLESxEST_DU_TYPENOMBREyEST_DU_TYPENOMBREiEST_DU_TYPENOMBREDEBUT_ALGORITHMEPOURiALLANTDE-5A5DEBUT_POURxPREND_LA_VALEURiyPREND_LA_VALEURx*xTRACER_POINT(x,y)FIN_POURFIN_ALGORITHME
VARIABLESx1EST_DU_TYPENOMBREy1EST_DU_TYPENOMBREx2EST_DU_TYPENOMBREy2EST_DU_TYPENOMBREiEST_DU_TYPENOMBREDEBUT_ALGORITHMEPOURiALLANTDE10A100DEBUT_POURx2PREND_LA_VALEURi/10y2PREND_LA_VALEURsqrt(x2-1)TRACER_POINT(x2,y2)FIN_POURFIN_ALGORITHME
1
Build
this
algorithm
using
Algobox.
2
Mathematically,
what
is
the
purpose
of
this
algorithm?
4.
Drawing
of
curves
E.3091
1
a
In
AlgoBox
and
in
the
tab
ˇ
Draw
in
a
marker
ı,
check
the
box
ˇ
Use
a
repère
ı
;
enter
the
following
values
for
the
axis
terminals
:
Xmin:-5
;
Xmax:5
;
GraduationsX:1
Ymin:0
;
Ymax:25
;
GraduationsY:1
b
Enter
the
following
algorithm
into
AlgoBox:
c
Run
the
algorithm
to
observe
its
display.
d
What
does
this
algorithm
appear
to
display?
2
We
want
to
plot
more
points
representing
this
curve,
to
do
this
we
want
to
modify
the
iterative
loop
so
that
the
abscissas
of
the
points
are
0.1
apart
in
0.1
:
a
Edit
line
x
PREND_LA_VALEUR
i
to
:
x
PREND_LA_VALUE
i/10
b
Run
the
algorithm
to
observe
the
effect
of
these
modi-fications.
c
What
modification
needs
to
be
made
to
the
algorithm
so
that
the
representative
curve
is
displayed
over
the
interval
−
5
;
5
?
d
Apply
these
changes
and
run
this
algorithm
again.
E.3092
Consider
the
function
f
defined
by:
f
(
x
)
=
x
−
1
In
a
reference
frame
O
;
I
;
J
orthogonal,
note
C
f
the
repre-sentative
curve
of
the
function
f
.
1
a
Determine
the
definition
set
of
the
function
f
.
b
Determine
the
coordinates
of
the
point
on
the
curve
C
f
having
abscissa
1
.
2
a
In
AlgoBox
and
in
the
ˇ
tab
Draw
in
a
marker
ı,
check
the
ˇ
box
Use
a
repère
ı
;
enter
the
following
values
defin-ing
the
axis
bounds
:
Xmin:0
;
Xmax:9
;
GraduationsX:1
Ymin:0
;
Ymax:3
;
GraduationsY:1
b
Enter
the
following
algorithm
into
AlgoBox:
c
Run
the
algorithm
and
observe
the
resulting
graph.
3
The
aim
of
this
question
is
to
draw
the
curve
C
f
by
seg-ments
connecting
each
of
the
previous
points.
a
Delete
the
command
ˇ
TRACER_POINT
(x2,y2)
ı
to
re-place
it
with
the
command
TRACER_SEGMENT
connect-ing
the
points
with
coordinates
(x1,y1)
and
(x2,y2)
.
b
Run
the
algorithm
to
observe
the
changes.
The
plot
is
made
up
of
segments
only.
What
is
the
common
origin
of
all
these
segments?
Why
or
why
not?
c
Before
defining
the
loop
for
and
in
relation
to
the
question
1
b
,
correctly
initialize
the
values
of
x1
and
y1
in
order
to
improve
the
curve
plot
C
f
.
d
To
plot
the
curve
C
f
segment
by
segment,
the
algo-rithm
must
connect
the
current
point
with
the
previ-ous
point.
Just
before
the
end
of
the
loop
POUR
,
make
the
point
with
coordinates
(x1,y1)
represent
the
coordinate
point
(x2,y2)
for
the
next
loop
execution.
5.
Observation
of
the
law
of
large
numbers
E.3108
1
a
Enter
the
following
algorithm
in
the
algorithm
of
your
choice
:
c
←
0
For
i
ranging
from
0
to
100
x
←
random
value
belonging
to
0
;
1
x
←
integer
part
of
3
×
x
End
For
b
Running
this
algorithm
step
by
step,
what
values
are
assigned
to
the
variable
ˇ
x
ı?
https://chingmath.fr
sacados/3091
VARIABLESxEST_DU_TYPENOMBREyEST_DU_TYPENOMBREiEST_DU_TYPENOMBREDEBUT_ALGORITHMEPOURiALLANTDE-5A5DEBUT_POURxPREND_LA_VALEURiyPREND_LA_VALEURx*xTRACER_POINT(x,y)FIN_POURFIN_ALGORITHME
sacados/3092
VARIABLESx1EST_DU_TYPENOMBREy1EST_DU_TYPENOMBREx2EST_DU_TYPENOMBREy2EST_DU_TYPENOMBREiEST_DU_TYPENOMBREDEBUT_ALGORITHMEPOURiALLANTDE10A100DEBUT_POURx2PREND_LA_VALEURi/10y2PREND_LA_VALEURsqrt(x2-1)TRACER_POINT(x2,y2)FIN_POURFIN_ALGORITHME
sacados/3108
VARIABLESxEST_DU_TYPENOMBREiEST_DU_TYPENOMBREmaxEST_DU_TYPENOMBREDEBUT_ALGORITHMEmaxPREND_LA_VALEUR100POURiALLANTDE1A100DEBUT_POURxPREND_LA_VALEURrandom()xPREND_LA_VALEURfloor(x*3)TRACER_POINT(10*i/max,x)FIN_POURFIN_ALGORITHME
VARIABLESborneMinEST_DU_TYPENOMBREborneMinEST_DU_TYPENOMBRExEST_DU_TYPENOMBREDEBUT_ALGORITHMETANT_QUE(borneMax-borneMin>pow(10,-3))FAIREDEBUT_TANT_QUESI(x<(borneMin+borneMax)/2)ALORSDEBUT_SIborneMaxPREND_LA_VALEUR(borneMin+borneMax)/2FIN_SISINONDEBUT_SINONborneMinPREND_LA_VALEUR(borneMax+borneMin)/2FIN_SINONAFFICHERborneMinAFFICHER"-"AFFICHERborneMaxFIN_TANT_QUEFIN_ALGORITHME
2
a
Add
a
conditional
structure
inside
the
POUR
loop
so
that
the
:
c
←
c+1
are
executed
whenever
the
variable
ˇ
x
ı
is
assigned
the
value
2
.
b
Run
the
algorithm
several
times
and
observe
the
value
of
the
variable
c
.
Can
we
explain
the
variations
in
the
values
of
the
vari-able
c
?
3
a
Modify
the
algorithm
so
that
the
loop
performs
500
iterations
and
add
the
instruction
below
at
the
end
of
the
algorithm:
f
←
c
500
b
Run
this
algorithm
several
times
and
observe
the
vari-ations
in
the
value
of
the
variable
f
at
the
end
of
the
algorithm.
4
What
can
be
done
to
make
the
variations
in
the
variable
f
stabilize?
E.3109
1
a
Enable
the
use
of
a
marker
in
AlgoBox
by
taking
the
following
parameters
:
Xmin
:
0
Xmax:
10
Graduations
X:
1
Ymin
:
0
Ymax:
10
Graduations
Y:
1
b
Enter
the
following
algorithm
in
AlgoBox:
c
Execute
this
algorithm.
What
does
it
do?
2
a
Using
the
previous
exercise,
modify
the
present
al-gorithm
so
that
it
displays
the
frequency
of
occurrence
of
the
number
2
(in
the
variable
x
)
.
b
Modify
the
algorithm
so
that
it
displays
the
straight
line
with
equation
y=1/3
.
c
Increase
the
number
of
runs
of
this
algorithm.
What
observation
can
be
made
when
running
the
algorithm?
6.
Dichotomy
E.3146
1
Enter
the
algorithm
below
:
2
a
Execute
this
algorithm
with
the
following
values
:
xMin=1
;
borneMax=3
;
x=1.9384
b
By
observing
the
successive
values
taken
by
borneMin
and
borneMax
,
to
what
value
do
the
numbers
borneMin
and
borneMax
point?
3
Modify
this
algorithm
so
that
these
two
values
approach
2
.
https://chingmath.fr
sacados/3109
VARIABLESxEST_DU_TYPENOMBREiEST_DU_TYPENOMBREmaxEST_DU_TYPENOMBREDEBUT_ALGORITHMEmaxPREND_LA_VALEUR100POURiALLANTDE1A100DEBUT_POURxPREND_LA_VALEURrandom()xPREND_LA_VALEURfloor(x*3)TRACER_POINT(10*i/max,x)FIN_POURFIN_ALGORITHME
sacados/3146
VARIABLESborneMinEST_DU_TYPENOMBREborneMinEST_DU_TYPENOMBRExEST_DU_TYPENOMBREDEBUT_ALGORITHMETANT_QUE(borneMax-borneMin>pow(10,-3))FAIREDEBUT_TANT_QUESI(x<(borneMin+borneMax)/2)ALORSDEBUT_SIborneMaxPREND_LA_VALEUR(borneMin+borneMax)/2FIN_SISINONDEBUT_SINONborneMinPREND_LA_VALEUR(borneMax+borneMin)/2FIN_SINONAFFICHERborneMinAFFICHER"-"AFFICHERborneMaxFIN_TANT_QUEFIN_ALGORITHME