Download as pdf or txt
Download as pdf or txt
You are on page 1of 100

COMPUTER SCIENCE WORKBOOK

GRADE 5

EKYA LEARNING CENTER


Table of Contents

No. Unit Name Page No.

1 Digital Citizenship 2

2 Evolution of Computers 8

3 Scratch - 2 19

4 Introduction to Google Sheets 34

5 Read Only Memory 75

6 Introduction to Flowcharts and Python 78

7 Computer Malware 92

8 Design Thinking Principles 97

1
Unit 1 - DIGITAL CITIZENSHIP
In this unit, we will look at whether technologies around the world are accessible and usable and what
measures are being done by tech companies to enhance accessibility and usability. We will also continue to
explore digital safety by learning more about how our online presence can affect others.

1.1 WHAT IS TECHNOLOGY ACCESSIBILITY?

Accessibility means availability to everyone regardless of where they are or whether they are physically able.
In order for us to use digital technology, we first need a device, internet connection, and in case we need to
download material or apps, memory in our device. Not all digital technology is free. There are some products
and services for which we have to pay.

● Is technology accessible in all parts of India?

● Is technology available in all parts of the world?

● Is technology available to those who are differently abled?

1.2 HOW ACCESSIBLE IS DIGITAL TECHNOLOGY IN INDIA?

About 50% of people (half the number of people) in India use the internet1. This amounts to approximately
650 Million people using the internet in India by 2022. A majority of India’s digital population accessed the
internet via their mobile phones. By 2023, mobile internet user penetration is expected to grow. An increased
availability of cheap data plans along with various government initiatives under the Digital India campaign
worked together to make mobile the primary internet access in the country.

The Digital India

Digital India is a campaign launched by the Government of India in order to ensure the Government's
services are made available to citizens electronically by improved online infrastructure and by increasing
Internet connectivity or making the country digitally empowered in the field of technology.The initiative
includes plans to connect rural areas with high-speed internet networks.

Visit the Digital India website and read the Accessibility statement here.

1
https://www.statista.com/topics/2157/internet-usage-in-india/#dossierKeyfigures
2
The Government of India hopes to achieve the following objectives with respect to making India
digital:

● Availability of high speed internet as a core utility for delivery of services to citizens

● Digital identity that is unique, lifelong, online and authenticable to every citizen

● Mobile phone & bank account enabling citizen participation in digital & financial space

● Safe and secure cyberspace

● Universal digital literacy

● Universally accessible digital resources

● Availability of digital resources / services in Indian languages

● Collaborative digital platforms for participative governance

● Citizens not required to physically submit Govt. documents / certificates

1.3 HOW ACCESSIBLE IS TECHNOLOGY AROUND THE WORLD?

Some of the countries with the highest number of internet users and internet connectivity are Denmark, UAE,
South Korea, Sweden, Switzerland.

3
Countries where the internet is not allowed to be used are North Korea (almost 0%) and
Somalia.

Do you think people who have access to the internet are at an advantage compared to people who do not
have access?

1.4 TECHNOLOGY FOR DIFFERENTLY ABLED PEOPLE

Digital technology—the tools, systems, and devices that we use to work, communicate, and manage our
day-to-day lives has made life more comfortable. It brings people of diverse race, gender, age, and ability
together as a community. However, in order to become truly inclusive2, we need further advancements and
thought processes while developing technology.

About 15 percent of people in the world have a disability. Some of these disabilities may prevent people from
using technology. Example - a visually impaired person may not be able to type using the keyboard and a
person with hearing impairment may not be able to hear during a video chat.

The design of the product or service (website, app, payment portal etc) should be such that there are icons to
allow people who do not know how to read in a language to be able to open pages, voice chats, voice to text
options and so on.

1.5 WHAT IS USABILITY OF A PRODUCT OR SERVICE?

2
Not excluding anyone
4
The usability of a digital product or service is the ease with which we can use it. To create digital technology
that is usable, what should we consider?

● Ease of learning - Can we figure out the different features and navigate to where we want to go (in a
website / app / device)

● Task efficiency - Can we quickly complete a task using this technology?

● Error free experience - Can we complete a task without bugs stopping us from doing so?

Can you think of 5 digital tech products that you feel are easy to use?

1.6 DIGITAL SAFETY

Let’s recollect the digital safety measures that we need to follow while using the internet:

● Always keep your login credentials, details about your personal life private.
● Ensure that you use a strong password whenever you need to create online accounts.
● Do not strike conversations with strangers online. Ensure that your parents / guardians are aware of
your online activities.
● If you see something that makes you uncomfortable, let your parents / guardians know immediately.
● Be a responsible digital citizen - ensure that your personal opinions are voiced in an appropriate
manner. Do not be mean to others online. Treat others as how you would want to be treated and think
about your digital footprints. In the event someone is treating you unfairly or in a mean manner, inform

5
your parents / guardians.
● The internet is full of catchy headlines and it is easy to get caught up in these messages. Be aware of
clickbaits on the internet. Do not share information without checking whether it is true.

Social interactions online3

Do you play games online? Do you chat with your friends online? How do you interact with your friends in
person and when you are online?

Social interaction means talking or messaging with people to develop friendship or community.

Watch this video that depicts a situation on online social interactions.

What are some aspects that we need to be aware of when talking to people online?

● It is important to have a friendly and respectful tone when communicating with others. It is easy to get
carried away with our opinions versus others’. Remember that we are entitled to our opinions and we
can share these as long as it is communicated appropriately without hurting the others.
● Do not strike conversations with strangers, let your parents know if unknown persons try to strike a
conversation.
● Keep your interactions positive and do not use mean words or put down others.

What are clickbaits?4

Lots of different kinds of headlines and images use the curiosity gap (desire for people to find out new
information) to try to get you to click on them, including many news sites. Some of these may be online
images or headlines that try to get you to click on it, usually for advertising purposes.These are known as
clickbaits. But not all are the same. By getting you to "bite on the hook," or click the link, clickbait headlines
help advertisers make more money. When lots of people click on a link, an advertiser gets more traffic and
can charge companies more money for their ads. It doesn't matter if the people who click find what they're
looking for. In fact, when you click on clickbait, it can:

● Lead to sites you didn't want to go to. This can be confusing and frustrating!
● Infect your device with computer viruses.

3
4
This part of the unit is from Common Sense Education
6
● Lead to someone stealing your information.

So, if you come across a headline that you think might be clickbait, avoid clicking it. Instead, do a search on
the headline to see if there are other sources that provide the information you're looking for.

1.7 EXERCISES

A. Fill in the blanks:

1. ______________ refers to the ease of use of a digital product of service.


2. An app that can be used by everyone in the world is said to be ______________ to all.
3. Information that we read online should be _________ before we share with others.
4. __________ ______________ campaign is an initiative by the Government of India to empower its citizens
to become digital citizens.
5. __________ ______________ refers to the online tools, tech devices and systems that we use to
communicate, work and socialize in our day to day lives.

B. State True or False:

1. Trolling someone online because we do not agree with their views is appropriate behaviour.
2. We should share our login credentials with our friends in case we forget.
3. North Korea has the least number of internet users due to the policies of their government.
4. Reena is playing a game and has refused to talk online with another player whom she does not know.
Her actions are correct.
5. A usable digital product should be bug free.

C. Answer the following questions:

1. What are clickbaits? What should we do when we encounter a clickbait?


2. Mention two objectives of the Digital India campaign.
3. If you were to create a game that should be accessible to all, what features would you include in the
game? What hardware would be required for everyone to play the game?

7
Unit 2 - EVOLUTION OF COMPUTERS

2.1 DEVICES ACROSS THE AGES

Can you imagine a time when there were no computers? Previously, people did not rely on computers to pay
their bills, to do shopping or to send mails. They also could not store vast amounts of important information
virtually and make calculations at super speed. The first computer was invented only after the invention of
electricity. Prior to that, man had to rely on mechanical devices that helped them calculate complex number
problems.

Let us learn about some of these devices:

Abacus ( ~ 4000 years ago)

Model of Abacus used in China - similar to what we


use currently

The Sumerian Abacus

The earliest device known for calculation purposes is the abacus. It was invented by the Chinese or
Sumerians about 4000 years back. It continues to be used even today.

Napier’s Bones ( 1614 AD)

John Napier Napier’s Bones

8
In 1614, John Napier from Scotland invented a calculating device with a set of
rectangular rods. This device was used for easy multiplication of numbers. This device is called The Napier’s
bones.

Difference Engine and Analytical Engine ( 1821 and 1833 AD )

Charles Babbage Model of Difference Engine Model of Analytical Engine

In 1821, Charles Babbage began designing the Difference Engine. This mechanical calculator could work
with 16-digit numbers.

