Q Basic
Q Basic
7478085288
📘 Lesson 1: QBASIC and the PRINT Statement (Very PRINT means show on the screen.
Easy)
Real-life example:
If you speak, people hear your words.
If the computer uses PRINT, we see words on the
1. Lesson Title
screen.
Lesson 1: QBASIC and the PRINT Statement
4. Syntax
2. Learning Objectives
This is the simple way to use PRINT:
After this lesson, you will be able to:
PRINT "message"
Tell what a program is
Rules:
Tell what QBASIC is
The word must be PRINT
Use PRINT to show text on the screen
Text must be inside double quotes " "
Run a simple QBASIC program
Each line runs from top to bottom
QBASIC is a simple computer language. 7. Step-by-Step Explanation of the Code (Every Line
It is good for beginners. Clearly)
It is used in schools to learn programming.
Line 1:
What is PRINT?
REM Lesson 1 program
1
Abu Farhad Sardar
7478085288
REM means “This is a note for humans.” PRINT "Hello"
It helps us understand the program. Reason: Text must be inside " ".
Line 2: ❌ Wrong:
Again, the computer ignores this line. Reason: The computer needs the correct word.
Line 3:
You can change Riya to your name. 2. Print your school name
PRINT "I am learning QBASIC" 4. Print any 3 lines about yourself (3 PRINT lines)
❌ Wrong: Homework
2
Abu Farhad Sardar
7478085288
Your class A box stores toys
Real-life example:
1. Lesson Title
Variable assignment
2. Learning Objectives A = 10
3. Concept Explanation (Very Simple Language + Use $ for text (string) variables
Real-Life Examples)
Numbers do not use $
What is a Variable?
3
Abu Farhad Sardar
7478085288
INPUT A 'Takes a number from the user
PRINT A 'Shows the number on the screen 10. Step-by-Step Explanation of Program 2
INPUT NAME$
The computer asks for text.
6. Program Output (Program 1)
The user types a name.
If the user enters: The name is stored in NAME$.
REM Program to input a number and print it Mistake 1: Forgetting $ for text
This is a comment. ❌ Wrong:
It explains the program.
The computer ignores it. INPUT NAME
INPUT A ✅ Correct:
The computer waits for the user.
INPUT NAME$
The user types a number.
The number is stored in A. Mistake 2: Using quotes in INPUT
PRINT A ❌ Wrong:
The computer shows the value stored in A.
INPUT "A"
✅ Correct:
8. Fully Commented Example Program 2
INPUT A
Program 2: Input and print a name
Mistake 3: Mixing number and text variables
REM Program to input and print a name
❌ Wrong:
A$ = 10
INPUT NAME$ 'Takes name from the user
✅ Correct:
PRINT "Hello "; NAME$ 'Prints greeting with name
A = 10
4
Abu Farhad Sardar
7478085288
5. Input your school name and print it Try to fix it
Homework
❌ Program 1 (Wrong)
Write a program that:
REM Program to input name
Inputs your name
INPUT NAME
Inputs your class
PRINT "Hello "; NAME
Prints both on the screen
📌 What is the problem?
Bonus
Look carefully at the variable name.
Print a message like:
INPUT "A"
PRINT A
❌ Program 3 (Wrong)
AGE$ = 12
PRINT AGE$
5
Abu Farhad Sardar
7478085288
INPUT NAME$ Below is Lesson 3, created using the same lesson
template, written in very simple English, with real-life
PRINT "Hello "; NAME$
school examples.
It is suitable for absolute beginners.
✔ Answer to Program 2
Correct Program:
1. Lesson Title
REM Program to input a number
Lesson 3: IF and IF…ELSE Statements
INPUT A
PRINT A
2. Learning Objectives
IF statement
IF…ELSE statement
6
Abu Farhad Sardar
7478085288
The IF…ELSE statement means: 5
👉 “If this is true, do this.
Output:
👉 Otherwise, do something else.”
Positive number
IF statement
7. Step-by-Step Explanation of Program 1
IF condition THEN
INPUT A
statement
The computer asks for a number.
END IF The number is stored in A.
statement END IF
This ends the IF block.
END IF
Rules:
8. Fully Commented Example Program 2
Conditions use symbols like >, <, =
Program 2: Check pass or fail
END IF is used to close the IF block
REM Program to check pass or fail
Statements run from top to bottom
55
6. Program Output (Program 1)
Output:
If the user enters:
7
Abu Farhad Sardar
7478085288
PASS IF MARKS = 40 THEN
Output:
❌ Wrong:
END IF
This ends the decision. 13. Homework Challenge
Homework
11. Common Mistakes Write a program that:
Mistake 1: Forgetting END IF Inputs your age
❌ Wrong: If age is 5 or more, print “School Student”
IF A > 0 THEN Else, print “Too young for school”
PRINT "Positive" Bonus
✅ Correct: Change the program to check:
IF A > 0 THEN Primary student
PRINT "Positive" Secondary student
END IF
❌ Wrong:
8
Abu Farhad Sardar
7478085288
1. Lesson Title
2. Learning Objectives
Understand repetition
9
Abu Farhad Sardar
7478085288
Use the FOR…NEXT loop NEXT I 'Increases I and repeats the loop
statement
8. Fully Commented Example Program 2
NEXT variable
Program 2: Print a message 3 times
Rules:
REM Program to print a message 3 times
The loop starts at the start value
Good Morning
FOR I = 1 TO 5 'Loop starts with I = 1 and ends at 5
Good Morning
PRINT I 'Prints value of I
10
Abu Farhad Sardar
7478085288
10. Step-by-Step Explanation of Program 2 PRINT I
NEXT J
✅ Correct:
FOR I = 1 TO 5
PRINT I
NEXT I
❌ Wrong:
Below is Lesson 5, written using the same lesson
FOR I = 5 TO 1
template, in very simple English, with clear daily-life
11
Abu Farhad Sardar
7478085288
examples, and a simple comparison with the FOR FOR Loop WHILE Loop
loop.
Used when number of Used when repeats are not
repeats is fixed fixed
📘 Lesson 5: WHILE…WEND Loop Example: Repeat while a
Example: Repeat 5 times
condition is true
1. Lesson Title Starts and ends with Starts and ends with a
numbers condition
Lesson 5: WHILE…WEND Loop
4. Syntax
2. Learning Objectives
WHILE condition
After this lesson, you will be able to:
statement
Understand conditional repetition
WEND
Use the WHILE…WEND loop
Rules:
Know when to use WHILE instead of FOR
Condition must be true to enter the loop
Write simple WHILE loop programs
Condition is checked before each repeat
Sometimes we repeat work until a condition becomes 5. Fully Commented Example Program 1
false.
Program 1: Print numbers from 1 to 5 using WHILE
Daily-life examples:
REM Program to print numbers from 1 to 5
Keep drinking water while you are thirsty
In these cases:
WHILE I <= 5 'Loop runs while I is less than or
We do not know how many times the work equal to 5
will repeat
PRINT I 'Prints the value of I
We stop only when the condition changes
I=I+1 'Increases I by 1
This is called conditional repetition.
WEND 'Ends the WHILE loop
What is WHILE…WEND?
2
Simple comparison with FOR loop
12
Abu Farhad Sardar
7478085288
3 Good Evening
COUNT = 1
The loop starts from 1.
7. Step-by-Step Explanation of Program 1
WHILE COUNT <= 3
I=1
The condition is checked.
The loop counter starts at 1.
PRINT "Good Evening"
WHILE I <= 5
The message is printed.
The computer checks the condition.
If true, it enters the loop. COUNT = COUNT + 1
The count increases.
PRINT I
The number is printed. When COUNT becomes 4, the loop stops.
I=I+1
The value of I increases.
11. Common Mistakes
This helps stop the loop later.
Mistake 1: Forgetting to change the value inside loop
WEND
The loop goes back to check the condition ❌ Wrong:
again.
I=1
WHILE I <= 5
8. Fully Commented Example Program 2
PRINT I
Program 2: Print a message until count reaches 3
WEND
REM Program to print a message 3 times
🔴 Problem: Loop never stops.
❌ Wrong:
WHILE COUNT <= 3 'Loop runs while count is 3
or less WHILE I <= 5
❌ Wrong:
13
Abu Farhad Sardar
7478085288
WEND
Homework
Starts from 1
Prints numbers
Bonus
FOR loop
Compare both programs.
14
Abu Farhad Sardar
7478085288
o 2 for Coffee
o 3 for Juice
On a TV remote:
4. Syntax
statement
Real-life examples:
5. Fully Commented Example Program 1
In a restaurant menu, you choose:
Program 1: Simple menu (Drink choice)
o 1 for Tea
15
Abu Farhad Sardar
7478085288
REM Program to show drink choice PRINT "1. Tea"
Shows menu option 1.
INPUT CHOICE
User enters a number.
INPUT CHOICE 'Takes user choice
SELECT CASE CHOICE
The computer checks the value.
SELECT CASE CHOICE 'Checks the value of CASE 1
CHOICE Runs if choice is 1.
CASE 1 CASE 2
PRINT "You chose Tea" Runs if choice is 2.
CASE 2 CASE 3
Runs if choice is 3.
PRINT "You chose Coffee"
CASE ELSE
CASE 3 Runs for any wrong number.
PRINT "You chose Juice" END SELECT
CASE ELSE Ends the SELECT CASE block.
Output: INPUT D
5 CASE 1
PRINT "Tuesday"
16
Abu Farhad Sardar
7478085288
PRINT "Wednesday"
PRINT "Saturday"
6 o
Output: 2. Science
Saturday o
3. English
10. Step-by-Step Explanation of Program 2 2. Menu for shapes:
User enters a number o
📘 Lesson 7: Arrays (Single Dimensional)
1. Addition
1. Lesson Title
2. Subtraction
Lesson 7: Arrays (Single Dimensional)
3. Multiplication
2. Learning Objectives
Ask the user to:
After this lesson, you will be able to:
Enter two numbers
Understand what an array is
Choose the operation
Store many numbers using an array
Print the result.
Use array index numbers
Bonus
Write simple programs using arrays
Rewrite the same program using IF…ELSE.
Real-life examples:
A = 10
B = 20
C = 30
18
Abu Farhad Sardar
7478085288
Declaring an array 10
DIM A(5) 20
Using an array 30
A(1) = 10 40
Rules: 50
REM Program to store and print 5 numbers using array INPUT A(I)
Takes a number.
Stores it in box number I.
DIM A(5) 'Creates an array with 5 boxes Second FOR loop
Reads values one by one.
Prints each value.
FOR I = 1 TO 5 'Loop to take input
40
PRINT "Total = "; SUM 'Prints the sum
50
Output:
19
Abu Farhad Sardar
7478085288
9. Program Output (Program 2)
Output:
Homework
❌ Wrong:
A(1) = 10
❌ Wrong:
DIM A(5)
PRINT A(6)
❌ Wrong:
INPUT A
20
Abu Farhad Sardar
7478085288
1. Lesson Title
2. Learning Objectives
21
Abu Farhad Sardar
7478085288
3. Concept Explanation (Very Simple Language +
Real-Life Examples)
SELECT CASE CHOICE
A real program uses many ideas together.
CASE 1
Real-life examples:
PRINT "Result = "; A + B
A calculator uses numbers and choices
CASE 2
A report card uses marks and averages
PRINT "Result = "; A - B
A game uses input, checking, and repeating
CASE 3
In this lesson:
PRINT "Result = "; A * B
You will build small but complete programs
CASE 4
Each program uses many concepts together
IF B <> 0 THEN
SELECT CASE
6. Program Output (Program 1)
If user enters:
5. Fully Commented Example Program 1
1
Program 1: Simple Calculator (Menu Based)
5
REM Simple calculator program
3
Output:
PRINT "1. Addition"
Result = 8
PRINT "2. Subtraction"
Result is printed
SUM = 0
FOR I = 1 TO 5
NEXT I
END
60
80 If user enters:
90 5
100 Output:
23
Abu Farhad Sardar
7478085288
13. Step-by-Step Explanation of Program 3
WHILE loop runs continuously You have completed the QBASIC Beginner Course.
You can now write simple programs on your own 👏
User enters a guess
Division by zero
Homework
Bonus
Add:
24
Abu Farhad Sardar
7478085288
1. Write a program to print your name.
Below are clean, printable practice worksheets for all 2. Write a program to print your school name.
8 QBASIC lessons, rewritten clearly and structured so
3. Print three different messages on the screen.
they can be directly printed or converted to PDF for
students.
25
Abu Farhad Sardar
7478085288
📘 Worksheet – Lesson 3
INPUT A 1.
ELSE NEXT I
PRINT "Small" 2.
END IF FOR I = 1 TO 3
2. NEXT I
INPUT M
26
Abu Farhad Sardar
7478085288
3. Write WHILE loop syntax. 4. Write SELECT CASE syntax.
4. One difference between FOR and WHILE. 5. Give one menu example from daily life.
1.
B. Write the Output
INPUT A
1.
SELECT CASE A
I=1
CASE 1
WHILE I <= 3
PRINT "One"
PRINT I
CASE 2
I=I+1
PRINT "Two"
WEND
CASE ELSE
2.
PRINT "Other"
X=4
END SELECT
WHILE X > 1
(User enters: 2)
PRINT X
2.
X=X-1
(User enters: 7)
WEND
📘 Worksheet – Lesson 7
📘 Worksheet – Lesson 6
Topic: Arrays (Single Dimensional)
Topic: SELECT CASE Statement
A. Short Answer Questions
A. Short Answer Questions
1. What is an array?
1. What is SELECT CASE used for?
2. Why is DIM used?
2. When is SELECT CASE better than IF?
3. What is an index?
3. What is CASE ELSE?
4. Write array declaration syntax.
27
Abu Farhad Sardar
7478085288
5. Give one real-life example of array. 1.
SUM = 0
1. INPUT A
A(1)=5 NEXT I
A(3)=15 (Inputs: 2, 3, 5)
PRINT A(2) 2.
2. N=6
N(2)=6 ELSE
END IF
📘 Worksheet – Lesson 8
✅ Teacher / Parent Note
Topic: Programs Using Multiple Concepts
Section A → Viva & theory
A. Short Answer Questions
Section B → Written exam
1. Why do we combine programming concepts?
Section C → Lab practice
2. Name any three QBASIC statements.
28
Abu Farhad Sardar
7478085288
🏫 Make unit tests & final exam
Just tell me 👍
29