Chapter 8 Conditional Control Statements
Chapter 8 Conditional Control Statements
Brain Developers
1. A ______________ has a unique name, a type, and a size, which is used to identify it
in a program.
4. If the conditional specified after IF is true, then the instructor after ____________ is
executed.
Answer:
1. A variable has a unique name, a type, and a size, which is used to identify it in a program.
4. If the conditional specified after IF is true, then the instructor after Then is executed.
3. The condition IF THEN ELSE statements is given by the logical operators. (False)
Correct Answer: The condition IF THEN ELSE statements is not given by the logical
operators.
4. GOTO statement transfers the program control from one statement to another. (True)
Correct Answer: In INPUT statement, the data is provided in a program at the time of
execution.
1. Vishal has created a program in QB64. He wants that the output of the program
should be displayed subjected to true and false condition. Suggest him the appropriate
statement.
2. Smriti wants to give output of a program in infinite loop. Which statement will you
suggest her to use?
Answer: She can use GOTO statement for giving output of a program in infinite loop.
a) +
b) $
c) ?
Answer: b) $
a) PRINT
b) INPUT
c) IF…THEN
Answer: c) IF…THEN
3. In IF…THEN…ELSE statement, if the condition is False, then the ___________
statement will be processed.
a) ELSE
b) IF
c) THEN
Answer: a) ELSE
a) PRINT
b) IF THEN
c) GOTO
Answer: c) GOTO
a) ELSEIF
b) GOTO
c) IF…THEN…ELSE
Answer: a) ELSEIF
Answer: IF X$=“SUNDAY” THEN PRINT “HAVE FUN” ELSE PRINT “FOLLOW THE ROUTINE”
Answer:
• Constants are the values that do not change during the execution of a program. Constants are of
two types: Numeric Constants and Character Constants.
• A variable is a named location in the memory of computer that stores data temporarily. It can hold
one value at a time and can accept different values during the execution of the program. Variables
are of two types: Numeric and String.
Answer: The statements that help to control the flow of a program and change the order of
execution of statements based upon a given condition are known as Control Statements. There are
various control statements in QB64, like IF...THEN, GOTO, IF...THEN...ELSE, etc.
Answer: The IF-THEN statement is the most basic type of control statement. It tells the program to
execute a set of statements only if the condition evaluates to true. Example: IFX > Y THEN C = C+1
It means that if X is greater than Y, then 1 is added to the value of C.
Answer: IF-THEN-ELSE is a two-way decision making statement. If the condition given after IF part
is true, statement(s} specified after THEN gets executed. But if the condition is False, the statements
after ELSE part will be processed.
Answer: END IF statement is required after the use of multiple line IF, ELSE IF or ELSE statement
blocks. It terminates the IF...THEN....ELSE block. It should be written before the END statement.
Example: CLS
INPUT X
IF X > 1 THEN
ELSE
END IF
Syntax: GOTO