Chapter 3
More on QBASIC
Answers to back Exercise
1. Tick the correct option
A. iii
b. i
c. ii
d. ii
e. i
f. iii
2. Fill in the Blanks
a. exit
b. string
c. Resolution
d. FOR ... NEXT
e. text mode, graphics mode
b. string
c. Resolution
d. FOR ... NEXT
e. text mode, graphics mode
f. 16
3. Write T if the given statement is true and F if it is false
a. F
b. T
c. F
d. T
e. T
f. F
4. Answer the questions.
a. The working of the following iterative commands is as follows:
(i) WHILE...WEND: This loop is used when you want to execute a set of instructions as long as the given condition is true.
(ii) DO...LOOP UNTIL: This loop executes a block of instructions repeatedly until the specified condition becomes true.
(iii) FOR...NEXT: This loop is used to repeatedly execute a statement or a block of statements for the specified number of times. This loop is a Fixed Loop.
b. The String functions available in QBASIC are given below.
- LEN: This function finds the number of characters in a string.
- LEFT$: This function extracts the specified number of characters from the left side of the string.
- RIGHT$: This function extracts the specified number of characters from the right side of the string.
- MID$: This function extracts the specified number of characters from anywhere in between the string.
- SPACE$: This function is used to insert a blank space between the given strings.
c. The screen modes enable the user to adjust the screen resolution according to the requirement. the 2 basic types of screen modes are available in QBASIC. they are the Text mode and the Graphics mode.
d. The LINE command is used to draw a line between two given coordinates. the syntax of LINe command is as follows:
LINE (50,50)-(200,200), 13
The CIRCLE command is used to draw a circle or an ellipse. This command requires to specify the coordinates of the centre, the radius of the circle and the colour. The syntax of the CIRCLE command is as follows:
CIRCLE (175,150),100,14
e. The exit command is used to terminate any loop before it execute the expected number of times.
f. QBASIC allows to use one loop inside another loop. This is known as nesting of loops and such loops are called nested loops.
No comments:
Post a Comment