Ch-7
QBASIC
class 8
Very short answer type
questions:-
Q1. What is library function?
Ans1. Library functions in QBASIC are used for scientific
and mathematical calculations. These are also called built in functions.
Syntax: - Function name (argument)
There are two types of library functions: -
1.
Numeric 2.
String.
Q2. What do you mean by word
‘string’?
Ans2. String is a combination of a group of characters or
words which are enclosed with in double quotes.
Q3. Explain SGN () function in
brief.
Ans3. This function determines the sign of the given
function. Eg: - SGN(-45) will return the value -1 and SGN(52) will return
the value 1.
Q4. Differentiate between
RIGHT$() and LEFT$().
Ans4.
RIGHT$()
|
LEFT$()
|
This function returns the specified number of
characters from the right most side of the string.
|
This function returns the specified number of
characters from the left most side of the string.
|
Syntax: -
RIGHT $(string, specific number of characters)
|
Syntax: -
LEFT $(string, specific number of characters)
|
Example: - Right$
(software, 5) -> ware
|
Example: -
Right$ (software, 5) -> soft
|
Q5. How the SOUND command is
different from the PLAY command.
Ans5.
Sound
|
Play
|
SOUND command generates a sound through computer’s
speaker
|
PLAY command is used for playing musical notes with the
help of alphabetic characters.
|
Example: - SOUND
1000, 5
|
Example: - CLS
PLAY”CDEFGAB”
END
|
Long answer type questions: -
Q1. Define loop. If we do not
use the ‘STEP’ statement, what will happen?
Ans1. Loops include certain series of instructions which
are to be repeated for a particular number of times or till the conditions are
satisfied. If we do not use STEP statement, the for loop will by default
increment the value by 1.
Q2. Write the difference between
FOR NEXT LOOP and DO LOOP.
Ans2.
FOR NEXT
|
DO LOOP
|
The FOR NEXT statement instructs the computer to repeat
a set of instructions for a given number of times.
|
It is a block of commands, where the program does not
have to do something a certain number of times like in FOR NEXT.
|
Example: - CLS
Input ”Enter a name” ; A$
For x = 1 to 5
PRINT
A$
NEXT
X
END
|
Example: - CLS
Sum = 0
INPUT ”Enter the first number (-1 to quit);” , Number
LOOP
PRINT
”The sum is; “sum
END
|
No comments:
Post a Comment