In 1833, Charles Babbage designed the Analytical Engine. Just like a modern-day computer, this mechanical
device had input, output and memory components in it. It could evaluate algebraic expressions and perform
simple calculations. For this reason, Charles Babbage is known as the Father of Computers.

World’s first Program ( 1800s )

Lady Ada Lovelace, a noted Mathematician wrote the first known algorithm to use the Analytical Engine in

9
the 19th century. Because of this, she is known as the first computer
programmer.

Tabulating Machine (1887 AD)

Herman Hollerith Tabulating Machine

Dr. Herman Hollerith invented the Tabulating Machine in 1887. This machine was used in taking census data.
It could read the punched cards and add up totals and categorise information on the punch card. This
machine used electricity.

ENIAC and UNIVAC ( 1900s )

John Mauchly Presper Eckert

10
ENIAC UNIVAC

The first electronic computer, Electronic Numeric Integrator and Calculator or ENIAC was invented in 1946 by
John Mauchly and Presper Eckert. It was a big machine and could do very fast calculations.

UNIVAC was developed in 1948 by Eckert and Mauchly. UNIVAC stands for Universal Automatic Computer
and was an improvement on ENIAC.

Turing Machine (1936)

Alan Turing Turing Machine Bombe Machine

Alan Turing is remembered fondly as the father of modern computers. Alan Turing was a mathematician,
cryptographer, and a pioneer of computer science. Turing is best known for his work at Bletchley Park during
World War II. Turing helped break the German Enigma Code, a naval code that allowed Britain’s food and
supplies to be shipped across the Atlantic without German interference. What made the Enigma Code
seemingly ‘uncrackable’ was the fact that you would have to go through more than almost 15 million million
million possibilities to arrive at the correctly deciphered code! He designed a machine to break the code
along with Gordon Welchman by modifying the Bombe machine, a machine invented by the Poles for

11
decrypting secret messages.

Turing also designed a hypothetical machine, now called the Turing machine that could read a tape of
symbols, one at a time, then either rewrite or erase the symbol, before shifting the tape to right or left. Due to
this feature, the machine was considered to have infinite memory.

2.2 GENERATIONS OF COMPUTERS

The development of computers can be classified as ‘Computer Generations’ based on the development of
electronics and software during that time. In general, computers can be divided into 5 different generations.

The First Generation (1946-1955)

First generation computers used the concept of ‘stored program’ and were characterised by vacuum tubes.
A vacuum tube is a device made of glass that can control and amplify electronic signals. First generation
computers like ENIAC and UNIVAC were made using thousands of vacuum tubes. These computers were
very large in size because of the use of bulky vacuum tubes. They consumed a lot of electricity and
generated a lot of heat.

Vacuum Tubes:

Size of ENIAC:

12
Features of First generation computers:

1. They used vacuum tubes to control and amplify electronic signals

2. They were huge computers which occupied lot of space

3. High electricity consumption and high heat generation

4. They were unreliable since they were prone to frequent hardware failures

5. They were very costly and required constant maintenance

6. Continuous air conditioning was required

The Second Generation (1956–1964)

Second generation computers used transistors. A transistor is an electronic device that replaces the vacuum
tube. Transistors were invented by William Shockley, W.H. Brattain and John Bardeen. They won the Nobel
Prize in Physics in 1956 for their contribution in Electronics. Transistors were smaller, highly reliable,
consumed less electricity and generated less heat.

Magnetic core memories for computers were developed during this generation. IBM 1401 and IBM 1620
were popular computers of this generation.

Transistors used in second generation computers:

IBM 1401:

13
Features of Second generation computers:

1. They used transistor based technology

2. They were smaller and less expensive as compared to first generation

3. They consumed less electricity and emitted less heat

4. Magnetic core memories and magnetic disks were used as primary and secondary storage
respectively

5. Wider commercial use but commercial production was still difficult

6. They also required constant air-conditioning

The Third Generation (1965-1975)

In 1965, the development of Integrated Circuits or ICs marked the beginning of the third generation. An IC is
a small silicon chip or wafer which has numerous transistors, and other components of an electronic circuit.

Various computers such as Mainframes and minicomputers were developed during this generation.

One example of a Third generation computer is the IBM 360.

Integrated Circuit:

IBM 360:

14
Features of Third Generation computers:

1. They used integrated circuits


2. The computers were smaller, faster and more reliable
3. Low power consumption and less emission of heat as compared to previous generations

The Fourth Generation (1975 to Present)

In this generation, up to 300,000 transistors were embedded on a single chip.

The integration of an entire processor on a single chip was achieved during this time. The chip was named
microprocessor. Computers which were based on microprocessor technology had faster accessing and
processing speeds. Portable computers were created due to the reduced size of the processor.

Commercial production of these computers is easier and they are the least expensive, compared to the
earlier generation computers.

Computer networks and the Internet were made possible during this generation.

Large scale integrated circuits: (many electronic components on a single chip)

IBM 5150 - PC launched in 1981 Features of Fourth generation Computers:

15
1. Microprocessors developed

2. Portable computers developed

3. Hand-held smart devices have been developed

4. Easy communication and information sharing due to development of networks

5. The computers are very reliable, powerful and small in size

Fifth Generation Computers (Present to Future)

This generation is based on the concept of artificial intelligence. Computers of this generation are supposed
to behave like humans. Computers are being developed to respond to human languages and to have the
ability to make decisions while executing a task. Some applications like voice recognition, visual recognition,
AI based robots, AI based information gathering and display already exist everywhere and are instrumental in
furthering the development of fifth generation computers.

Features of fifth generation computers:

1. Use of natural language

2. Artificial Intelligence

3. Voice and Visual Recognition

4. Augmented and Virtual reality

Augmented Reality:

Virtual Reality:

16
2.3 TECHNOLOGY AND CULTURE

There has always been an interdependency between culture and technology. From the first use of stone tools
to the development of handheld digital machines, technology has influenced human culture just as much as
culture has sparked advancements in technology.

Both technology and culture continue to influence each other as they develop and change over time. In the
19th, 20th and 21st centuries, technology and culture have significantly influenced one another. As cultures
change so does the technology they develop. With developments in manufacturing, communications and
engineering, cultures have been re-shaped around the world by freeing people from small family farms by
choice or by force, dispersing information and changing the landscape. These technological developments
have changed the cultures positively but negatively as well. Cultures in turn drive technological
development. Although it gets difficult to explain these interdependencies in every aspect, we can review a
few examples.

The Industrial Revolutions of the 19th century drastically influenced culture. Corporations began to
manufacture goods that had previously been made in the home. Goods were mass produced using
machinery instead of people.

One of the major influences of manufacturing allowed people to purchase goods in a store instead of having
to make everything from scratch. This freed up a lot of time for people because they no longer had to spend
all of their time producing food, clothing and other goods for their families. This meant that a machine could
be built to make one particular item much faster than any skilled artisan could. Machinery eliminated the
need for skilled workers.

As manufactured goods became cheaper to produce, people bought more and more things. The increased
rate of consumption of goods gave rise to supermarkets and department stores.

The 20th century saw a rise in the development of agricultural technologies. Small farming villages who have
developed farming techniques over hundreds of generations that work with nature in order to feed their
families have now been replaced by those techniques for genetically modified seeds, manufactured fertilisers
and chemicals. As technology changes the agricultural techniques, it also creates a change in the lifestyle of
people and the environment.

Due to the development of technology in the medical field, the care of patients has also become much safer.
Throughout history it has become clear that in order to increase lifespan we need to improve our methods of
medical care and this is shown through the development of safer and more efficient technologies. Surgeries
have developed and improved greatly, along with the survival rate of surgeries increasing everyday as tech
becomes more reliable

In the light of the COVID-19 pandemic, it is interesting to take a look at the role technology played in controlling
the spread of the virus. COVID-19, although not the first pandemic that the world has faced, is the first that
technology has made an incredible impact on.
With the assistance of technology, the government and the medical community is able to track the spread of
the pandemic from person to person. This can be done through contact tracing using GPS and facial
recognition systems. As well as tracking the spread of the virus, there have been many new innovations that
have been used to reassure and educate populations of the spread.

Technology and culture are two forces that greatly influence one another. As new technology is introduced
into a society, the culture reacts in a positive or negative way and is thus changed forever. Consequently, as

17
cultures change so does the technology they develop. Advances in technology directly
affect how cultures evolve; thus, when cultures evolve, they tend to create new technology.

Watch these videos for the latest innovations in technology and how these have influenced culture and
people in real life:

● Technology and culture (Ted Talk)

● Evolution of Technology

2.4 EXERCISES

A. Fill in the blanks.

1. The _____________ was the first calculating device.

2. __________ is known as the Father of Computers.

3. The first electronic computer was _______________ .

