Wednesday, 13 December 2017

Chapter 12

      Class 6                                                     Lesson 12
QB64 Statements
Q1. What is the use of INPUT statement? What does a computer do when we use INPUT statement?
Ans. The input statement is used to accept a data item from the user and store it in a variable. A computer performs the following tasks when we use Input Statement:
1.      It stops the further execution of the program.
2.      It prints question mark on the screen.
3.      It waits for the user to key in its response and press the enter key.
4.      It assigns the same data item into the corresponding variable.

Q2. What is the use of PRINT statement using TAB function?
Ans. The TAB function is used to move the print position to the column given in its argument. This statement is quite suitable for printing tabular type of results.
Syntax:   PRINT TAB (C); “Constant/Variable/Expression”

Q3. Differentiate between the use of PRINT statement with comma and semicolon by using examples.
Ans. PRINT with Semi Colon: It is used to display the values One after another, without any space  in between.
Syntax: PRINT (variable);(variable);…
Example:     LET X$= “MY”
                      LET Y$= “NAME”
                      PRINT X$; Y$
                      END

PRINT with Comma:     It is used to display the values one after another with plenty of spaces in between. Only five values can be printed in one line.
Syntax: PRINT (Variable), (Variable)
Example:           LET X =78
                           LET Y = 22
                           LET Z = 52
                           PRINT X, Y, Z
                           END

Q4. What is the use of Assignment statement?
Ans. The Assignment statement is used to assign or give a value to a variable.
      Syntax:  [LET] <Variable Name> =<Value>
The use of word LET is optional.

Q5. When does the “redo from start” message get displayed on the screen?

Ans. If the value entered during execution of a program does not match with the type of variable given in the program, then the “redo from start” message is displayed on the graphic screen. It means that you have to re-enter all the values.

15 comments: