ICSE_Tekie_G4_Coding_AY24_Final

Page 1

About the Book This coding book is supplementary to the main “Mel n Conji” content book. This book represents a 21st-century approach to learning coding concepts and developing computational thinking and problem-solving skills. To prepare students for the digital age, the curriculum is interwoven with well-thought-out concept graduation with real-life examples and practice problems.

Special Features • Illustrative approach: Concepts in coding and computer science are delivered through pictorial representations and learner-friendly approaches. • Learning through real-life examples: Age-appropriate examples that enable learners to relate to the concept and learn about the unknown from the known. • Extensive practice: Multiple practice scenarios to reinforce learnings. • Coding challenges: Includes projects through which learners can demonstrate their learning outcomes in coding and computer science.

About Uolo Uolo partners with K-12 schools to bring technology-based learning programs. We believe pedagogy and technology must come together to deliver scalable learning experiences that generate measurable outcomes. Uolo is trusted by over 10,000 schools across India, South East Asia, and the Middle East.

Singapore

|

Gurugram

CS_CB_Coding_ICSE_Grade4_Cover.indd All Pages

|

Bengaluru

|

hello@uolo.com �199

© 2024 Uolo EdTech Pvt. Ltd. All rights reserved.

NEP 2020 based

|

ICSE compliant

|

Technology powered

06/12/23 7:14 PM



ICSE Computer Science

Computer Science

Scratch 3.0 I

ICSE_CODE_ORG CODING BOOKLET_LO_ED_FM_G_3.indd 1

12/5/2023 10:41:54 AM


CB_Grade 3.indb 2

11/28/2023 3:03:17 PM


Contents 1

Introduction to Scratch 3.0

1

Block-based Coding Scratch 3.0

Creating a Project

Components of Scratch 2 Scratch Blocks

11

Motion Blocks Looks Blocks

Events Blocks Sound Blocks

Control Blocks 3 Making a Scratch Project

20

Naming a Project Deleting a Sprite Adding a Sprite

Positioning a Sprite Moving a Sprite Pen Extension

Drawing a Line

Saving a Scratch Project

Opening an Existing Scratch Project 4 Drawing Shapes

34

Drawing a Square Drawing a Circle

iii

CB_Grade 3.indb 3

11/28/2023 3:03:17 PM


5 Drawing a Pattern

44

Rotating a Sprite

Creating a Clone

Drawing a Pattern

Creating a Blank Sprite Drawing a Pattern

iv

CB_Grade 3.indb 4

11/28/2023 3:03:17 PM


1

Introduction to Scratch 3.0

Brushing teeth is a good way to keep them healthy.

We should brush our teeth twice a day, for 2 minutes each time. Can you tell me how you brush your teeth?

Right! We follow a set of steps to brush our teeth. Here are the steps to brush your teeth: 1

Wet your toothbrush.

3

Brush your teeth for 2 minutes.

2 4 5

Put toothpaste on your toothbrush. Spit out the toothpaste.

Rinse your mouth with water.

These steps are the instructions we follow to brush our teeth.

Just like how we use instructions to do something step-by-step, we need to tell computers how to do something step-by-step too. But computers do not understand our language, so we need to use a special language that they can understand. We call that language coding. Coding is a way of giving instructions to tell a computer what to do. We will be using block-based coding to make computers do things for us.

Block-based Coding

Block-based coding is the language in which we use colourful code blocks to tell computers what to do.

25 15 X ____

You must have drawn things on a computer earlier, right? But did you know that you can use block-based coding to make computers draw shapes and other things for you? 1

CB_Grade 3.indb 1

11/28/2023 3:03:18 PM


We are going to use a block-based coding platform called Scratch 3.0 to make fun drawings.

Scratch 3.0 Scratch 3.0 is a free and simple platform where we use colourful blocks to create our own games, stories, and drawings.

Creating a Project

Now, let us learn to create a blank project.

Follow the given steps to create a project. 1

Click Create.

Did You Know? Scratch Cat is the official mascot of Scratch because cats are curious and playful animals, just like the children who use Scratch.

2

CB_Grade 3.indb 2

11/28/2023 3:03:18 PM


2 The Scratch editor opens. By default, the name of a Scratch project is shown as Untitled.

Components of Scratch

The Scratch editor holds all the components needed to create and run a Scratch project. The components of the Scratch editor are: 1

11

3

7 9 4

2

10

5

6

8

Menu bar: The purple bar at the top of the Scratch editor is called the 1 Menu bar. The main parts of the menu bar are: a

b

File and Edit menus: These let us create, save, and open a project. Project name: This space shows the name of your project.

Folder: Clicking here takes you to your 'My Stuff' page where you can c see your saved projects.

Chapter 1 • Introduction to Scratch 3.0

CB_Grade 3.indb 3

3

11/28/2023 3:03:18 PM


2 3

Sprite: A sprite can be a character or an object in a Scratch project. Tabs: There are three tabs in the Scratch editor:

Code: This tab has various code blocks to make the sprite move and do a things.

Costumes: This tab opens the Costumes editor where we can change b how a sprite looks.

4

Sounds: This tab opens the Sound editor to add and make changes to c the sound effects of the sprite and to the backdrop.

