• BASIC stands for Beginner’s All
Purpose Symbolic Instruction Code.
It was invented in 1963, at
Dartmouth College, by the
mathematicians John George Kemeny
and Tom Kurtzas.
• BASIC is an interpreter which means
it reads every line, translates it
and lets the computer execute it
before reading another. Each
instruction starts with a line
number.
1. It is a user friendly language.
2. It is widely known and accepted
programming language.
3. It is one of the most flexible
languages, as modification can
easily be done in already existing
program.
4. Language is easy since the variables
can be named easily and uses simple
English phrases with mathematical
expressions.
1. All QBasic programs are made up of
series of statements, which are
executed in the order in which they
are written.
2. Every statement should have at least
one basic command word. The words
that BASIC recognizes are all
keywords.
3. All the command words have to be
written using some standard rules,
which are called SYNTAX RULES.
DATA
A collection of facts and figures
that is entered into the computer through
the keyboard. Data is of two types:
1. CONSTANT
(a)Numeric Constant
(b)Alphanumeric Constant/String
2. VARIABLE
(a)Numeric Variable
(b)Alphanumeric Variable
Data whose value does not change or
remains fixed. There are two types of
constants:
1. NUMERIC CONSTANT
Numbers – negative or positive used
for mathematical calculations.
e.g. -10, 20, 0
2. ALPHANUMERIC CONSTANT/STRING
Numbers or alphabets written within
double quotes(inverted commas “ ”).
e.g. “Computer”, “Operating System”
Data whose value is not constant and may change
due to some calculations during the program execution.
It is a location in the computer’s memory, which
stores the values. Depending on what value is held,
Variables are of two types:
1. NUMERIC VARIABLE
The variable that hold a Numeric constant for
arithmetic calculation(+,-,*,/) is called a Numeric
Variable.
e.g. A=50, here a is the Numeric Variable
2. ALPHANUMERIC VARIABLE/STRING
The variable that holds an Alphanumeric
Constant, which cannot be used for arithmetic
calculations. An Alphanumeric variable must end with $
sign and the Alphanumeric constant must be enclosed in
inverted commas.
e.g. Name$=“Akanksha”, here Name$ is an Alphanumeric
Variable
Once QBASIC program is loaded
into the computer memory, it displays
OK prompt. Ok means it ready to
accept the commands. QBASIC can be
made to translate your instructions
in two modes:
1. DIRECT MODE
2. PROGRAM MODE
Accepts single line instructions
from the user and the output is
viewed as soon as enter key is
pressed. The instructions are not
stored in the memory. This mode can
be used to do quick calculation. They
do not have line numbers. E.g. Print
3+4
Print “This is the Direct mode in Qbasic”
The mode is used to type a
program which is stored in the
memory. They have line numbers. We
have to give the command to get the
output.
e.g.
10 Print 3+4
20 End
RUN
The following commands do not need line
number.
1. LIST – command is used to list the
program on the screen.
2. RUN – command is used to execute the
program.
3. LLIST – command is used to list of
program as a hardcopy.
4. LPRINT – command is used to get the
output of the program on the hard
copy.
5. NEW – command is used to clear the
memory of the existing program.
6. SYSTEM – command is used to take you
back to dos prompt.
7. PRINT & CLS – command can also be
used without line number. Print is used
to view the display on the screen and
CLS to clear the screen.
8. RME – is used to show the position of
the mistake.
9. SAVE – the keyword is used to save
the program.
10. LOAD – the keyword is used to load
the program from the disk to the memory.
1. CLS: This command is used to clear the
screen.
2. PRINT: Print command is used to
display the output on the screen.
e.g. Print “HELLO WORLD”
Print 80*8
Print-Only Print command will leave
blank space.
Print Tab(10) “Navrachana”-will
print Navrachana on 10 column.
3. REM: It stands for Remark.it gives an
explanation of the program or of the
statements in the program thereby making
the program more understandable to the
reader. The computer does not execute this
statement since whatever is written after
REM is ignored by the compiler. REM can be
used anywhere and many times in a program.
4. LET: It assigns a value to a variable
in a program. It stores a value in the
memory location.
SYNTAX: Let<Variable>=<Constant/Variable or
Expression>
5. END: This command is usually given at the
end of the program. Statements written after
end are not executed since the program
terminates execution on reading this command.
6. INPUT: This statement allows the user to
enter a value for the variable while running
the program. A question mark (?) appears on
the output screen waiting for the user to
enter a relevant data and then press enter
key. Once the Return key or Enter key is
pressed the data is stored in the variable.
SYNTAX: INPUT <VARIABLE>
7. DELETE <LINE NO.>: To delete a line number
in a program.
e.g. Delete 10 will delete line number 10
Print with Semi-Colon (;): Semi-Colon
placed after the message to be displayed,
leaves no space between two messages.
e.g. Print “This is an example"; "of
QBasic program”
Output: This is an example of QBasic
program
Print with Comma(,): The screen of the
computer is made of 80 columns and 40
rows. The columns are divided into five
(5) zones of 14 columns each. Comma
placed after the message prints the
message zone wise on the srceen.
A QBASIC program consists of lines
containing
1. A line number
2. A QBASIC keyword like PRINT, END
etc.
3. Each program line begins with
positive number.
4. No two lines should have same
number.
RUNNING A PROGRAM
RUN is the command used to execute the
program and get the output on the screen.
WRITING A NEW PROGRAM
It is possible to overwrite lines with
the new statements, but if you want to
write a totally new program use a NEW
command.
EXITING QBASIC
In order to exit the QBASIC program
SYSTEM command is used.
Joy Hilary Yambao
Glaiza Soriano

