Three guided scenarios that move from simple branching to ordered checks and true nested decisions: read the statement, map the branch plan, complete the flowchart, then finish the matching C++ logic.
Trois scénarios guidés qui passent du branchement simple aux tests ordonnés puis aux décisions vraiment imbriquées : lire l'énoncé, tracer le plan des branches, compléter l'organigramme, puis terminer la logique C++ correspondante.
ثلاثة سيناريوهات موجهة تنتقل من التفرع البسيط إلى الفحوصات المرتبة ثم إلى القرارات المتداخلة فعلاً: اقرأ نص المسألة، وابنِ خطة التفرعات، وأكمل المخطط الانسيابي، ثم أتمم منطق C++ المطابق.
0 / 0
Mock exams
Examens blancs
اختبارات تجريبية
Conditions and nested logic exam
Examen des conditions et de la logique imbriquée
اختبار الشروط والمنطق المتداخل
Three guided scenarios that move from simple branching to ordered checks and true nested decisions: read the statement, map the branch plan, complete the flowchart, then finish the matching C++ logic.
Trois scénarios guidés qui passent du branchement simple aux tests ordonnés puis aux décisions vraiment imbriquées : lire l'énoncé, tracer le plan des branches, compléter l'organigramme, puis terminer la logique C++ correspondante.
ثلاثة سيناريوهات موجهة تنتقل من التفرع البسيط إلى الفحوصات المرتبة ثم إلى القرارات المتداخلة فعلاً: اقرأ نص المسألة، وابنِ خطة التفرعات، وأكمل المخطط الانسيابي، ثم أتمم منطق C++ المطابق.
How this exam works
Comment fonctionne cet examen
كيف يعمل هذا الاختبار
Finish one scenario, then submit it to see the review and unlock the next tier.Terminez un scénario, puis soumettez-le pour voir le corrigé et débloquer le niveau suivant.أكمل سيناريو واحداً، ثم أرسله لرؤية المراجعة وفتح المستوى التالي.
Harmless spacing is ignored in structured fields, but exact-output prompts still require the exact visible output.Les espaces sans importance sont ignorés dans les champs structurés, mais les questions de sortie exacte demandent toujours la sortie visible exacte.يتم تجاهل المسافات غير المهمة في الحقول المنظمة، لكن أسئلة المخرجات الدقيقة ما زالت تتطلب المخرجات الظاهرة نفسها تماماً.
Your drafts and submitted scores are saved on this device.Vos brouillons et scores soumis sont enregistrés sur cet appareil.يتم حفظ مسوداتك ودرجاتك المرسلة على هذا الجهاز.
Read one integer age. If the age is invalid (less than 0 or greater than 150), print "Invalid". Otherwise, if the age is from 13 to 19 inclusive, print "Teen ticket". In every other valid case, print "Standard ticket".
This scenario introduces an ordered chain. Reject the bad case first, then classify the remaining valid ages.
Lisez un entier age. Si l’âge est invalide (inférieur à 0 ou supérieur à 150), affichez "Invalid". Sinon, si l’âge est compris entre 13 et 19 inclus, affichez "Teen ticket". Dans tous les autres cas valides, affichez "Standard ticket".
Ce scénario introduit une chaîne ordonnée. Rejetez d’abord le cas incorrect, puis classez les âges valides restants.
اقرأ عددًا صحيحًا واحدًا age. إذا كان العمر غير صالح (أقل من 0 أو أكبر من 150) فاطبع "Invalid". وإلا، إذا كان العمر بين 13 و19 شاملًا، فاطبع "Teen ticket". وفي كل حالة صالحة أخرى اطبع "Standard ticket".
يقدّم هذا السيناريو سلسلة شروط مرتبة. ارفض الحالة الخاطئة أولًا، ثم صنّف الأعمار الصالحة المتبقية.
Write the branch checkpoints
Écrivez les points de contrôle du branchement
اكتب نقاط فحص التفرع
Use the exact variable name and exact branch conditions from the intended solution.
Utilisez le nom exact de la variable et les conditions exactes des branches de la solution attendue.
استخدم اسم المتغير الدقيق وشروط الفروع الدقيقة من الحل المقصود.
Review
Corrigé
مراجعة
This chain rejects invalid ages first, then checks the teen range, then uses else for the remaining valid ages.
Cette chaîne rejette d'abord les âges invalides, puis vérifie la plage adolescente, puis utilise else pour les âges valides restants.
ترفض هذه السلسلة الأعمار غير الصالحة أولاً، ثم تفحص مجال المراهقين، ثم تستخدم else لما تبقى من الأعمار الصالحة.
Complete the chain flowchart
Complétez l'organigramme de la chaîne
أكمل مخطط السلسلة
Fill the missing decision text exactly as it appears in the intended logic.
Complétez le texte manquant des décisions exactement comme dans la logique attendue.
أكمل نص القرارات الناقصة كما يظهر تماماً في المنطق المقصود.
Review
Corrigé
مراجعة
The No path of the invalid check continues into the teen check. That second decision is the else if part of the chain.
Le chemin Non du test d'invalidité continue vers le test adolescent. Cette seconde décision correspond à la partie else if de la chaîne.
يمتد مسار لا من فحص عدم الصلاحية إلى فحص المراهق. ويمثل هذا القرار الثاني جزء else if من السلسلة.
Fill the exact logic tokens
Complétez les jetons logiques exacts
املأ عناصر المنطق الدقيقة
Use the exact operator or keyword in each blank. Some blanks are two words or two symbols.
Utilisez l'opérateur ou le mot-clé exact dans chaque blanc. Certains blancs contiennent deux mots ou deux symboles.
استخدم العامل أو الكلمة المفتاحية الدقيقة في كل فراغ. بعض الفراغات تتكون من كلمتين أو من رمزين.
1int age;
2cin >> age;
3if (age < 0 age > 150)
4 cout << "Invalid";
5 (age >= 13 age <= 19)
6 cout << "Teen ticket";
7else
8 cout << "Standard ticket";
Review
Corrigé
مراجعة
The invalid check uses ||, the second branch is else if, and the teen range needs && because both limits must hold.
Le test d'invalidité utilise ||, la deuxième branche est else if, et la plage adolescente demande && car les deux limites doivent être vraies.
يستخدم فحص عدم الصلاحية العامل ||، والفرع الثاني هو else if، ويحتاج مجال المراهق إلى && لأن الحدين يجب أن يتحققا معاً.
Fill the printed result for each age
Complétez le résultat affiché pour chaque âge
املأ النتيجة المطبوعة لكل عمر
1int age;
2cin>> age;
3if (age < 0 || age > 150) cout<<"Invalid";
4elseif (age >= 13 && age <= 19) cout<<"Teen ticket";
5elsecout<<"Standard ticket";
ageageage
printedaffichéمطبوع
-2
16
42
Review
Corrigé
مراجعة
Trace from the top each time. -2 matches the first branch, 16 fails invalid then matches the teen range, and 42 reaches the final else.
Tracez depuis le haut à chaque fois. -2 correspond à la première branche, 16 échoue au test invalid puis correspond à la plage ado, et 42 atteint le else final.
ابدأ التتبع من الأعلى كل مرة. تطابق -2 الفرع الأول، ويفشل 16 في فحص عدم الصلاحية ثم يطابق مجال المراهق، بينما يصل 42 إلى else الأخير.
Scenario scoreScore du scénarioدرجة السيناريو0 / 0
Read one integer x. If x is positive, check whether it is even or odd: print "Positive even" for an even positive number, and "Positive odd" for an odd positive number. If x is not positive, print "Not positive".
This is the least scaffolded scenario. The parity test belongs inside the positive branch, not in a separate chain.
Lisez un entier x. Si x est positif, vérifiez ensuite s’il est pair ou impair : affichez "Positive even" pour un entier positif pair, et "Positive odd" pour un entier positif impair. Si x n’est pas positif, affichez "Not positive".
C’est le scénario le moins guidé. Le test de parité appartient à l’intérieur de la branche positive, pas dans une chaîne séparée.
اقرأ عددًا صحيحًا واحدًا x. إذا كان x موجبًا، فافحص بعد ذلك هل هو زوجي أم فردي: اطبع "Positive even" إذا كان العدد الموجب زوجيًا، واطبع "Positive odd" إذا كان العدد الموجب فرديًا. وإذا لم يكن x موجبًا، فاطبع "Not positive".
هذا هو السيناريو الأقل توجيهًا. فحص الزوجية ينتمي إلى داخل الفرع الموجب، وليس إلى سلسلة مستقلة.
Write the nested branch plan
Écrivez le plan du branchement imbriqué
اكتب خطة التفرع المتداخل
Use the exact outer test, inner test, and printed phrases from the intended solution.
Utilisez le test externe exact, le test interne exact et les phrases affichées exactes de la solution attendue.
استخدم الفحص الخارجي الدقيق والفحص الداخلي الدقيق والعبارات المطبوعة الدقيقة من الحل المقصود.
Review
Corrigé
مراجعة
This is true nesting: the parity check happens only inside the Yes branch of x > 0.
Il s'agit d'une vraie imbrication : le test de parité ne se fait que dans la branche Oui de x > 0.
هذا تداخل حقيقي: لا يحدث فحص الزوجية إلا داخل فرع نعم للشرط x > 0.
Complete the nested flowchart
Complétez l'organigramme imbriqué
أكمل المخطط المتداخل
Fill the two decision diamonds exactly. The second diamond lives inside the Yes branch of the first.
Complétez exactement les deux losanges de décision. Le second se trouve dans la branche Oui du premier.
أكمل معيني القرار بدقة. يقع المعين الثاني داخل فرع نعم للمعين الأول.
Review
Corrigé
مراجعة
Nested decisions are not a chain. The inner test is physically inside the Yes branch of the outer decision.
Les décisions imbriquées ne forment pas une chaîne. Le test interne se trouve physiquement dans la branche Oui de la décision externe.
القرارات المتداخلة ليست سلسلة. يقع الفحص الداخلي فعلياً داخل فرع نعم للقرار الخارجي.
Fill the nested code
Complétez le code imbriqué
أكمل الكود المتداخل
Reuse the same condition text in code. The second if is inside braces, not in an else if chain.
Réutilisez le même texte de condition dans le code. Le second if est dans des accolades, pas dans une chaîne else if.
أعد استخدام نص الشرط نفسه في الكود. تقع if الثانية داخل أقواس معقوفة، وليست ضمن سلسلة else if.
1int x;
2cin >> x;
3if () {
4 if ()
5 cout << "Positive even";
6 else
7 cout << "Positive odd";
8} else {
9 cout << "Not positive";
10}
Review
Corrigé
مراجعة
The outer if guards the whole positive branch. Only after entering that block do we ask whether the positive number is even.
Le if externe protège toute la branche positive. Ce n'est qu'après être entré dans ce bloc qu'on demande si le nombre positif est pair.
يحرس if الخارجي الفرع الإيجابي كله. ولا نسأل إن كان العدد الموجب زوجياً إلا بعد دخول هذه الكتلة.
Type the exact output
Tapez la sortie exacte
اكتب المخرجات الدقيقة
Write only the exact words printed on screen.
Écrivez seulement les mots exacts affichés à l'écran.
اكتب فقط الكلمات الدقيقة المطبوعة على الشاشة.
1int x = 15;
2if (x > 0) {
3if (x % 2 == 0)
4cout<<"Positive even";
5else
6cout<<"Positive odd";
7} else {
8cout<<"Not positive";
9}
Review
Corrigé
مراجعة
15 > 0 is true, so the program enters the outer block. Then 15 % 2 == 0 is false, so the inner else prints "Positive odd".
15 > 0 est vrai, donc le programme entre dans le bloc externe. Ensuite 15 % 2 == 0 est faux, donc le else interne affiche "Positive odd".
الشرط 15 > 0 صحيح، لذلك يدخل البرنامج إلى الكتلة الخارجية. ثم يكون 15 % 2 == 0 خاطئاً، فتطبع else الداخلية العبارة "Positive odd".
Scenario scoreScore du scénarioدرجة السيناريو0 / 0