Lesson 10 to 13

Cards (30)

  • In programming, repetitive tasks are often performed and need to be executed efficiently. To handle this scenario, repetition control structures, also referred to as loops, are used. These enable a certain block of code to be executed multiple times based on specific conditions.
  • By using loops, the programmers can minimize code redundancy, improve the clarity of codes, and manage complex computations easily.
  • Entry controlled loops - it evaluate the condition first before entering the loop body.
    • while loop
    • for loop
  • Exit controlled loop - the condition is evaluated at the end of the loop body.
    • do while loop
  • Fill in the Blank
    A) Loops
    B) Entry Controlled
    C) for
    D) while
    E) Exit Controlled
    F) do-while
  • Fill in the Blank
    A) while
    B) expression
    C) statement
    D) while
    E) expression
    F) true
    G) statement
    H) false
    I) statement
    J) expression
    K) true
  • Fill in the Blank
    A) Loop Control Variable (LCV)
    B) Initialize
    C) LCV
    D) evaluate
    E) expression
    F) LCV
    G) executes
    H) inside
    I) expression
    J) true
    K) LCV
  • Fill in the Blank
    A) 012345Thank You!
    B) vertically aligned because of endl;
  • Fill in the Blank
    A) 0123456Thank you!
    B) vertically aligned bacause of endl
  • Fill in the Blank
    A) Infinity 0
  • Various forms of while loop
    Case 1: Counter-Controlled while loops
    Case 2: Sentinel-Controlled while loops
    Case 3: Flag-Controlled while loops
  • Fill in the Blank
    A) user input value
  • Fill in the Blank
    A) counter=0;
    B) while(counter<n)
    C) {
    D) counter++;
    E) }
  • Fill in the Blank
    A) cin>>variable;
    B) while(variable!=sentinel)
    C) {
    D) cin>>variable;
    E) }
  • Observe:
  • Fill in the Blank
    A) isFound=false;
    B) while(!isFound)
    C) {
    D) if(expression)
    E) isFound=true
    F) }
    G) boolean variable
    H) flag variable
    I) true
    J) false
  • Observe:
  • Fill in the Blank
    A) for
    B) (initial statement; loop condition; update statement)
    C) statement
    D) initial statement
    E) loop condition
    F) true
    G) statement
    H) update statement
    I) false
    J) for loop control
    K) for indexed
    L) variable
    M) true
    N) update statement
    O) true
    P) terminated
  • Fill in the Blank
    A) 012345Thank you!
  • Fill in the Blank
    A) 012345*Thank you!
    B) compound statements
  • Fill in the Blank
    A) 0*1*2*3*4*5*Thank you!
  • Fill in the Blank
    A) 6Thank you!
    B) semicolon
  • Fill in the Blank
    A) Infinite Hello World!
  • Fill in the Blank
    A) break
  • Fill in the Blank
    A) continue
  • Fill in the Blank
    A) do
    B) statement
    C) while(expression);
    D) statement
    E) expression
    F) true
    G) false
    H) initialize
    I) execute
    J) update
    K) evaluate
    L) true
    M) false
  • Fill in the Blank
    A) 012345Thank you!
  • Fill in the Blank
    A) Thank you!
    B) 6Thank you!
  • Fill in the Blank
    A) Nested loop
    B) nested loop
    C) inner loop
    D) true
    E) inner loop
  • Fill in the Blank
    A) five