4. ________ invented the Tabulating machine.

B. Match the following

1. Analytical Engine a. 1946

2. ENIAC b. 1833

3. Tabulating machine c. 1642

4. UNIVAC d. 1887

5. Pascaline e. 1948

C. Answer the following questions

1. What is Pascaline?

2. What was special about the Analytical Engine?

3. Which was the first machine to use electricity? What was the use of this machine?

4. Who is Lady Ada Lovelace? What was her contribution to the development of computers?

5. Compare second and third generation computers.

6. What features of fifth generation computers are being addressed in computers of today?

7. Describe these terms - Artificial intelligence, Augmented reality, Virtual reality.

18
Unit - SCRATCH 2

2.1 QUICK RECAP

2.1.1 Scratch Screen Components

In Scratch, we can animate characters called Sprites. The sprites are added to the Stage. Stage is the area
where the animations occur.

2.1.2 How do we animate in Scratch?

We animate sprites by connecting certain blocks together which act as instructions for the sprite. These are
given in the Script Area.

There are different block types available in Scratch.

Motion Blocks control the movement of the sprite.

Looks Blocks control the way the sprite appears.

Sound Blocks help us in adding sounds to our animation.

Events Blocks help us start a series of actions by using an event such as When Green Flag
clicked.

Control Blocks help us manage the order in which we want the blocks of instructions to be
carried out.

19
Sensing blocks are used to detect things such as if a sprite is touching another, the location of
the mouse pointer, distance from another sprite etc.

Operators blocks are used when we want to compare numbers and do some calculations.

Variables blocks allow us to create new variables. Let’s say we want to display the score in a
game, we can create a variable Score and update this variable each time the user gets a point.

My Blocks allow us to create new blocks with a specific use in Scratch.

2.1.3 Menu options to change the direction and size of a sprite

Before we start coding our sprites, we may want to edit how the sprite appears. To reduce the size change from
100 to a lower value. To increase the size of the sprite, change it to a value more than 100. We can change the
direction to which the sprite is pointing to by editing the direction value. If we want to flip the sprite, then we

can use the block from Motion or use the costume editor which we will
explore in the next section.

2.1.4 New Sprite Tabs:

We can add a sprite onto the stage by using any of these new sprite tabs from the Sprites Pane.

20
● Choose sprite from library: Allows us to select a sprite from a list of sprites present in Scratch library.
● Paint new sprite: Opens an image editor where we can create our own sprites.
● Surprise sprite: Selects and adds a random sprite on the stage.
● Upload sprite from file: Allows us to use images existing in our computer.

In grade 4, we learnt how to use event blocks, change the backdrops, add sounds to an animation, program
multiple sprites, change the costumes of sprites, add conditional and loop blocks to create games and stories
in Scratch.

In grade 5, we will learn to do the following in Scratch:

1. Creating sprites using Paint a sprite option


2. Creating your own Scratch blocks
3. Games using random numbers and math blocks
4. Games using variables

2.2. CREATING A NEW SPRITE

We can create our own sprites in scratch instead of using the sprites from the library.
Example 1: Construct a creature sprite in Scratch
1 Open a new file in Scratch.
2. Click on Paint new sprite tab (The Paintbrush icon)
3. The Costume pane opens up with tools, colours and drawing area.

4. First construct a creature on notebook / paint. This will give us an idea of what tools we require to create it in
Scratch. In this example, the sprite to be created is this:

21
5. To draw the outline of the body, use the brush tool and set the width of the brush to a small value.

6. To draw the eyes, use the Ellipse tool and fill the oval with colour. This option can be chosen once the Ellipse
tool is chosen:

7. To fill with colour, select the Fill with colour tool. Again, we can choose a solid colour or gradients of two
colours:

8. To create a Costume for this sprite, select the existing sprite using the selection tool.

9. Copy the sprite using the Duplicate tool or Ctrl + C. Click on Paint new Costume and paste the copied image
on the new drawing area.

22
10. Now, we will modify the image slightly. Change the smiling expression to one of shock using Eraser, Brush
and Fill with colour tools.

11.Final costume of the newly created sprite looks like this:

12. Now, let’s add a set of drums to the first costume. This can be achieved by clicking on the Add tab and
then selecting the Drum Congo - 2 sprite.

13. The Sprite now has two elements: The creature as well as the drums which together is the sprite.

23
14. Let us make the drum set disappear in Costume - 2. Replace the drums with the text POOF! In Costume -
2.

15. Now create a Scratch project with drum music such that these two costumes interchange forever.

2.3. MAKE A BLOCK ACTIVITY

Scratch has a feature known as Make a Block in My Blocks. This feature allows us to combine different blocks
together and call the series of blocks by a different name.

24
Example 2: Create a block called Jump that will make a sprite jump.
1. Add a sprite on the stage.

2. Click on My Blocks on the Blocks Palette.


3. Click on Make a Block.

4. Give a name for the block you are creating and click OK. In this example, the name Jump has been given.

5. A Define Jump block can be seen in the script area now.

6. Add the blocks to make the sprite jump when it is clicked. Every sprite has two values: the x and y values
that together determine the position of the sprite on the stage. The y value determines the vertical position of a

sprite and the x value determines the horizontal position of the sprite (from a point). Why do you think the y
values are changed and not the x values of the sprite to make the sprite jump? Since the y values determine the

25
vertical position and jumping involves only change in the height, we modify only the y
value. Also, to bring the sprite back to its original position, we change the y by equal negative value.
To get the block Jump, go to My Blocks -> Under Make a Block, you would find the block that you created (in
this case, Jump).

7. Test the project.

2.4. ACCEPTING VALUES FROM USERS IN SCRATCH

Wouldn’t it be fun to ask the user how high Tera should jump and make the sprite

jump so much? We can achieve this by using and blocks.


Example 3: Create a project such that, when the sprite is clicked, it should ask the user how high the sprite
should jump. The number given by the user will be saved in the answer block by Scratch.

1. Drag and drop ask block and modify the text such that it reads:

2. Join this block under the event When this sprite clicked.

3. Now we need to change the definition of Jump such that the y value changes by the amount entered by

the user and not by a fixed value. Replace all number values with blocks.
4. The final set of blocks should look like this :

26
5. Test the project. You will notice that the sprite jumps up but does not come down. Instead it further
moves up. This is because we have not given a negative number to make the sprite come down.

6. Since we cannot directly add a negative sign to , we need to

use a block from the Operator blocks to change into a negative value. Drag and drop

on the stage.

7. Modify this block like this:

Now we have a negative of .


8. Add this to the Define Jump block such that it looks like this:

9. Test the project. What is the difference between and blocks?

Use instead of in the code and observe if the results change.


10. Observe some of the projects created by Scratchers around the world for Make a Block challenge
using this link: https://scratch.mit.edu/studios/475545/
11. Choose any one project that can be added on and remix that project. (Note: To use the Remix tab, you
need a Scratch online account. Alternatively, you can download the project and add new blocks to the
project.)

27
2.5. USING RANDOM NUMBERS

Random numbers, as the name suggests, are numbers that are simply random and are not part of any pattern
or series of numbers. So, we cannot predict what the next number would be. Random numbers are useful
when creating online games. One example of a random number generator is a die (singular of dice). We cannot
predict

what set of numbers will be generated when we roll a die. What we would know though is that the numbers
cannot exceed 6 and cannot be less than 1.

Example 4: Create a guessing game in Scratch that has a virtual die. When the player clicks on a button, a
number from 1 to 6 will be randomly chosen by Scratch (similar to a die). We will have the player guess which

number has been chosen. If the guessed number matches the number generated by Scratch, will
appear

on the screen in place of the button. Otherwise, will appear.

1. Open a new file in Scratch.


2. Add a button sprite.

3. Since we need to add the tick and cross symbols in place of the button, we need to add these sprites
as costumes to the first button. Click on Costumes and go to Choose Costume from the library.

4. Add the tick and cross buttons as costumes to the button.


5. Rename the costumes such that they are named as button 1, button 2 and button 3.

28
6. Go back to the Scripts window. When the game starts, button 1 should be displayed first so that the
player can click on it. Use blocks from the Looks category to achieve this.

7. We need to ask the player to guess the number on the die. Use

and to get the guessed number.

8. Random number in Scratch can be generated using


block from Operators category. Change the value from 1 to 10 to 1 to 6. This will be the number for the
virtual die. Notice that we cannot lock this block along with any other block. This block can replace any
integer value of any block.
9. We have to compare the guessed number with the number generated by the user. So, we need a
conditional block.

10. Final code block should look like this:

29
11. Screenshots of Stage:

30
2.5 BUILDING GAMES AND DISPLAYING SCORES
Games are fun when we can track our progress in it. This can be done using variables. Variables are similar to
boxes that store a value. The value they store can change during the Project run.
We need a variable that would keep track of the score of the player, the value changing each time the player
scores a point.

