Identifiers, Variables, Constants and Data Types – Grade 11 ICT Notes 1.4

© 2026 schoolict.net (Ruwan Mangala Suraweera)

1.4 Identifiers, Variables, Constants and Data Typesහඳුන්වන, විචල්‍ය, නියත සහ දත්ත වර්ග

G.C.E. O/L Grade 11 ICT · Lesson 1G.C.E. O/L ICT · 11 ශ්‍රේණිය · පාඩම 1

Prints all tabs in the language you are reading. Use “Save as PDF” in the print window to keep a copy.ඔබ කියවන භාෂාවෙන් සියලු tabs මුද්‍රණය වේ. පිටපතක් තියාගන්න print window එකේ “Save as PDF” තෝරන්න.
🎬Video coming soon in this language. Switch language to watch the other video.මේ භාෂාවෙන් වීඩියෝව ඉක්මනින් එනවා. අනෙක් වීඩියෝව බලන්න භාෂාව මාරු කරන්න.

In this videoමේ වීඩියෝවේ

  • A variable is a named memory place whose value can change.විචල්‍යය වෙනස් විය හැකි අගයක් ඇති නම් කළ මතක ස්ථානයකි.
  • A constant’s value does not change.නියතයක අගය වෙනස් නොවේ.
  • Identifiers start with a letter; no spaces.හඳුන්වන අකුරකින් ආරම්භ වේ; හිස්තැන් නැත.
  • Reserved words like begin, if cannot be names.begin, if වැනි වෙන් කළ වචන නම් ලෙස භාවිත කළ නොහැක.
  • Data types: integer, real, char, string, Boolean.දත්ත වර්ග: integer, real, char, string, Boolean.
VariableConstantIdentifierReserved wordIntegerRealBoolean

Notesසටහන්

Syllabus 10.4. A program must remember data – a name, a mark, a price. It keeps each value in a named box in memory. If the value can change, the box is a variable; if it never changes, it is a constant. The name of the box is an identifier, and the kind of value it holds is its data type. Some words are reserved and cannot be used as names.විෂය නිර්දේශය 10.4. වැඩසටහනකට දත්ත මතක තබා ගත යුතුය – නමක්, ලකුණක්, මිලක්. එය එක් එක් අගය මතකයේ නමක් ඇති පෙට්ටියක තබා ගනී. අගය වෙනස් විය හැකි නම් එම පෙට්ටිය විචල්‍යයකි (variable); කිසි විටෙක වෙනස් නොවේ නම් එය නියතයකි (constant). පෙට්ටියේ නම හඳුන්වනයයි (identifier), එහි ඇති අගයේ වර්ගය එහි දත්ත වර්ගයයි (data type). සමහර වචන වෙන් කර ඇති (reserved) නිසා නම් ලෙස භාවිත කළ නොහැක.

1. Variables1. විචල්‍ය (Variables)

A variable is a named memory location whose value can change while the program runs. Think of a labelled box: the label is “Marks”, and inside today is 65; later we can put 80 in the same box. The old value is replaced.විචල්‍යයක් යනු වැඩසටහන ධාවනය වන අතරතුර අගය වෙනස් විය හැකි, නමක් ඇති මතක ස්ථානයකි. ලේබලයක් ඇති පෙට්ටියක් ගැන සිතන්න: ලේබලය “Marks”, අද ඇතුළත 65; පසුව එම පෙට්ටියටම 80 දැමිය හැක. පැරණි අගය ප්‍රතිස්ථාපනය වේ.

StepපියවරPseudocodeව්‍යාජ කේතයValue in MarksMarks හි අගය
11Marks = 65Marks = 656565
22Marks = 80Marks = 808080
33Marks = Marks + 5Marks = Marks + 58585

2. Constants2. නියත (Constants)

A constant is a named value that does not change while the program runs, such as π = 3.14 or the pass mark 35. Using a constant makes the program easy to read and easy to change – if the pass mark changes, you change it in one place only. In Pascal we write it under const. Python has no real constants, so by custom we write the name in CAPITALS.නියතයක් යනු π = 3.14 හෝ සමත් ලකුණ 35 වැනි, වැඩසටහන ධාවනයේදී වෙනස් නොවන නමක් ඇති අගයකි. නියතයක් භාවිතයෙන් වැඩසටහන කියවීමට පහසු සහ වෙනස් කිරීමට පහසු වේ – සමත් ලකුණ වෙනස් වුවහොත් එක් තැනක පමණක් වෙනස් කළ යුතුය. Pascal හි එය const යටතේ ලියමු. Python හි සැබෑ නියත නැති නිසා සම්ප්‍රදායිකව නම ලොකු අකුරින් ලියමු.

