GRADE 11 ICT · CHAPTER 1

Programming

Algorithms · Control Structures · Flowcharts · Pseudo Code · Pascal · Language Evolution

📊 Problem Analysis🔢 Algorithms Sequence · Selection · Repetition📈 Flowcharts 📝 Pseudo Code💻 Pascal IF · CASE · FOR · WHILE · REPEAT🌐 Languages
🎯Analyze problems using Input–Process–Output
🎯Develop algorithms and identify control structures
🎯Draw flowcharts and write pseudo codes
🎯Write Pascal programs using selection & repetition
🎯Use arrays and sub-programs in Pascal
🎯Understand language evolution and translators
Section 1.1
Introduction — Analyzing a Problem

Every problem can be broken into three parts that describe how raw data becomes a useful result.

📥 INPUT

Raw materials or data provided to solve a problem. This is what you start with.

egNumbers, names, marks, dimensions

⚙️ PROCESS

Step-by-step operations that convert input into output. Order matters.

egAdding, comparing, sorting, calculating

📤 OUTPUT

The final result obtained after the process. The answer to the problem.

egTotal, grade, area, printed report
keyAlways identify Input, Process, and Output separately before writing any code.
keyAll possible solutions form the Solution Space. Selecting the best one produces shorter, more efficient programs.

📚 IPO Examples

✉️LetterPosting a letter
TeaMaking tea
📐RectangleArea & perimeter
🔢Odd/EvenCheck a number
📏PerimeterSolution space
✉️ Problem 1 — Preparing a Letter to Post
INPUT
  • 📄Sheet of paper & pen
  • 📬Envelope and stamp
  • 🧴Glue
OUTPUT
resultA letter ready to be posted
PROCESS (must follow this order)
  • 1Write the letter
  • 2Fold and put into the envelope
  • 3Paste the envelope
  • 4Write recipient's address
  • 5Stick the stamp
noteSteps 4 & 5 can swap. All other steps must stay in order.
☕ Problem 2 — Making a Cup of Tea
INPUT
  • 🍃Tea leaves
  • 🍬Sugar
  • 💧Hot water
OUTPUT
resultA cup of tea ☕
noteContains repetition — re-test until taste is satisfactory.
PROCESS
  • 1Put tea leaves in the strainer
  • 2Pour hot water through strainer
  • 3Add some sugar
  • 4Stir well with a spoon
  • 5Take a sip; test for taste
  • 6If not satisfactory → go back to step 3
📐 Problems 4 & 5 — Rectangle Calculations
AREA OF RECTANGLE
  • InLength (L) and Width (W)
  • PrArea = L × W
  • OutArea value
ADDING TWO NUMBERS
  • InTwo numbers
  • PrAdd the two numbers
  • OutTotal
ODD OR EVEN (Problem 7)
  • InA number N
  • PrFind remainder: N ÷ 2
  • PrIf remainder = 0 → Even; else → Odd
  • OutOdd or Even
LARGER OF TWO NUMBERS (Problem 6)
  • InTwo numbers n1, n2
  • PrCompare the two numbers
  • OutLarger number
🔢 Alternative Solutions — Pass/Fail
SOLUTION 1
IF mark < 35 THEN Result = Fail
ELSE Result = Pass
SOLUTION 2 (preferred)
IF mark ≥ 35 THEN Result = Pass
ELSE Result = Fail
keyBoth are correct. Choose the most logical and readable solution.
📏 Solution Space — Perimeter of a Rectangle
SolutionFormulaOperationsBest For
1stL+W+L+W3 additionsAddition only
2ndL×2 + W×22 mult + 1 addMultiplication known
3rd ✓(L+W)×21 add + 1 multMost efficient!
keyIn programming, always select the solution with fewest operations from the solution space.

🛠️ Activity 1 — IPO Classifier

For each item below click to classify it as Input, Process, or Output for: "Finding the average of 5 exam marks." Click an item multiple times to cycle through categories.

