💻
⌨️
🖱️
🖥️
💾
← Back to Dashboard
Font Size:

1. Introduction

Programming is the art of giving instructions to a computer so that it can solve a problem. A computer cannot think on its own; it follows every instruction exactly as given. The set of instructions written to solve a problem is called a program, and the person who writes programs is called a programmer. Before writing a program, a programmer must plan carefully, because the computer will do exactly what is written, not what was meant. The whole process of planning and writing a program is called programming, and it involves understanding the problem, designing a solution, writing the code, testing it, and fixing the errors.

2. Problem Solving Steps

Solving a problem with a computer follows a fixed set of steps. The first step is to understand the problem completely and decide what input is needed and what output is expected. The second step is to plan the solution, which is done by drawing a flowchart or writing pseudocode. The third step is to write the program using a programming language. The fourth step is to test the program with sample data and find errors. The fifth step is to document the program so that other people can understand it. These five steps keep the work organised and reduce mistakes.

3. Algorithms

An algorithm is a step-by-step, ordered sequence of instructions to solve a problem. Every algorithm must have three qualities. It must be definite, which means every step must be clear and have only one meaning. It must be finite, which means it must stop after a limited number of steps. It must be effective, which means each step must actually do something useful. For example, an algorithm to make a cup of tea lists each action in order: boil water, put tea leaves in the cup, pour the water, add sugar, and stir. An algorithm is written in simple language, not in any computer language.

4. Flowcharts

A flowchart is a pictorial representation of an algorithm, using different symbols for different actions. The oval symbol is used for the start and stop of the program. The parallelogram is used for input and output. The rectangle is used for processing steps and calculations. The diamond is used for decisions that give a yes or no answer, and arrows show the flow from one step to the next. A flowchart makes the logic of the program easy to see and easy to explain, and it helps in finding mistakes before the program is written.

5. Pseudocode and Programming Languages

Pseudocode is a mixture of simple English and programming terms that describes the logic of the algorithm, for example "IF marks are more than 40 THEN print PASS". Pseudocode is easier to write than a flowchart and easier to read than a real program. A programming language is a formal language used to write programs that the computer can execute. Languages can be divided into low-level languages, which are close to the machine, and high-level languages, which are close to human language and easier to use, such as Python, Java and BASIC. High-level languages must be translated into machine language before the computer can run them.

6. Variables and Data Types

A variable is a named place in memory where a value is stored, and the stored value can change during the program. In the statement "age = 12", age is the variable and 12 is its value. Variables hold different kinds of data called data types. Integer data stores whole numbers such as 10 or -5. Floating point data stores numbers with a decimal point such as 3.14. Character data stores a single letter or symbol, and string data stores a sequence of characters such as "Hello Class 7". A constant is like a variable, but its value never changes during the program.

7. Control Structures: Sequence, Selection and Loops

Programs control their flow in three ways. Sequence means the instructions run one after another in order, from top to bottom. Selection means the program chooses between different actions using a condition; the IF...THEN...ELSE statement makes a decision, for example IF age is greater than 12 THEN print "Teenager" ELSE print "Child". Iteration, also called a loop, repeats a group of instructions. The FOR loop repeats a known number of times, and the WHILE loop repeats as long as a condition is true. These three control structures can solve any problem that can be solved by a computer.

8. Errors and Debugging

Errors in a program are called bugs, and the process of finding and removing them is called debugging. There are three main types of errors. Syntax errors happen when the rules of the language are broken, such as a missing bracket, and the program will not run. Runtime errors happen while the program is running, such as dividing a number by zero. Logical errors happen when the program runs but gives wrong answers because the logic is wrong, such as using + instead of *. Testing the program with different inputs and checking the output carefully is the best way to catch bugs.

Quick Revision Tables

Table 1: Flowchart Symbols

Symbol Shape Meaning
Oval Oval Start or stop of the program
Parallelogram Parallelogram Input and output
Rectangle Rectangle Processing and calculation
Diamond Diamond Decision with yes or no
Arrow Arrow Direction of flow

Table 2: Data Types and Control Structures

Data Type Stores Example
Integer Whole numbers 12, -5
Floating point Decimal numbers 3.14
Character One symbol 'A'
String Text "Hello Class 7"
Control Structure Meaning Example
Sequence Steps run in order Lines 1, 2, 3
Selection Decision between actions IF...THEN...ELSE
Iteration Repeating instructions FOR loop, WHILE loop

Mind Map

graph TD A["Programming"] --> B["Algorithm"] A --> C["Flowchart"] A --> D["Pseudocode"] A --> E["Variables and Data"] A --> F["Control Structures"] A --> G["Debugging"] B --> B1["Definite, Finite, Effective"] C --> C1["Oval, Parallelogram, Rectangle, Diamond"] E --> E1["Integer, Float, String"] F --> F1["Sequence"] F --> F2["Selection - IF ELSE"] F --> F3["Loops - FOR, WHILE"] G --> G1["Syntax, Runtime, Logical"]

Important Diagrams (SVG)

Diagram 1: Flowchart Symbols and Meanings

Flowchart Symbols Used in Programming START / STOP INPUT Read a value PROCESS Calculate sum OUTPUT DECISION Yes / No question Arrows show the flow Golden Rule: Oval for start and stop, parallelogram for input and output, rectangle for processing, diamond for decisions. Every flowchart must begin and end with an oval.

Diagram 2: IF THEN ELSE Selection

Selection: IF...THEN...ELSE START Is marks greater than 40? THEN: PASS ELSE: FAIL YES NO STOP Golden Rule: A decision diamond has one question but two paths — one for YES and one for NO.

Common Mistakes

  1. Writing an algorithm without a stop step. An algorithm must be finite and must end.
  2. Using a rectangle for a decision. Decisions are drawn in diamonds; rectangles are for processing.
  3. Forgetting to start and end a flowchart with an oval, which is compulsory.
  4. Confusing a variable with a constant. A variable changes; a constant never changes.
  5. Writing IF...THEN...ELSE without both branches. Every decision has a true and a false path.
  6. Calling syntax errors logical errors. Syntax errors break the rules of the language; logical errors give wrong answers.
  7. Believing high-level language can run directly. It must first be translated into machine language.
  8. Writing a loop that never stops. The WHILE loop must have a condition that becomes false.

Exam Tips

  1. Define an algorithm with its three qualities: definite, finite and effective.
  2. Draw the four main flowchart symbols and write the name and use of each.
  3. Give a small IF...THEN...ELSE example such as the marks and pass case.
  4. Compare variables and constants with one example of each.
  5. Name the three data types and the three control structures in one line each.
  6. Explain the three types of errors — syntax, runtime, logical — with a small example of each.
  7. End the answer by stating that flowcharts and pseudocode are the plans made before coding.

Conclusion

Programming is the process of turning a problem into instructions a computer can follow. Every solution begins with an algorithm, is planned visually with a flowchart or in words with pseudocode, and is then written in a programming language using variables, data types and the three control structures of sequence, selection and iteration. Errors are normal, and debugging is a natural part of the work. With these fundamentals, you are ready to write your first programs and use the computer as a true problem-solving tool.