Units — Computer Education
  1. Unit 1Introduction to Computers
  2. Unit 2Digital Skills
  3. Unit 3Algorithmic Thinking and Problem Solving
  4. Unit 4Programming Scratch
  5. Unit 5Digital Citizenship
  6. Unit 6Entrepreneurship in Digital Age

Unit 4: Programming Scratch

Computer Education Class 6 — English (Sindh Textbook Board)

Source: Computer Education Class 6, Sindh Textbook Board, Jamshoro.

About this source

Textbook text is reproduced for free educational study. All solutions, explanations, practice questions, diagrams and teacher's guides are original work by 100MCQs. 100MCQs is an independent site and is not affiliated with or endorsed by the Sindh Textbook Board. Read our Disclaimer.

Unit 4: Programming Scratch (printed pp 112–146)

Student Learning Outcomes

After the completion of this unit students will be able to learn about:

  • What is Computer Program
  • Program and Programming
  • Programming Languages
  • Importance of Programming language
  • Basic Programming concept
  • Differentiate between Algorithm and Program
  • Getting Starting with Scratch programming
  • Setup Scratch Software
  • The Scratch Editor
  • Programming Sprite
  • Fundamentals Of Scratch Constructs
  • Design your first Scratch Program
  • Running a program
  • Debugging a program

In this chapter, we will learn about the fundamentals of computer programming. We will analyze and apply basic constructs (for example sequence, selection, repetition, variables, inputs/events) by creating short programs using a visual programming tool.

4.1 Program Concept (printed pp 112–113)

4.1.1 Program

A computer program is like a set of instructions that tells a computer what to do. It is a series of steps or commands written in a language that the computer can understand. These instructions guide the computer to perform tasks efficiently.

4.1.2 Programming

Computer programming is the process of creating and writing a computer program. Programming is like giving instructions to a computer so it can do things for you. It is a bit like writing a recipe for a cake: you tell the computer what steps to follow, and it does them to achieve the required outcome.

4.1.3 Programming Language

Programs are written in programming languages, which provide the facility to write a program in a text-based editor or in visual mode. Programming languages are classified into different types. The textbook's Figure 4.3 classifies computer languages like this:

Type of languageHow instructions are writtenExamples from the book
Low Level Language (Machine Language)Uses 1s and 0s to create instructionsBinary Language
Middle Level Language (Assembly Language)Uses mnemonics to create instructionsAssembly Language
High Level LanguageSimilar to human languageCOBOL, FORTRAN, BASIC, C, C++, JAVA
Textbook note: In Figure 4.3 the book calls Assembly Language a "Middle Level Language". This label is not standard: in most books, Assembly Language is grouped with the low-level languages because it is very close to the machine's own code. Keep the book's diagram for your exam, but remember the usual grouping. The figure also prints the word "langugae", which is a spelling mistake for "language".

Do You Know? ENIAC was the first electronic computer that could run programs, but the Manchester Baby, built in 1948, is regarded as the first programmable computer like we have today.

4.2 Importance and Uses of Programming Language (printed p 114)

In today's world, programming languages are important because they help to create useful things on computers like websites, games, phone apps, and more. Businesses and industries worldwide are changing and automating their operations. Many businesses need web designers, AI (Artificial Intelligence) engineers, and mobile app developers for tasks like marketing, supply chain management, and customer care service. Computer programmers can work from anywhere for any business. Without programming languages, many of the things we use daily would not exist.

4.3 Difference between Algorithm and Program (printed pp 114–115)

An algorithm and a program are closely related, but they are not the same thing. The textbook compares them like this:

AlgorithmProgram
It is the conceptual idea of how to solve a problem.It is a set of instructions written in a specific programming language.
It is like a recipe or step by step solution of a problem.It is the implementation of an algorithm.
High level plan or strategy for solving a problem.It uses syntax and features of programming language.
Described in simple human language or with diagram.It is actual code that translates algorithm into instructions a computer can understand and execute.

4.3.1 Converting an Algorithm into a Program

An algorithm is created in the view of the problem under consideration. Therefore, we simply code the steps of the algorithm in a programming language like Scratch. The book shows this with the problem: find the square of the given number.

Steps of AlgorithmWhat happens
Input ATake the number A as input.
A = 5In the book's worked example, A is given the value 5.
Multiply A with A5 × 5
Result 25The answer is 25.

In Scratch, the same steps become code blocks: start when the green flag is clicked, ask for a number and store the answer in A, set A to A × A, then say A.

when green flag clickedask Enter an integer number and waitset A to answerset A to A * Asay A
Square of a number in Scratch
Textbook note: Read the example carefully: the printed algorithm fixes A = 5, so its result is 25. The Scratch version, however, asks the user to type any integer, so it can find the square of any whole number you enter — 5 is only one example input.

You can try running this program in the Scratch editor by dragging these code blocks and clicking on the green flag to see how it works.

📚 Book Vocabulary

EnglishMeaning
program ⭐A set of instructions that tells a computer what to do.
programming ⭐The process of creating and writing a computer program.
programming language ⭐A language used to write programs, in a text-based editor or in visual mode.
algorithm ⭐A step-by-step plan or strategy for solving a problem, written in simple human language or shown with a diagram.

🌱 Extra Help Words

EnglishMeaning
mnemonicA short word or code that stands for a machine instruction in Assembly Language.
syntaxThe set of rules that says how the instructions of a programming language must be written.
inputThe data given to a program so that it can work on it.

4.4 Introduction to Scratch Programming (printed pp 115–117)

