Operators:
Operator is the symbol or a command that is used to perform operation on operands(values or variables) in program. There are different types of variables supported by QBASIC.
- Arithmetic operator: Arithmetic operators are those operators which helps program perform mathematical calculations in data. Below is the list of Arithmetic operators used in QBASIC;
| Name of operator | Symbol |
| Exponent | ^ |
| Division | / |
| Integer Division(returns quotient without decimal points | \ |
| Modular Division(Returns remainder) | MOD |
| Multiplication | * |
| Addition | + |
| Subtraction | - |
- Relational Operator: Relational operators are the symbols that are used to compare two values of same type. Examples of relational operator are:- >,<,>=,<=,= ,< >(not equale to). Relational operators gives logical(boolean) result. i.e. One among Yes or No(True or False). For. Eg: x>15, y$<>"E".
- Logical Operator: Logical operators are the operators which are used to derive the result from one or more relational operators. Logical operators also provide result among "TRUE" or "FALSE",i.e. BOOLEAN or LOGICAL result. Logical operators used in QBASIC are AND, OR and NOT.
- AND: AND operator is a logical operator that returns "TRUE" result only when all relational expression result in "TRUE" and returns "FALSE" if one or more relational expressions result in "FALSE". Truth table of AND operator is shown below;
Truth Table "AND" Expression 1 Expression 2 Expression 1 AND Expression 2 FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE TRUE TRUE TRUE - OR: OR operator is the logical operator that returns "TRUE" when any relational expression results in "TRUE" and returns "FALSE" only when all the relational expressions return "FALSE". The truth table of OR operator is given below;
Truth Table "OR" Expression 1 Expression 2 Expression 1 OR Expression 2
FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE - NOT: NOT operator is a logical operator which reverses the result of relational expression. NOT operator is used with single operand. Truth Table of NOT operator is given below;
Truth Table NOT Expression 1 NOT Expression 1 FALSE TRUE TRUE FALSE
- AND: AND operator is a logical operator that returns "TRUE" result only when all relational expression result in "TRUE" and returns "FALSE" if one or more relational expressions result in "FALSE". Truth table of AND operator is shown below;
Modular Programming:
Modular programming is a programming technique in which the program is divided into multiple self-dependent modules. The advantages in adapting modular programming technique are listed below;
- Easy Development: Coding, Testing, Debugging and Modification of program becomes easier in small modules.
- Job Distribution: Single program can be distributed among various programmers.
- Reusability: Modules used in one program can be used in other programs if needed.
In QBASIC, two different types of modules can be used; Sub Procedure and Function Procedure. The following table explains about them with the differences;
| Sub Procedure | Function Procedure |
| - It is a block of program that performs a set of task. | - It is a block of program that performs one particular task. |
| - It doesn't return any value. | - It returns value. |
| - It doesn't have any datatype. | - It has datatype. |
| - It is called using a CALL statement. | - It is called wherever the function name is mentioned. |
Parameters:
Parameters are defined as the values or variables passed from a calling module to a called module. Parameters are generally categorized into two different types;
- Formal Parameters: Formal parameters are those which are used to reserve the memory location to be occupied by the values used in program. These are used in Declare statement as well as in the sub module.
- Actual Parameters: Actual parameters are those which are passed to submodule during call. Actual parameters are also known as Real parameters or Arguments. These parameters are used with calling statement.
There are two different ways of passing arguments to sub modules;
- Pass by reference: In pass by reference method, we pass the memory address of the value to the sub module. Since the original address is sent, changes made in subprocedure are also reflected in the calling procedure. In QBASIC, the default method of passing argument is 'Pass by Reference' method. Eg: CALL ADD(C,D) or PRINT AREA(C,D)
- Pass by value: In pass by value method, instead of passing the memory address, the copy of value is sent to the sub module. Any changes made in subprocedure are not reflected in calling procedure. In QBASIC, passing of parameters by value is done by enclosing the parameters by an extra pair of paranthesis. For Eg: CALL ADD((C),D). Here, C is passed by value and D is passed by reference.





