Qbasic Notes For Class 7
Qbasic Notes For Class 7
BASIC (Beginners All Purpose Symbolic Instruct ion Code) is a very suitable high level
language for beginners. This language was developed in 1960 by Professors John Kemeny
and Thomas Kurtz. It is used in scientific, business and educational fields.
In the year 1975, Bill Gates and Paul Allen developed QBASIC (Quick Beginners All Purpose
Symbolic Instruct ion Code) language. It is a user- friendly language which enables various
kinds of tasks such as general programs, graphics etc. It is a compiler- based high level
language which perform s tasks in Window s environ ment.
Characters from the basic charact er set are combined to form keywords, variables,
operato rs and labels. These in turn combine to form instructions that make up a program.
The BASIC charact er set consists of:
The follow1ng charact ers have a special meaning to the BASIC translat or.
#, $ ➔ suffixes used at the end of variable names to specify the kind of variable .
+ I -I * / I ,
➔ Mathematical operato rs.
/"'\Ot:>
< ,> , = ➔ Relation al operato rs
'l -=- :> L-==- , L_'?
() ➔ Parentheses used
0
C,
·➔ Used while writing multiple stateme nts on a line.
'"
• 7 l)ee~" rn~L 1)o~~t--
·BASIC datatypes
r Constants
BASIC constants are predefined values that do not change during program executi on . There
are two types of constants: String constants and Numeric constants.
Keywords
There are some words that have special significance to BASIC. These are called keywords.
Variables
PRINT statement
WORLD
• More than one statement can be I d.
-
( :) · E.g. :- PRINT 20 : PRINT P ace in one I" .f h
ine I t ey are separated by a colon
30
• Generally PRINT statement takes th
the next PRINT t t e cursor to th e next line. Therefore the output of
s a ement will b h .
followed b . e on t e next line. But if the PRINT statement is
Ya semicolon or
a comma, the cursor stays on the same line.
PRINT "Hello"
PRINT "Hello"·
PRINT "World" '
PRINT "World"
Output: Output:
Hello \
HelloWorld
World \
I
INPUT Statement
The INPUT statement is used to provide input to the program while it is running.
E.g.:- INPUT name$
• It can be used to make the program more user friendly by providing a prompt or
message.
E.g.:- \NPUT" Enter your name:"; name$
INPUT" What is your age?"; a
#The string within the quotation marks after the INPUT statement is the prompt
telling the user what he/ she is required to input.
#A comma or a semicolon can separate the prompt and the variable that is to hold
the user input.
# a comma after the prompt suppresses the question mark.
# More than one value can be read with one INPUT statement.
E.g. :- INPUT "Enter two numbers:"; X,Y
PRINT "the first number is:" ;X
PRINT "the second number is:" ;Y
******************************* ***************************************