Example 5: Create a simple Scratch game using a sprite. The sprite will move randomly on the stage. If the
player clicks on the sprite, then he/she scores a point. The score will be displayed on the stage.
1. Open a new file in Scratch. Add a spooky backdrop and a ghost sprite.
2. To make the sprite move randomly around the stage, we need to know minimum and maximum x and y
values of the stage. Y values change from 180 (on top) to -180 (at the bottom of the stage). X values
change from -240 (on the left) to 240 (on the right). You can observe this by moving the cursor to the
four corners of the stage. Use these minimum and maximum values as boundaries within which random
values of x and y should be generated. To make sure that the sprite is fully visible on the stage, you can
further reduce the range of values. In this example, x value randomly changes from -210 to 210 and y
value changes from -150 to 150.

3. Since the sprite keeps moving all the time, we need a Forever block that randomly places the sprite on
the stage.

4. Next, we need to give some time for the player to try and click on the sprite before the sprite changes
location. Add a wait time depending on how easy or difficult you want the game to be. Your script
should look like this for the sprite:

5. To create the score variable, click on Data and click on Make a Variable.
6. In the window that pops, give a name to the variable and leave the default setting - For all sprites
checked. It does not make a difference in our Project as we have only one sprite.

31
7. A new set of options are added under the Scripts menu.

8. Notice that the Score block has a checkbox next to it. When checked, the score will be displayed on the
stage.
9. Initially the score has to be set to 0. This should be the setting before the sprite starts moving. Modify
the script to include this block.

10. When the sprite is clicked, score increases by one.

Use and to do this.


11. Your final set of blocks should be similar to this:

32
12. Screenshot of the stage:

See the starter project Fish Chomp using this link: https://scratch.mit.edu/projects/10859244/
How can you make the ghost change direction randomly along with its location?

33
Unit - INTRODUCTION TO GOOGLE SHEETS
4.1. INTRODUCTION

Google Sheets allows you to organize, edit, and analyze different types of information using spreadsheets.
In this lesson, you'll learn about the different ways you might use spreadsheets and how to navigate the
Google Sheets interface. You'll also learn the basic ways to work with cells and cell content, including how
to select cells, insert content, and copy and paste cells.

Watch the video below to see an overview of Google Sheets - link.

Google Sheets is a web-based spreadsheet application that allows you to store and organize different
types of information, much like Microsoft Excel. While Google Sheets does not offer all of Excel's advanced
features, it's easy to create and edit spreadsheets ranging from the simple to the complex.

While you might think spreadsheets are only used by certain people to process complicated numbers and
data, they can actually be used for a variety of everyday tasks. Whether you're starting a budget, planning a
garden, or creating an invoice or just about anything else you can think of, spreadsheets are a great way to
organize information.

➢ You can use spreadsheets to :


○ Organize a field trip
○ Plan a budget
○ Gather contact information
○ Calculate statistics
○ Manage data
○ Create invoices

The Google Sheets interface:

In order to use and edit spreadsheets, you will need to become familiar with the Google Sheets interface.

34
A Navigate to Google Sheets Home Screen
- Click this icon to navigate back to your Google Sheets homepage.

B Formula Bar
- You can use the formula bar to enter and edit data, functions, and
formulas for a specific cell.

C Cell
- Each rectangle in a spreadsheet is called a cell. A cell is the intersection
of a row and a column. Click to select a cell. Cell A1 is selected in this
example.

D Row
- A row is a group of cells that runs horizontally from side to side. Rows
are identified by numbers. Row 9 is selected in this example.

E Sheets Toolbar
- Every spreadsheet can have multiple sheets. Select the sheet tabs to
navigate among sheets, and click the plus sign (+) to add a new sheet.

F Spreadsheet Title
- By default, any new spreadsheet is named Untitled Spreadsheet. Click
the title to rename the spreadsheet.

G Toolbar Menu
- You can use the toolbar menu options to edit and modify your
spreadsheet in various ways. Click a menu and select the desired action
from the drop-down list.

H Shortcut Toolbar
- This toolbar provides convenient shortcut buttons for formatting the
data in your spreadsheet, like font size, text alignment, and text color.

I Column
- A column is a group of cells that runs vertically from top to bottom.
Columns are identified by letters. Column C is selected in this example.

J Saved Changes Notification


- Google Sheets automatically saves your changes as you work. The
saved changes notification lets you know your spreadsheet has been
saved.

K Collaboration Options
- Collaboration options allow you to share your spreadsheet with others
and make comments as you work.

Steps to create a new Google spreadsheet:

1. While viewing your Google Drive, click New and select Google Sheets from the drop-down menu.

35
2. The spreadsheet will appear in a new browser tab.

3. To name your spreadsheet, locate and select Untitled spreadsheet at the top of the page. Type a
name for your spreadsheet, then press Enter on your keyboard.

4. Your spreadsheet will be renamed.

36
5. Whenever you need to view or edit your spreadsheet, you can access it again from your Google Drive,
where it will be saved automatically.

★ You may notice that there is no save button. This is because Google Drive uses autosave, which
automatically and immediately saves your files as you edit them.

4.2. CELL BASICS

Every spreadsheet is made up of thousands of rectangles, which are called cells. A cell is the intersection of

37
a row and a column. Columns are identified by letters (A, B, C), while rows are
identified by numbers (1, 2, 3).

Each cell has its own name—or cell address—based on its column and row. In this example, the selected
cell intersects column C and row 10, so the cell address is C10. Note that a cell's column and row
headings become darker when the cell is selected.

You can also select multiple cells at the same time. A group of cells is known as a cell range. Rather than a
single cell address, you'll refer to a cell range using the cell address of the first and last cells in the cell
range, separated by a colon. For example, a cell range that included cells A1, A2, A3, A4, and A5 would be
written as A1:A5.

In the images below, two different cell ranges are selected:

A. Cell range A2:A8

B. Cell range A2:B8

38
Understanding cell content

Any information you enter into a spreadsheet will be stored in a cell. Each cell can contain several different
types of content, including text, formatting, formulas, and functions.

➢ Text: Cells can contain text, such as letters, numbers, and dates.

➢ Formatting attributes: Cells can contain formatting attributes that change the way letters, numbers,
and dates are displayed. For example, percentages can appear as 0.15 or 15%. You can even
change a cell's background color.

➢ Formulas and functions: Cells can contain formulas and functions that calculate cell values. In our
example, SUM(B2:B8) adds the value of each cell in cell range B2:B8 and displays the total in cell B9.

39
A. To select cells:

To input or edit cell content, you'll first need to select the cell.

1. Click a cell to select it.


2. A blue box will appear around the selected cell.

★ You can also select cells using the arrow keys on your keyboard.

B. To select a cell range:

Sometimes you may want to select a larger group of cells, or cell range.

1. Click and drag the mouse until all of the cells you want to select are highlighted.
2. Release the mouse to select the desired cell range.

C. To insert cell content:

1. Select the desired cell.

40
2. Type content into the selected cell, then press Enter. The content will appear in the cell and
the formula bar. You can also input content into and edit cell content in the formula bar.

D. To delete cell content:

1. Select the cell you want to delete.


2. Press the Delete or Backspace key on your keyboard. The cell's contents will be deleted.

41
E. To copy and paste cells:

It's easy to copy content that is already entered into your spreadsheet and paste this content to other
cells.

1. Select the cells you want to copy.


2. Press Ctrl+C (Windows) or Command+C (Mac) on your keyboard to copy the cells.

3. Select the cell or cells where you want to paste the cells. The copied cells will now have a box
around them.

42
4. Press Ctrl+V (Windows) or Command+V (Mac) on your keyboard to paste the cells.

F. To copy and paste cells:

Unlike copying and pasting—which duplicates cell content—cutting and pasting moves content
between cells.

1. Select the cells you want to cut.

43
2. Press Ctrl+X (Windows) or Command+X (Mac) on your keyboard to cut the cells. The cell
content will remain in its original location until the cells are pasted.
3. Select the cell or cells where you want to paste the cells.

4. Press Ctrl+V (Windows) or Command+V (Mac) on your keyboard to paste the cells.

44
★ There may be times when you want to copy and paste only certain parts of a cell's content. In these
cases, you can use the Paste Special option. Click Edit in the toolbar menu, hover the mouse over
Paste Special, and select your desired paste option from the drop-down menu.

G. To drag and drop cells:

45
Rather than cutting and pasting, you can drag and drop cells to move their
contents.

1. Select a cell, then hover the mouse over an outside edge of the blue box. The cursor will turn
into a hand icon.

2. Click and drag the cell to its desired location.

3. Release the mouse to drop the cell.