Block panel: This panel has nine colour-coded categories of blocks:

We can even add more categories using the Add Extension

Block palette: This is the area where you 5 can see all the blocks for a selected block category.

button.

Script area: The script area is next to 6 the block palette. This is where you drag the blocks to make your sprite do something.

The blocks you put together in the script area are called a Script.

Script

Script Area

4

CB_Grade 3.indb 4

11/28/2023 3:03:19 PM


Stage: The stage is where you can see 7 backdrops and sprites in action.

Stage

Sprites pane: The Sprites pane is 8 below the stage. This pane shows all the details of sprites, like their name, location, and size.

Backdrop: It is the background of 9 the stage. You can add backdrops from the Scratch library or from your computer.

Backdrop

Backdrop pane: It is below the stage and next to the Sprites pane. 10 You can use it to add, upload, edit, or delete backdrops.

Go button and Stop button: The green flag is the Go 11 button. You click it to run the script. The red button is the Stop button. You click it to stop the running script.

Discuss

What is the difference between the stage and the backdrop?

Chapter 1 • Introduction to Scratch 3.0

CB_Grade 3.indb 5

5

11/28/2023 3:03:20 PM


Do It Yourself 1A Identify and label the components based on the clues given below.

a.

d.

e.

c. 1 2 3 4 5

b.

I'm a character in your project.

I show you the options to change the name, size, and location of a character. I hold colour-coded categories of blocks.

I'm the area where you drag and join the blocks. I hold all the blocks for a block category.

Chapter Checkup A

Fill in the Blanks. Hints

menu bar

1 In Scratch, we use colourful drawing.

untitled

backdrop

blocks

create

to create our own games, stories, and

2

To create a project in Scratch, you need to click

.

3

By default, the name of the Scratch project is

4

The purple bar at the top of the Scratch editor is called the

5

The background of the stage is called the

. .

.

6

CB_Grade 3.indb 6

11/28/2023 3:03:20 PM


B

Tick () the Correct Option. 1 What is the name of the area where you can see all the details of sprites?

a

Stage

b

Sprites pane

c

Block palette

d

Script area

2

What do you use to stop your running scripts?

a

b

c

d

3

The

tab is used to

.

a

open the Sound editor

b

listen to songs

c

close the Sound editor

d

open the Costumes editor

4

Which of the following option has the

icon?

a

File menu

b

Edit menu

c

Stage

d

Costumes tab

5

Which of the following options has this

icon?

a

Sprites pane

b

Stage

c

Backdrop pane

d

All of these

Chapter 1 • Introduction to Scratch 3.0

CB_Grade 3.indb 7

7

11/28/2023 3:03:20 PM


C

Who Am I? How Do I Look?

Who Am I? Sprite

Script Area Costumes Tab

Go button and Stop button Sounds Tab D

Write T for True and F for False. 1

The default project name in Scratch is Project1.

2 You can add and make changes to the sound effects of your sprite and backdrop in the Sound editor.

E

3

The Go button is used to stop the running project.

4

Events are one of the categories of blocks.

5

The colour of the Go button is green.

Answer the Following. 1

What is block-based coding?

2

What is the use of the Costumes tab?

8

CB_Grade 3.indb 8

11/28/2023 3:03:21 PM


3

What is the role of the Sounds tab?

4

What is a Script?

5

Describe the Go and Stop buttons.

F

Apply Your Learning. 1 Rahul wants to make a project related to a jungle in Scratch. Which background should he use?

a

b

c

d

2

What is a script in a project?

a

b

c

d

None of these

Chapter 1 • Introduction to Scratch 3.0

CB_Grade 3.indb 9

9

11/28/2023 3:03:22 PM


3

Sheena wants to change the appearance of the sprite. What should she use?

a

b

c

d

4

Ritu wants to change the name of the sprite. Where should she go?

a

b

c

d

5

Arun wants to change the backdrop of the Stage. Which option should he choose?

a

b

c

d

10

CB_Grade 3.indb 10

11/28/2023 3:03:22 PM


2

Scratch Blocks

In the previous chapter, we learnt about Scratch and the components of the Scratch editor. Now, let us explore the various types of blocks in Scratch. Scratch blocks are colourful pieces of code that you can drag to tell a computer what to do. Each block represents a unique instruction, like moving a sprite, playing a sound, or changing the background.

Scratch blocks are grouped into categories based on what they do. For example, the Motion blocks are used to control the movement of sprites, whereas the Looks blocks are used to change the appearance of sprites. Each block category is represented by a different colour. This makes it easy to find the blocks you need when you are creating a program. Let us learn more about the Scratch blocks.

Motion Blocks blocks are used to control the movement of the sprites. They are blue in colour. block makes this sprite move

For example, the 10 steps towards the right.

Let us learn about some of the Motion blocks. Blocks

Description

Moves the sprite forward the specified number of steps. Turns the sprite (clockwise) to the specified value. Turns the sprite (anti-clockwise) to the specified value. Moves the sprite to the specified x and y positions.

11

CB_Grade 3.indb 11

11/28/2023 3:03:22 PM


Looks Blocks blocks are used to control how a sprite looks. They are purple in colour. block will

