← VCE Software Development U3O1

Hungarian notation for variables

A naming style where a variable name starts with a short lower-case prefix showing its data type, e.g. strName, intAge, fltPrice, blnPassed.

Understanding Hungarian notation for variables in VCE Software Development U3O1

What it does: The int prefix shows an integer, and the descriptive part StudentAge starts with capital letters (camel casing) after the lower-case prefix. The flt prefix shows a floating point (decimal) number, so fltPrice suits a value like 4.50. The prefix str stands for string, so strSurname holds text. intName is misleading because int means integer, but the value is text. strName is correct for a string. The bln prefix marks a Boolean variable, so blnPassed holds True or False, such as whether a student passed. A Hungarian notation prefix must match the data type actually stored, otherwise the name misleads anyone reading the code.

Common mistakes: The value 12.50 is a floating point number, so the prefix should be flt, not int. The line should be fltPrice = 12.50. 270000 is a whole number, so the prefix should be int, not str. The line should be intPopulation = 270000.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 48–71) and word search (Modules 10–71).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which variable name uses Hungarian notation for a whole number holding a student's age?
intAgeage
Matches
StrName = "Ava"
↓
The prefix starts with a capital letter. Hungarian notation prefixes must be lower case, so it should be strName.
Applying
Meanings
Term
Hungarian notation
Meaning
A naming style where a variable name starts with a short lower-case prefix showing its data type, e.g. strName, intAge, fltPrice, blnPassed.
Practice
strStudentName = "Ava"
Testing
Gaps
Name = "Ava"
Check Answer
Spots
2intAge = int(input("Age: "))
3intPrice = 12.50

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Ermine' badge — Tundra Streak, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which variable name uses Hungarian notation for a whole number holding a student's age?
A. intAge ✓
B. age
The prefix int shows the variable holds an integer, so intAge tells you its data type at a glance.
2. What data type does the variable strSurname most likely hold?
A. A string (text) ✓
B. A Boolean (True/False)
The prefix str stands for string, so strSurname holds text.
3. Which name is the better choice for a decimal price such as 4.95?
A. intPrice
B. fltPrice ✓
The prefix flt stands for floating point, which stores decimals. int is for whole numbers only.
4. A variable holds True or False to show whether a student passed. Which name follows Hungarian notation?
A. strPassed
B. blnPassed ✓
The prefix bln stands for Boolean. The value is True or False, not text.
5. Which name correctly combines a Hungarian prefix with camel casing?
A. strFirstName ✓
B. strfirstname
The prefix stays lower case, and each word after it starts with a capital letter, giving strFirstName. Writing it all in lower case loses the camel casing and makes it harder to read.

Match the Pairs

strName → A variable holding a string (text), shown by the str prefix
blnPassed → A variable holding a Boolean (True or False) value, shown by the bln prefix
A whole-number variable named with a Hungarian notation prefix, then camel casing for the rest of the name → intStudentAge
A decimal-number variable named with a Hungarian notation prefix and a descriptive word → fltPrice
StrName = "Ava" → The prefix starts with a capital letter. Hungarian notation prefixes must be lower case, so it should be strName.
intName = "Liam" → The int prefix says integer, but the value is a string. The prefix should be str, giving strName.

Key Term

Hungarian notation
A naming style where a variable name starts with a short lower-case prefix showing its data type, e.g. strName, intAge, fltPrice, blnPassed.

Fill in the Blanks

1. strName = "Ava"
Hint: Type the Hungarian prefix for a text (string) value.
2. intAge = 16
Hint: Type the Hungarian prefix for a whole number.
3. fltPrice = 4.50
Hint: Type the Hungarian prefix for a decimal (floating point) number.
4. blnPassed = True
Hint: Type the Hungarian prefix for a True/False value.
5. marks = 72 blnHasPassed = marks >= 50
Hint: The comparison gives True or False, so type the prefix for that data type.

Spot the Error

Question 1
A strName = input("Name: ")
B intAge = int(input("Age: "))
C intPrice = 12.50
D blnPassed = True
Line C — The value 12.50 is a floating point number, so the prefix should be flt, not int. The line should be fltPrice = 12.50.
Question 2
A strCity = "Geelong"
B strPopulation = 270000
C print(strCity, intPopulation)
Line B — 270000 is a whole number, so the prefix should be int, not str. The line should be intPopulation = 270000.
Question 3
A strScore = 72
B blnPassed = intScore >= 50
C print(blnPassed)
Line A — 72 is an integer, so the prefix should be int. The str prefix wrongly suggests text. The line should be intScore = 72.
Question 4
A strFirstName = "Mia"
B strLastName = "Chen"
C intYear = 11
D average = 78.5
E print(strFirstName, fltAverage)
Line D — Hungarian notation needs a data type prefix at the start of the name. This float variable is missing its flt prefix. It should be fltAverage = 78.5.
Question 5
A fltPrice = 4.50
B blnQty = 3
C fltTotal = fltPrice * intQty
D print(fltTotal)
Line B — The bln prefix is for Boolean values (True or False). The quantity 3 is an integer, so the name should be intQty.

Student with a class code? Join your class →