Scratch is a block-based visual programming language and online community that provides an interface to create interactive stories, animations, and games. Instead of typing, users can use colorful blocks like puzzle pieces to build their creations. Scratch is free for anyone to use and share. When students create programs, they learn important mathematical and computer concepts, which help them think creatively, solve problems, and develop logical reasoning. Scratch allows students to share their creations online, enabling them to showcase their work and team up with others from around the world.

4.4.1 Downloading and Installing the Scratch Software

The textbook gives these steps for the edition it was written for:

  • Step 1: Open Google Chrome or any other browser that you have in your PC and type the following URL: https://scratch.mit.edu/download
  • Step 2: Select the Direct Download option. (The download page offers the free Scratch app for Windows 10 or later, macOS, ChromeOS and Android; you can also get the app from the Microsoft Store.)
  • Step 3: After downloading the software, run the downloaded file (for example the .exe file on Windows) and proceed with the installation steps.
  • Step 4: After the successful installation process, start your Scratch software from its icon or from your computer's app list.

4.4.2 Using Scratch Online

You can also use Scratch online by accessing its editor through your web browser. Simply enter the following URL: https://scratch.mit.edu/projects/editor/ Once you have opened the URL, Scratch will work just like the offline/downloaded version. The book also says you can create an account on the Scratch website to save your projects online.

Textbook note: These pages describe the Scratch of the textbook's edition. Today's Scratch is version 3, and it should only be downloaded from the official Scratch website (scratch.mit.edu). Children must not create online accounts, choose usernames, or share personal information without a parent or teacher. On this website you never need a Scratch account: the offline app is enough for every activity in this unit.

📚 Book Vocabulary

EnglishMeaning
Scratch ⭐A free block-based visual programming language for creating interactive stories, animations and games.
block ⭐A colorful puzzle-shaped piece of code that snaps together with other blocks to build a program.

🌱 Extra Help Words

EnglishMeaning
downloadTo copy a file or program from the Internet onto your own computer.
installTo set up a downloaded program on a computer so that it is ready to use.

4.5 Working with Scratch (printed pp 118–121)

To start working with Scratch, open the Scratch software on your computer after installation. Once the software is opened you can see a Scratch editor screen.

4.5.1 Scratch Editor

The Scratch editor provides a platform where you can drag and drop and snap code blocks to create games and animations. On the Scratch editor platform, we can find many options. The labelled parts of the editor (Figure 4.9) are:

Menu BarCode TabCostume TabSound TabBlocksBlock PaletteScripting AreaSprite Info AreaNew SpriteNew BackgroundStage AreaStage SizeExtension Library
Parts of the Scratch Editor (Figure 4.9)
  • The Code Tab is where you find and build code blocks.
  • The Costume Tab is where you change how a sprite looks.
  • The Sound Tab is where you work with sounds.
  • The Stage Area is where your program runs and your sprites perform.
  • The Scripting Area (also called the Script area) is the working space where you drag and drop code blocks to be executed.
  • The Block Palette holds the blocks; a single piece of joined code is called a Script.

4.5.1.1 Costume Tab

The Costume Tab enables users to alter the appearance of a sprite to generate many effects, including animation. You can also choose a different costume by clicking the bottom-left button labeled "Choose a Costume".

4.5.1.2 Sound Tab

This tab is used to record, import, or edit sounds. You can choose the sound from the Scratch library, record your own sound, select a surprise sound or import a sound file from your computer. Sounds can be edited, for example made faster, slower, louder or softer.

Sprites, costumes, backdrops and sounds all share a common menu with four options:

Menu optionWhat it does
UploadYou can take a picture or file from your computer.
SurpriseAny random image will automatically be selected.
PaintYou can paint or draw your own creation.
Choose from LibraryYou can select any image from the available library.

4.5.1.3 Code Tab

The Code Tab contains the Block Palette, which has the blocks used to control and program sprites. There are 9 block palettes available on the Code Tab:

NumberPaletteColour and job (as printed in the book)
1MotionBlue blocks that make your sprite move in different ways.
2LooksPurple blocks that change the color, size and costumes of your sprite.
3SoundOrchid color blocks that add sound from the library, record sound, or upload it from your computer.
4EventsYellow "starting blocks". An event triggers specific code at a particular time or action, such as clicking the green flag. These blocks must be placed at the beginning of each new code segment.
5ControlOrange blocks used to control the scripts; they provide options to wait, use loops and use conditional statements.
6SensingLight blue blocks that help your program detect things, such as where the mouse pointer is, how far apart sprites are, and whether one sprite is touching another.
7OperatorsGreen blocks used to compare variables and values, do calculations with numbers, and work with strings (text).
8VariablesOrange blocks used to save the values that are used in the program.
9My BlocksPink blocks that allow you to create new blocks for a sprite: you give the name and then define what the new block does using other Scratch blocks.
Textbook note: The Code Tab section of the book says that programming a sprite "always begins with a control block (orange or yellow category)". This mixes up two different palettes. The yellow starting blocks are Events blocks (hat blocks such as "when green flag clicked"). Control is the orange palette of C-shaped blocks such as repeat, forever and if. A script begins with an Events block; Control blocks are placed under it.

4.5.2 Elements of Scratch

Scratch has four main parts: the Stage, Sprites, Scripts, and Programming Palette. We can think of them as the different roles and props in a play.