For example, the

change the boy sprite’s costume from its current costume to Costume 2. Let us learn about some of the Looks blocks. Blocks

Costume 11 Costume

Costume 2 2 Costume

Description Makes the sprite say the specified text. Makes the sprite say the specified text for the specified number of seconds. Makes the sprite think of the specified text. Makes the sprite think of the specified text for the specified number of seconds. Shows the sprite. Hides the sprite. Changes the costume of the sprite to the specified one.

Discuss

Difference between the Motion and Looks blocks.

Events Blocks blocks are used to tell a computer when to run a script to make things happen.

They are yellow in colour.

An event is something that makes an action happen. 12

CB_Grade 3.indb 12

11/28/2023 3:03:23 PM


For example, the boy hitting the ball is an event and the ball moving and reaching the net is the action. Let us learn about some of the Events blocks. Blocks

Event

Action

Description Runs the script when the green flag (the Go button) is clicked. Runs the script when the sprite is clicked.

Sound Blocks blocks are used to control the sound. They are pink in colour. For example, making the ball sprite play a hitting sound when the boy hits it. Let us learn about some of the Sound blocks. Blocks

Description Plays a sound and pauses the script until it finishes. Plays a sound without pausing the script. Stops all playing sounds.

Control Blocks blocks are used to control the scripts. They are orange in colour. For example, making a sprite move towards the right 3 times.

Chapter 2 • Scratch Blocks

CB_Grade 3.indb 13

13

11/28/2023 3:03:23 PM


Let us learn about some of the Control blocks. Blocks

Description Pauses the script for the specified number of seconds. Repeats the instructions inside it a specified number of times. Repeats the instructions inside it forever, unless the Stop button is clicked. Runs the script for the clone (the copy of a sprite) when it is created. Creates a clone of the specified sprite. Deletes a clone.

Let us create our first script to move and turn a sprite by using some of these blocks. 1

Click the Events category.

2

Drag the

3

Click the Motion category.

block in the Script area.

14

CB_Grade 3.indb 14

11/28/2023 3:03:23 PM


Drag the 4

block to below the

block, as shown in the

image below.

5 Drag the

block to the Script area just below the

block, as shown in the image below.

button to run the script. The Sprite turns 15 degrees clockwise 6 Click the and then moves forward 10 steps each time you click the button.

We can also change the values in the

and

blocks to

turn by specified degrees and move a specified number of steps at once.

Did You Know? Scratch is available in more than 40 languages, so kids from all over the world can code in their language!

Chapter 2 • Scratch Blocks

CB_Grade 3.indb 15

15

11/28/2023 3:03:24 PM


Do It Yourself 2A 1 Match the columns. Column A

Column B Plays a sound and pauses the script until it finishes. Turns the sprite (clockwise) to the specified value. Repeats the instructions inside the block specified number of times. Runs the script when the green flag (the Go button) is clicked. Pauses the script for the specified time.

2 Tick the correct colour for the Sound blocks in Scratch.

Chapter Checkup A

Fill in the Blanks. Hints

green flag

go to x y

wait seconds

scratch blocks

control

are colourful pieces of code that you can drag together to tell a computer 1 what to do. blocks are orange in colour.

2 3 The 4

The

5 The

block moves the sprite to the specified x and y position. block runs the script when the

is clicked.

block pauses the script for the specified number of seconds.

16

CB_Grade 3.indb 16

11/28/2023 3:03:24 PM


B

Tick () the Correct Option. 1

Which block is used to move a sprite?

a

b

c

d

2

Which block is used to make a sprite turn clockwise?

a

b

c

d

3

Which block is used to run a script when the sprite is clicked?

a

b

c

d

4

Which block can pause a script for 10 seconds?

a

b

c

d

5

Which block can repeat a script 5 times?

a

b

c

d

C

Who Am I? 1

I change the costume of a sprite to a specified one.

2

I delete a clone of a sprite.

3

I repeat the instructions inside forever.

Chapter 2 • Scratch Blocks

CB_Grade 3.indb 17

17

11/28/2023 3:03:25 PM


D

E

4

I stop all playing sounds.

5

I run the script for a clone when it is created.

Write T for True and F for False. 1

The Motion blocks in Scratch are used to control the appearance of sprites.

2

Events blocks are used to tell a computer when to run a script.

3

Sound blocks can make a 'hitting' sound when a ball hits a sprite.

4

Each Scratch block stands for a different instruction.

5

You can use a Control block to delete a sprite from your project.

Answer the Following. 1

What is an event?

2

What is the purpose of the Looks blocks in Scratch?

3

What is the use of the say block? Where can we find this block in Scratch?

4 Which category of Scratch blocks controls sound, and what is the colour of these blocks? 5

What is the purpose of the think for seconds block?

18

CB_Grade 3.indb 18

11/28/2023 3:03:25 PM


F

Apply Your Learning. 1 Reena is making a Scratch project where she needs to move the bear from left to right. Which block should she use?

2 Simran wants to turn her pufferfish clockwise, as shown in the picture. Which block can she use? 3 Arya has a goblin sprite in his project with two different looks, as shown in the picture. Which block can he use to change the current look of the goblin to the other one? 4 Ayan made a project for his father and wants to add sound to it. Which block can he use?

