Chapter 8 :- QBasic Statements
Chapter 8 :- QBasic Statements
Buzz Keyword
(i)LET: This statement allows us to assign value to a variable.
(ii)PRINT: This statement prints numeric or string expressions to the program output screen.
(iii)INPUT: This command is used to accept values from the user for the variables.
(iv)IF THEN: This statement is used to check conditions in the program
Fill in the blanks.
1. The + symbol with PRINT statement is used to combine string expression. .
2.Let statement allows us to assign value to a variable
3. The Input command generates a question mark symbol on the output screen.
4. If the condition mentioned with IF is TRUE then the statement with Then is excuted
State whether True or False
1. Input Statement does not work for String variables. False
2. LET statement is optional to use. True
3. Any expression with the PRINT statement within the quotes will be printed as a message. True
4. The column number is mentioned in double quotes with the TAB statement. False
5. Relational operators can never be used within the conditions of IF…THEN…ELSE statements. False
Multiple choice questions.
1. Every IF statement should be terminated with
(i) Comma
(ii) Full Stop
(iii) End If
(iv)Question Mark
2. The INPUT statement generates this symbol on the output screen.
(i) Comma
(ii) Full Stop
(iii) End If
(iv) Question Mark
3. Identify the symbol(s) that can be used with the PRINT statement.
(i) Double quotes
(ii) Semi colon
(iii) Comma
(iv) All of the above
4.The output of the statement PRINT “ONE”+ “TWO” is
(i)THREE
(ii) 12
(iii) ONE TWO
(iv) ONE+TWO
5.The output of the statement PRINT “100”:100+100 is
(i)100100100
(ii)100200
(iii)300
(iv) 100100+100
Match the following.
Answer briefly.
1. What is LET statement used for?
Ans :- LET statement allows us to assign value to a variable. It is optional to use the LET statement.
2. With the help of an example, explain the PRINT statement with the addition operator
Ans :- The addition symbol (+) is used to combine string expressions.
print “RAM” + “SHArma”
output is RAM SHARMA
3. Which are the two results that are produced by the IF…THEN statement?
Ans :-This statement evaluates the program decision and the results are only in TRUE or FALSE.
4. How can we input values for multiple variables using the INPUT statement?
Ans :- The INPUT command can also input values for a list of variables. The variable names should
be separated by commas (,).
Syntax : INPUT <Variable_Name1>, <Variable_Name2>, <Variable_Name3>
Answer the following.
1. Explain the difference in output produced by the PRINT statement when used with TAB stateme and the comma operator.
Ans :- The TAB statement is used with PRINT to move to a specifi ed column position. The column number is mentioned in brackets with the TAB statement.
Syntax : PRINT TAB(C); <“EXPRESSION / VARIABLE/CONSTANT”>
Where, C is the column number.
Comma (“,”) is used with the PRINT statement to display multiple statements with spaces in between.
2. In how many various ways can the INPUT be used?
Ans :- Input Statement Using Numeric Variables with Messages, Input Statement Using Numeric and Alphanumeric Variables with Messages
3. How is the IF…THEN…ELSEIF statement used? Illustrate with an appropriate example.
Ans :-
The multiple IF’s can be combined together to form IF…THEN…ELSEIF. Every ELSEIF used
in the code can test a different condition, followed by the expression to be executed.
Example: to check if a number is greater than or smaller than or equal to10 using IF…
THEN…ELSEIF statement.
INPUT “ENTER A NUMBER”; N
IF (N > 10) THEN
PRINT “NUMBER IS GREATER THAN 10”
ELSEIF(N < 10) THEN
PRINT “NUMBER IS SMALLER THAN 10”
ELSEIF (N=0) THEN
PRINT “NUMBER IS EQUAL TO 10”
END IF
END
4. Write a program to find the cube of a number less than 11 using GOTO statement.
Ans :-
10 INPUT NUMBER”;N
20 IF (N < 11) THEN
30 PRINT N*N*N
60
40 ELSE GOTO 50
50 END IF
60 END
Popular Videos
UX for Teams
Learn the basics and a bit beyond to improve your backend dev skills.
Designer
SEO & Instagram
Learn the basics and a bit beyond to improve your backend dev skills.
Designer