ElementMeaning
SpriteThey are the basic objects in Scratch, the actors or main characters of the project. Sprites are programmed to do something in Scratch. The default sprite in Scratch is an orange cat.
StageIt is similar to the stage in a play. It is the main area where the action of your program takes place.
ScriptIt tells the actors what to say or do. Each sprite is programmed with a script.
Programming PaletteThe elements used to program the sprite to do or say something. Sprites must be programmed to carry out every function you want them to perform.

📚 Book Vocabulary

EnglishMeaning
sprite ⭐The basic object in Scratch; an actor or main character of the project that is programmed to do something.
stage ⭐The main area, like the stage in a play, where the action of your program takes place.
script ⭐The joined blocks that tell a sprite what to say or do.
programming palette ⭐The column of blocks used to program a sprite.

🌱 Extra Help Words

EnglishMeaning
editorThe screen or window in which you build and change something, such as the Scratch editor.
costumeOne of the looks or appearances of a sprite; changing costumes can create animation.

4.6 Programming a Sprite (printed pp 122–124)

Programming a sprite means choosing a character or object, changing its appearance, position, background and foreground colors, and telling it what to do by giving it instructions in the form of block code, which looks like a puzzle that you simply drag and drop from the Block Palette.

4.6.1 Choose Sprite

The default sprite is an orange cat. You can choose or draw a different sprite from the Choose a Sprite option located at the bottom of the Sprite Info Area. You can select any sprite from the library, draw your own, or upload one from your computer. The Sprite Info Area also shows the sprite's name, its x and y position, whether it is shown or hidden, its size and its direction.

4.6.2 Choose a Backdrop

A backdrop is like a background of your stage. The Choose a Backdrop option is available at the bottom right corner next to the Choose Sprite button. You can choose a backdrop from the library, paint your own using the Scratch paint editor, use the surprise option to select a random backdrop from the library, or use the upload option to upload an image from your computer. (For uploads, always use a picture your teacher gives you or one you drew yourself — never a personal photo.)

4.6.3 Stage Area and Coordinates

The Stage Area is the main area where all the fun activities happen. It is where characters move, perform actions, and follow the instructions you give them. The stage acts as the background of your project. Coordinates in Scratch are based on a grid.

Coordinates are like addresses that tell you exactly where something is located. They are used to pinpoint a specific position on a map, grid, or other surface. The X coordinate tells you how far to go horizontally (sideways), and the Y coordinate tells you how far to go vertically (up or down).

Position on the stageCoordinates
CentreX: 0, Y: 0
Top middleX: 0, Y: 180
Bottom middleX: 0, Y: -180
Middle of the left edgeX: -240, Y: 0
Middle of the right edgeX: 240, Y: 0

So the stage runs from X = -240 (left) to X = 240 (right), and from Y = -180 (bottom) to Y = 180 (top).

Stage Adjustment

  • Small stage — decreases the stage window and increases the script area.
  • Regular size — increases the stage window and decreases the script area.
  • Full screen mode — switches the stage window to full screen.

📚 Book Vocabulary

EnglishMeaning
backdrop ⭐The background picture of the stage.
coordinate ⭐A number in an address (X or Y) that pinpoints an exact position on the stage grid.

🌱 Extra Help Words

EnglishMeaning
directionThe way a sprite is facing, measured in degrees; 90 means facing right.
sizeHow big a sprite appears on the stage; the normal size is 100.

4.7 Fundamentals of Scratch Constructs (printed pp 124–128)

Programming constructs are simple building blocks that help you control how your program works. The book teaches five main types of programming constructs in Scratch: sequence, events, loops, selection/condition, and variables.

1. Sequence

In programming, a sequence means a list of steps that tell the computer what to do, one after the other. In Scratch, if you have two characters, each can have its own list of steps to follow and do something.

StartStatement 1Statement 2Statement 3End
Sequence: steps run one after another

2. Events

An event is something the program knows about and reacts to, like pressing a key, clicking a mouse, or tapping a phone screen. In Scratch, events are shown in yellow color. The six Events hat blocks pictured in the book are:

when green flag clickedwhen space key pressedwhen I receive message1when this sprite clickedwhen backdrop switches to backdrop1when loudness is greater than 10
The six Events (hat) blocks

3. Loops

Loops are like a magic trick in coding that makes an action repeat again and again without needing to write the code multiple times. In the Control section of the block code, you will find three types of loops, each with its own special job.

  • repeat (number n) block: a control block that repeats a set of commands "n" times. The number "n" can be any positive whole number.
  • repeat until block: an iteration block that runs a set of commands again and again, and stops when the condition placed in "until" becomes true.
  • forever block: an iteration block that runs a set of commands continuously without stopping. There is no stopping condition in the forever block. It is used when you want something to keep happening forever.
Textbook note: The book prints that the repeat until block "runs a set of commands until a certain condition remains true". That wording is wrong. A repeat until loop keeps repeating while the condition is false, and it stops when the condition becomes true. For example, "repeat until key space pressed?" keeps looping until the moment the space key is pressed — then it stops.

The book's Examples of Loops table shows the three loops in action:

when space key pressedrepeat 10say Hello! for 2 secs
Loop example 1: repeat a number of times

When the space bar on the keyboard is pressed, the sprite will say "Hello!" every 2 seconds and repeat it 10 times.

when this sprite clickedrepeat until key space pressed?say Hassan is cool for 2 secs
Loop example 2: repeat until

When you click on the sprite, it will say "Hassan is cool" and repeat it every 2 seconds until the space bar on the keyboard is pressed.

when green flag clickedforeverturn right 15 degrees
Loop example 3: forever