⚡ IPO Classifier — Click items to assign categories
📥 INPUT
⚙️ PROCESS
📤 OUTPUT
Section 1.2
Algorithms & Control Structures

An algorithm is a step-by-step procedure for solving a problem. Three control structures direct the flow.

factAn algorithm must have a clear beginning and end, with each step precise and unambiguous.
keyThree control structures are used in all algorithms: Sequence, Selection, and Repetition.
➡️SequenceSteps one after another
🔀SelectionChoose based on condition
🔁RepetitionRepeat until condition met
➡️ Sequence — Steps in Strict Order
DEFINITION

All steps executed one after another in a fixed order. No conditions, no branching, no loops.

ALGORITHM — POSTING A LETTER
  • 1Write the letter
  • 2Fold the letter
  • 3Insert in envelope
  • 4Write the address
  • 5Stick the stamp
  • 6Post the letter
DAY-TO-DAY EXAMPLES
  • 1Climbing stairs step by step from bottom to top
  • 2Students advancing from Grade 1 to Grade 13
  • 3Boiling water: put pot → add water → heat → wait → pour
  • 4Turning on PC: press power → BIOS → OS loads → login
ruleIn a pure sequence, every step runs exactly once. Changing order changes or breaks the result.
🔀 Selection — Choose Based on a Condition
DEFINITION

A condition is evaluated. Depending on whether it is True or False, a different set of steps executes.

Pseudo Code
IF condition THEN
  statement when True
ELSE
  statement when False
ENDIF
REAL-WORLD EXAMPLES
  • 1School admission: IF age ≥ 5 → admit; ELSE → reject
  • 2Passing: IF mark ≥ 35 → Pass; ELSE → Fail
  • 3Voting: IF age ≥ 18 → can vote; ELSE → cannot vote
  • 4Buying: IF money ≥ price → buy; ELSE → cannot buy
ruleThere are always exactly two paths: TRUE and FALSE. Exactly one always executes.
🔁 Repetition — Repeat Until a Condition is Satisfied
DEFINITION

One or more steps are repeated until a condition is satisfied (or while a condition remains true). The repeating section is called a loop.

ATTENDANCE MARKING
  • 1Call first name on register
  • 2Mark 1 (present) or 0 (absent)
  • 3Call the next student's name
  • 4Repeat steps 2–3 until last name is called
DAY-TO-DAY EXAMPLES
  • 1Adding sugar to tea until it tastes right
  • 2Reading paragraph words one by one until the end
  • 3Measuring sugar: add/remove until exactly 500g
  • 4Printing 10 numbers one by one
ruleEvery loop must eventually end — otherwise it becomes an infinite loop and the program never stops.

🛠️ Activity 2 — Identify the Control Structure

⚡ Control Structure Identifier — 8 questions
Section 1.3.1
Flowcharts

Flowcharts use standard symbols to visually represent an algorithm step by step.

🔷 Flowchart Symbols

Terminal

Oval — marks Start or End of algorithm.

Parallelogram

Skewed — represents Input or Output.

Rectangle

Square corners — represents a Process.

Diamond

Diamond — represents a Decision (Yes/No).

Arrow

Directed line — shows Flow Direction.

Connector

Circle — used to connect flowchart parts.

📊 Flowchart Examples

🔢 Sequence — Area of Circle
🔀 Selection — Odd or Even
🔁 Repetition — Sum of Numbers
Start Input Radius Area = 22/7 × r × r Output Area End

➡️ Sequence — Area of a Circle

Pure top-to-bottom flow — every step runs exactly once in order.

1
Program starts (oval terminal)
2
Input the radius (parallelogram)
3
Calculate Area = 22/7 × r × r (rectangle)
4
Output the area (parallelogram)
5
Program ends (oval terminal)
No conditions, no loops — arrows always flow downward. A pure sequence.
Start Input Number N Calculate: remainder = N mod 2 Remainder = 0? Yes Even Number No Odd Number End

