0% found this document useful (0 votes)
4 views3 pages

CH 7 Using Loops in MakeCode

The document covers the use of loops in MakeCode, including types of loops such as While, For, and Nested Loops, as well as their components and exit criteria. It includes multiple-choice questions, fill-in-the-blank exercises, and competency-based questions related to loops. Additionally, it discusses the advantages of using loops over repetitive code and provides assertions with their reasoning.

Uploaded by

jungkookjeon7053
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

CH 7 Using Loops in MakeCode

The document covers the use of loops in MakeCode, including types of loops such as While, For, and Nested Loops, as well as their components and exit criteria. It includes multiple-choice questions, fill-in-the-blank exercises, and competency-based questions related to loops. Additionally, it discusses the advantages of using loops over repetitive code and provides assertions with their reasoning.

Uploaded by

jungkookjeon7053
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Ch 7

Using Loops in MakeCode


Book work
A. Select the correct option:
i. (b) Continue
ii. (b) Exit
iii. (b) Condition
iv. (a) Loops
v. (c) Nested Loop

B. Fill in the blanks:


i. Definite
ii. Loops
iii. Infinite
iv. Looping
v. True

C. State True or False:


i. True
ii. False
iii. False
iv. True
v. False

E. Competency-based questions:
1. Exit Criteria
Notebook Work
C. Answer the following:
i. What are the different types of loops? (88)
Ans. The three different types of loops are: While Loop, For Loop, Nested Loop.
ii. What are the four components of while loop? (89)
Ans. It has four components: Initialisation, condition, loop body and step value.
iii. Define exit criteria. (90)
Ans. In a loop, there must be a terminating condition, which should meet false so that
the block of code should exit from the loop. To make sure that the block of code does
not enter into an infinite loop, it is important to add exit criterion in the loop.
iv. What is a break statement? (90)
Ans. You can use break statement with for loop to terminate the loop when a certain
condition is met.

Extra Questions
1. MCQs:
a. Which statement is used to exit from a loop?
i. Break ii. Continue iii. Exit iv. None of these

b. Which of the following is NOT a loop in MakeCode?


i. while ii. for iii. nested iv. Repeat

c. Which statement is used to skip some lines of code within a loop?


i. Break ii. Exit iii. For iv. Continue

d. ______________ means repeating a set of statements until the condition is true.


i. Sequential ii. Conditional iii. Looping iv. None of these

2. Answer in one word:


a. What is the process of increasing or decreasing a value in a loop is called?
Ans. Step Value.
b. What is the first step in a while loop?
Ans. Initialisation.

c. A loop without an exit condition results in __________ loop.


Ans. Infinite.

d. What is the variable that changes its value in every iteration of the loop is
called?
Ans. Counter.

3. Competency Based Questions:


a. If you forget to provide an exit criterion in a loop, what will happen?
Ans. The loop will run infinitely, causing the program to hang or crash.
b. In a password login system where a user gets 5 chances, which type of loop is
suitable and why?
Ans. A while loop, because the number of attempts depends on the user’s input and
not a fixed sequence.

c. A teacher wants to print the squares of numbers from 1 to 50. Which loop
should be used and why?
Ans. A for loop, since the range (1 to 50) is predetermined.

e. Why is using loops better than copying and pasting the same statement
multiple times?
Ans. Loops save time, reduce redundancy, prevent errors, and make the program more
flexible and readable.

4. Assertion and Reason:


1. Assertion: A for loop is also called a definite loop.
Reason: It is used when the number of iterations is pre-determined.
Ans. Both A and R are true, and R is the correct explanation of A.

2. Assertion: The break statement skips the current iteration.


Reason: The continue statement terminates the loop.
Ans. Both A and R are false.

You might also like