When the green flag is clicked, the sprite will turn 15 degrees clockwise forever.

4. Selection / Condition

A condition is like a rule in a program that tells it what to do next. It is similar to a yes-or-no question. If the answer is "yes" (true), the program does one action. If the answer is "no" (false), it does something else. Conditional statements are like everyday choices. Computers use them to decide what to do next based on whether something is true or false. You will see them in the Control blocks of the Code tab. For example, the book's flowchart checks "Body Temperature >= 100 °F": if it is true, the result is "Fever"; if it is false, the result is "Normal".

If then Block

The if then block is a control block. It works on the condition's value and decides what to do depending on a condition. If the condition is true, it runs some code. If not, nothing happens. For example, as shown in the book's Fig 4.22, if the user presses the "a" key, then the sprite must glide for 1 second.

when green flag clickedif key a pressed? thenglide 1 secs to random position
If then example (Fig 4.22)

If then else Block

The if then else block is a control block. It is an extension of the if-then block. If the condition is true, then the set of lines specified in the "if" body gets executed. And if the condition is false, then the set of lines specified in the "else" part is executed. For example, if the user presses the "a" key, then the sprite must glide for 1 second, or else it must say "hello".

when green flag clickedif key a pressed? thenglide 1 secs to mouse-pointerelsesay hello
If then else example (Fig 4.23)

5. Variables

Variables are like containers that hold values. Imagine a box with a number inside it. A variable is a named computer memory location where we can store data. It can only hold one piece of information at a time. Variables store data of different types (like name, number/digits etc.). Once the variable is created, we can use it in different parts of a program. In the Variables palette you can make a variable, set its value, change its value, and show or hide it on the stage.

📚 Book Vocabulary

EnglishMeaning
construct ⭐A simple building block, such as sequence, selection or repetition, that helps control how a program works.
sequence ⭐A list of steps that the computer does one after the other, in order.
event ⭐Something the program knows about and reacts to, like a key press or a mouse click; shown by yellow hat blocks.
loop ⭐A construct that repeats a set of instructions again and again; also called repetition or iteration.
condition ⭐A yes-or-no (true or false) question that a program checks to decide what to do next.
variable ⭐A named memory location, like a container, that stores one piece of data at a time.

🌱 Extra Help Words

EnglishMeaning
hat blockA block with a rounded top that starts a script; it cannot have another block above it.
glideTo move smoothly from one place to another over a set number of seconds.

4.8 Create and Run First Program in Scratch (printed pp 129–135)

Now it is time to create the first simple program in Scratch by using different code blocks. In this program, our default sprite will interact by asking a question and showing a greeting message.

4.8.1 Creating First Program

  • Step 1: Select your default sprite, or you can change the sprite.
  • Step 2: Go to the Events block palette and drag the "when Green Flag Clicked" block into the scripting area.
  • Step 3: Go to the Sensing block palette and drag the "ask What's your name? and wait" block into the scripting area, below the first block. The two blocks fit into one another like puzzle or Lego pieces.
  • Step 4: Go to the Looks blocks palette (purple) and drag the "say Hello! for 2 seconds" block and snap it right below the previous block.
when green flag clickedask What's your name? and waitsay Hello! for 2 secs
The first program

4.8.2 Saving First Program

To save your program, go to the File menu and click on Save to Your Computer.

4.8.3 Running First Program

  • Step 1: Click on the green flag button present on the top side of the Stage Area.
  • Step 2: The sprite will ask for the name by prompting "What's your name?".
  • Step 3: Type your name in the purple highlighted text box and press Enter from your keyboard. (On this website, always type a made-up practice name, never your real full name.)
  • Step 4: The cat will say hello, and after two seconds the bubble disappears.

This is our first program. When the green flag is clicked, the cat (sprite) asks for the name and waits; after we input our name, the cat says hello for two seconds. This is how code works: these code blocks are executed one after another — a sequence.

4.8.4 Make First Program Smarter

Now the sprite will do something a little smarter. We use the Sensing code block palette, which is in light blue color.

  • Step 1: Open your first program from your computer. Go to the File menu and click "Load from your Computer".
  • Step 2: Your first saved Scratch program is now open in your editor.
  • Step 3: Drag the answer block and snap it into the "say Hello! for 2 seconds" block, where "Hello" is showing. The sprite will now say whatever answer you typed, instead of saying hello — it echoes back whatever we typed.
when green flag clickedask What's your name? and waitsay answer for 2 secs
Echo program: the sprite says the answer
  • Step 4: Run the program, type the name, and now the sprite will say the name.

Let's make the sprite do a proper greeting by saying "Hello" together with the name, instead of saying the name alone. For this we use the Operators code block palette (green).

  • Step 5: Go to the Operators block palette and drag the join block into the scripting area.
  • Step 6: Take out the answer code block from the previous block and snap it into the second hole of the join block.
  • Step 7: In the first hole of the join block, type a greeting word like "Hello," and snap this join block into the "say" block.
when green flag clickedask What's your name? and waitsay join Hello, and answer for 2 secs
Smarter program: a proper greeting

