ICT Class 7 - Programming In-Qbasic Notes
Comprehensive study notes for Class 7 - Programming In-Qbasic olympiad preparation
Programming in QBASIC
Welcome to the chapter on Programming in QBASIC for Class 7. In this chapter, you will learn what QBASIC is, how to write simple programs, and understand the basic commands used in QBASIC. By the end of this chapter, you will be able to write and run simple QBASIC programs!
Introduction
QBASIC stands for Quick Beginners All-purpose Symbolic Instruction Code. It is a simple programming language used to write and run programs. QBASIC helps you learn the basics of coding and logic.
Starting QBASIC
- QBASIC runs in a special window called the QBASIC editor.
- You type your program and run it to see the output.
Basic QBASIC Commands
- PRINT: Shows text or numbers on the screen.
Example:PRINT "Hello" - INPUT: Takes input from the user.
Example:INPUT "Enter your name: ", N$ - LET: Assigns a value to a variable.
Example:LET A = 5 - END: Stops the program.
Writing a Simple Program
Here is a simple QBASIC program:
PRINT "Welcome to QBASIC!"
INPUT "Enter a number: ", N
PRINT "You entered "; N
END
Variables in QBASIC
Variables are used to store values. In QBASIC, you can use letters and numbers for variable names.
- Example:
A = 10,NAME$ = "Ravi"
Operators in QBASIC
- + (Addition)
- - (Subtraction)
- * (Multiplication)
- / (Division)
Example: SUM = A + B
Fun Activity: Try It Yourself!
Write a QBASIC program to add two numbers and show the result.
INPUT "Enter first number: ", A
INPUT "Enter second number: ", B
SUM = A + B
PRINT "The sum is "; SUM
END
Summary
- QBASIC is a simple programming language.
- You can use PRINT, INPUT, LET, and END commands.
- Variables store values and operators help do calculations.
Practice Questions
- Write a QBASIC program to subtract two numbers.
- What does the PRINT command do?
- How do you take input from the user in QBASIC?
- Write a program to multiply two numbers.
- What is the use of the END command?
Challenge Yourself
- Write a QBASIC program to divide two numbers and show the result.
- Write a program to ask for your name and print "Hello, [your name]!"
Did You Know?
- QBASIC was created by Microsoft in 1991!
- Many programmers started learning coding with QBASIC.
Glossary
- Program: A set of instructions for the computer.
- Variable: A name that stores a value.
- Command: An instruction in QBASIC.
Answers to Practice Questions
-
INPUT "Enter first number: ", A INPUT "Enter second number: ", B DIFF = A - B PRINT "The difference is "; DIFF END - It shows text or numbers on the screen.
- By using the INPUT command.
-
INPUT "Enter first number: ", A INPUT "Enter second number: ", B PROD = A * B PRINT "The product is "; PROD END - It stops the program.
Practice writing QBASIC programs to become a coding star!