FAT H E R ’ S D AY

5 Priya wants to make the frog sprite move forward 3 times. Which block should she use?

Chapter 2 • Scratch Blocks

CB_Grade 3.indb 19

19

11/28/2023 3:03:27 PM


31

Making a Scratch Project

In the previous chapter, we learnt about some of the scratch blocks. Now, we are going to make a Scratch project to draw a line.

Naming a Project

When a new Scratch project gets created, it comes with a default name 'Untitled' and a default cat sprite 'Sprite1'. To change the default name, click it and replace it with the new name 'Drawing a Line'.

Now, let us recall what a Sprite is. A Sprite is a character or object that you can move around on the stage and make this object do things.

20

CB_Grade 3.indb 20

11/28/2023 3:03:27 PM


Before we learn how to add a sprite to our project, we need to remove the cat sprite, as we don’t need it for the project.

Deleting a Sprite

As you know, Scratch Cat is the default sprite in Scratch. Steps to delete Scratch Cat: 1

2

elect the sprite to be deleted in the Sprites S pane. The

Click the

button appears.

button to delete the sprite.

Adding a Sprite

In Scratch, you can choose to add a sprite from the Sprites pane in four ways: 1

Choose a Sprite: To choose a sprite from the Scratch Sprite Library.

3

Surprise: To add a random sprite.

2 4

Paint: To create a sprite using Paint Editor.

Upload Sprite: To upload a sprite from your computers.

Chapter 3 • Making a Scratch Project

CB_Grade 3.indb 21

21

11/28/2023 3:03:29 PM


Choosing a Sprite

Now, let us add our first sprite, the Pencil Sprite Library into our project.

, from the

Steps to add a sprite from Sprite Library: 1

lick the Choose a Sprite option in the Sprites C pane. The Sprite Library opens.

2

Type 'pencil' in the search bar and then click the Pencil sprite.

The Pencil sprite is added to the stage and is also visible in the Sprites pane. 3

Set the Size of the Pencil sprite to 40.

Let us now learn to position our Pencil sprite.

22

CB_Grade 3.indb 22

11/28/2023 3:03:30 PM


Positioning a Sprite

A position is a place on the stage where you want a sprite to go. A position on the Scratch stage is made up of two values: x and y. The x value tells the horizontal (left to right) position of the sprite. The y value tells the vertical (top to down) position of the sprite. To set the position of a sprite, you can use the

block.

This block makes the sprite go to the position specified by the values of x and y. Let us make the Pencil sprite go to the centre of the stage when the green flag is clicked. 1

Select the Pencil sprite in the Sprites pane.

3

Drag the

block in the script area.

Drag the

block to under the

2 4 5 6

Click the Events category in the block panel. Click the Motion category.

Set the value of x and y to 0.

Code

block in the script area.

Output

Click the Go button to run your project.

Now, we need to move the Pencil sprite to draw a line. Chapter 3 • Making a Scratch Project

CB_Grade 3.indb 23

23

11/28/2023 3:03:31 PM


Moving a Sprite

To move a sprite, you can use the

block.

Let us move the pencil sprite 100 steps forward to draw a line. 1 2

Select the Pencil sprite in the Sprites pane.

Click the Motion category in the block panel.

3 Drag the area.

block to under the

block in the script

4 Set the value of steps to 100. Code

Output

Click the Go button to run your project.

Did the Pencil sprite draw a line when moved forward by 100 steps? No.

To make the Pencil sprite draw a line, use the Pen extension.

Pen Extension

The Pen Extension in Scratch allows sprites to draw on the stage. The Pen blocks are green in colour. They are used to create simple drawings such as lines, shapes, and patterns or more complex drawings such as pictures and animations. To use the Pen extension, you must first add it to your Scratch project.

Adding the Pen Extension

Steps to add the pen extension: 1

lick the purple Add Extension button in the bottom left C corner of the Scratch Editor window.

24

CB_Grade 3.indb 24

11/28/2023 3:03:31 PM


2

The Extension Library opens up. Click the Pen extension.

The Pen extension is added to the block panel.

Let us learn about some of the Pen blocks. Blocks

Description

Tells the sprite to start drawing on the stage. Tells the sprite to stop drawing on the stage. Sets the colour of the pen. Sets the thickness of the pen. Makes your pen lighter or darker. Clears all pen marks on the stage.

Drawing a Line

Now, let us use Pen blocks to make the Pencil sprite draw a line. Steps to make the Pencil sprite draw a line: 1

Drag the the

2

block between the

block and

block (before the Pencil sprite starts moving).

Drag the

block under the

block (once the

Pencil sprite stops moving). Chapter 3 • Making a Scratch Project

CB_Grade 3.indb 25

25

11/28/2023 3:03:32 PM


Code

Output

Click the Go button to run your project.

What happens when you run your project again? Nothing changes.

What should happen?

The older drawing should be removed.

To remove the older drawing, we can use the

block.

Erasing a Drawing

Steps to erase the old drawing when the green flag is clicked: 1

Click the Pen category in the block panel.

2

Drag the 0

Code

block between the 0

block and the

block. Output