Congratulations! At this point your first code is smarter than the previous one. Now run your program and see the results: the sprite asks your name, and then greets you properly, for example "Hello, Ali". (The join block puts two pieces of text together exactly as they are — it adds no space by itself, so type the comma and space inside the greeting word, as the book's figure does with "Hello,".)

📚 Book Vocabulary

EnglishMeaning
answer ⭐The Sensing block that holds whatever the user typed in reply to an ask block.
join ⭐The Operators block that joins two pieces of text together into one.

🌱 Extra Help Words

EnglishMeaning
echoTo repeat back exactly what was typed or said.
loadTo open a saved file again so that you can work on it.

4.9 Debug a Program (printed pp 135–136)

Bugs are errors or mistakes in writing a program. Debugging a program means finding and fixing mistakes or problems in it, so that the program will run smoothly. It is like solving puzzles to make sure the program works correctly.

The book gives a debugging list in words. Following is the debugging process through which we can fix the bugs:

  • Run the program.
  • Understand the problem that causes the program to run abnormally.
  • Examine the code to identify where things might be going wrong.
  • Fix the issue in the code.
  • Run the program again to make sure the problem is fixed.

The book's Figure 4.39 also shows debugging as a six-step cycle. Notice that this cycle is not identical to the list above — it starts earlier, with planning and writing the code:

  • 1. Plan your Program
  • 2. Write the Code
  • 3. Test the Code
  • 4. Find Errors
  • 5. Identify the cause of the error
  • 6. Plan to fix errors

After step 6, the cycle arrow goes back to step 1, because debugging is repeated until the program works correctly.

Textbook note: Later in this book, the "Applying Debugging Process" figure (printed p 145) prints its step labels irregularly: the numbering runs 1, 2, 3, 5, 6, 7, 8, two labels are repeated, and no step 4 is printed. Use the correct six-step cycle from Figure 4.39 above as the version to learn; the irregular printed labels are a printing mistake, not a different process.

4.10 Creating and Running Another Program (printed pp 136–141)

We are creating another program in which a sprite will move from left to right and right to left.

  • Open Scratch software.
  • Select your favorite sprite by clicking on the "Choose a Sprite" button. A sprite selection window will appear. Select your favorite sprite (the book chooses the Fish), and it will be added to the sprite area. Once your sprite is added, a small cross icon (x) will appear next to the default sprite, allowing you to delete it.
  • If you want to change the color of your sprite, you can go to the Costume tab and change the color, use any available costume of your sprite, or design your own. The Fish has costumes such as fish-a, fish-b, fish-c and fish-d.
  • Select any suitable backdrop (if you want) from the Choose a Backdrop option; the book uses an underwater backdrop.

All the basic steps are done. Now it is time to program some code. Click on the sprite to write its script so the sprite should move:

  • Go to the Events block palette and drag the "when Green Flag clicked" code block into the scripting area.
  • Go to the Motion block palette and drag the "move 10 steps" code block to make your sprite move 10 steps.

By writing the above code, the sprite will only move 10 steps and then stop. To make the sprite move continuously, use a forever loop: drag the forever loop block from the Control block palette and snap the "move 10 steps" block into the forever loop block.

Because of the forever loop block, the sprite will continuously move and may move outside the stage area. So you have to use the "if on edge, bounce" block from the Motion block palette to bounce the sprite back into the stage area. When the sprite bounces back, its direction reverses; with the default rotation it can appear flipped or upside down. To set the sprite's orientation after it bounces back from the edge, drag the "set rotation style left-right" block from the Motion block palette. You will see the sprite move from right to left and back again.

You can control the speed of the sprite by adding the "wait" block from the Control palette and setting the desired time in seconds.

when green flag clickedforevermove 10 stepswait 1 secsif on edge, bounceset rotation style left-right
Fish program: swimming with the forever loop

Making the Fish Program Interactive

We can make this program more interactive by adding additional blocks based on the situation. For example, when the sprite bounces back from the edge, its costume changes. Additionally, before bouncing off the edge, the sprite can say "Bye", and after bouncing back, it can say "Hello". We use a Sensing block and a Control block to detect the edge of the stage and apply a condition.

when green flag clickedforevermove 10 stepsif touching edge? thensay Bye for 1 secswait 0.01 secsif on edge, bouncenext costumeset rotation style left-rightsay Hello! for 1.5 secs
Fish program: final form (Figure 4.46)
Textbook note: The text on printed p 141 says to "apply condition if-else block", but the book's own Figure 4.46 uses an if … then block (with a Sensing "touching edge?" condition), not an if-else block. Learn the figure's version: there is no "else" part in this program — if the fish is not touching the edge, nothing extra happens.

Update your code as shown and click on the green flag button to run the program. Congratulations! You have created your first animated Scratch program.

📚 Book Vocabulary

EnglishMeaning
bug ⭐An error or mistake in writing a program.
debugging ⭐Finding and fixing the mistakes or problems in a program so that it runs smoothly.
rotation style ⭐The setting that decides how a sprite turns; left-right makes it flip sideways instead of turning upside down.

🌱 Extra Help Words

EnglishMeaning
bounceTo spring back after hitting something, such as the edge of the stage.
interactiveAllowing the user to take part, for example by pressing keys or clicking, so the program responds.

Summary (printed p 142)

  • Scratch programming is an engaging way for kids and beginners to create their own stories, games, and animations.
  • The main purpose of Scratch is to help young learners learn basic coding concepts without getting into the difficulties of textual coding. Benefits of coding with Scratch: it enhances analytical and problem-solving skills; makes it easier to learn coding; makes learning fun and interesting; and explains programming logic visually.
  • An Event is like a signal that makes something happen, like pressing a button to start the game.
  • A Sequence is a list of actions performed one by one, in a specific order. Computers follow these actions exactly as they are written.
  • A Loop repeats a set of instructions until a specific stopping condition is met. It is a way to do something over and over again without having to manually do it each time. (Remember: the forever loop is the special loop that has no stopping condition.)
  • A Variable is like a container where we keep some information/data, which we call its value.
  • An Error results in incorrect execution or behavior of a program.
  • Debugging is the process of finding errors or bugs in a program and fixing them so that the program can execute smoothly.
  • A conditional statement asks a question to figure out which path to take next.

Important Terms to Remember (printed pp 142–143)

📚 Book Vocabulary

EnglishMeaning
Online Community ⭐An online community is like a big group of people who talk and share stuff on the Internet. It is like a virtual version of a neighborhood or club where people with similar interests or goals come together to chat and help each other out.
MIDI ⭐Musical Instrument Digital Interface.
URL ⭐Uniform Resource Locator — the address of a page on the World Wide Web.
Program ⭐Set of instructions.
Repetition/Iteration ⭐Act of doing one thing again and again.
Add-on ⭐An add-on is a small program or tool that adds extra features to existing software, enhancing its functionality.
Dragging ⭐Pulling something along, for example pulling a block across the screen with the mouse.
Constructs ⭐Building blocks formed by combining or arranging parts or elements, used to control how a program works.
Extension Library ⭐An extension is an add-on that adds extra features and functions to a program or software. It improves the original capabilities, allowing users to do more with the software.

🌱 Extra Help Words

EnglishMeaning
animationMaking a still character seem to move, for example by changing its costumes quickly.
paletteA set of choices shown together, such as the block palette of code blocks.
script areaThe working space where you drag and drop code blocks to be executed; also called the scripting area.
hat blockA rounded-top Events block that starts a script.
foreverA loop with no stopping condition; it runs continuously.
bounceTo spring back after hitting the edge of the stage.
valueThe information or data stored in a variable.
greetingWords of welcome, such as "Hello", said when meeting someone.

Exercise 1 — Encircle the Correct Answer (printed p 143)

Exercise 1(i)

VPL is the: (a) Graphical Programming Language (b) Set of instruction (c) Visual Programming Language (d) A Background

Exercise 1(ii)

Scripts in programming are the: (a) List of sprites (b) List of background (c) A set of instructions blocks connected with one another used for programming (d) None of the above

Exercise 1(iii)

The types of code blocks in Scratch are the: (a) 3 (b) 5 (c) 7 (d) 9

Exercise 1(iv)

The blocks which we use to start the program: (a) Control block (b) Event Block (c) Motion Block (d) Looks Blocks

Exercise 1(v)

The actual working space where you can drag and drop code blocks to be executed is: (a) Block palette (b) Backdrop (c) Script Area (d) Stage

Exercise 2 — Fill in the Blanks (printed p 144)

Exercise 2 — Word Bank

The printed word bank for all five blanks is: Repeat · Wait · if-else · Use the move block · Use the if block. Each blank below uses one of these.

Exercise 2(i)

The block used to create a loop in Scratch is __________.

Exercise 2(ii)

The construct used for creating a wait time in Scratch is __________.

Exercise 2(iii)

We check if a certain condition is true in Scratch using __________.

Exercise 2(iv)

The construct used for making decisions in Scratch is __________.

Exercise 2(v)

To move a sprite in Scratch, we __________.

Exercise 3 — Descriptive Answers (printed p 144)

Exercise 3(i)

What is programming?

Exercise 3(ii)

Differentiate between Algorithm and Program.

Exercise 3(iii)

Explain Sprite, Script and Stage.

Exercise 3(iv)

Define 9 available options in block palettes.

Exercise 3(v)

What is control block used for?

Exercise 3(vi)

In what situations are conditional statements used?

Exercise 3(vii)

How do we change the backdrop in Scratch?

Exercise 4 — Activities (printed pp 144–145)

Exercise 4(i) — Install Scratch

Get the Scratch software on your lab computers by following the instructions in the software download section and install it.

Exercise 4(ii) — The Turn-Only Code

The book shows this code and asks: the sprite should move 10 steps and move in its direction 10 times — what code block should be added to the code?

when space key pressedturn right 90 degreesturn right 90 degreesturn right 90 degreesturn right 90 degrees
The printed code in Exercise 4(ii)

Exercise 4(iii) — Left and Right Cursor-Key Game

Design a game which uses the cursor keys to move the sprite on the stage from left to right and right to left.

Exercise 4(iv) — Teacher-Guided Debugging Demonstration

The teacher should guide students how to fix the bug in the code by applying the debugging process.

Applying the Debugging Process (printed pp 145–146)

Worked Demonstration — Slowing Down the Turns

The book's worked example says: open your Scratch editor, drag the code blocks as shown (the same turn-only stack as Exercise 4(ii)), run your code and see the results. The book prints "Nothing will happen", then explains that the block codes run one after another in microseconds, and directs you to drag wait blocks from the Control palette into the stack. What is the corrected program, and what does it really do?

In-lesson Activities

Activity (printed p 118) — Exploring the Scratch Editor

Textbook activity: "Teacher guide the students to open the Scratch software and explains all the options available in Scratch editor."

Activity (printed p 121) — Exploring Every Block Palette

Textbook activity: "Teacher guide the students to open the Scratch software and explain each block one by one, providing examples for better understanding."

Activity (printed p 122) — Replace the Default Sprite

Textbook activity: "In the Scratch editor, replace the default sprite with a new one that you like."

Activity (printed p 123) — Upload a New Background

Textbook activity: "Upload a new background from your computer in the Scratch stage area."

Activity (printed p 127) — How Many Times Does the Loop Repeat?

Textbook activity: "How many times does these loops repeat the block inside?" for the three printed scripts (a), (b) and (c).

set counter to 20repeat counterturn right 15 degrees
Activity script (a)
forevernext costume
Activity script (b)
set counter to 10repeat until counter = 0say counterwait 1 secschange counter by -1say Blastoff!
Activity script (c)

Practice is organized in complete sets of 10 questions. Practice Set 1 can be attempted by everyone. Sets 2–5 are Pro sets. Question order and option order are shuffled on every new attempt; after you check an answer it locks, and the correct answer and explanation appear beneath it.

Practice Set 1

Which of these activities is an example of programming?

In Scratch, the exact centre of the stage has which coordinates?

Which block starts a script when you click on the sprite itself?

A variable in Scratch is best described as:

You test your code and find an error. According to the debugging cycle, what is the NEXT step?

Ayesha writes in her notebook, in plain English: "Step 1: Take two numbers. Step 2: Add them. Step 3: Write the answer." She has not used any programming language. What has she written?

You want to make your sprite glide smoothly to a new position. The "glide" block is found in which palette?

A script has: when green flag clicked, then repeat (6) with move (5) steps inside it. How far does the sprite move in total?

In the smarter greeting program, the sprite asks "What's your name?" and the user types "Sara". After the ask block runs, what does the (answer) block hold?

You have finished your first Scratch program on the school computer and want to keep a copy of the file. What should you do?

100MCQs ProComing soon

Practice Set 2 with Pro

Rs. 250/month

10 more original practice questions on this unit’s topics, with full explanations — available with Pro when accounts open.

Pro accounts are not open yet. Lessons, solved exercises and teacher’s guides on 100MCQs are always free.

  • Everything in Free
  • Full access to approved practice MCQs
  • Exclusive practice questions
  • Complete eligible practice sets — more opportunities to practise

100MCQs ProComing soon

Practice Set 3 with Pro

Rs. 250/month

10 more original practice questions on this unit’s topics, with full explanations — available with Pro when accounts open.

Pro accounts are not open yet. Lessons, solved exercises and teacher’s guides on 100MCQs are always free.

100MCQs ProComing soon

Practice Set 4 with Pro

Rs. 250/month

10 more original practice questions on this unit’s topics, with full explanations — available with Pro when accounts open.

Pro accounts are not open yet. Lessons, solved exercises and teacher’s guides on 100MCQs are always free.

100MCQs ProComing soon

Practice Set 5 with Pro

Rs. 250/month

10 more original practice questions on this unit’s topics, with full explanations — available with Pro when accounts open.

Pro accounts are not open yet. Lessons, solved exercises and teacher’s guides on 100MCQs are always free.

Teacher's Guide — Unit 4: Programming Scratch

The Book's Note for Teachers (printed p 146)

The textbook prints this Note for Teachers at the end of the unit:

  • Teachers should motivate students to explore various resources and continue learning independently.
  • Divide the class into groups of 2 or 3 students.
  • Open all the code block options from each block palette and discuss with groups about the working of each and every block by placing the blocks in the Scratch script area.
  • Make a sample program in which two sprites talk with each other. Try making a few jokes.

The Book's Teacher Tip on the Online Community (printed p 116)

The book's tip asks the teacher to explain the Scratch online community to the students and how to join the Scratch community. Please teach the idea of an online community, but do NOT have children create Scratch accounts, choose usernames, or share personal information in class. Any account for a child must be a family decision made at home with a parent. Every activity in this unit works fully in the offline Scratch app with no account at all.

The Book's Useful Links (printed p 146) — textbook's list

  • https://scratch.mit.edu
  • https://scratch.mit.edu/download
  • https://scratch.mit.edu/projects/editor/
  • https://scratch.mit.edu/ideas
  • https://scratch.mit.edu/explore/projects/tutorials/

Caution: these links and the Scratch version they open change over time. Always reach Scratch through the official scratch.mit.edu address, check the page before a lesson, and never download "Scratch" from advertisements or other websites. Present-day Scratch is version 3.

Teaching Guidance, Construct by Construct

  • Sequence (§4.7, §4.8): stress that blocks run one after another, top to bottom, exactly as joined. The first program is the model: ask, then say.
  • Events (§4.7): every script needs a yellow hat block to start. If a script "does nothing at all", first check whether it has an Events block and whether that event actually happened (flag clicked, key pressed, sprite clicked).
  • Loops (§4.7): teach the three loops by their stopping rule — repeat n stops after n passes; repeat until stops when its condition becomes true; forever never stops. Use the p 127 counting activity to test understanding before moving on.
  • Selection (§4.7): if-then does nothing when the condition is false — that is correct behavior, not an error. if-then-else always does one of its two parts.
  • Variables (§4.7, §4.3.1): introduce a variable as a labelled box holding one value. The counter scripts on p 127 are the best early practice: set, use, and change the value inside a loop.
  • Sensing and Operators (§4.8.4): answer holds what the user typed; join glues two texts with no space added. Have students predict the greeting before running the improved program.
  • Debugging (§4.9, pp 145–146): teach the Figure 4.39 six-step cycle as the class routine: Plan, Write, Test, Find Errors, Identify the cause, Plan to fix — then test again. Use the turn-only program to show the difference between "the program did not run" and "the program ran too fast to see".
  • Animation (§4.10): build the fish program in stages and run it after every stage, so students see exactly what each added block changes: forever makes it continuous; if on edge, bounce keeps it on the stage; set rotation style left-right keeps it upright; wait controls the speed; the touching-edge if adds the costume change and the Bye/Hello speech.

Common Misconceptions to Correct

  • "Nothing happened" versus "it executed too fast": in Exercise 4(ii) the four turn blocks DO execute — 4 × 90 degrees = 360 degrees in microseconds — so the sprite finishes facing the same way and only APPEARS not to move.
  • Stationary versus not executing: a sprite that turns in place is executing; it is stationary because no move block ever changes its position. Travel needs a move block.
  • Turning versus moving: turn blocks change direction only. Point in direction plus move makes a sprite travel.
  • repeat until: beginners often think the loop runs "while the condition is true". It is the opposite: it runs while the condition is false and stops the moment the condition becomes true.
  • Events versus Control: yellow hat blocks are Events and start scripts; orange C-blocks are Control and shape the flow under a hat block.
  • if-then with a false condition is not broken: doing nothing is its designed result.
  • join adds no space: "Hello," plus a name reads correctly only because the comma/space was typed in the first hole.
  • Exercise 2 blanks (iii) and (iv) are close cousins: checking a condition = use the if block; deciding between two paths = if-else. Warn the class before they answer.

Textbook Correction Ledger (every correction carried in this unit)

  • Printed p 112 (SLOs): the book spells "Programing Languages" with one "m". The lesson prints "Programming". Spelling only; no note needed on the student page.
  • Printed p 113 (Figure 4.3): Assembly Language is labelled a "Middle Level Language", which is non-standard — it is usually grouped with low-level languages. The figure also misprints "langugae". Corrected and flagged by a Textbook note in §4.1.
  • Printed p 115 (§4.3.1): the printed algorithm fixes A = 5 (result 25), while the Scratch version asks for any integer. Flagged by a Textbook note in §4.3; teach 5 as one example input.
  • Printed p 119 (§4.5.1.3): the book says programming "always begins with a control block (orange or yellow category)". The yellow hat blocks are Events, not Control; Control is the orange palette. Flagged by a Textbook note in §4.5.
  • Printed p 125 (§4.7): the repeat until definition ("until a certain condition remains true") is wrong. The loop stops when the condition BECOMES true. The lesson text is corrected and flagged by a Textbook note.
  • Printed p 128 (§4.7): "extension of the if-then value" is a misprint for "extension of the if-then block". Corrected silently in the lesson wording.
  • Printed p 133 (§4.8.4 step 4): the cross-reference "fig 4.8.3 3" is garbled; it means the typing step of §4.8.3. The lesson presents the step without the garbled reference.
  • Printed pp 133–135 (§4.8.4): the step text says to type "hello" in the join block, while Figure 4.37 shows "Hello," typed; the join block adds no space by itself. The lesson follows the figure and explains the comma/space.
  • Printed p 141 (§4.10): the prose says "apply condition if-else block", but Figure 4.46 uses an if … then block with a Sensing touching-edge condition. The lesson teaches the figure's version and flags the mismatch with a Textbook note.
  • Printed p 142 (Summary): the summary's loop definition ("until a specific stopping condition is met") does not fit the forever loop, which has no stopping condition. The lesson keeps the printed summary and adds the reminder in brackets.
  • Printed p 144 (Exercise 4(ii)): the question wording is garbled, and the pictured code contains only turn blocks. The solved answer keeps the printed code, explains the 4 × 90 = 360 degrees effect precisely, and identifies the missing move block (and a repeat loop for 10 repetitions).
  • Printed p 145 (Applying Debugging Process): the figure's step labels are irregular — numbering runs 1, 2, 3, 5, 6, 7, 8, "Identify the cause of error" and "Plan to fix errors" are each printed twice, and no step 4 exists. Do NOT invent a step 4 for that figure. The correct six-step cycle from Figure 4.39 (printed p 136) is the teaching version; the irregularity is flagged by a Textbook note in §4.9 and in the solved demonstration.
  • Printed p 145: the sentence pair "The block codes run at a same time one after another in micro seconds. Use Control block palette and drag wait code block." is printed twice in succession. It is presented once in the solved demonstration.
  • Printed p 145: "Nothing will happen" is imprecise. The turn blocks execute in microseconds and the sprite ends facing its start direction. The solved answers distinguish "executes but appears stationary" from "does not execute".
  • Printed pp 130–131 and p 146 (screenshots and figures): the book's screenshots show a typed personal name and the author's own computer folders. These are never reproduced on this website; all examples use a generic practice name such as "Ali", and no personal file paths are shown.

Child-Safety Rules for This Unit

  • No Scratch account, username or password is required by this website for any lesson, exercise or activity.
  • Installation is done or supervised by a teacher or parent, and only from the official Scratch website.
  • Students use made-up practice names in ask/answer programs — never their real full names.
  • Uploads (sprites, backdrops, sounds) use teacher-provided files or the student's own drawings only — never personal photos or recordings of other people.
  • The online community is taught as an idea to understand, not a place children from this site should join unsupervised.

Assessment Notes

Exercise 1(iii) and 3(iv) both rest on the book's own count of nine block palettes (printed pp 120–121); accept the nine names in any order for 3(iv). For Exercise 4(ii), the essential understanding is the missing move block; a repeat loop is required only for the "10 times" part of the question. Solved Exercises and the in-lesson activities on this page are the textbook's own items; they count zero toward the unit's original Practice MCQ bank, which is kept separately and privately.

Help us improve this page. Spotted a mistake, or something that is not clear? Email us at [email protected] — every report helps the next student.