📝 Pseudocodeව්‍යාජ කේතය (Pseudocode)

BEGIN
  CONSTANT PI = 3.14
  INPUT Radius
  Area = PI * Radius * Radius
  DISPLAY Area
END
StartPI = 3.14INPUT RadiusArea = PI * Radius * RadiusDISPLAY AreaStop
Flowchart – A constant: area of a circleගැලීම් සටහන – නියතයක්: වෘත්තයක වර්ගඵලය
💻 A constant: area of a circleනියතයක්: වෘත්තයක වර්ගඵලය
program CircleArea;
const
  PI = 3.14;
var
  radius, area: real;
begin
  write('Enter radius: ');
  readln(radius);
  area := PI * radius * radius;
  writeln('Area = ', area:0:2);
end.
PI = 3.14             # a constant (capital letters by custom)
radius = float(input("Enter radius: "))
area = PI * radius * radius
print(f"Area = {area:.2f}")

▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)

Enter radius: 7
Area = 153.86

3. Data types3. දත්ත වර්ග

The data type tells the computer what kind of value a variable holds and how much memory it needs. The O/L syllabus uses four basic types:දත්ත වර්ගය මගින් විචල්‍යයක ඇති අගයේ වර්ගය සහ එයට අවශ්‍ය මතක ප්‍රමාණය පරිගණකයට කියයි. O/L විෂය නිර්දේශය මූලික වර්ග හතරක් භාවිත කරයි:

Data typeදත්ත වර්ගයHoldsදරන්නේExamplesඋදාහරණPascalPascalPythonPython
Integerපූර්ණ සංඛ්‍යාWhole numbersපූර්ණ සංඛ්‍යා16, −5, 202616, −5, 2026integerintegerintint
Floating point (real)දශම සංඛ්‍යා (real)Numbers with a decimal pointදශම තිතක් ඇති සංඛ්‍යා1.62, 3.14, 71.671.62, 3.14, 71.67realrealfloatfloat
Characterඅක්ෂරOne letter, digit or symbolඑක් අකුරක්, ඉලක්කමක් හෝ සංකේතයක්‘A’, ‘7’, ‘#’‘A’, ‘7’, ‘#’charcharstr of length 1දිග 1 වන str
Logical (Boolean)තාර්කික (Boolean)Only True or Falseසත්‍ය හෝ අසත්‍ය පමණිTrue, FalseTrue, Falsebooleanbooleanboolbool
String (extra)String (අමතර)Text – many charactersපාඨය – අක්ෂර බොහොමයක්‘Nimal’, ‘Kandy’‘Nimal’, ‘Kandy’stringstringstrstr
💻 Variables of different data typesවිවිධ දත්ත වර්ගවල විචල්‍ය
program DataTypes;
var
  name: string;
  age: integer;
  height: real;
  grade: char;
  isPrefect: boolean;
begin
  name := 'Nimal';
  age := 16;
  height := 1.62;
  grade := 'A';
  isPrefect := true;
  writeln('Name: ', name);
  writeln('Age: ', age);
  writeln('Height: ', height:0:2);
  writeln('Grade: ', grade);
  if isPrefect then
    writeln('Prefect: Yes')
  else
    writeln('Prefect: No');
end.
name = "Nimal"        # string
age = 16              # integer
height = 1.62         # floating point (real)
grade = "A"           # character
is_prefect = True     # logical (Boolean)
print("Name:", name)
print("Age:", age)
print(f"Height: {height:.2f}")
print("Grade:", grade)
if is_prefect:
    print("Prefect: Yes")
else:
    print("Prefect: No")

▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්‍රතිදානය

Name: Nimal
Age: 16
Height: 1.62
Grade: A
Prefect: Yes
💡 In Pascal you must declare every variable with its type before using it (var age: integer;). In Python you just assign a value (age = 16) and Python works out the type itself. Both are fine – but the idea of a data type is the same.Pascal හි සෑම විචල්‍යයක්ම භාවිතයට පෙර එහි වර්ගය සමඟ ප්‍රකාශ කළ (declare) යුතුය (var age: integer;). Python හි අගයක් පැවරීම පමණක් ප්‍රමාණවත් (age = 16), වර්ගය Python විසින්ම සොයා ගනී. දෙකම හරි – දත්ත වර්ගයේ අදහස එකමය.