46
H. Autofill content in multiple cells:

There may be times when you want to copy the content of one cell to several other cells in your
spreadsheet. You could copy and paste the content into each cell, but this method would be time
consuming. Instead, you can use the fill handle to quickly copy and paste content from one cell to
any other cells in the same row or column.

1. Select the cell you want to use. A small square—known as the fill handle—will appear in the
bottom-right corner of the cell.
2. Hover the mouse over the fill handle. The cursor will change to a black cross.

3. Click and drag the fill handle over the cells you want to fill. A dotted black line will appear
around the cells that will be filled.

47
4. Release the mouse to fill the selected cells.

I. Using the fill handle to continue a series:

The fill handle can also be used to continue a series. Whenever the content of a row or column
follows a sequential order—like numbers (1, 2, 3) or days (Monday, Tuesday, Wednesday)—the fill
handle will guess what should come next in the series. In our example below, the fill handle is used to
extend a series of dates in a column.

48
4.3. EXERCISES

Try this challenge...

1. Open Google Sheets and create a new blank spreadsheet.


2. Change the spreadsheet title from Untitled Spreadsheet to Practice Spreadsheet.
3. In cell A1, type the date using the format M/D/YY (for example, 5/30/17).
4. Use the fill handle to place dates in cells A1:A10.
5. Use drag and drop to move the dates to cells B1:B10.
6. Delete the content in cell B5.
7. When you're finished, your spreadsheet should look something like this:

4.4. MODIFYING COLUMNS, ROWS, AND CELLS

By default, the cells of every new spreadsheet are always the same size. Once you begin entering
information into your spreadsheet, it's easy to customize rows and columns to better fit your data.

In this section, you'll learn how to change the height and width of rows and columns, as well as how to
insert, move, delete, and freeze them. You'll also learn how to wrap and merge cells.

Watch the video below to learn more about modifying cells in Google Sheets - link.

49
4.4.1. Working with columns, rows, and cells

Every row and column of a new spreadsheet is always set to the same height and width. As you begin to
work with spreadsheets, you will find that these default sizes are not always well-suited to different types of
cell content.

A. To modify column width:


In our example below, some of the content in column B is too long to be displayed. We can make all
of this content visible by changing the width of column B.

1. Hover the mouse over the line between two columns. The cursor will turn into a double arrow.

2. Click and drag the column border to the right to increase column width. Dragging the border
to the left will decrease column width.

3. Release the mouse when you are satisfied with the new column width. All of the cell content is
now visible.

50
B. To autosize a column's width:
The autosizing feature will allow you to set a column's width to fit its content automatically.

1. Hover the mouse over the line between two columns. The cursor will turn into a double arrow.
2. Double-click the mouse.

3. The column's width will be changed to fit the content.

51
C. To modify row height:
You can make cells taller by modifying the row height. Changing the row height will create additional
space in a cell, which often makes it easier to view cell content.

1. Hover the mouse over the line between two rows. The cursor will turn into a double arrow.

2. Click and drag the row border down to increase the height. Dragging the border up will
decrease the row height.

52
3. Release the mouse when you are satisfied with the new row height.

D. To modify all rows or columns:


Rather than resizing rows and columns individually, you can modify the height and width of every row
and column in a spreadsheet at the same time using the Select All button. This method allows you to
set a uniform size for the spreadsheet's rows and columns. In our example, we'll set a uniform row
height.

1. Click the Select All button just below the formula bar to select every cell in the spreadsheet.

53
2. Hover the mouse over the line between two rows. The cursor will turn into a double arrow.
3. Click and drag the row border to modify the height.

4. Release the mouse when you are satisfied with the new row height for the spreadsheet.

54
4.4.2 Inserting, deleting, and moving rows and columns
After you've been working with a spreadsheet for a while, you may find that you want to add new columns or
rows, delete certain rows or columns, or even move them to a different location in the spreadsheet.

A. To insert a column:
1. Right-click a column heading. A drop-down menu will appear. There are two options to add a
column. Select Insert 1 left to add a column to the left of the current column, or select Insert
1 right to add a column to the right of the current column.

2. The new column will be inserted into the spreadsheet.

55
B. To insert a row:
1. Right-click a row heading. A drop-down menu will appear. There are two options to add a
row. Select Insert 1 above to add a row above the current row, or select Insert 1 below to
add a column below the current row.

2. The new row will be inserted into the spreadsheet.

56
C. To delete a row or column:
It's easy to delete any row or column you no longer need in your spreadsheet. In our example, we'll
delete a row, but you can delete a column in the same way.

1. Select the row you want to delete.

2. Right-click the row heading, then select Delete row from the drop-down menu.

57
3. The rows below the deleted row will shift up to take its place. In our example, row 8 is now
row 7.

★ There's a difference between deleting a row or column and simply clearing its contents. If you want
to remove the content of a row or column without causing the others to shift, right-click a heading,
then select Clear row or Clear column.

58
D. To move a row or column:
Sometimes you may want to move a column or row to make it more accessible in your spreadsheet.
In our example, we'll move a column, but you can move a row in the same way.

1. Select the column you want to move, then hover the mouse over the column heading. The
cursor will become a hand icon.

2. Click and drag the column to its desired position. An outline of the column will appear.

3. Release the mouse when you are satisfied with the new location.

59
4.5. WRAPPING TEXT AND MERGING CELLS

Whenever you have too much cell content to be displayed in a single cell, you may decide to wrap the text
or merge the cell rather than resize a column. Wrapping the text will automatically modify a cell's row height,
allowing the cell contents to be displayed on multiple lines. Merging allows you to combine a cell with
adjacent empty cells to create one large cell.

A. To wrap text:
1. Select the cells you want to wrap. In this example, we're selecting cell range C3:C10.

2. Open the Text wrapping drop-down menu, then click the Wrap button.

3. The cells will be automatically resized to fit their content.

60
B. To merge cells:
1. Select the cells you want to merge. In this example, we're selecting cell range A1:C1.

2. Select the Merge cells button.

3. The cells will now be merged into a single cell.

61
★ To unmerge a cell, click the drop-down arrow next to the Merge cells button, then select Unmerge
from the drop-down menu.

4.6. FREEZING ROWS AND COLUMNS


When working with large spreadsheets, there will be times when you'll want to see certain rows or columns
all the time, especially when using header cells as in our example below. By freezing rows or columns in
place, you'll be able to scroll through your spreadsheet while continuing to see the header cells.

A. To freeze a row:
1. Locate the row or rows you want to freeze. In this example, we'll freeze the top two rows.
Note: You do not need to select the rows you want to freeze.

62
2. Click View in the toolbar. Hover the mouse over Freeze, then select the desired number of
rows to freeze from the drop-down menu.

3. The top two rows are frozen in place. You can scroll down your worksheet while continuing to
view the frozen rows at the top.

B. To freeze a column:
1. Locate the column or columns you want to freeze. In this example, we'll freeze the leftmost

63
column. Note: You do not need to select the columns you want to
freeze.

2. Click View in the toolbar. Hover the mouse over Freeze, then select the desired number of
columns to freeze from the drop-down menu.

3. The leftmost column is now frozen in place. You can scroll across your worksheet while
continuing to view the frozen column on the left.

64
★ To unfreeze rows, click View, hover the mouse over Freeze, then select No rows. To unfreeze
columns, click View, hover the mouse over Freeze, then select No columns.

4.7. EXERCISES

Try this challenge…

1. Open the Google Sheet shared by your teacher in Schoology.


2. Change the row height of all of the rows to be smaller.
3. Merge cells A1:I1.
4. Insert a row below row 11 and type your name in the first cell.
5. Delete row 7. This row contains the name Ben Mathis.
6. Insert a column between columns G and H and type Total Quantity as the column header.
7. Select cells A2:J2, change them to wrap text, and center align them.
8. Freeze the top two rows.
9. Apply fill colour and/or modify the font colour to make the headings look different.

65
10. When you're finished, your spreadsheet should look something like
this:

4.8. FORMATTING CELLS

After you've added a lot of content to a spreadsheet, it can sometimes be difficult to view and read all of your
information easily. Formatting allows you to customize the look and feel of your spreadsheet, making it
easier to view and understand.

In this section, you'll learn how to modify the size, style, and colour of text in your cells. You will also learn
how to set text alignment and add borders and background colours to your cells.

Every cell in a new spreadsheet uses the same default formatting. As you begin to build a spreadsheet, you
can customize the formatting to make your information easier to view and understand. In our example, we
will be using a spreadsheet to plan and organize a garden plot.

Watch the video below to learn the basics of formatting cells- link.

A. To change the font size:


Modifying the font size can help call attention to important cells and make them easier to read. In our
example, we will be increasing the size of our header cells to help distinguish them from the rest of
the spreadsheet.
1. Select the cell or cells you want to modify.