Click the Go button to run your project.

26

CB_Grade 3.indb 26

11/28/2023 3:03:33 PM


Did the old drawing get removed or not? No.

What can be the problem?

The problem is that the new drawing is created so quickly that we cannot see the gap between the old drawing and the new drawing. To solve the problem, we can use the

block. It adds a delay between

the erasing of the old drawing and creation of the new drawing.

Adding a Delay

Let us add a delay of 1 second between erasing of the old drawing and creation of the new drawing. Steps to add a delay of 1 second: 1

Click Control in the block panel.

2 Drag the

block between the

0

0

block and the

block. Code

Output

Click the Go button to run your project.

The project 'Drawing a Line' is complete. Now, let us learn how to save a project in Scratch.

Chapter 3 • Making a Scratch Project

CB_Grade 3.indb 27

27

11/28/2023 3:03:34 PM


Saving a Scratch Project Steps to save a scratch project: 1 2

Click the File menu in the Menu bar. Click Save now.

Opening an Existing Scratch Project

All the projects you create get saved in the My Stuff folder. Steps to open a Scratch project from the My Stuff folder: 1

2 3

Click the My Stuff folder icon in the top-right corner of the Menu bar.

All your saved projects appear.

Go to the project you want to open.

Click the corresponding See inside button.

28

CB_Grade 3.indb 28

11/28/2023 3:03:35 PM


The particular project opens up in the Scratch Editor window.

Discuss

What happens when you click the green flag in a Scratch project that does not have any code attached to it?

Do It Yourself 3A 1 Identify the missing code block in the given script. a

b

c

d

2 What does the

block do?

a

Tells the sprite to stop drawing

b

Tells the sprite to start drawing

c

Changes the colour of the sprite’s pen

d

None of these

Chapter Checkup A

Fill in the Blanks. Hints 1 A it do things.

pen up

pen down

erase all

sprite

is a character or object that you can move on the stage and make

Chapter 3 • Making a Scratch Project

CB_Grade 3.indb 29

draw

29

11/28/2023 3:03:36 PM


2 To start drawing a line, you need to use the

block.

3 The Pen extension allows sprites to

on the stage.

4 To stop drawing a line, you need to use the

block.

5 To erase all pen marks on a screen, you need to use the B

block.

Tick () the Correct Option. 1 What extension do you need to make the sprite draw?

a

Video

b

Pen

c

Music

d

Text

2 What block can be used to add delay? a

b

c

d

3 Which block can be used to set the colour of the sprite’s pen? a

b

c

d

4 What does the

block do?

a

Turns the pen feature off inside a sprite

b

Stops drawing

c

Starts drawing

d

Changes the pen colour

30

CB_Grade 3.indb 30

11/28/2023 3:03:36 PM


C

Who Am I? What I Do?

Who Am I?

Performs different actions on stage. Makes your pen lighter or darker. Moves the sprite to the specified x and y values. Clears all pen marks on the screen. Sets the colour of the sprite’s pen. D

Write T for True and F for False. 1

The set pen colour to block sets the thickness of the pen.

2

The erase all block adds delay to the script.

3

The x value tells the vertical (top to down) position of the sprite.

4

The Pen extension allows sprites to draw.

5 To save a Scratch project, you should click the File menu and then select Save now. E

Answer the Following. 1

What is a sprite?

2

Write any two ways to add a sprite to your project.

3

What is the use of the pen blocks?

Chapter 3 • Making a Scratch Project

CB_Grade 3.indb 31

31

11/28/2023 3:03:37 PM


4

What is the difference between the pen down and pen up blocks?

5

Which block is used to move a sprite to a specific position, and where can we find it?

F

Apply Your Learning. 1 Rahul added a cat sprite to his Scratch project. Can you tell where will the sprite be visible now?

2

What code block can Rohit use to make a sprite move by 300 steps?

3 Imagine the girl sprite is 200 steps away from the boy sprite. Write down the script to make the ball reach the girl when the green flag is clicked.

32

CB_Grade 3.indb 32

11/28/2023 3:03:38 PM


4

Ritu wants to revisit one of her old Scratch projects. How can she do that?

Chapter 3 • Making a Scratch Project

CB_Grade 3.indb 33

33

11/28/2023 3:03:38 PM


41

Drawing Shapes

In the previous chapter, we learnt about pen blocks and how to make a sprite draw a line. Now, we will learn to draw more shapes using the pen extension. First, we will learn to draw a square. Do you know what a square is?

A square is a 2D shape with four sides and four corners. All sides of a square are of the same length. Imagine you are walking in a square in a garden. How would you do it?

To walk in a square, you would walk straight for a few steps, then turn, then walk straight for the same number of steps, and then turn again. You would do this four times to make a square.

Did You Know? The Rubik’s Cube is a square-shaped puzzle with nine squares on each side.

But what is a turn?

A turn is a change in the direction you are walking, either clockwise or anti-clockwise. Just like you use measuring units centimetre and metre to measure a length, you can use a unit called degrees to measure how much you turn. To make a square, you need to turn 90 degrees four times.

90 degrees

A degree is a measure of how much you turn. 34

CB_Grade 3.indb 34

11/28/2023 3:03:39 PM