4. Identifiers and naming rules4. හඳුන්වන සහ නම් කිරීමේ නීති

An identifier is the name we give to a variable, constant, program or sub-program. Rules (Pascal and Python):හඳුන්වනයක් යනු විචල්‍යයකට, නියතයකට, වැඩසටහනකට හෝ උප වැඩසටහනකට දෙන නමයි. නීති (Pascal සහ Python):

  • Use letters, digits and the underscore _ only.අකුරු, ඉලක්කම් සහ යටි ඉර _ පමණක් භාවිත කරන්න.
  • It must start with a letter (or _), never a digit.එය අකුරකින් (හෝ _) ආරම්භ විය යුතුය, කිසි විටෙක ඉලක්කමකින් නොවේ.
  • No spaces and no symbols such as -, %, @.හිස්තැන් නැත, -, %, @ වැනි සංකේත නැත.
  • It must not be a reserved word.එය වෙන් කළ වචනයක් නොවිය යුතුය.
  • Python is case-sensitive (Total and total are different). Pascal is not (Total and TOTAL are the same name).Python අකුරු වර්ගයට සංවේදීය (Total සහ total වෙනස්). Pascal සංවේදී නොවේ (Total සහ TOTAL එකම නමකි).
Identifierහඳුන්වනයValid?වලංගුද?Reasonහේතුව
total_markstotal_marksYesඔව්Letters and _අකුරු සහ _
Mark2Mark2Yesඔව්Digit not at the startඉලක්කම මුලින් නොවේ
2ndMark2ndMarkNoනැතStarts with a digitඉලක්කමකින් ආරම්භ වේ
total markstotal marksNoනැතHas a spaceහිස්තැනක් ඇත
pass%pass%NoනැතHas a symbolසංකේතයක් ඇත
begin / ifbegin / ifNoනැතReserved wordවෙන් කළ වචනයකි

5. Reserved words (keywords)5. වෙන් කළ වචන (keywords)

Reserved words are words that already have a special meaning in the language, so they cannot be used as identifiers. Pascal: program, var, const, begin, end, if, then, else, for, while, repeat, until, and, or, not, div, mod. Python: if, else, elif, for, while, def, return, True, False, and, or, not, import.වෙන් කළ වචන යනු භාෂාවේ දැනටමත් විශේෂ අර්ථයක් ඇති වචන වන නිසා ඒවා හඳුන්වන ලෙස භාවිත කළ නොහැක. Pascal: program, var, const, begin, end, if, then, else, for, while, repeat, until, and, or, not, div, mod. Python: if, else, elif, for, while, def, return, True, False, and, or, not, import.

6. Meaningful names6. අර්ථවත් නම්

Choose names that tell you what the value is. Compare x = a * b with total = price * quantity. The second is much easier to understand and to fix later. Good: studentName, totalMarks, unit_price. Poor: a, x1, abc.අගය කුමක්දැයි කියන නම් තෝරන්න. x = a * b සහ total = price * quantity සසඳන්න. දෙවැන්න තේරුම් ගැනීමට සහ පසුව නිවැරදි කිරීමට බෙහෙවින් පහසුය. හොඳ: studentName, totalMarks, unit_price. දුර්වල: a, x1, abc.

💡 Pascal trap: because Pascal ignores capital letters, a program called Discount cannot also have a variable called discount – the compiler says “Duplicate identifier”. Our discount program in 1.6 is therefore named BillDiscount.Pascal උගුල: Pascal ලොකු/කුඩා අකුරු නොසලකන නිසා Discount නම් වැඩසටහනකට discount නම් විචල්‍යයක්ද තිබිය නොහැක – සම්පාදකය “Duplicate identifier” කියයි. එබැවින් 1.6 හි අපේ වට්ටම් වැඩසටහන BillDiscount ලෙස නම් කර ඇත.

Key Wordsප්‍රධාන පද