66
2. Locate and select the Font Size button in the toolbar, then choose the desired font size from
the drop-down menu. In our example, we will choose 14 to make the text larger.

3. The text will change to the new font size.

B. To change the font:


Choosing a different font can help to further separate certain parts of your spreadsheet—like the

67
header cells—from the rest of your information.

1. Select the cell or cells you want to modify.


2. Locate and select Format in the toolbar menu.
3. Hover the mouse over Font, then select a new font from the drop-down menu. In our example,
we'll select Georgia.

4. The text will change to the new font.

C. To change the text colour:


1. Select the cell or cells you want to modify.
2. Locate and select the Text color button in the toolbar.

3. A drop-down menu of different text colours will appear.


4. Select the colour you want to use. In our example, we'll select red.

68
5. The text will change to the new colour.

D. To make text bold:


1. Select the text you want to modify.
2. To bold text, click the Bold text button or press Ctrl+B (Windows) or Command+B (Mac) on

your keyboard.
3. The text will change to bold.

69
★ Press Ctrl+I (Windows) or Command+I (Mac) on your keyboard to add italics. Press Ctrl+U (Windows)
or Command+U (Mac) to add underlining.

4.9. TEXT ALIGNMENT


By default, any text entered into your spreadsheet will be aligned to the bottom-left of a cell. Any numbers
will be aligned to the bottom-right of a cell. Changing the alignment of your cell content allows you to
choose where the content will appear.

A. To modify the horizontal text alignment:


1. Select the text you want to modify.

70
2. Click the Horizontal align button in the toolbar, then select the desired alignment from the
drop-down menu.

3. The text will realign.

B. To modify the vertical text alignment:


1. Select the text you want to modify.
2. Click the Vertical align button in the toolbar, then choose the desired alignment from the
drop-down menu.

71
3. The text will realign.

★ You can apply both vertical and horizontal alignment settings to any cell.

4.10. CELL BORDERS AND BACKGROUND COLOURS


Cell borders and background colours make it easy to create clear and defined boundaries for different
sections of your spreadsheet.

A. To add cell borders:


1. Select the cell or cells you want to modify.

72
2. Select the Borders button and choose the desired border option
from the drop-down menu. In our example, we'll choose to display all cell borders.

3. The new cell borders will appear.

B. To change the fill colour:


It's easy to change the background colour of any cell, which is known as the fill colour.

1. Select the cell or cells you want to modify.


2. Locate and select the Fill colour button from the toolbar.

3. Select a colour from the drop-down menu. In our example, we'll choose blue.

73
4. The new fill colour will appear.

4.11.EXERCISES

Try this challenge...

1. Open the Google sheet in the Schoology assignment.


2. Select cells A1:E6. Change the horizontal alignment to center and the vertical
alignment to middle.
3. Select cells B3:E3. Bold the text and add an outside border.
4. Select the merged cell in row 1 and change the font to something other than Arial.
5. With the cell still selected, change the font size to 18 pt and bold the text.
6. For the same cell, change the fill colour to purple and the font colour to white.
7. When you're finished, your spreadsheet should look something like this:

74
Unit - READ ONLY MEMORY

5.1 INTRODUCTION

Memory is an important aspect of computers. Computer users can save information, programs etc using
memory. Memory can be either volatile, like RAM (random access memory) which means anything stored in it
will disappear when the power is turned off or if the computer crashes. Or it can be non-volatile, like ROM
(read-only memory), which means the information will not disappear when the power is turned off or the
computer crashes. A computer needs both RAM and ROM to operate, and how fast the computer can get to
the memory and use what's in it is a factor in the speed of your machine. Beyond this, a computer also
needs secondary storage, mainly in the form of a hard disk in order to save information that the user wants.

In this unit, let us understand ROM and its types.


As the name suggests, read-only memory, or ROM, stores information that can only be read. Modifying it is
either impossible or very difficult. ROM is also a type of non- volatile storage, which means that the
information is maintained even if the component loses power. The data in ROM cannot be modified, or only
with great difficulty, since these instructions do not need to be changed very often.

5.2 TYPES OF ROM

The following types of ROMs are listed below:

PROM: Short for Programmable Read Only Memory, a memory chip on which
data can be written only once. Once a program has been written onto a PROM,
it remains there forever. The difference between a PROM and a ROM (read only
memory) is that a PROM is manufactured as blank memory, whereas a ROM is
programmed during the manufacturing process. To write data onto a PROM
chip, you need a special device called a PROMprogrammer or PROM burner.
The process of programming a PROM is sometimes called burning the PROM.

EPROM: Acronym for Erasable Programmable Read Only Memory, and


pronounced e-prom, EPROM is a special type of memory that retains its
contents until it is exposed to ultraviolet light. Ultraviolet light clears its
contents, making it possible to reprogram the memory. Erasure can be
achieved using X-rays.

EEPROM: Short form of Electrically Erasable Programmable Read-Only


Memory. EEPROM is a special type of PROM that can be erased by exposing it
to an electrical charge. Like other types of PROM, EEPROM retains its contents
even when the power is turned off. Also like other types of ROM, EEPROM is
not as fast as RAM.

75
5.3 USES OF ROM

ROM finds its usages in embedded systems. An embedded system is an electronic system, which includes a
single chip microcomputer (Microcontrollers). It is configured to perform a specific dedicated application.
Software is programmed into the ROM of the single chip computer. Digital camera, Microwave Oven, MP3
player, automobile anti lock brake system etc are examples of embedded systems.

5.4 BASIC INPUT OUTPUT SYSTEM

5.5 EXERCISES

A. Expand these acronyms:


1. ROM
2. RAM
3. PROM
4. EPROM
5. EEPROM

76
B. Answer the following:
1. What are the different types of ROM you know?
2. What do you understand about volatile and non-volatile memory? Give examples.
3. Write two uses of ROM.

77
Unit - INTRODUCTION TO FLOWCHARTS AND PYTHON

6.1 INTRODUCTION

Have you ever had a problem that needed to be solved? It could be a simple problem like what shoes
to wear or a Math problem like 23 * 8 + 45 /5.

How do we solve problems?


If it is a real-life problem like what shoes to wear, we think back and list the various shoes and choose
one best suited. So, we list the possible solutions and decide on the most suitable one.
If it is a Math problem, then there is only one answer. We can solve the problem given above step by
step. But we need to remember our BODMAS rule to solve it.

Step 1: 23 * 8 = 184

Step 2: 45/5 = 9

Step 3: 23*8 + 45/5 = 184 + 9 = 193.

We arrived at this solution by following a sequence of steps. When we give instructions to a computer, we
need to give the sequence of steps for a problem to be solved. This is called an algorithm.

Flowcharts are graphical representations of an algorithm. Flowcharts are easier to understand as the flow of
sequence is easily understood. Before we draw a flowchart, we need to know that there are different boxes
for different kinds of instructions.

6.2 FLOWCHART SHAPES AND FUNCTIONS

78
6.3 EXAMPLES OF FLOWCHARTS

Example 1: Flowchart that takes two numbers from user and adds them and gives the result:

In the above example a specific set of numbers is given (12, 15). But this flowchart can be used for any two
numbers if we modify the input box to say -

A and B are similar to boxes which hold numbers. At the time of calculation, A will have a number in it and B
will have another number in it.

79
Conditional Flowchart

A conditional flowchart checks whether a condition is met. If the condition is true or met, then a specific
action is action, if the condition is not met, another action is taken.

Let us now draw a flowchart that compares any two numbers and displays the larger number.

6.4 EXERCISES

1. Write an algorithm that finds the average of any 3 numbers.

2. Create a flowchart that decides if you can go out with friends on Saturday. Check for conditions like
parents’ approval, timings, school working or not working etc.

3. Create a flowchart to calculate the area of a square and a rectangle. Try adding a menu that lets the
user choose between square and rectangle.

6.5 INTRODUCTION TO PYTHON

Python is an easy-to-use, free programming language. A programming language is a way of communication


with the computer. A program is a set of instructions given to the computer to achieve a result.

Python is a popular high-level language. This means that the set of instructions written in it are English-like
statements that can be easily understood by both us and the computer. These lines of instructions are known
as code lines.

We start Python by double clicking on the Python shortcut icon on the desktop or on the taskbar .
You can also use Cortana to search for IDLE and open it.

80
Python IDLE stands for Integrated Development and Learning Environment. Python IDLE is the interactive
mode of Python where we type program commands one line (or one block of code) at a time. This line of code
gets executed instantly and the output is displayed on the IDLE.

Python IDLE:

Commands in IDLE:

Take a look at the code lines given in IDLE. The first 2 lines are numerical calculations and Python returns an
answer as soon as we type the statement and press enter. The next 2 statements are print functions.
The print function in Python helps us display things. If you want to print some text like the example given
above, you put the text within quotes. Python allows both single as well as double quotes for inputting text.

If you want to print a numeric value, then do not use quotes. Observe the IDLE screen shown below:

81
The first print statement causes 10 to be printed. Since it is a number, we do not use quotes while printing it.
The second print statement prints text. So, we need to use quotes.
The third print statement uses a combination of number and text. We use a comma to separate the number and
text here.
The fourth print statement uses double quotes at the beginning of text and single quotes at the end. This
causes Python to return an error. You can see that an error is returned by Python (line in red). Let us correct this
error by matching the single quote at the end with one at the beginning.

6.6 SCRIPT MODE IN PYTHON

So far, we have seen how the interactive mode of Python works. It processes the instructions we give one line
at a time and displays the answer. But what if we want to save all the lines of code for later use? Or if we want
multiple lines of code to be processed and output displayed together? We cannot use the interactive mode in
order to achieve this. We need to use Script mode.

A script in Python is a set of code that is saved as a file. The extension for a Python script file is .py. A script is
also known as a module or a program. To create a new script/program/module in Python:
1. Click on File in IDLE.
2. Click on New File.

The New File that opens is a text editor and looks like this:

