• Courses
• Data Structure

### Elements of QBASIC

Each programming language has various types of elements, which are essential to write a programs. QBASIC also consists such programming elements and proper rules for preparing effective programs. The following are the basic Elements of QBAIC Programming language.

• Character Set
• Variables
• Constants
• Operators
• Keywords

#### Charecter Set

The QBASIC Character Set consists of letters, numbers and special characters.

1. Letters : A - Z or a - z
2. Digits : 0, 1, 2, 3, ...... 9
3. Special Characters : +, -, *, , =, /, ;, ", ^, \$, #, !, %, ? etc.

#### Variables

Variable is a data item which can store some values such as numbers or string. It is a name of storage location in the computer's memory, in which we can store different values. It may change during the program execution time. There are two types of variables. They are:

A) Numeric Variable

The variable which is used to store numeric data is called numeric variable. Numeric data means numbers that can perform mathematical calculations. For example x = 5, here the variable x is stores the numeric value 5.

Example :

CLS
x = 5
y = 6
z = x + y
PRINT z
END

Output

11

B) String Variable

A variable that stores string data is called string variable. String is the collection of letters, numbers and special symbols enclosed in double quotes. String data means alphanumeric values that cannot perform mathematical calculations. The string variable name must begin with alphabets and should always end with a \$ sign. For example name\$ = "Technical School", here the variable name\$ stores the string value "Technical School".

Example:

CLS
name\$ = "Welcome to Technical School"
PRINT name\$
END

Output

Welcome to Technical School

#### Constans

Constants are the fixed value which remain unchanged during the program execution time. There are two types of constants. They are:

A) Numeric Constants

Numeric constants includes positive or negative number values. These values can be used in mathematical calculations such as addition, subtraction, multiplication and division. For example x = 5, here 5 is a numeric constants. Some valid numeric constants are 5, 10.5, -34 etc.

B) String Constants

A string constant is a set of alphanumeric characters, which are enclosed within double quotation marks. For example name\$ = "Technical School". Here "Technical School" is a string constants. Some example of string constants are: "14 years", "3 boyes", "Nepal" etc.

#### Keywords

Keywords are the collection of commands, statements or functions which are used to accomplish the particular job. Some example of QBASIC keywords are CLA, INPUT, PRINT, KILL, END, FOR, DO etc.

535

#### Recent MCQs

 MS-Excel Quick Tip 2 MS-Excel Quick Tip 1 MS-Word Quick Tip 3 MS-Word Quick Tip 2