Qbasic Tutorial

  • 2.
    • BASIC standsfor Beginner’s All Purpose Symbolic Instruction Code. It was invented in 1963, at Dartmouth College, by the mathematicians John George Kemeny and Tom Kurtzas. • BASIC is an interpreter which means it reads every line, translates it and lets the computer execute it before reading another. Each instruction starts with a line number.
  • 3.
    1. It isa user friendly language. 2. It is widely known and accepted programming language. 3. It is one of the most flexible languages, as modification can easily be done in already existing program. 4. Language is easy since the variables can be named easily and uses simple English phrases with mathematical expressions.
  • 4.
    1. All QBasicprograms are made up of series of statements, which are executed in the order in which they are written. 2. Every statement should have at least one basic command word. The words that BASIC recognizes are all keywords. 3. All the command words have to be written using some standard rules, which are called SYNTAX RULES.
  • 5.
    DATA A collection offacts and figures that is entered into the computer through the keyboard. Data is of two types: 1. CONSTANT (a)Numeric Constant (b)Alphanumeric Constant/String 2. VARIABLE (a)Numeric Variable (b)Alphanumeric Variable
  • 6.
    Data whose valuedoes not change or remains fixed. There are two types of constants: 1. NUMERIC CONSTANT Numbers – negative or positive used for mathematical calculations. e.g. -10, 20, 0 2. ALPHANUMERIC CONSTANT/STRING Numbers or alphabets written within double quotes(inverted commas “ ”). e.g. “Computer”, “Operating System”
  • 7.
    Data whose valueis not constant and may change due to some calculations during the program execution. It is a location in the computer’s memory, which stores the values. Depending on what value is held, Variables are of two types: 1. NUMERIC VARIABLE The variable that hold a Numeric constant for arithmetic calculation(+,-,*,/) is called a Numeric Variable. e.g. A=50, here a is the Numeric Variable 2. ALPHANUMERIC VARIABLE/STRING The variable that holds an Alphanumeric Constant, which cannot be used for arithmetic calculations. An Alphanumeric variable must end with $ sign and the Alphanumeric constant must be enclosed in inverted commas. e.g. Name$=“Akanksha”, here Name$ is an Alphanumeric Variable
  • 8.
    Once QBASIC programis loaded into the computer memory, it displays OK prompt. Ok means it ready to accept the commands. QBASIC can be made to translate your instructions in two modes: 1. DIRECT MODE 2. PROGRAM MODE
  • 9.
    Accepts single lineinstructions from the user and the output is viewed as soon as enter key is pressed. The instructions are not stored in the memory. This mode can be used to do quick calculation. They do not have line numbers. E.g. Print 3+4 Print “This is the Direct mode in Qbasic”
  • 10.
    The mode isused to type a program which is stored in the memory. They have line numbers. We have to give the command to get the output. e.g. 10 Print 3+4 20 End RUN
  • 11.
    The following commandsdo not need line number. 1. LIST – command is used to list the program on the screen. 2. RUN – command is used to execute the program. 3. LLIST – command is used to list of program as a hardcopy. 4. LPRINT – command is used to get the output of the program on the hard copy. 5. NEW – command is used to clear the memory of the existing program.
  • 12.
    6. SYSTEM –command is used to take you back to dos prompt. 7. PRINT & CLS – command can also be used without line number. Print is used to view the display on the screen and CLS to clear the screen. 8. RME – is used to show the position of the mistake. 9. SAVE – the keyword is used to save the program. 10. LOAD – the keyword is used to load the program from the disk to the memory.
  • 13.
    1. CLS: Thiscommand is used to clear the screen. 2. PRINT: Print command is used to display the output on the screen. e.g. Print “HELLO WORLD” Print 80*8 Print-Only Print command will leave blank space. Print Tab(10) “Navrachana”-will print Navrachana on 10 column.
  • 14.
    3. REM: Itstands for Remark.it gives an explanation of the program or of the statements in the program thereby making the program more understandable to the reader. The computer does not execute this statement since whatever is written after REM is ignored by the compiler. REM can be used anywhere and many times in a program. 4. LET: It assigns a value to a variable in a program. It stores a value in the memory location. SYNTAX: Let<Variable>=<Constant/Variable or Expression>
  • 15.
    5. END: Thiscommand is usually given at the end of the program. Statements written after end are not executed since the program terminates execution on reading this command. 6. INPUT: This statement allows the user to enter a value for the variable while running the program. A question mark (?) appears on the output screen waiting for the user to enter a relevant data and then press enter key. Once the Return key or Enter key is pressed the data is stored in the variable. SYNTAX: INPUT <VARIABLE> 7. DELETE <LINE NO.>: To delete a line number in a program. e.g. Delete 10 will delete line number 10
  • 16.
    Print with Semi-Colon(;): Semi-Colon placed after the message to be displayed, leaves no space between two messages. e.g. Print “This is an example"; "of QBasic program” Output: This is an example of QBasic program Print with Comma(,): The screen of the computer is made of 80 columns and 40 rows. The columns are divided into five (5) zones of 14 columns each. Comma placed after the message prints the message zone wise on the srceen.
  • 17.
    A QBASIC programconsists of lines containing 1. A line number 2. A QBASIC keyword like PRINT, END etc. 3. Each program line begins with positive number. 4. No two lines should have same number.
  • 18.
    RUNNING A PROGRAM RUNis the command used to execute the program and get the output on the screen. WRITING A NEW PROGRAM It is possible to overwrite lines with the new statements, but if you want to write a totally new program use a NEW command. EXITING QBASIC In order to exit the QBASIC program SYSTEM command is used.
  • 20.