R ÉP U BL IQ UE EXAMEN DU BACCALAURÉAT Session 2023 Problème : (10 points)
Nouveau Type
TUN I SI E NN E Sections :Mathématiques, Sciences Algorithme CAPTCHA
Épreuve :INFORMATIQUE expérimentales, Sciences Techniques Tab1= Tableau de 20 chaines de caractères
MI NI ST È R E D E DEBUT
Tab2=Tableau de 20 entiers
L’ E DU C AT IO N Durée : 1 H 30 Coefficient de l’épreuve : 0.5 Saisir(N)
[Link]
Corrigé et barème de notation Remplir(T1,T2, N)
Objet Type/Nature
Exercice N°1 : (6.25 points) Afficher(T1,T2,N)
Saisir, Remplir, Afficher Procédure
1-Le type de retour de la fonction Inconnue est Entier (0.5 point) FIN
T1 Tab1
2- (1.5 points=0.5*3) 3-(1.5 points=0.5*3) Procédure Saisir(@N : entier)
T2 Tab2
Tableau de déclaration des objets locaux x Inconnue (x) DEBUT
N Entier
Objet Type/Nature 15472 157 Répéter
R, CH Chaine de caractères 9931 9931 Ecrire ("Donner la taille du tableau T")
i Entier 2462 -1 Lire(N)
4- Le rôle de la fonction Inconnue (1.25 points=0.75+0.5) Jusqu’à N ∈[4..20]
La fonction Inconnue permet de retourner l’entier formé par le(s) chiffre(s) impair(s) de x sinon FIN
elle retourne -1 si tous les chiffres de x sont pairs. Procédure Remplir(@T1 :Tab1, @T2 :Tab2, N :entier)
février 2024
5- Algorithme de la procédure Affiche (1.5 points) DEBUT
Procédure Affiche (T :Tab, N :entier) T.D.O.L 0.5 Pour i de 1 à N Faire
Début Objet Type/Nature Nbre1 Aléa(0,20)
Pour i de 1 à N Faire 0.5 i Entier
Ecrire(Inconnue(T[i])) 0.5 Nbre2 Aléa(0,20)
Inconnue fonction
Fin Pour x Aléa(0,2)
Fin si x=0 alors
Exercice N°2 : (3.75 points=0.75*5) op "+"
[Link]
Appel de la fonction x1 " " T2[i] Nbre1+Nbre2
Séquences algorithmiques Sinon Si x=1 Alors
prédéfinie Pour i de 0 à (a-1) Faire
Si (x ≥ 0) Alors y x x1 x1+ch[i] op "-"
[Link]
sinon y -x Fin Pour T2[i] Nbre1-Nbre2
y Abs(x) Objet Type/Nature
x2 " " ch Sinon
FinSi Nbre1, Nbre2 ,i , x Entier
Pour i de b à (Long(ch)–1) Faire Effacer(ch, op "*"
op Caractère
x2 x2 + ch[i] a,b) T2[i] Nbre1*Nbre2
x1 " " FinSi
Fin Pour
pour i de a à (b - 1) Faire x1 T1[i] Convch(Nbre1) + op +Convch(Nbre2)+"= ?"
ch x1 + x2
x1 x1 + ch[i] Sous_Chaine(ch,a,b) FinPour
FinPour FIN
Si Long(ch) = 0 alors Procédure Afficher (T1 :Tab1, T2 :Tab2, N :entier)
a -1, i 0 R Faux DEBUT
Sinon X Aléa(1,N)
Répéter R Vrai, i -1 Ecrire(T1[X])
Si ch[i] = c Alors a i Répéter
i i+1 R Lire(Rep)
Sinon i i+1 Si Non(ch[i] ∈["0".."9"] Si Rep=T2[X] Alors Ecrire("Authentification valide")
a Pos(c,ch) Estnum(ch) [Link]
FinSi Alors R Faux Sinon Ecrire("Authentification invalide") Objet Type/Nature
FinSi FinSi
Jusqu’à (i > Long(ch)-1) Ou Jusqu’à (i = Long(ch) - 1) Ou Rep , X Entier
(a ≠ -1) (R=Faux)
FIN
FinSi