Fundamentals of QBASIC: Introduction
Choose the correct option
Question 1
QBASIC is a programming language. What does the letter Q signify in QBASIC?
- Quack
- Quick
- Quest
- Quiet
Answer
Quick
Reason — The full form of BASIC is Quick Beginner's All purpose Symbolic Instruction Code.
Question 2
Who among the following are the developer(s) of QBASIC?
- Bill Gates
- John Kemeny
- Bill Gates and Paul Allen
- Thomas Kurtz
Answer
Bill Gates and Paul Allen
Reason — In the year 1975, Bill Gates and Paul Allen developed QBASIC.
Question 3
Which of the following is the correct statement about QBASIC?
- It is a machine language
- It is an assembly language
- It is a high-fi language
- It is a high-level language
Answer
It is a high-level language
Reason — QBASIC is a compiler-based high-level language where tasks are performed in the windows environment.
Question 4
Which of the following is a correct expression in BASIC?
- A B + C D
- A x B + C x D
- A * B + C x D
- A * B + C * D
Answer
A * B + C * D
Reason — This expression uses the operators of QBASIC correctly.
Question 5
Which of the following is not a special character in BASIC?
- $
- @
- <
- #
Answer
@
Reason — @ is not used as a special character in BASIC.
Objective
Question 2
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 3
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 4
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 to |
< | Less than |
>= | Greater than or equal to |
Question 5
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 6
Convert the following mathematical expressions into QBASIC expressions.
Mathematical Expressions | QBASIC Expressions |
---|---|
4 x 5 + 15 | |
a + bc | |
(ab + cd)/2 | |
pqr | |
a2 + b3 + c4 |
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 |
a2 + b3 + c4 | a ^ 2 + b ^ 3 + c ^ 4 |
Question 7
Write 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 that are used in a programming language to perform different arithmetical or logical operations. An operator acts on different data items called operands.
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.