82
Notice that the line of code that you see in this example starts with the hash symbol (#). This indicates to
Python that it is a comment that the programmer has made. Comment lines are not executed by Python.

Let us complete our program to add 15 and 30 in Python script mode:


Type this line of code under the comment statement:
print ('The sum of 15 and 30 is' , 15+30)
Next, we need to execute this program and see the output. We can execute a program by following these
steps:
Click on Run and select Run Module.

You will see a dialog box open that asks you to save your program first. Give a suitable name for the program
and save it.

83
IDLE pops up with the output:

Every time we run a module, Python shell (IDLE) is restarted.

6.7 PYTHON FUNDAMENTALS

A. Character Set
Any spoken language has its own set of characters which is recognised by the language. In the same manner,
Python allows a set of characters to be used. This is known as its character set.
- Letters: A-Z, a – z are the alphabets that can be used as part of the character set.
- Digits: 0 to 9
- Special Symbols: +, -, *, /, %, _, !, >, <, ( ), [ ], { } etc
- Whitespaces: Blank space, tabs etc.

B. Tokens – Tokens are the smallest units of a program. Python has the following tokens:
1. Keywords
2. Identifiers
3. Literals

84
4. Operators
5. Punctuators

C. Keywords – These words convey a special meaning to Python. They are reserved for performing special
tasks and cannot be used by the user.
Some examples of keywords include: and, or, not, in, try, raise, print etc. Look at the example given below.
Python raises an error when we try to use a keyword to assign a value.

D. Identifiers – Identifiers are names given to variables. Let us first understand the term variable. A variable
points to a value that may change when a program runs. Imagine if you want to write a program that adds 2
numbers and displays the result. To be able to write such a program, we make use of variables. (Note: In
Python, variables do not store a value but point to a value.)
Any name we give to variables is known as identifier.

In this example, a and b are identifiers.

E. Literals - Constants or Literals are values that do not change during program run. Examples of constants
would be Number_days_week = 7. Here the number of days in a week is always 7 and this value will not
change during program run.

F. Operators – There are many types of operators in Python. This unit will discuss arithmetic and relational
operators. Operators cause some type of result to be produced on a set of variables and or constants.

F.1 Arithmetic operators:


Arithmetic operators are used for numerical calculations.

A+ B Addition operation

A-B Subtraction operation

A*B Asterisk is used to denote the multiplication operation

A/B Forward slash is used to denote division operation. Gives the quotient when A is
divided by B.

Division when A and B are integers:


When we have 2 integers, then the answer for division is also an integer (in
Python 2.7). Ex: 5/2 gives 2 instead of 2.5. 10/3 gives 3 instead of 3.3333.
If any of the variables is float, then the answer is in float. Ex: 5.0/2 gives 2.5.

85
A%B % operator is known as the modulo operator and gives the remainder when A is
divided by B.

F.2 Relational Operators: Relational operators are used when we need to compare two quantities.

A>B Checks if A is greater than B

A<B Checks if A is less than B

A == B Checks if A is equal to B. == operator is different from = operator. = is used for


assigning a value to a variable. == is used for checking if 2 values are equal.

A >= B Checks if A is greater than or equal to B

A <= B Checks if A is less than or equal to B

A != B Checks if A is not equal to B.

G. Punctuators – Punctuators or separators separate one part of code from another. We use a comma
punctuator to separate the text part from the variable part. Python also uses other separators such as dot (.),
colon ( : ) etc. Look at the example given below for use of comma punctuator.

Here, the text part is separated from the number part using commas.

H. Data types in Python


We have already seen two types of data: Text and Number. There are many data types in Python. In this unit,
we will learn about 4 data types: integer, float, string and Boolean.

86
6.8 PRACTICE EXERCISE IN IDLE
Type the given commands in IDLE and note down the output given by Python. Write the reason for getting that
output.

Command Output Reason

print (‘Hello World’)

print (‘What’s the next step?’)

print (“What’s the next step?”)

A = 3.4

A = 2 + 3.0
print (A)

9/4

9/4.0

9.0/2

B=A
B=3
B == A

87
12 % 7

12.0%7

‘red’ + ‘red’ + ‘red’

‘red’*3

‘Red’ * ’3’

print (31, ‘is a prime number’)

print (‘31’ + ‘is a prime number’)

print (‘red’)
print (‘green’)
print (‘blue’)

print (‘red’ , ‘green’, ‘blue’)

6.9 USER INPUT IN PYTHON

Until now, we have used numbers directly or used variable assignment to give values to variables. In the
addition example, we used variables a and b that pointed to values 13 and 16. But we may not always want to
add these numbers. Each time we run the program, we may want to use another pair of numbers for a and b.
So, how can we write a program that will allow the user to input any pair of values?
We use input( ) function to accept user value. Observe the example given below:

Output seen in IDLE:

input() accepts any value input by the user and assigns it to the variable on the left hand side. The text that
appears inside input() is the prompt given to the user. If you want to ask the user to input his name, then the
prompt can be ‘Enter your name ‘.
Note: input() accepts any input given by the user as string (text) value. But numbers are not text. If we want to
accept numbers, we need to use an additional function outside the input().

88
If the user has to input an integer, we use int() which encloses input(). If the user has to
input decimal fractions, we use float().

Note: A comma separator in the print function adds a space automatically in output. In input(), we need to put
an extra space when typing our prompt so that there is a space seen when the prompt appears in IDLE.

6.10 PROGRAMMING EXERCISES


1. Write a program to accept 2 numbers of float data type and find their product.
2. Write a program to accept 2 numbers and print the quotient when number 1 is divided by number 2.
3. Write a program to accept the length and breadth of a rectangle and find the area and perimeter.
4. Write a program to accept side measurement of a square and print its area and perimeter.
5. Write a program to accept name, age and class from the user and display the same.

6.11 IF STATEMENTS IN PYTHON

If statement checks if a condition is true. We have already seen how conditions can be checked in the
Algorithms and Flowcharts unit. When a condition is true, one branch of the program gets executed. Otherwise,
another branch of the program gets executed. In Python, If statements form a block of statements. (A block is a
set of statements which are executed as a unit.)

Syntax for a simple IF statement:


In this case, a condition is tested. If it is true, then a code block is executed.
if <condition to be tested>:
<statements to be executed>

Notice that the statements to be executed are indented. Python automatically indents statements when it reads
the colon separator. Colon separator indicates the beginning of a code block.

Using simple IF statement: The program given below checks if the integer entered is positive. We will get an
output only for positive integers.

Output for the program:

But wouldn’t it be more informative if we had an output when the entered number is not positive? We need an
IF-ELSE block in order to achieve this.

Syntax for IF-ELSE Statement:


if <condition to be tested>:
<statements to be executed if condition is true>

89
else:
<statements to be executed if condition is not true>

Using IF-ELSE Statement:


Let us add the ELSE clause in our program to find if an integer is positive. If it is not positive, we will display an
output that says number is not positive.

Output for this program:

6.12 EXERCISES
A. Write Programs:
1. Write a program that accepts a number and checks if it is even.
2. Modify the previous program to check if a number is even or odd.
3. Write a program that accepts 2 numbers and prints the larger number.
4. In the previous program, what happens if both the numbers are equal? Justify your answer.
5. Write a program to accept two string values and print the ‘smaller’ string. How do you think the
comparison takes place?

B. Answer the following.


1. A Python program has __________ file extension.
2. We click on __________ tab to copy statements.
3. We can save a Python program by clicking on _________ menu option.
4. __________________ is also known as Python shell.
5. _______________ is a set of computer understandable instructions.
6. The ______________ set in Python is the set of allowed symbols, alphabets and numbers.
7. ______________ are the smallest units of a Python program.

C. Describe these terms:


1. print
2. input()
3. int()

D. Answer the following.


1. What is Python?
2. When do we use relational operators? When do we use arithmetic operators?
3. What is the syntax for IF statement in Python?

90
4. How do we execute a program in Python?
5. What are punctuators?
6. What is a variable?

E. Practical work

1. Write a program that accepts three numbers from the user and calculates the average. (Average of 3
numbers = sum /3)
2. Write a program that accepts two numbers and displays the smaller number.
3. Write a program to check if a number is divisible by 5.
4. Write a program that takes 1 or 2 from the user. If 1 is chosen, then the program accepts radius and
calculates the area of a circle. If 2 is chosen, then length is accepted to calculate the area of the square.
5. Write a program to accept age from the user and find if the user is eligible to vote in India.
6. Write a program to accept marks from the user in 3 subjects (English, Math, and Science). Find the
average of the three subjects. Also, check if the user has passed in the exam based on his average. (If
average marks >= 50, display “Pass” otherwise display “Work hard”)

91
Unit - Computer Malware

7.1. WHAT IS COMPUTER MALWARE?

You get sick because of a virus, tiny germs that multiply from person to person, infecting them too. A computer
virus works in a similar manner. Instead of living germs, these are computer programs that are designed by
criminals. These programs are made such that if they infect one computer, then they will infect others in the
network or move to other computers through email attachments. Computer viruses can cause extensive
damage to the data stored in a system and we need to understand how to identify if a computer is infected and
what measures need to be taken to prevent / retrieve data.

Malware is a general term for any piece of software that has malicious intent. Malware comes from the words -
malicious software. There are several types of malware and each of them has a unique way of gaining access
to your computer which may include attempts at gaining unauthorized control of your computer system,
stealing your personal information, encrypting (convert into unreadable form) your important files, or causing
other harm to your computer. Sometimes the damage can be irrevocable.

7.2. TYPES OF MALWARE

The different types of malware you should be aware of are:

1. Bugs
2. Worms
3. Virus
4. Bots
92
5. Trojan Horses
6. Ransomware
7. Adware
8. Spyware

93
7.3. HOW DOES A DEVICE GET INFECTED?

7.4. WHAT HAPPENS WHEN A DEVICE IS INFECTED?

7.5. VIRUSES, WORMS, TROJANS AND RANSOMWARE

Virus: These malicious programs attach themselves to an executable file (in windows, these are the .exe files).
Only if we run the file will the virus be able to corrupt the system. These are usually present in the
downloadable exe files on the internet and enter our systems when we download such a file.

Worms: These programs can replicate themselves and spread from system to system in a computer network
without an action taken by humans.

Trojans: These appear harmless and may even look like a free software that seems very useful or fun. But once
this enters our system, it can steal sensitive data, create a backdoor for the hackers and worms to enter the
device.

Ransomware: Ransomware is a malicious program that holds your system hostage and demands money. It
locks up the device and demands money before it can be unlocked and used again. There is no guarantee that
the device will be unlocked after we pay the money.

94
7.6. HOW TO PREVENT / TAKE PRECAUTIONS AGAINST VIRUS

You can protect your computer system by taking the following measures:

● Use reliable anti-virus software. Set up the anti-virus software such that it scans the system periodically
for malware.
● Update Operating System and system software as and when you get notification. Malware is constantly
evolving and hence keeping the system software updated is important.
● Back up device data regularly
● Ignore pop-ups and use the help of your parent / guardian to block pop ups
● Watch out for download dialogue boxes, especially if you are not planning to download anything
● Only download files from sources that are trustworthy.
● Do not open spam emails.
● If you are unfamiliar with the sender’s address, do not open that email.

7.7. ANTI-VIRUS SOFTWARE

An antivirus software prevents the entry of malicious programs into the computer and in case such a program
has been downloaded, contains the virus and prevents it from damaging the computer.

7.8. IT ACT 2000

Building malicious programs is a crime and is unethical. This is an example of misuse of technology. More often
than not, we are enticed by free products and apps. If we choose to download a questionable app just because
it is a free version of a paid app, then we are misusing technology too and this is an unethical behaviour.

Installing spyware in another person’s computer, attaching a virus infected file to an email etc are all crimes.
The IT Act 2000 in India is the main law that deals with cyber crime.
The Information Technology Act 2000 defines cyber crimes and prescribes penalties for them.

7.9 EXERCISES

Answer the following questions:

1. What is Computer malware?


2. How does malware affect a device? Give two examples.
3. How can we remove malware from an infected device?

95
4. What happens to a device when it is infected?
5. How does the IT ACT 2000 help?

96
DESIGN THINKING PRINCIPLES

What is Design Thinking?

It is a way to think and solve problems. The first step in Design Thinking is to Empathize. Empathizing means to
care. Consider this information on Food wastage in India: According to the Food Waste Index Report 2021, 50
kilos of food is thrown away per person every year in Indian homes. This excess food waste usually ends up in
landfills, adding to greenhouse gas emissions and resulting in global warming.

In order to Empathize, we need to conduct interviews and talk to relevant people.Speaking to people who work
in the food industry, people who rely on day to day wages to buy food, people who have large families and so on
will give us an idea about how people buy food, how much food is being wasted, how does weather affect food
storage, why etc.

Here is an example of interview highlights:

Name of Interviewee 1: Ms. Latha, restaurant owner

What issues were highlighted by Ms. Latha?

The number of people coming into the restaurant varies from day to day and there is no way to anticipate how
many people will come to the restaurant for a meal in a precise manner.
Food prep has to be done well in advance. People also expect fresh ingredients to be used in their meal. So
sometimes, cut vegetables, rice etc are thrown away or given to staff. Apart from this there is food wastage by
the customers too. They may order many items but not eat most of it. This is thrown away.

Name of Interviewee 2: Mr. Robert, member of a joint family

What issues were highlighted by Mr. Robert?

97
Mr. Robert lives with his brother’s family and his parents. Twelve members live in the household. A food budget
is drawn up every month, but money is spent again towards the end of the month on food as excess food is
cooked every day and some cooked food is thrown away every day. Money as well as food is being wasted
mainly because it is difficult to plan meals for a large family with members wanting to eat different types of food.

When you Empathize, you will identify a problem within the theme that you would want to solve. For the Food
Wastage theme, we can come up with problems such as these:

● How can we help families reduce food wastage on a day to day basis?
● How can we create better food storage facilities for poor people?

This step is called Defining the problem. The problem should be open ended to allow us to explore multiple
solutions.

Once you have a problem that you want to solve,you should think of all the different ways to solve the problem.
This is called Ideating (or coming up with ideas). When you are ideating, it’s okay to think of crazy ideas. No idea
is wrong!

Below is an example of a problem and ideas for solving the problem.

Problem: How can we help families reduce food wastage on a day to day basis?

Ideas to solve the problem:

● AI powered app to suggest amount of food to be cooked


● Meals on the go! A catering unit that will interview families and cook portion controlled meals for each
member
● Food Saver - a temperature controlled box that can keep cooked food fresh as ever
● IntelloBuy - A special container with an app that allows the customer to buy the same ingredient in the
box only when it is really needed
● Foodonate - An organization that will come and collect extra food from your doorstep and donate to the
needy
● Best Before - A tracker app that checks the expiry date on ingredients at home and gives meal
suggestions using these ingredients.

Prototyping means making a model of your idea so that you can show this to others and talk about this
innovative idea of yours in solving the problem. Here is a sample prototype (only for reference purposes - this is
not an original prototype.)

IntelloBuy - A special container with an app that allows the customer to buy the same ingredient in the box only
when it is really needed. This reduces the food bought and wasted without ever being used.

98
Once you have the prototype ready, show it to the interviewees and talk about the model. Is your idea solving
the problem or are there questions and suggestions from others on how we can improve our solution? This is
how we test if our solution to the problem addresses all the needs of people.

Here is an example of recording feedback about your solution:

Ms. Latha:
The idea of intelligent ordering is great, but what are the sizes of the containers and can these containers be
refrigerated, will it affect the sensors? It would be good to also track the freshness level of the food stored in the
container.

Mr. Robert:
I would love to try a few of these containers at home, especially for the staples such as rice, dal, oil and sugar.

Sometimes, the feedback will make us pause and review our design. Is there something that we are forgetting,
how should we modify this so that the users can benefit the most? So, we Repeat our prototyping and testing
until a final solution is found.

Now that you know what Design Thinking approach is, use the principles in solving a problem with your
teacher’s help.

99

You might also like