Chapter 12 QB64 Statements
Brain Developer
A. Fill in the blanks
1. By using semicolon in a PRINT statement, the items are printed without any space between them.
2. TAB statement prints tabular type of results.
3. INPUT statement instructs the computer to wait for some data to be entered.
4. CLS command clears all the contents of the screen.
5. The INPUT statement displays a Question mark on the screen.
6. The INPUT program can be given with both numeric and alphanumeric variables.
B. State True or False
1. The PRINT statement provides variations to print the output on the screen. (True)
2. When comma is used with PRINT statement, the items are displayed close to each other without spaces. (False)
Correct Answer: When semicolon is used with PRINT statement, the items are displayed close to each other without spaces.
3. The “redo from start” message is displayed if the value of a defined variable is incorrect. (True)
4. While using INPUT statement, the punctuation between the message and the variable is a colon. (False)
Correct Answer: While using INPUT statement, the punctuation between the message and the variable is a semicolon.
5. The INPUT statement is used to assign values to variables. (False)
Correct Answer: The LET statement or Assignment statement is used to assign a value to a variable.
6. When INPUT statement is executed, the ‘’ symbol is displayed. (True)
7. You can have only one INPUT statement in a program. (False)
Correct Answer: You can have more than one INPUT statement in a program.
C. Application Based Questions
1. Vishal has created a program in QB64. He wants that the output of the program should be displayed leaving the number of spaces between the values. The variables to be displayed are N$, M$ and Total. Suggest him the appropriate Print command.
Answer: PRINT N$, M$, Total
2. Smriti wants that the program which she is writing should wait for user to key in his response. Which statement will you suggest her to use
Answer: She should use INPUT to wait for user to key in his response.
D. Multiple Choice Questions
1. _______________ command helps to insert comments that enable us to understand what the program is all about.
a) LET
b) REM
c) CLS
Answer: b) REM
2. The ___________________ statement is used to accept the data item from the user.
a) Output
b) Input
c) LET
Answer: b) Input
3. __________________ statement can be used in controlling column location.
a) Print
b) Tab
c) Print Tab
Answer: c) Print Tab
4. In QB64, whenever any item is enclosed in the ____________________ it means it is optional.
a) Curly brackets
b) Square brackets
c) Rounded brackets
Answer: b) Square brackets
5. _________________ statement stops further the execution of the program.
a) PRINT
b) INPUT
c) LET
Answer: b) INPUT
E. Identify the errors and re-write the statements
1. INPUT“Enter the name of the article; N$”
Answer: INPUT“Enter the name of the article”; N$
2. LET A=“Aarav”
Answer: LET A$=“Aarav”
3. INPUT“Enter total marks”,M.
Answer: INPUT“Enter total marks”;M
4. PRINT Marks = M
Answer: PRINT“Marks =”; M
5. Let X = “MY NAME IS KABIR”
Answer: LET X$ = “MY NAME IS KABIR”
F. Write QB64 statements for the following
1. To add values of X and Y and store the sum in Z.
Answer: Z = X + Y
2. Increase the value of A by 10 and store in A.
Answer: A = A + 10
3. Store the name Abhinav in the variable A$.
Answer: A$ = “Abhinav”
4. Multiply two variables A and B and store the result in C.
Answer: C = A*B
5. To print your name and surname without leaving any space between them.
Answer: PRINT “WINNIE”; “POOH”
6. To accept the data item for the variables, Marks with the message, during the execution of a program.
Answer: INPUT“MARKS”; M
G. Answer the following
1. What is the use of INPUT statement What does a computer do when we use INPUT statement
Answer: The INPUT statement is used to accept a data item from the user and store it in a variable. While using INPUT statement, the computer performs the following tasks
→ It stops further execution of the program and prints a question mark on the screen.
→ It waits for the user to key in its response and press the Enter key.
→ It stores or assigns the same data item into the corresponding variable mentioned in the INPUT statement.
2. What is the use of PRINT statement using TAB function
Answer: The TAB function is used to move the print position to the column indicated in its argument. This statement is quite suitable for printing tabular type of results. PRINT TAB statement can be used in controlling column location.
3. Differentiate between the use of PRINT statement with comma and semicolon by using examples.
Answer:
→ PRINT statement with comma
PRINT with comma is used to display values one after another with plenty of spaces (normally 14) in between. Only five values can be printed in one line. In case of more than 5 values, the remaining values will be printed on the next line. Example PRINT Ramu, Mofta
→ PRINT statement with semicolon
PRINT with semicolon is used to display the values one after another, without any space in between. Example PRINT “RAMU”, “MOFTA”
4. What is the use of Assignment statement
Answer: The LET statement or Assignment statement is used to assign or give a value to a variable. Example LET A = 13 will assign value 13 to variable A.
5. When does the “redo from start” message get displayed on the screen
Answer: 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.
No comments:
Post a Comment