Drawing a Square

Let us look at the steps to draw a square. 1

Move forward 100 steps.

2

Turn 90 degrees to the right.

3

Move forward 100 steps.

4

Turn 90 degrees to the right.

5

Move forward 100 steps.

6

Turn 90 degrees to the right.

7

Move forward 100 steps.

8

Turn 90 degrees to the right.

In the given steps, do you observe a pattern?

Right! We are repeating steps 1 and 2 four times. Now, observe the following:

Repeat the following steps 4 times: 1

Move forward 100 steps.

2

Turn 90 degrees to the right.

Which of the two ways looks simple, easy, and quick to make a script? The second way, right?

But how can we do this in Scratch? For this, we need to learn about loops. A loop is doing something again and again to complete a task. We have the

block that repeats the instructions in it for the given

number of times.

We will use the script we made for 'Drawing a Line' and add more code blocks to draw a square.

Chapter 4 • Drawing Shapes

CB_Grade 3.indb 35

35

11/28/2023 3:03:40 PM


Steps to draw a square: 1

Select the Pencil sprite.

2 Detach the

and

blocks from the script.

But keep them in the script area. 3

Click the Motion in the block panel.

4

Drag the repeat block to under the

5

Change the number of times to 4.

6

Drag the

7

Drag the

8 Drag the

block.

block to inside the repeat 4 block. block to below the repeat 4 block. block to below the

block inside the

repeat 4 block.

9

Change the value of degrees to 90.

Code

Output

Click the Go button to run your project.

36

CB_Grade 3.indb 36

11/28/2023 3:03:41 PM


What happens when you run your project?

The Pencil sprite moves quickly and draws the square.

It is tough to see how the Pencil sprite turns and when.

We can make the Pencil sprite pause on a turn by adding a delay. Steps to add a delay of 1 second: 1

Click the Control in the block panel.

2 Drag the

block to after the

block inside the

repeat block. Code

Output

Click the Go button to run your project.

We have completed the script to draw a square. Save this project with the name 'Drawing a Square'. Next, we will learn to draw a circle.

Discuss

How is a loop helpful to draw a square?

Chapter 4 • Drawing Shapes

CB_Grade 3.indb 37

37

11/28/2023 3:03:41 PM


Drawing a Circle A circle is a round shape with no corners or sides. Imagine you are standing in the middle of a circle. o

360

o

180

If you turn around all the way, you have turned 360 degrees.

If you turn halfway around, you have turned 180 degrees. But to make a complete circle, we need to walk around the circle 360 steps, turning 1 degree with each step.

Did You Know? The equator is an imaginary line that encircles the Earth horizontally in the middle.

We will use the script we made for a square and make some changes to draw a circle. Steps to draw a circle: 1 Drag the

block inside the repeat block to the block palette to

remove it. 2

Change the value of the repeat block from 4 to 360 to make a full circle.

3

Change the number of steps in the

4

Change the value of degrees in the

block from 100 to 1. block from 90 to 1.

38

CB_Grade 3.indb 38

11/28/2023 3:03:41 PM


Code

Output

Click the Go button to run your project.

Think and Tell Why do we need to repeat 360 times to draw a full circle?

Do It Yourself 4A 1 What will be the output when you run the given script? a

b

c

d

Chapter 4 • Drawing Shapes

CB_Grade 3.indb 39

39

11/28/2023 3:03:42 PM


2

What will be the output when you run the given script? a

b

c

d

Chapter Checkup A

Fill in the Blanks. Hints

90

4

square

corners

1 A

is a 2D shape with four sides of the same length.

2 A

is to change the direction you are walking in.

3 A circle is a round shape with no 4 The code inside the

or

block repeats

5 To make a square, we need to turn B

turn

sides

. times. degrees four times.

Tick () the Correct Option. 1

The given code block is an example of which block category?

a Control

b

Events

c Motion

d

Pen

2 How many move blocks do you need to create the given figure without loop? a 2

b

3

c 4

d

1

40

CB_Grade 3.indb 40

11/28/2023 3:03:42 PM


3

Identify the shape of the carrom board.

a Circle

b

Square

c Triangle

d

Rectangle

4

What is the value of x in the given script?

a 0

b

100

c 50

d

20

C

Who Am I? Code Block

Block Category Pen

Events Control Motion D

E

Write T for True and F for False. 1

A circle is a shape with four equal sides.

2

You need to turn 1 degree 360 times to make a square.

3

A degree is a measure of how much you turn.

4

To add a pause or delay in a sequence of actions, you can use the 'wait' block.

Answer the Following. 1

What is a turn?

Chapter 4 • Drawing Shapes

CB_Grade 3.indb 41

41

11/28/2023 3:03:43 PM


2

What is a square?

3 How many times will the move block be used to draw a circle without the repeat block? 4 F

How many degrees do we need to turn to make a semi-circle?

Apply Your Learning. 1 Arya has made a project to make his sprite run a circle shaped track, but the sprite is not completing the track. What is wrong in the script?

Code

42

CB_Grade 3.indb 42

11/28/2023 3:03:43 PM


2 Shaurya wants to make the knight reach the horse who is 100 steps away. On which sprite does he need to add the script? Write the script to make the knight reach the horse.