🔀 Selection — Odd or Even

The diamond creates a branch. One path runs depending on the condition result.

1
Input number N
2
Calculate N mod 2
3
Diamond: Is remainder = 0?
YES → Output "Even Number"
NO → Output "Odd Number"
4
Both paths merge → End
Diamond has one input and two outputs (labelled Yes / No).
Start Total = 0 ◄ loop Get Number N Total = Total + N More numbers? Yes No Output Total End

🔁 Repetition — Sum of Numbers

The backward arrow is the key indicator — it creates the loop.

1
Set Total = 0
2
Input a number N
3
Total = Total + N (accumulate)
4
Diamond: More numbers?
YES → arrow loops back to step 2
5
NO → Output Total → End
Loop repeats as long as condition is YES. Flow exits downward when NO.

🛠️ Activity 3 — Flowchart Symbol Quiz

⚡ Symbol Identifier — What symbol is this?
Section 1.3.2
Pseudo Codes

Pseudo code expresses an algorithm in simple English-like terms, independent of any programming language.

keyPseudo code can be converted to any programming language — Pascal, Python, C, Java, etc.
factPseudo code is not executed by a computer — it is a planning and communication tool for programmers.

🔑 Keywords

BEGIN / END

Mark start and end

INPUT / READ / GET

Receive data from user

OUTPUT / DISPLAY

Show result to user

CALCULATE / PROCESS

Perform computation

IF…THEN…ELSE…ENDIF

Selection structure

FOR … DO

Count-controlled loop

WHILE … ENDWHILE

Condition-first loop

REPEAT … UNTIL

Condition-last loop

📄 Pseudo Code Examples

CircleArea — Sequence
🔢Odd/EvenIF-ELSE
WHILETotal of numbers
📊REPEATAverage of 10
🏆MinimumFind smallest of 10
⭕ Example 1 — Area of Circle (Sequence)
PSEUDO CODE
Pseudo Code
BEGIN
  INPUT Radius
  CALCULATE Area = 22/7 × Radius × Radius
  DISPLAY Area
END
TYPE & KEY POINTS
typeSequence — all steps run once, in order.
  • 1INPUT brings value from user into memory
  • 2CALCULATE performs the arithmetic
  • 3DISPLAY shows the result to the user
🔢 Example 2 — Odd or Even (IF-ELSE)
PSEUDO CODE
Pseudo Code
BEGIN
  READ number as N
  CALCULATE Rem = N MOD 2
  IF Rem = 0 THEN
    DISPLAY "Even number"
  ELSE
    DISPLAY "Odd number"
  ENDIF
END
TRACE FOR N = 7
  • 1N = 7
  • 2Rem = 7 MOD 2 = 1
  • 3Is 1 = 0? → No (False)
  • 4Execute ELSE → Display "Odd number"
ruleThe ELSE branch executes when the IF condition is False.
➕ Example 3 — Total of Numbers (WHILE Loop)
Pseudo Code
BEGIN
  Total = 0 ; n = 1
  WHILE n <= 10
    READ Number
    Total = Total + Number
    n = n + 1
  ENDWHILE
  DISPLAY Total
END
IMPORTANT NOTES
  • !Total = Total + Number is NOT a math equation — it adds Number to current Total and stores back
  • !n starts at 1, condition is n ≤ 10, n increments by 1 each pass
  • !Loop body executes exactly 10 times
  • !When n becomes 11, condition is False → loop exits
📊 Example 4 — Total & Average (REPEAT-UNTIL)
Pseudo Code
BEGIN
  Total = 0 ; count = 0
  REPEAT
    READ Number
    Total = Total + Number
    count = count + 1
  UNTIL count = 10
  Average = Total / 10
  DISPLAY Total, Average
