# Fundamentals of QBASIC: Character Sets

## Objective Questions

#### Question 1

Write down the symbols of the special characters

NameSymbol
hash
forward slash
asterisk
colon
semi-colon
dollar sign
double quotes
exclamation

NameSymbol
hash#
forward slash/
asterisk*
colon:
semi-colon;
dollar sign\$
double quotes"
exclamation!

#### Question 2

Complete the table with reference to arithmetical operators as shown below:

OperationOperandFormat used in QBASIC
MultiplicationM * N
M / N
^
SubtractionM - N

OperationOperandFormat used in QBASIC
Multiplication*M * N
Division/M / N
Exponent^M ^ N
Subtraction-M - N

#### Question 3

Write down the names of the following relational operators:

Relational OperatorMeaning
>
<=
=
<>
<
>=

Relational OperatorMeaning
>Greater than
<=Less than or equal to
=Equal to
<>Not equal
<Less than
>=Greater than or equal to

#### Question 4

Name the three types of logical operators and also mention how they are used in QBASIC.

Logical OperatorsFormat used in QBASIC
AND(A = B) AND (B = C)
OR(A = B) OR (B = C)
NOTNOT(A = B)

#### Question 5

Convert the following mathematical expressions into QBASIC expressions.

Mathematical ExpressionsQBASIC Expressions
4 x 5 + 15
a + bc
(ab + cd)/2
pqr
a2 + b3 + c4

Mathematical ExpressionsQBASIC Expressions
4 x 5 + 154 * 5 + 15
a + bca + b * c
(ab + cd)/2(a * b + c * d) / 2
pqrp * q * r
a2 + b3 + c4a ^ 2 + b ^ 3 + c ^ 4

#### Question 6

Rewrite the given instructions in QBASIC:

1. The product of p, q and r is divided by 100.
2. m raised to the power 2 plus n raised to the power 3.
3. The sum of a and b is divided by the product of a and b.
4. Subtract 5 from m and the result is multiplied by 10.
5. The sum of p and q is multiplied by 2.
6. A is greater than or equal to B.
7. The sum of A and B is less than the product of A and B.
8. Twice the product of A plus thrice the product of B is greater than or equal to 50.

1. (p * q * r) / 100
2. m ^ 2 + n ^ 3
3. (a + b) / (a * b)
4. (m - 5) * 10
5. (p + q) * 2
6. A >= B
7. (A + B) < (A * B)
8. (2 * a + 3 * b) >= 50

#### Question 1

What is meant by the language QBASIC?

QBASIC is a programming language developed by Bill Gates and Paul Allen. It is intended to replace GWBASIC programming language.

This language is best suited for beginners. It is user friendly as all types of tasks like general programs, graphics, etc. can be performed using this language. It supports all the commands and instructions of GWBASIC.

It is a compiler based high-level language where tasks are performed in the Windows environment.

#### Question 2

What are the features of QBASIC language?

The features of QBASIC language are as follows:

1. It is user-friendly.
2. The syntax of the statements is very simple.
3. It provides Windows-based platform for writing programs.
4. It is a compiler based language.
5. Debugging can be easily done.
6. It doesn't require specifying line numbers.
7. It provides the facility to find errors in a program.
8. It works with numeric as well as non-numeric data.
9. It is useful for mathematical, scientific and engineering purposes as well.
10. It is one of the simplest high-level languages for beginners.

#### Question 3

What is meant by character sets? Name the different types of character sets.

A character set defines the valid characters that can be used in source programs or interpreted when a program is running.

In a computer, three types of character sets are used for entering the data items. They are:

1. Alphabets
2. Numbers
3. Special Characters

#### Question 4

What is an operator? Name the different types of operators.

Operators are the symbols which are used to perform different arithmetical or logical operations.

The three types of operators are:

1. Arithmetical Operators
2. Relational Operators
3. Logical Operators

#### Question 5

Define the following with two examples of each:

(a) Arithmetical Operator
(b) Relational Operator
(c) Logical Operator

(a) Arithmetical Operator

Arithmetical operators are used to perform mathematical calculations in a program. These operators work in the same sequence in which they are used in mathematics.

For example- addition (A + B), subtraction (A - B).

(b) Relational Operator

A relational operator is used to determine the relationship between two or more operands. The relational operator checks the condition and returns the result in either 'true' or 'false' for further processing.

For example- less than (A < B), greater than (A > B).

(c) Logical Operator

Logical operators are needed to compare two or more expressions. These operators give result in 'true' or 'false', depending upon the outcome of the logical expressions.

For example:

AND ⇒ ((A = B) AND (B = C))
NOT ⇒ (NOT(A = B))

#### Question 6

What are the rules to write mathematical operators?