3 Riya is making a project where the flying cat sprite will play with the flying hippo sprite. Help her write a script to make the flying cat draw a line.

4 Rayan wants to make a ball move around a square with sides that are 200 steps long. Help him write a script to make the ball move in a square.

Chapter 4 • Drawing Shapes

CB_Grade 3.indb 43

43

11/28/2023 3:03:44 PM


51

Drawing a Pattern

In the previous chapter, we learnt how to draw a square and a circle using the Pen extension. Now, we will learn how to draw a pattern by making a sprite rotate. Do you know what rotation is?

Rotation is when an object moves around its centre. Like a spinning top!

Did You Know?

Think and Tell

The Earth spins around its centre once every 24 hours, causing day and night.

Can you think of some objects that spin or turn around their centre?

Let us learn to rotate a sprite.

Rotating a Sprite

Steps to rotate a sprite are: 1

Select the Cat sprite in the Sprites pane.

2

Drag the

block from the Events blocks to the script area.

3 Drag the

block in the script area.

4 We use the stage.

block from Motion blocks to under the block to make a sprite go to the centre of the

There is another block

that helps us move a sprite to any

random position. A random position can be any place on the stage.

5 Click the Add Extension panel.

button to add the Pen blocks to the block

44

CB_Grade 3.indb 44

11/28/2023 3:03:44 PM


6 Drag the

block from the Pen blocks to under the

7 Drag the

block from the Control blocks to under

block in the script area.

block in the script area. Change the value

the 8

inside the repeat block to 400.

Click the Motion in the block panel.

9 Drag the

block from the Motion blocks

inside the

block in the script area. Change its value

to 57.

The cat rotates on its location when you click the Go button or the green flag. Now, we will learn to make clones of the cat sprite when it rotates.

Creating a Clone Clones are the exact copies of a sprite. We can make copies of a sprite using the Sprites pane, but what if we need to make 100 copies of a sprite? It will take a long time, and tracking 100 sprites will be difficult. But there is a quick way to make many copies of a sprite without the need to track a list of 100 sprites. This way is called cloning. Cloning is making copies of a sprite without tracking a list of sprites.

Did You Know? Many toy companies use toy moulds to make clones of their toys.

Chapter 5 • Drawing a Pattern

CB_Grade 3.indb 45

45

11/28/2023 3:03:45 PM


There are three clone blocks in Scratch: Blocks

Description Creates a clone of the specified sprite. Runs the attached script when a sprite is cloned. Deletes the clone that is running the script and stops all its scripts.

Steps to create the clone of a sprite: 1

Click Control in the block panel.

Drag the block under the 2 block in the script area. 3

Click the Go

block, inside the repeat

button.

Observe that multiple clones of the cat sprite are created on the stage. What happens when you run the project?

When the cat sprite rotates, many of its copies are created during the rotation.

Discuss

How is creating clones of a sprite better than duplicating a sprite?

This means that the clones are created but not doing anything.

Now, let us make these cloned cat sprites move and rotate to create an amazing pattern. 46

CB_Grade 3.indb 46

11/28/2023 3:03:46 PM


Drawing a Pattern Steps to draw a pattern: 1

Select the cat sprite in the Sprites pane.

2

Drag the

Drag the 3

block from the Control blocks to the script area. block under the

block. Change the number

of times to 40. 4

Drag the

Drag the 5

block inside the repeat block. block from the Motion blocks to under the block.

Drag the 6 block.

Click the

block under the

block, inside the repeat

block multiple times to see how a clone is created that

moves and rotates with each click.

What happens when you run the project?

It creates clones of the cat sprite and makes them move and rotate. In the end, all the clones rest behind the cat sprite. But we can remove the sprites when they are no longer needed using the block.

Chapter 5 • Drawing a Pattern

CB_Grade 3.indb 47

47

11/28/2023 3:03:46 PM


We made a pattern using the cat sprite.

Next, we will draw the pattern the cat sprite made but with pen blocks.

To do so, we need a blank sprite. Let us learn how to make a blank sprite.

Creating a Blank Sprite Steps to make a blank sprite: 1 2

Select the cat sprite.

Click the Costumes tab.

3 Select the Paint option to add a blank costume for the cat sprite. The blank costume appears in the costumes list. 4 Select the cat costumes one by one and then click the Delete button delete the cat costumes, leaving only the blank costume.

to

48

CB_Grade 3.indb 48

11/28/2023 3:03:47 PM


Drawing a Pattern

Now, let us add pen blocks in the script to draw a pattern using the blank sprite. Steps to draw a pattern using pen blocks: 1

Drag the

block from the Control blocks to the script area.

Drag the 2

block from Pen blocks and place it under the block.

Drag the 3

block under the

block in the script

Drag the 4

block under the

block in the script

area. Change the colour of the pen.

area. Change the value of the pen size to 5.

Drag the 5

block under the

block in the script area.

Drag the 6

block under the

block from the Control blocks.

7

Drag another repeat block and then change the value inside this block to 4.

Chapter 5 • Drawing a Pattern

CB_Grade 3.indb 49

49

11/28/2023 3:03:49 PM


