100% found this document useful (1 vote)
268 views

Qbasic Notes

QBASIC is a simple, easy to learn programming language developed in 1985 by Bill Gates and Paul Allen as a version of BASIC for beginners. It uses common English words and symbols for commands and has a simple character set of letters, numbers, and punctuation. QBASIC programs work with numeric constants, string constants, numeric variables, and string variables. The language includes arithmetic, relational, and logical operators to perform calculations and make comparisons that return true or false values.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
268 views

Qbasic Notes

QBASIC is a simple, easy to learn programming language developed in 1985 by Bill Gates and Paul Allen as a version of BASIC for beginners. It uses common English words and symbols for commands and has a simple character set of letters, numbers, and punctuation. QBASIC programs work with numeric constants, string constants, numeric variables, and string variables. The language includes arithmetic, relational, and logical operators to perform calculations and make comparisons that return true or false values.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

QBASIC

Introduction

It is a very simple and easy to learn computer language.

BASIC ( Beginners All Purpose Symbolic Instruction Code) was first developed by a team of professors
John G. Kemeny and Thomas E. Kurtz of Dartmouth College, New Hampshire, USA, as a Computer
language for beginners and was implemented in the 1964.

BASIC is best suited for beginners as it helps in developing logical skills and is very user friendly
programming language.

Its commands or syntax (rules for writing statements) are very simple as they are written in common
English language. Debugging (removing error) in program of BASIC can be done easily.

Later on in 1985, Bill Gates and Paul Allen developed QBasic.

QBASIC stands for Quick Beginners All Purpose Symbolic Instruction Code.

CHARACTER SET

A Character denotes any letter, digit, punctual mark, or any other sign used in the representation of
information in any language. It has the following character set:

1. Alphabets:
A,B,C, …….., Z (26 characters)
2. Numerals:
0,1,2,…., 9 (10 characters)
3. Special Characters:
-, +, *, /, &,^, $, <, >, etc.

CONSTANTS

Constants are those that do not change while executing the program. BASIC deals with 2 types of
constants.

Numeric Constants

All numbers belong to this category because their values remain constant.

Eg. +95, 62.5, -235,

1.5 E+5 = 1.5 x 105

String ConstantsA String Constant is any set of valid QBASIC characters enclosed in quotation marks. The
quotation mark do not form part of the string.
Eg. “Name”, “Delhi”, “a+b” , “56”

VARIABLES

Computer programs contain not only quantities that do not change but also quantities which change
during the execution. These quantities are called variables.

QBASIC has two types of variable :

1. Numeric Variables
2. String Variables

Numeric Variables

Numeric variables can be any single letter of the alphabet or any single letter of the alphabet
followed by one of the numerals 0, 1, 2, ……,9. Or letters
Eg. A, B, C, ……., Z
A0,B0,…….., Z0
A1, B1, ……,Z1
.
.
.
.
A9,B9,……Z9

STRING VARIABLES

String variables are designated by a single alphabet followed by a dollar sign.

Eg. A$, B$,…….., Z$

A1$, ….. Z9$

AA$, AZ$,……. etc

It should be remembered that any string variable can be used to store a string constant.

Blank space is a character when used in string constants.

OPERATORS IN QBASIC

In QBASIC, a set of special symbols are used to indicate the nature of operations to be performed on the
given data. Such symbols are said as operators and the data items on which calculation is done are
called operands. There are three types of operators in QBASIC:-

1. Arithmetic Operators
2. Relational Operators
3. Logical operators.

ARITHMETICAL OPERATOR

The operator which operates on numeric constants and variables is said to be an Arithmetic operator. It
helps to do calculation to produce numeric output. Some arithmetic operators are :-

+ for addition

- For subtraction
*For multiplication

/ for division

^ for exponentiation

HIERARCHY OF OPERATIONS

The operators work and follow the same sequence in which they are used in mathematics ( i.e. as per
BODMAS rule). In computer it follows the rule of BEDMAS i.e.

Brackets ()

Exponents ^

Division /

Multiplication *

Addition +

Subtraction -

RELATIONAL OPERATOR

Relational Operators are used to compare two values. The relational operator checks the condition and
produces the results in either ‘True’ or ‘ False’ and further processing is done accordingly.

Name of the operator Symbols used in QBASIC Format used OUTPUT


Considering A=5 and B= 3
Less than < A<B FALSE
Greater than > A>B TRUE
Less than or equal to <= A<=B FALSE
Greater than or equal to >= A>=B TRUE
Equal to = A=B FALSE
Not equal to <> A<>B TRUE
LOGICAL OPERATOR

They are used to connect two or more relations and return a True or False value to be used in a decision.

AND conjunction

OR disjunction

NOT logical negation

Eg. 1. A>50 and B>100

2. X<1 or y>10

You might also like