END
WHILE vs REPEAT-UNTIL
WHILE: Condition at START. May execute 0 times if condition initially false.
REPEAT-UNTIL: Condition at END. Always executes at least once.
ruleREPEAT-UNTIL stops when condition becomes True. WHILE stops when condition becomes False.
🏆 Example 5 — Find Smallest of 10 Numbers
Pseudo Code
BEGIN
  INPUT N
  Min = N ; Count = 1
  WHILE Count < 10
    INPUT N
    IF N < Min THEN
      Min = N
    ENDIF
    Count = Count + 1
  ENDWHILE
  DISPLAY Min
END
HOW IT WORKS
  • 1Read first number; set it as Min
  • 2Read remaining 9 numbers one by one
  • 3Compare each with current Min
  • 4If new number < Min → update Min
  • 5After all 10 numbers, display Min
noteCombines Repetition (WHILE) and Selection (IF inside loop) — a nested control structure.
Section 1.4
Pascal Programming — Basics

Pascal is a high-level, structured programming language ideal for learning fundamental programming concepts.

factPascal was designed by Niklaus Wirth in 1968 specifically to teach structured programming.
Pascal uses := for assignment and = for comparison — mixing them is a common mistake!

🏷️ Identifiers

✅ Rules for Valid Identifiers
  • 1Must start with an English letter (A–Z, a–z)
  • 2Can contain letters, digits (0–9), and underscore ( _ )
  • 3No spaces between words
  • 4No special characters (! @ # $ % etc.) — only _ is allowed
  • 5Cannot be a Pascal reserved word
  • 6Not case-sensitive: Art = ART = art
✅ Valid: Sum, Total_Nos, Num1, FirstName, avg, mark_1
❌ Invalid:
$75 — starts with $
Average Marks — has a space
9A — starts with digit
Last-name — hyphen not allowed
begin — reserved word

📦 Data Types

🔢IntegerWhole numbers
📊RealDecimal numbers
BooleanTrue or False
🔤CharSingle character
🔡StringText sequence
🔢 Integer — Positive or negative whole numbers. No decimal point.
Examples: 0, 46, -12, 999    Declaration: var count : integer;

⚡ Operators

Arithmetic+ – * / DIV MOD
⚖️Comparison> < >= <= = <>
🔗LogicalAND OR NOT
➕ Arithmetic Operators
OpUsageExampleResult
+Addition6 + 39
-Subtraction7 - 52
*Multiplication2 * 510
/Division (real)10 / 42.50
DIVInteger division20 DIV 63
MODRemainder20 MOD 62
DIV & MOD EXPLAINED
20 DIV 6:
6 × 3 = 18 (largest multiple ≤ 20)
Result = 3 (quotient)

20 MOD 6:
20 − 18 = 2
Result = 2 (remainder)
noteDIV and MOD only work with integer values. Use / for real-number division.
⚖️ Comparison Operators — Always return Boolean (True/False)
OperatorMeaningExampleResult
>Greater than7 > 3True
>=Greater than or equal8 >= 8True
<Less than3 < 2False
<=Less than or equal4 <= 6True
=Equal to3 = 1False
<>Not equal to2 <> 5True
🔗 Logical Operators & Precedence
TRUTH TABLES

AND — BOTH must be True

ABA AND B
FFFalse
FTFalse
TFFalse
TTTrue

OR — at least ONE True

ABA OR B
FFFalse
FTTrue
TFTrue
TTTrue
PRECEDENCE (highest first)
PriorityOperators
1 (highest)NOT
2* / DIV MOD AND
3+ - OR
4 (lowest)= <> < <= > >=
EXAMPLES
  • 5 + 14 MOD 4 → 14 MOD 4=2 → 5+2 = 7
  • NOT(8 MOD 2 > 5) → 0>5=F → NOT(F) = True
  • (3>=2) AND (3<>3) → T AND F = False

🛠️ Activity 4 — Expression Evaluator

⚡ Pascal Expression Evaluator — Step by Step

📄 Basic Pascal Program

Pascal — Complete Program: Add Two Numbers
program addNum(input,output);         { Program name }
var
  num1, num2, total : integer;    { Declare variables }
  avg                : real;
begin                                  { Main program starts }
  Writeln('Enter First Number');
  Read(num1);                         { Input }
  Writeln('Enter Second Number');
  Read(num2);
  total := num1 + num2;               { Process }
  avg   := total / 2;
  Writeln('Total = ', total);          { Output }
  Writeln('Average = ', avg);
end.                                   { Main program ends }
Section 1.4.6
Selection in Pascal

Pascal provides IF-THEN, IF-THEN-ELSE, Nested IF, and CASE statements for selection.

✔️IF-THENOne-way selection
🔀IF-ELSETwo-way selection
🗂️Nested IFMultiple conditions
📋CASERange-based selection
✔️ IF–THEN — Execute Only When Condition is True
Pascal
if N > 0 then
  Writeln('Positive Number');
BEHAVIOUR
  • TCondition is TRUE → statement executes
  • FCondition is FALSE → statement is skipped, nothing happens
ruleUse IF-THEN when you want to do something only under a specific condition — no else needed.
🔀 IF–THEN–ELSE — Always Executes One of Two Paths
Pascal — Larger of Two Numbers
Read(N1, N2);
if N1 > N2 then
  Large := N1
else
  Large := N2;
Writeln('Large = ', Large);
KEY RULES
  • !No semicolon before else
  • !Exactly one of the two paths always executes
  • !Multiple statements → wrap in begin...end
Adding ; after the THEN statement before else causes a syntax error!
🗂️ Nested IF — Chains of Conditions
Pascal — Grade from Marks
Read(M);
if M >= 75 then  Grade := 'A'
else if M >= 65 then  Grade := 'B'
else if M >= 50 then  Grade := 'C'
else if M >= 35 then  Grade := 'S'
else                   Grade := 'F';
HOW IT WORKS
  • 1Conditions checked top to bottom
  • 2First True condition executes, rest are skipped
  • 3Example: M=70 → ≥75? No → ≥65? Yes → Grade = B
  • 4Final else catches all remaining cases
📋 CASE Statement — Cleaner Multiple-Range Selection
Pascal — Grade with CASE
Read(Marks);
case Marks of
   0..34  : Grade := 'W';
  35..49  : Grade := 'S';
  50..64  : Grade := 'C';
  65..74  : Grade := 'B';
  75..100 : Grade := 'A';
  else Writeln('Invalid');
end;
ADVANTAGES
  • 1Cleaner and more readable than chained IF-ELSE
  • 2Supports ranges using .. notation
  • 3else handles unmatched values
  • 4Only for integer, char, or boolean types
noteCASE ends with end; (semicolon) — unlike the main program's end. (full stop).

🛠️ Activity 5 — Grade Calculator

⚡ Interactive Grade Calculator (Pascal IF Logic)
Section 1.4.7
Repetition (Loops) in Pascal

Three loop structures handle different repetition scenarios in Pascal programs.

🔢 FOR – DO
Use when:Count known in advance
Condition check:Before each pass
Counter:Auto incremented
Min runs:0 (if end < start)
🔄 WHILE – DO
Use when:Count unknown
Condition check:At START
Loop ends:Condition = False
Min runs:0 (may never run)
🔁 REPEAT – UNTIL
Use when:Must run once
Condition check:At END
Loop ends:Condition = True
Min runs:1 (always once)
🔢FOR (TO)Count up
🔻FOR (DOWNTO)Count down
🔄WHILE–DOCondition first
🔁REPEAT–UNTILCondition last
🔢 FOR–DO (TO) — Count Upward
Pascal — Print 1 to 10 & Find Total
var i, total : integer;
begin
  total := 0;
  for i := 1 to 10 do
  begin
    Writeln(i);
    total := total + i;
  end;
  Writeln('Total = ', total);
end.
FOR-DO TABLE
StructureRuns
for x := 1 to 5 do5 times
for x := 0 to 4 do5 times
for x := 5 to 10 do6 times
ruleMultiple statements inside loop body must be wrapped in begin...end.
🔻 FOR–DO (DOWNTO) — Count Downward
Pascal — Print 10 to 1
for count := 10 downto 1 do
  Writeln(count);
KEY POINTS
  • 1DOWNTO decrements the counter each iteration
  • 2Start value must be greater than end value
  • 3Output: 10, 9, 8, 7 … 1
StructureRuns
for x := 10 downto 5 do6 times
for x := 4 downto 0 do5 times
🔄 WHILE–DO — Condition at Start
Pascal — Multiples of 5 from 5 to 50
n := 5;
while n <= 50 do
begin
  Writeln(n);
  n := n + 5;
end;
egOutput: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50
HOW IT WORKS
  • 1n starts at 5
  • 2Check: n ≤ 50 → True → execute body
  • 3Print n, then n := n + 5
  • 4When n = 55 → condition False → loop exits
ruleIf condition is False from the start, the body never executes (0 runs).
🔁 REPEAT–UNTIL — Condition at End
Pascal — Print 'Pascal' six times
count := 0;
repeat
  Writeln('Pascal');
  count := count + 1;
until count > 5;
TRACE TABLE
countPrintsAftercount > 5?
0Pascal1No → continue
1Pascal2No → continue
2Pascal3No → continue
3Pascal4No → continue
4Pascal5No → continue
5Pascal6Yes → STOP
key"Pascal" is printed 6 times.

🛠️ Activity 6 — Loop Trace Simulator

⚡ FOR Loop Trace — Step by Step

Tracing: for i := 1 to 5 do sum := sum + i; (initial sum = 0)

Sections 1.4.9 & 1.4.10
Arrays & Sub-Programs

Arrays store multiple same-type values. Sub-programs (Procedures & Functions) organize code into reusable blocks.

📦 Arrays

keyAn array stores many values of the same data type under one variable name, accessed via an index.
factArray elements are stored in adjacent memory locations, making sequential access very efficient.
📦 Array Declaration & Access
DECLARATION SYNTAX
Pascal
{ General syntax }
var Name : array[first..last] of type;

{ Example: 10 integers, index 0–9 }
var marks : array[0..9] of integer;

{ Assign values }
marks[0] := 45;
marks[1] := 75;

{ Loop through all elements }
for i := 0 to 9 do
  Writeln(marks[i]);
VISUALIZATION — marks : array[0..4]
[0]
45
[1]
75
[2]
36
[3]
81
[4]
60

🔧 Sub-Programs

📋 Procedure — Does NOT return a value

Performs a task. Control returns to the main program after execution — but no value is sent back.

Pascal
procedure showArea(var r:real);
begin
  Writeln(22/7 * r * r);
end;
{ Call: } showArea(radius);
🔄 Function — Returns a value

Computes and returns a result. The return type is declared after the parameter list.

Pascal
function square(var n:integer):integer;
begin
  square := n * n;
end;
{ Call: } res := square(5); { res=25 }
Section 1.5
Evolution of Programming Languages

Programming languages evolved from complex machine code to human-friendly high-level languages.

🏗️ Language Levels

🌐 High-Level: Pascal, C, Java, Python, BASIC
🔣 Assembly Language (symbolic codes)
01 Machine Language (binary 0s & 1s)
⚙️ Computer Hardware

🔍 Comparison

FeatureMachineAssemblyHigh-Level
Human readableNoPartlyYes
Execution speedFastestFastSlower
Translation neededNoneAssemblerCompiler/Interpreter
Machine dependentYesYesNo

⚙️ Translators

🔧AssemblerAssembly → Machine
📦CompilerWhole program at once
📄InterpreterOne line at a time
🔧 Assembler

Translates programs written in Assembly Language (symbolic codes like ADD, MOV) into machine language.

Assembly Code
Assembler
Machine Language
factAssembly uses mnemonics like MOV AX, 5 instead of binary like 10110000 00000101.
📦 Compiler — Translates Entire Program at Once
  • 1Reads entire source code
  • 2Translates all to machine code in one step
  • 3All syntax errors reported together
  • 4Creates a standalone executable file
  • 5Compiled file runs fast every time
  • 6Only recompile if source code changes
egPascal, C, C++ use compilers
keyAfter compiling once, machine code runs at full speed without re-translation.
📄 Interpreter — Translates One Line at a Time
  • 1Reads, translates, and executes one statement at a time
  • 2Stops at the first error encountered
  • 3Re-translates every time the program runs
  • 4Slower than compiled code
  • 5No separate output file created
egJavaScript, PHP, Python (interactive mode)
FeatureCompilerInterpreter
Error reportAll at onceOne by one
SpeedFasterSlower
Output fileYes (.exe)No

🧩 Programming Paradigms

📋 Procedural

Describes how step-by-step using procedures.

eg C, Pascal, FORTRAN

🧾 Declarative

Describes what you want — system finds how.

eg SQL, Prolog

🧱 Object-Oriented

Models objects with properties and methods.

eg Java, C++, Python

🔢 Functional

Based on mathematical functions.

eg Lisp, Haskell

🔗 Logic

States facts and rules; system deduces answers.

eg Prolog

🗃️ Database

Queries and manages structured data.

eg SQL

keyPascal uses the Procedural paradigm — programs structured as procedures/functions with clear top-down flow.
factProcedural = "How": step-by-step instructions. Declarative = "What": describe the result wanted, computer finds the steps.
Test Yourself
🧠 Quick Quiz

12 questions covering all topics. Click an answer to check immediately.

0/12

Exam Preparation
📝 Practice Questions & Answers

Exam-style questions with detailed answers. Try each one before revealing the solution.

Q 01Identify the Input, Process, and Output for: "Finding the average mark of 5 students."
Q 02Write an algorithm to find the largest of three numbers A, B, and C.
Q 03Identify the control structure in each: (a) Counting 1 to 100. (b) Unlocking phone if correct PIN. (c) Advancing grade by grade from Grade 1 to 13.
Q 04Write pseudo code to check if a year is a leap year. (Divisible by 4 but not 100, unless also by 400.)
Q 05Which are valid Pascal identifiers? Give a reason for each. (a) 9average (b) Average_Mark (c) begin (d) Total-Sum (e) firstName
Q 06Evaluate step by step: (a) 4 + 15 MOD 6   (b) NOT (5 = 5)   (c) (7 >= 3) AND (4 <> 4)
Q 07Write a Pascal program to read 10 numbers and display only the positive ones. Use a FOR loop.
Q 08Trace the code and state the output: sum:=0; repeat sum:=sum+5; writeln(sum); until sum>=20;
Q 09Write a Pascal program to input marks of 5 students into an array and find the highest mark.
Q 10What is the difference between a Compiler and an Interpreter? Give one advantage of each.
Q 11Write a Pascal procedure to calculate and display the area and perimeter of a rectangle.
Q 12Explain the difference between Procedural and Object-Oriented programming paradigms with a real-life example.

💡 Study Tips

1
Master IPO first. Every program has inputs, a process, and outputs. Identify them before coding.
2
Know control structure rules. Sequence = straight line. Selection = diamond branch. Repetition = backward arrow.
3
Know loop differences. FOR = known count. WHILE = check before. REPEAT = check after (runs at least once).
4
Practice tracing code. Draw a trace table for any loop — step through with actual values.
5
Remember identifier rules. Starts with letter, no spaces, no special chars except _, not a reserved word.
6
No semicolon before else! if N>0 then Writeln('Y'); followed by else causes a syntax error.