ЁЯТ╗
тМия╕П
ЁЯЦ▒я╕П
ЁЯЦея╕П
ЁЯТ╛
тЖР Back to Dashboard
Font Size:

1. Introduction

We have learned that a computer works by following instructions. But who writes these instructions? The answer is a programmer. A programmer writes instructions in a special language that the computer can understand. This process of writing instructions for a computer is called programming.

In this chapter, we will learn what a program is and what programming means. We will study programming languages and how they are different from human languages. We will learn about algorithms and flowcharts, which help us plan our programs. We will also learn basic programming concepts like variables, data types, and control structures. By the end of this chapter, you will be able to write a simple program and draw a flowchart to solve a problem.

2. What is a Program?

A program is a set of instructions given to a computer to perform a specific task. For example, a program can be written to add two numbers, to draw a picture, or to play a game. A computer follows the instructions of a program step by step, exactly in the order they are written.

The process of writing a program is called programming. The person who writes programs is called a programmer.

A program is like a recipe. A recipe tells a cook, step by step, how to make a dish. If we miss a step or change the order, the dish may be wrong. Similarly, a computer follows the steps of a program exactly, and a mistake anywhere will give a wrong result.

Programs are written to solve problems. Before writing a program, we must first understand the problem clearly and plan how to solve it.

3. Programming Languages

Human beings communicate in languages like English and Hindi. A computer understands only machine language, which is made of 0s and 1s. It is impossible for humans to write long programs in 0s and 1s. So, special programming languages were created that are closer to human language.

Programming languages are of two main types:

Low-level languages: These are close to machine language. Machine language and assembly language are low-level languages. They are hard for humans to read and write.

High-level languages: These use English-like words and are easy for humans to understand and write. Examples are Python, Java, C, C++, and Scratch. High-level programs must be translated into machine language with the help of a compiler or interpreter before the computer can run them.

Python is a very popular high-level language and is often the first language students learn. It is easy to read because its commands look like simple English sentences.

4. Algorithms

An algorithm is a step-by-step plan to solve a problem. Before writing a program, we first write an algorithm. An algorithm uses simple steps in plain language, without any computer code.

Let us see an algorithm to add two numbers:

Step 1: Start. Step 2: Take two numbers, A and B. Step 3: Add A and B and store the result in S. Step 4: Show the result S. Step 5: Stop.

An algorithm must have the following qualities:

Algorithms help us think clearly about a problem. A good algorithm always leads to a good program.

5. Flowcharts

A flowchart is a diagram that shows the steps of an algorithm using different shapes and arrows. It helps us see the logic of a program visually, which makes it easier to understand and check.

The main symbols of a flowchart are:

Oval (start/stop): The oval shape shows the beginning (Start) and the end (Stop) of the flowchart.

Rectangle (process): A rectangle shows a processing step, like adding two numbers or moving data.

Parallelogram (input/output): A parallelogram shows where we take input or show output.

Diamond (decision): A diamond shows a decision where the program must choose yes or no.

Arrows: Arrows connect the shapes and show the direction of flow.

For example, a flowchart to check if a number is even has an oval to start, a parallelogram to take the number, a diamond to decide whether the number divided by 2 gives remainder 0, and then output "Even" or "Odd" before the stop oval.

6. Variables and Data Types

In a program, we need a place to store data. A variable is a named storage location in a program where data can be kept and changed. Just as we label a box to keep our toys, we give names to variables to keep data.

A variable has a name, like "age" or "marks", and it stores a value. The value of a variable can change during the program. For example, in the algorithm above, A, B, and S are variables.

Data stored in a program can be of different types, called data types. The common data types are:

Integer: Whole numbers without a decimal point, like 5, -3, or 100.

Float: Numbers with a decimal point, like 3.14 or 9.5.

String: A sequence of characters like a word or sentence, for example "Hello" or "Class 6".

Boolean: A value that is either true or false.

7. Control Structures

A program usually runs its statements one after another from top to bottom. But sometimes we want the program to make decisions or repeat work. For this, we use control structures. The main control structures are:

Sequence: The statements run one after another in order. This is the normal flow of a program.

Decision (if-else): The program checks a condition and does different work depending on whether the condition is true or false. For example, if marks are more than 33, print "Pass", else print "Fail".

