0% found this document useful (0 votes)
3 views

VII_Coding_Chap2_Homework

The document discusses the benefits of sequencing in coding, highlighting logical thinking and replicability. It provides algorithms for swapping two numbers, outlines advantages of loops, and differentiates between while and for loops. Additionally, it defines iteration and lists types of loops, along with algorithms for a morning routine and making a sandwich.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

VII_Coding_Chap2_Homework

The document discusses the benefits of sequencing in coding, highlighting logical thinking and replicability. It provides algorithms for swapping two numbers, outlines advantages of loops, and differentiates between while and for loops. Additionally, it defines iteration and lists types of loops, along with algorithms for a morning routine and making a sandwich.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

‭ LASS: VII‬

C
‭SUBJECT: CODING‬

‭ hapter 2:‬ ‭Sequencing with Block Coding‬


C
‭Term‬‭: 1‬

‭ 1. Write the benefits of using sequencing in coding?‬


Q
‭Ans: Benefits‬
‭1)‬ ‭Our manner of thinking can be easily replicated in sequence programming.‬
‭2)‬ ‭Sequence of programming reflects logical thinking.‬
‭Q2. Write an algorithm to swap two numbers.‬
‭Step 1: Start‬
‭Step 2: READ num1, num2‬
‭Step 3: temp = num1‬
‭Step 4: num1 = num2‬
‭Step 5: num2 = temp‬
‭Step 6: PRINT num1, num2‬
‭Step 7: Stop‬
‭ 3. Write down the two advantages of the loop‬
Q
‭Ans. 1) Reduce lines of code.‬
‭2) Code becomes easier to understand.‬

‭Q4. Write the difference between While loop and For Loop‬

‭While Loop‬ ‭For Loop‬

‭1)‬ W‭ hile Loops repeats a statement or‬ ‭1)‬ F‭ or loop is used for iterating over a‬
‭group of statements when a given‬ ‭sequence.‬
‭condition is true.‬ ‭2)‬ ‭A for loop executes for a specific‬
‭2)‬ ‭It tests the condition before‬ ‭number of times.‬
‭executing the loop body‬
‭Q5. What do you mean by Iteration?‬
‭ ns.‬ ‭Iteration‬ ‭can‬ ‭be‬ ‭defined‬ ‭as‬ ‭repeating‬ ‭the‬ ‭same‬ ‭task‬ ‭again‬ ‭and‬ ‭again‬ ‭until‬ ‭the‬ ‭specified‬
A
‭condition is met. Iteration is a repeating situation.‬

‭Q6. What are the different types of loops‬‭?‬

‭Ans. Different types of loops are:‬

‭1) While loop‬

‭2)‬ ‭For loop‬

‭ 7. Write an algorithm for your morning routine.‬


Q
‭Ans.‬
‭Step 1: Wake up‬
‭Step 2: Brush your teeth‬
‭Step 3: Take a bath‬
‭Step 4: Have breakfast‬
‭Step 5: Go to school‬

‭ 8. Write an algorithm to make a sandwich.‬


Q
‭Ans:‬
‭Step 1: Get two slices of bread, jam and butter.‬
‭Step 2: Spread jam on one slice of bread‬
‭Step 3: Spread butter on the other slice of bread.‬
‭Step 4: Put the two pieces of bread together.‬

You might also like