Kablow!

Selection and iteration

விளையாடிக் கற்றுக்கொள்ளுங்கள்

ஆற்றல் சம்பாதிக்க இந்த கேள்விகளுக்குப் பதிலளியுங்கள், பின்னர் மீன் பிடித்து ஆராயுங்கள். கணக்கு தேவையில்லை.

கல்வியாளர்களுக்கு: Selection and iteration (Computer Science, Programming)-க்கான தயாரான பாட ஸ்லைடுகள், திருப்புதல் குறிப்புகள் — உங்கள் பாடத்தில் அவற்றைப் பயன்படுத்தவும், அல்லது கற்பவர்கள் நேரலை விளையாட்டாக விளையாடும் ஊடாடும் வகுப்பு செயல்பாடாக தலைப்பை இயக்கவும்.

பாட குறிப்புகள்

Selection

  • Selection lets a program choose between paths using conditions. IF ... THEN ... ELSE ... ENDIF; ELSE IF for multiple options; nested IF statements put one decision inside another.
  • Example: IF mark ≥ 70 THEN OUTPUT "Distinction" ELSE IF mark ≥ 40 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF.

Selection chooses a path

Selection chooses a path

Iteration

  • Count-controlled loops (FOR) repeat a set number of times: FOR i = 1 TO 5 ... NEXT i.
  • Condition-controlled loops (WHILE, REPEAT UNTIL) repeat until a condition is met. WHILE checks before; REPEAT UNTIL checks after (always runs at least once).
  • Nested loops: a loop inside a loop; useful for tables and 2D arrays.

Repeating instructions in a loop

Repeating instructions in a loop

Choosing

  • Use FOR when you know how many repeats; WHILE/REPEAT when you don't (e.g. keep asking for a password until correct).

Avoiding infinite loops

  • For WHILE, update the values used by the condition so it can become false. For REPEAT UNTIL, update them so the stopping condition can become true. Trace normal and boundary cases.

Trace a changing loop variable

Trace a changing loop variable

Boolean conditions

  • Combine with AND, OR, NOT; use brackets for clarity.

Tracing

  • Use trace tables to follow loop values.

ஸ்லைடுகள்

Sign up free to view the lesson slides

Step through every slide for this topic — plus flashcards and revision notes — with a free account.

பயிற்சி கேள்விகள்

இலவச முன்னோட்டம் — 33-இல் 8 கேள்விகள். அனைத்தையும் பார்க்க பதிவு செய்யவும்.
  1. 1.What does IF do?

    Easy
    • Aruns code only if a condition is true
    • Brepeats code
    • Cends a program
    • Dstores data
  2. 2.What does a loop do?

    Easy
    • Arepeats instructions
    • Bmakes a decision
    • Cstores a value
    • Dends a program
  3. 3.What does ELSE do?

    Easy
    • Aruns when the IF condition is false
    • Brepeats code
    • Cends the loop
    • Dstores a value
  4. 4.Which loop runs a fixed number of times?

    Easy
    • AFOR
    • BWHILE
    • CREPEAT UNTIL
    • DIF
  5. 5.Which condition-controlled loop tests before executing its body?

    Easy
    • AWHILE
    • BREPEAT UNTIL
    • CFOR only
    • Dnone
  6. 6.What is the output? x = 5 IF x > 3 THEN OUTPUT "A" ELSE OUTPUT "B" ENDIF

    Easy
    • AA
    • BB
    • C5
    • Dnothing
  7. 7.What is the output? n = 1 WHILE n < 4 OUTPUT n n = n + 1 ENDWHILE

    Easy
    • A1 2 3
    • B1 2 3 4
    • C4
    • D0 1 2 3
  8. 8.What is the output? FOR i = 2 TO 8 STEP 2 OUTPUT i NEXT i

    Easy
    • A2 4 6 8
    • B2 3 4 5 6 7 8
    • C2 8
    • D8 6 4 2

Unlock all 33 questions & more

இந்த தலைப்பிற்கான ஒவ்வொரு கேள்வியையும், ஸ்லைடுகளையும், ஃப்ளாஷ் கார்டுகளையும் மற்றும் திருப்புதல் குறிப்புகளையும் பார்க்க இலவச கணக்கை உருவாக்கவும்.

முந்தைய தேர்வுகள்

இந்த தலைப்பிற்கான முந்தைய தேர்வு பயிற்சி விரைவில் வருகிறது.
விரைவில் வருகிறது