## Objective Questions

#### Question 1

Write down the symbols of the special characters

Name | Symbol |
---|---|

hash | |

forward slash | |

asterisk | |

colon | |

semi-colon | |

dollar sign | |

double quotes | |

exclamation |

**Answer**

Name | Symbol |
---|---|

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:

Operation | Operand | Format used in QBASIC |
---|---|---|

Multiplication | M * N | |

Addition | + | |

M / N | ||

^ | ||

Subtraction | M - N |

**Answer**

Operation | Operand | Format used in QBASIC |
---|---|---|

Multiplication | * | M * N |

Addition | + | M + N |

Division | / | M / N |

Exponent | ^ | M ^ N |

Subtraction | - | M - N |

#### Question 3

Write down the names of the following relational operators:

Relational Operator | Meaning |
---|---|

> | |

<= | |

= | |

<> | |

< | |

>= |

**Answer**

Relational Operator | Meaning |
---|---|

> | 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.

**Answer**

Logical Operators | Format used in QBASIC |
---|---|

AND | (A = B) AND (B = C) |

OR | (A = B) OR (B = C) |

NOT | NOT(A = B) |

#### Question 5

Convert the following mathematical expressions into QBASIC expressions.

Mathematical Expressions | QBASIC Expressions |
---|---|

4 x 5 + 15 | |

a + bc | |

(ab + cd)/2 | |

pqr | |

a^{2} + b^{3} + c^{4} |

**Answer**

Mathematical Expressions | QBASIC Expressions |
---|---|

4 x 5 + 15 | 4 * 5 + 15 |

a + bc | a + b * c |

(ab + cd)/2 | (a * b + c * d) / 2 |

pqr | p * q * r |

a^{2} + b^{3} + c^{4} | a ^ 2 + b ^ 3 + c ^ 4 |

#### Question 6

Rewrite the given instructions in QBASIC:

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

**Answer**

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

## Answer the following questions

#### Question 1

What is meant by the language QBASIC?

**Answer**

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?

**Answer**

The features of QBASIC language are as follows:

- It is user-friendly.
- The syntax of the statements is very simple.
- It provides Windows-based platform for writing programs.
- It is a compiler based language.
- Debugging can be easily done.
- It doesn't require specifying line numbers.
- It provides the facility to find errors in a program.
- It works with numeric as well as non-numeric data.
- It is useful for mathematical, scientific and engineering purposes as well.
- 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.

**Answer**

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:

- Alphabets
- Numbers
- Special Characters

#### Question 4

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

**Answer**

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

The three types of operators are:

- Arithmetical Operators
- Relational Operators
- Logical Operators

#### Question 5

Define the following with two examples of each:

(a) Arithmetical Operator

(b) Relational Operator

(c) Logical Operator

**Answer**

**(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?

**Answer**

The rules to write mathematical operators are as follows:

There must be an operator between two operands.

For example, to multiply A and B, we need to write A * B.Zero raised to the power of any number is insignificant.

For example, 0 ^ 4.Division by zero is an invalid statement.

For example, 8 / 0.