Basic terms used in a programming language

8 Min Read

Starting with the programming language you should know some of the terminology used in programming language and some of them are described below:

 Variable: A variable is a name of storage location in the computer`s memory, in which the user can store different values temporarily. A variable stores those values which are changeable during the program execution time. Variables can hold letters and numbers. As QBASIC uses two types of data, two types of variables are needed to store different data. The two types of variables are:[1] 

 1. Numeric variable

 2. String variable

 1. Numeric variable:

 The variable which is used to store only numeric data is called a numeric variable. That means to store numeric data, users need to have a numeric variable in the program. Example: Here, x and y are numeric variables and they store values 55 and 7.53 respectively.[2] 

x = 55
y = 7.53
sum = x + y
PRINT “sum”

 2. String variable:

 The variable which is used to store only string data is called the string variable. A string variable can store numbers as well as characters. The string data should be closed by double quotation marks (“……………”). The string variable is represented by an alphabet followed by a dollar sign ($). Example: name$= “Hari”, address$= “Ward no. 4 Chitwan”[3]  Here name$ and address$ are string variables. They store values Hari and Ward no. 4 Chitwan respectively.


Name$ = “Ram”
Address$ = “Kathmandu”
PRINT “Name”; Name$
PRINT “Address”; Address$

Rules for giving variable names:

 Some rules while giving variable names are as follows:

1.     The first character of a variable name must begin with alphabets.

the remaining letters can be letters, numbers, or decimal points.

2.      Variable names can be up to 40 characters in length.

3.     There cannot be a space between the variable names.

4.      String variable names must end with a dollar sign ($).

5.     QBASIC keywords or reserved words cannot be used as variable names such as cls, input, print.

Some of the Valid string variables in qbasic names are:

X $, y $, Name $, address $, sec1 $, and so on.

Some of the invalid string variables in qbasic names are:

X, z, 3age $, name $, class 5 $, cls $, input $, and so on., Etc

Some valid numeric variable names in qbasic are:

 X, y, role number, grade, salary, age, Num1, etc.

Some invalid numeric variable names in qbasic are:

1x, mark sheet, name $, cls, etc. 

 2  .   Constants: Constants are these data items. Values ​​that change during program execution remain the same. Constants are also called data. There are two types of constants. Since QBASIC uses two types of data, there are two types of constants[1]. They are:

 Numeric constant

 String constant

1. Numeric constants are just numbers. These values ​​cannot be changed while the program is running. These numbers can be used in mathematical calculations. Example: 22, 76, 43, etc.[2] 

 2. String constant String constants are characters as well as numbers and are always enclosed in double quotation marks (“……………….”). These values cannot be changed during the program execution.

These numbers cannot be used in mathematical calculations. Example: “Chitwan”, “0977Nepal”, “Sita rolls no 7”, “Chitwan, 4, Bharatpur”, etc

Keywords: Keywords are the reserved words that instruct the computer to perform certain actions. Every programming language has its own keywords. In the same way, QBASIC also has its own keywords. Some of the examples of QBASIC keywords are INPUT, CLS, PRINT, etc the user should remember that keywords cannot be used as variable names.

 Character set: Character set refers to the set of characters that are allowed to be used in QBASIC. The QBASIC character set contains alphabets (both uppercase and lowercase), numbers (09), and special characters. The special characters have their own meaning and function,

 for example: * means multiplication, and it is used to multiply two operands. The characters used in QBASIC are: Alphabets: Uppercase (A, B, C, D, ………………X, Y, Z) and lowercase (a,b,c,d,……………….,x,y,z) Numbers: 0,1,2,3,4,5,6,7,8,9 Special characters: + * ? / =, ^ $ & %; < > \ # etc

Operator: A symbol that is used to perform an operation between two operands is called operator. An operator symbolizes what kind of operation has to be performed on the data. In QBASIC, four types of operators are used, which are as follows: 

1. Arithmetic operator 

2. Relational operator (Comparison operator)

3. Logical operator

4. String operator

 1. Arithmetic operator: Arithmetic operator refers to the operator which is used to perform mathematical calculations such as addition, subtraction, multiplication, etc. The arithmetic operators used in QBASIC are as follows: Operator Meaning Example + Addition 3 + 2 = 5 Subtraction 4 – 2 = 2 * Multiplication 2 * 2 = 4 / Division 9 / 2 = 4.5 \ Integer division 9 \ 2 = 4 MOD Modulus division 5 MOD 2 = 1 ^ Exponentiation 3 ^ 2 = 9 

2. Relational operator ( Comparison operator )Relational operator refers to the operator which are used to compare two values. These operators are used to show relation. The relational operator is also known as comparison operator. The relational operator used in QBASIC are given below: Operator Relation Example = Equal X = Y < > Not equal to X < > 50 < Less than X < 30 > Greater than X > 12 <= Less than or equal to X <= 16 >= Greater than or equal to X >= 14

3. Logical Operator refers to the operator that is used to combine two or more relational expressions. It gives a single value, that would be either True or False. Logical operators are specially used for making decisions. The logical operators used in QBASIC are shown below. Example of operator AND A = 5 AND B = 12 OR A = 5 OR B = 12 NOT A = 5 NOT B = 12 

4. String operator (concatenation) T) The operator or twist used to combine the two. Many strings are called string operators. The strings are separated by the concatenation operator. H. Plus sign (+), connected. Example: 

A$ = “Hello”
B$ = “Everyone”
           Output: HelloEveryone

Please download our app by clicking the image below:

Download Qbasic application on your phone
Download Qbasic application on your phone

If the above link is not working. You can use this link –>

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *