ch-6 QBASIC
Ch-6
QBASIC
Short answer type questions:-
Q1.
Write the purpose and syntax of the following statements:
a)
CLS b) LET c) INPUT d)
END
ANS1.
|
Statement
|
Syntax
|
Purpose
|
|
1.CLS
|
CLS
|
It clears the screen.
|
|
|
|
|
|
2.LET
|
LET<variable>=<constants>
|
To assign a value to a variable.
|
|
|
|
|
|
3.END
|
END
|
It ends the program permanently. It can be used only
once at the end of the program.
|
|
|
|
|
|
4.INPUT
|
INPUT<variable>
|
To accept a value for the variable.
|
Q2.
What is elseif? Explain.
Ans2. The command allows us to perform a secondary action
if the first expression mentioned with the IF statement was false.
Syntax:- IF<condition1>then
<Statements>
Elseif<condition>
<Statements>
Else
<Statements>
Endif.
Q3.
What is the difference between LET and INPUT statements?
Ans3.
|
LET
|
INPUT
|
|
1. Purpose:-
to assign a value to the variable
|
Purpose: - to accept a value
for the variable.
|
|
2. Syntax:-
LET<variable>=<constant>
|
Syntax:-INPUT
<variable>
|
|
3. Example:-
LET A=10
|
Example:- INPUT A
|
Q4.
Write a note on REM statement.
Ans4. The text after REM is taken as comments. It is
known as non executable command and is simply ignored by the computer.
Syntax: - REM<remarks>
Long
answer type questions:-
Q1. Which
command allows us to perform secondary action if the first expression mentioned
with the IF statement was false? Explain briefly.
Ans1. The command allows us to perform a secondary action
if the first expression mentioned with the IF statement was false.
Syntax:- IF<condition1>then
<Statements>
Elseif<condition>
<Statements>
Else
<Statements>
Endif.
If no condition is satisfied,
the program control will go to the statement after the ELSE part.
Example:-
To print the grades:-
Cls
Input ”Enter marks”;MK
IF MK>=90 THEN
Grade$ = “A”
ELSEIF MK>=80 THEN
Grade$= “B”
ELSEIF MK>=70 THEN
Grade$= “C”
ELSE
Grade $=”D”
ENDIF
PRINT Grade$
END.
Comments
Post a Comment