Click Motion in the block panel. Drag the 8

block inside the

block. Change the value of steps to 100. Drag the 9

block below the

block. Change the

value of degrees to 90. Drag the 10

block below the

inside the repeat block.

11 Now, drag the

block below the

block. Change the

block below the

block. Change the

value of steps to 50.

Drag the 12

block

value of the degrees to 36.

A colourful pattern of square shapes is created on running the script.

Discuss

When do we need a blank sprite?

50

CB_Grade 3.indb 50

11/28/2023 3:03:50 PM


Do It Yourself 5A 1 Find the given words in the word puzzle. Words can be found in any direction, including up, down, left, and right. Hints D H Q U F G W H F L

L E H S U R Y D V J

C A M C B R F Y Z A

SCRATCH

SPRITE

O O L R I P Z H V J

L Z H T E N D D Y J

E P S A S E C E W U

D O L C U C L O N E

CLONE J L E H V M I X M J

PEN J T I S O S E A I C

J H S P R I T E A K

2 Colour the pattern.

Coding Challenge

Make clones of the Donut sprite so that they appear at various positions on the stage.

You can use the Hint

Chapter 5 • Drawing a Pattern

CB_Grade 3.indb 51

motion block to make clones of the donut sprite appear at a random position.

51

11/28/2023 3:03:50 PM


Chapter Checkup A

Fill in the Blanks. Hints 1

is when an object moves around its centre.

2

are the exact same copies of a sprite.

3 The

B

thickness when I start as a clone delete this clone rotation clones

4

The

5

The

block runs the attached script when a sprite is cloned. block helps us remove a clone when it is no longer needed. block sets the

of the sprite’s pen.

Tick () the Correct Option. 1

Why is cloning useful when working with sprites?

a

It changes the colour of the sprite.

b

It creates random variations of the sprite.

c

It allows you to make multiple copies without tracking each copy separately.

d

It makes the sprite disappear.

2

How can we rotate a sprite in Scratch?

a

By using the 'turn' block

b

By using the 'rotate' block

c

By using the 'spin' block

d

By using the 'move' block

3

How can we create a blank sprite in Scratch?

a

By using the Surprise option

b

By using the Choose a costume option

c

By using the Paint option

d

By using the Upload option

52

CB_Grade 3.indb 52

11/28/2023 3:03:50 PM


4

What will the given script do?

a

Move the clone to the centre of the stage.

b

Make the clone invisible.

c

Delete the clone.

d

Make the clone wait for a specified number of seconds.

C

Who Am I? What I Do?

Who Am I?

Make the sprite turn around by specified degrees. Create a clone of the specified sprite. Delete the clone. Change the colour of the pen. D

E

Write T for True and F for False. 1

Cloning can create only a single copy of a sprite.

2

Deleting the costume of a sprite deletes the sprite itself.

3

Cloning in Scratch creates exact copies of sprites.

4

The Go button is used to run a project.

5

You can move a sprite to any random position on the stage.

Answer the Following. 1

What is rotation? Give an example.

Chapter 5 • Drawing a Pattern

CB_Grade 3.indb 53

53

11/28/2023 3:03:51 PM


2

What happens if you change the value of the 'turn' block?

3

What happens if you clone the cat sprite while it is turning?

4

Name the three clone blocks in Scratch.

5

Which block is used to make the clones disappear on the stage?

F

Apply Your Learning. 1 Shreya is making a project to show the Earth rotating in space. Help her write the script to make the Earth sprite rotate.

2 Tina has made a project to make her sprite rotate, but the sprite is not rotating. What is wrong in the given script?

54

CB_Grade 3.indb 54

11/28/2023 3:03:51 PM


3 Sheena wants to draw a pattern with various colours. Name the block that can help

her do so.

4 What will happen to the dove sprite when you run the given script?

Chapter 5 • Drawing a Pattern

CB_Grade 3.indb 55

55

11/28/2023 3:03:51 PM


About the Book This coding book is supplementary to the main “Mel n Conji” content book. This book represents a 21st-century approach to learning coding concepts and developing computational thinking and problem-solving skills. To prepare students for the digital age, the curriculum is interwoven with well-thought-out concept graduation with real-life examples and practice problems.

Special Features • Illustrative approach: Concepts in coding and computer science are delivered through pictorial representations and learner-friendly approaches. • Learning through real-life examples: Age-appropriate examples that enable learners to relate to the concept and learn about the unknown from the known. • Extensive practice: Multiple practice scenarios to reinforce learnings. • Coding challenges: Includes projects through which learners can demonstrate their learning outcomes in coding and computer science.

About Uolo Uolo partners with K-12 schools to bring technology-based learning programs. We believe pedagogy and technology must come together to deliver scalable learning experiences that generate measurable outcomes. Uolo is trusted by over 10,000 schools across India, South East Asia, and the Middle East.

Singapore

|

Gurugram

CS_CB_Coding_ICSE_Grade4_Cover.indd All Pages

|

Bengaluru

|

hello@uolo.com �199

© 2024 Uolo EdTech Pvt. Ltd. All rights reserved.

NEP 2020 based

|

ICSE compliant

|

Technology powered

06/12/23 7:14 PM


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.