Loops (repetition): A loop makes the program repeat a set of instructions several times. For example, we can use a loop to print "Happy Birthday" ten times instead of writing the print command ten times.

Loops save us a lot of typing and make programs shorter. The computer repeats the instructions inside the loop until a condition is met.

8. Introduction to Scratch

Scratch is a visual programming language made for children. In Scratch, we do not type code in words. Instead, we drag and join colourful blocks, like puzzle pieces, to build a program. Each block is an instruction, and joining the blocks creates a script.

In Scratch:

Scratch teaches us the logic of programming in a fun way. When we make a cat move on the stage, we are actually writing a program using blocks.

9. Why Learn Programming?

Learning programming helps us in many ways. It makes us think logically and solve problems step by step. It improves our creativity, because we can create games, animations, and projects. Programming is also used everywhere: in smartphones, games, websites, robots, and even in machines at school and hospital. A person who can program can create new things and find solutions to problems. Programming is not only for future jobs; it helps us think better every day.

Quick Revision Tables

Flowchart Symbol Shape Meaning
Start / Stop Oval Beginning or end of the flowchart
Process Rectangle A processing step
Input / Output Parallelogram Taking input or showing output
Decision Diamond A yes or no decision
Data Type Example
Integer 5, -3, 100
Float 3.14, 9.5
String "Hello", "Class 6"
Boolean true, false

Mind Map

flowchart TD A["PROGRAMMING"] --> B["Program"] A --> C["Languages"] A --> D["Algorithm"] A --> E["Flowchart"] A --> F["Variables and data types"] A --> G["Control structures"] A --> H["Scratch"] B --> B1["Set of instructions"] C --> C1["Low-level and high-level"] C --> C2["Python, Java, C, Scratch"] D --> D1["Step-by-step plan"] E --> E1["Oval, rectangle, diamond"] F --> F1["Integer, float, string, boolean"] G --> G1["Sequence, decision, loops"] H --> H1["Blocks, sprite, stage"]

Important Diagrams (SVG)

Diagram 1: Flowchart to Add Two Numbers

FLOWCHART: ADD TWO NUMBERS START Input A, B S = A + B Process Show S STOP GOLDEN RULE

Diagram 2: Flowchart Symbols

FLOWCHART SYMBOLS START / STOP Oval - start or end PROCESS S = A + B Rectangle - processing Input / Output Show S Parallelogram - I/O DECISION Diamond - yes / no GOLDEN RULE

Common Mistakes

  1. Thinking that a computer can understand high-level languages directly; programs must be translated into machine language first.
  2. Confusing an algorithm with a program; an algorithm is a plan in plain language, while a program is written in a programming language.
  3. Forgetting the Start and Stop in a flowchart; every flowchart must begin and end with an oval.
  4. Confusing the flowchart shapes; the rectangle is for process, the parallelogram for input/output, and the diamond for decisions.
  5. Believing that a program runs only if we memorise code; planning with an algorithm and flowchart always comes first.
  6. Mixing up data types; 5 is an integer, 3.14 is a float, "Hello" is a string, and true is a boolean.
  7. Writing a whole loop again and again; a loop repeats instructions automatically and saves time.

Exam Tips

  1. Memorise the main flowchart symbols: oval (start/stop), rectangle (process), parallelogram (input/output), and diamond (decision).
  2. Know the difference between low-level and high-level languages, with Python and Scratch as high-level examples.
  3. Remember the order of problem solving: understand the problem, write an algorithm, draw a flowchart, then write the program.
  4. Learn the common data types: integer, float, string, and boolean, with one example each.
  5. Know the control structures: sequence, decision (if-else), and loops.
  6. Remember that a variable stores data and its value can change.
  7. Remember that machine language is made of only 0s and 1s.

Conclusion

In this chapter, we were introduced to the wonderful world of programming. We learned that a program is a set of instructions that tells a computer what to do, and a programmer is the person who writes these instructions. We studied programming languages and understood the difference between low-level and high-level languages. We learned how to plan our solution with an algorithm and present it visually with a flowchart. We explored the important concepts of variables, data types, and control structures like decisions and loops. We also had fun learning about Scratch, where we build programs with colourful blocks. Programming teaches us to think logically and solve problems creatively. As we continue to learn, we will be able to create games, animations, and useful programs of our own.