Variableවිචල්‍යය
A named memory location whose value can change.අගය වෙනස් විය හැකි නමක් ඇති මතක ස්ථානයක්.
Constantනියතය
A named value that does not change while the program runs.වැඩසටහන ධාවනයේදී වෙනස් නොවන නමක් ඇති අගයක්.
Identifierහඳුන්වනය
The name of a variable, constant, program or sub-program.විචල්‍යයක, නියතයක, වැඩසටහනක හෝ උප වැඩසටහනක නම.
Reserved wordවෙන් කළ වචනය
A word with a special meaning in the language; not allowed as a name.භාෂාවේ විශේෂ අර්ථයක් ඇති වචනයක්; නමක් ලෙස ඉඩ නැත.
Data typeදත්ත වර්ගය
The kind of value a variable holds.විචල්‍යයක ඇති අගයේ වර්ගය.
Integerපූර්ණ සංඛ්‍යාව
A whole number such as 16 or −5.16 හෝ −5 වැනි පූර්ණ සංඛ්‍යාවක්.
Floating pointදශම සංඛ්‍යාව
A number with a decimal point such as 1.62 (Pascal: real).1.62 වැනි දශම තිතක් ඇති සංඛ්‍යාවක් (Pascal: real).
Characterඅක්ෂරය
A single letter, digit or symbol such as ‘A’.‘A’ වැනි තනි අකුරක්, ඉලක්කමක් හෝ සංකේතයක්.
Logical (Boolean)තාර්කික (Boolean)
A type with only two values: True and False.සත්‍ය සහ අසත්‍ය යන අගයන් දෙක පමණක් ඇති වර්ගයක්.
Declarationප්‍රකාශනය
Telling the computer a variable’s name and type before use.භාවිතයට පෙර විචල්‍යයක නම සහ වර්ගය පරිගණකයට කීම.
Case-sensitiveඅකුරු සංවේදී
Capital and small letters are treated as different (Python).ලොකු සහ කුඩා අකුරු වෙනස් ලෙස සලකයි (Python).
Meaningful nameඅර්ථවත් නම
A name that shows what the value is, e.g. totalMarks.අගය කුමක්දැයි පෙන්වන නමක්, උදා totalMarks.

Sample Q&Aආදර්ශ ප්‍රශ්න සහ පිළිතුරු

1What is the difference between a variable and a constant?විචල්‍යයක් සහ නියතයක් අතර වෙනස කුමක්ද?

Answerපිළිතුර: A variable’s value can change while the program runs; a constant’s value cannot.විචල්‍යයක අගය ධාවනයේදී වෙනස් විය හැක; නියතයක අගය වෙනස් විය නොහැක.

2Name the four basic data types in the syllabus.විෂය නිර්දේශයේ මූලික දත්ත වර්ග හතර නම් කරන්න.

Answerපිළිතුර: Integer, floating point (real), character and logical (Boolean).පූර්ණ සංඛ්‍යා, දශම (real), අක්ෂර සහ තාර්කික (Boolean).

3Is 2ndMark a valid identifier? Why?2ndMark වලංගු හඳුන්වනයක්ද? ඇයි?

Answerපිළිතුර: No – an identifier cannot start with a digit.නැත – හඳුන්වනයක් ඉලක්කමකින් ආරම්භ විය නොහැක.

4Give the data type for: 16, 1.62, ‘A’, True.16, 1.62, ‘A’, True සඳහා දත්ත වර්ගය දෙන්න.

Answerපිළිතුර: Integer, floating point, character, logical.පූර්ණ සංඛ්‍යා, දශම, අක්ෂර, තාර්කික.

5Why should we use meaningful names?අර්ථවත් නම් භාවිත කළ යුත්තේ ඇයි?

Answerපිළිතුර: The program is easier to read, understand and fix.වැඩසටහන කියවීමට, තේරුම් ගැනීමට සහ නිවැරදි කිරීමට පහසුය.

6What is a reserved word? Give two examples.වෙන් කළ වචනයක් යනු කුමක්ද? උදාහරණ දෙකක් දෙන්න.

Answerපිළිතුර: A word with a special meaning in the language, e.g. if, while (begin, end, for…).භාෂාවේ විශේෂ අර්ථයක් ඇති වචනයක්, උදා if, while (begin, end, for…).

MCQබහුවරණ ප්‍රශ්න

Choose the correct answer for each question.සෑම ප්‍රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.

Scoreලකුණු: 0 / 15

1A named memory location whose value can change is a…අගය වෙනස් විය හැකි නමක් ඇති මතක ස්ථානයක්…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Variable.විචල්‍යය.

2The value 3.14 used for π, which never changes, is best stored as a…කිසි විටෙක වෙනස් නොවන π සඳහා 3.14 ගබඩා කිරීමට වඩාත් සුදුසු…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Fixed value = constant.ස්ථාවර අගය = නියතය.

3Which is a valid identifier?වලංගු හඳුන්වනයක් කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Letters and underscore only.අකුරු සහ යටි ඉර පමණි.

4Which is NOT a valid identifier?වලංගු හඳුන්වනයක් නොවන්නේ කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

begin is reserved in Pascal.begin Pascal හි වෙන් කළ වචනයකි.

5The data type of 1.62 is…1.62 හි දත්ත වර්ගය…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Has a decimal point.දශම තිතක් ඇත.

6The data type of ‘A’ is…‘A’ හි දත්ත වර්ගය…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Single letter.තනි අකුර.

7A logical (Boolean) variable can hold…තාර්කික (Boolean) විචල්‍යයකට දැරිය හැක්කේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Two values only.අගයන් දෙකක් පමණි.

8The number of students in a class is best stored as…පන්තියක සිසුන් ගණන ගබඩා කිරීමට වඩාත් සුදුසු…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Whole number.පූර්ණ සංඛ්‍යාව.

9In Pascal, the type for a floating point number is…Pascal හි දශම සංඛ්‍යාවක් සඳහා වර්ගය…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

Pascal uses real.Pascal real භාවිත කරයි.

10In Python, the type for a whole number is…Python හි පූර්ණ සංඛ්‍යාවක් සඳහා වර්ගය…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

Python uses int.Python int භාවිත කරයි.

11Which language is case-sensitive (Total ≠ total)?අකුරු වර්ගයට සංවේදී (Total ≠ total) භාෂාව කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D

Python is case-sensitive; Pascal is not.Python සංවේදීයි; Pascal නොවේ.

12Which is the most meaningful name for the price of one item?එක් භාණ්ඩයක මිල සඳහා වඩාත්ම අර්ථවත් නම කුමක්ද?

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C

Tells what it is.එය කුමක්දැයි කියයි.

13After Marks = 65, Marks = 80, Marks = Marks + 5, the value of Marks is…Marks = 65, Marks = 80, Marks = Marks + 5 ට පසු Marks හි අගය…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A

80 + 5.80 + 5.

14In Pascal, variables are declared under the word…Pascal හි විචල්‍ය ප්‍රකාශ කරන්නේ … වචනය යටතේය

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

var section.var කොටස.

15For radius 7 and PI = 3.14, the circle program shows…අරය 7 සහ PI = 3.14 සඳහා වෘත්ත වැඩසටහන පෙන්වන්නේ…

✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B

3.14 × 7 × 7 = 153.86.3.14 × 7 × 7 = 153.86.

MCQ answer keyMCQ පිළිතුරු

  1. A – Variable.විචල්‍යය.
  2. B – Fixed value = constant.ස්ථාවර අගය = නියතය.
  3. C – Letters and underscore only.අකුරු සහ යටි ඉර පමණි.
  4. C – begin is reserved in Pascal.begin Pascal හි වෙන් කළ වචනයකි.
  5. D – Has a decimal point.දශම තිතක් ඇත.
  6. C – Single letter.තනි අකුර.
  7. D – Two values only.අගයන් දෙකක් පමණි.
  8. A – Whole number.පූර්ණ සංඛ්‍යාව.
  9. B – Pascal uses real.Pascal real භාවිත කරයි.
  10. A – Python uses int.Python int භාවිත කරයි.
  11. D – Python is case-sensitive; Pascal is not.Python සංවේදීයි; Pascal නොවේ.
  12. C – Tells what it is.එය කුමක්දැයි කියයි.
  13. A – 80 + 5.80 + 5.
  14. B – var section.var කොටස.
  15. B – 3.14 × 7 × 7 = 153.86.3.14 × 7 × 7 = 153.86.

Structured Questionsව්‍යුහගත ප්‍රශ්න

1(i) Define a variable and a constant. (2 marks)
(ii) Give one example of each from a school-fees program. (2 marks)
(i) විචල්‍යයක් සහ නියතයක් අර්ථ දක්වන්න. (ලකුණු 2)
(ii) පාසල් ගාස්තු වැඩසටහනකින් එක් එකකට උදාහරණයක් දෙන්න. (ලකුණු 2)
(4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(i) Variable – named memory location whose value can change; constant – named value that does not change. (ii) Variable: number of students / amount paid; constant: fee per term (e.g. 500).(i) විචල්‍යය – අගය වෙනස් විය හැකි නමක් ඇති මතක ස්ථානය; නියතය – වෙනස් නොවන නමක් ඇති අගය. (ii) විචල්‍යය: සිසුන් ගණන / ගෙවූ මුදල; නියතය: වාරයකට ගාස්තුව (උදා 500).

2Give the most suitable data type for: (a) a student’s age (b) height in metres (c) a grade letter (d) whether a student is a prefect. (4 marks)පහත සඳහා වඩාත් සුදුසු දත්ත වර්ගය දෙන්න: (a) සිසුවෙකුගේ වයස (b) මීටර්වලින් උස (c) ශ්‍රේණි අකුර (d) සිසුවා ශිෂ්‍ය නායකයෙක්ද යන්න. (ලකුණු 4) (4 marksලකුණු 4)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
(a) integer (b) floating point / real (c) character (d) logical / Boolean.(a) පූර්ණ සංඛ්‍යා (b) දශම / real (c) අක්ෂර (d) තාර්කික / Boolean.

3State whether each identifier is valid and give a reason: total, 3sum, my mark, if, Avg_1. (5 marks)එක් එක් හඳුන්වනය වලංගුද යන්න හේතුව සමඟ සඳහන් කරන්න: total, 3sum, my mark, if, Avg_1. (ලකුණු 5) (5 marksලකුණු 5)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
total – valid; 3sum – invalid, starts with a digit; my mark – invalid, space; if – invalid, reserved word; Avg_1 – valid.total – වලංගු; 3sum – අවලංගු, ඉලක්කමකින් ආරම්භය; my mark – අවලංගු, හිස්තැන; if – අවලංගු, වෙන් කළ වචනය; Avg_1 – වලංගු.

4Explain two advantages of using a constant such as PASSMARK = 35 instead of typing 35 everywhere. (2 marks)සෑම තැනම 35 ටයිප් කිරීම වෙනුවට PASSMARK = 35 වැනි නියතයක් භාවිතයේ වාසි දෙකක් පහදන්න. (ලකුණු 2) (2 marksලකුණු 2)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Easy to read (the name tells the meaning) (1); easy to change – change in one place only (1).කියවීමට පහසුයි (නම මගින් අර්ථය කියයි) (1); වෙනස් කිරීමට පහසුයි – එක් තැනක පමණක් වෙනස් කරයි (1).

5A Pascal program called Discount has a variable discount. Why does it not compile? How can you fix it? (2 marks)Discount නම් Pascal වැඩසටහනක discount නම් විචල්‍යයක් ඇත. එය compile නොවන්නේ ඇයි? නිවැරදි කරන්නේ කෙසේද? (ලකුණු 2) (2 marksලකුණු 2)

Show model answerආදර්ශ පිළිතුර පෙන්වන්න
Pascal is not case-sensitive, so both names are the same identifier (“Duplicate identifier”) (1). Rename the program, e.g. BillDiscount (1).Pascal අකුරු වර්ගයට සංවේදී නොවන නිසා නම් දෙකම එකම හඳුන්වනයයි (“Duplicate identifier”) (1). වැඩසටහන නැවත නම් කරන්න, උදා BillDiscount (1).

🎮 Game🎮 ක්‍රීඩා

Pick a game. Each one uses words from this lesson.ක්‍රීඩාවක් තෝරන්න. හැම එකක්ම මේ පාඩමේ වචන පාවිච්චි කරනවා.

Summary & Downloadsසාරාංශය සහ බාගත කිරීම්

Key pointsප්‍රධාන කරුණු

  • Variable: value can change.විචල්‍යය: අගය වෙනස් විය හැක.
  • Constant: value stays fixed.නියතය: අගය ස්ථාවරයි.
  • Identifier = a name; start with a letter, no spaces.හඳුන්වනය = නමක්; අකුරකින් ආරම්භය, හිස්තැන් නැත.
  • Reserved words cannot be names.වෙන් කළ වචන නම් ලෙස භාවිත කළ නොහැක.
  • Integer, floating point, character, logical.පූර්ණ, දශම, අක්ෂර, තාර්කික.
  • Pascal: integer, real, char, boolean.Pascal: integer, real, char, boolean.
  • Python: int, float, str, bool; case-sensitive.Python: int, float, str, bool; අකුරු සංවේදී.
  • Use meaningful names like totalMarks.totalMarks වැනි අර්ථවත් නම් භාවිත කරන්න.

Downloadsබාගත කිරීම්

Full Lesson 1 PDFසම්පූර්ණ පාඩම 1 PDF: English · සිංහල

Next noteඊළඟ සටහන 1.5 →

© 2026 schoolict.net (Ruwan Mangala Suraweera). All rights reserved.සියලු හිමිකම් ඇවිරිණි.