0% found this document useful (0 votes)
5 views5 pages

VII Ch7 QB64 ExerciseQnA

Chapter 7 covers conditional control statements in QB64, including the use of IF-THEN, IF-THEN-ELSE, and GOTO statements for decision-making and flow control in programming. It includes fill-in-the-blank exercises, true/false questions, application-based scenarios, multiple choice questions, and error identification related to these statements. The chapter emphasizes the importance of control statements in managing program execution and provides examples for clarity.

Uploaded by

sinhasujata358
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

VII Ch7 QB64 ExerciseQnA

Chapter 7 covers conditional control statements in QB64, including the use of IF-THEN, IF-THEN-ELSE, and GOTO statements for decision-making and flow control in programming. It includes fill-in-the-blank exercises, true/false questions, application-based scenarios, multiple choice questions, and error identification related to these statements. The chapter emphasizes the importance of control statements in managing program execution and provides examples for clarity.

Uploaded by

sinhasujata358
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Chapter – 7

Conditional Control statements in QB64

### A. Fill in the blanks:

1. A **Variable** has a unique name, a type, and a size, which is used to identify it in a
program.

2. A string variable contains values, **text** or **symbols** within double quotes.

3. IF-THEN statement is used for making **decisions** as well as **comparisons**.

4. If the condition specified after IF is true, then the instruction after **Then** is
executed.

5. **IF THEN ELSE** is a conditional decision-making statement.

6. **Control** statements help to control the flow of a program.

### B. State True or False:

1. Constants can change their values during the execution of a program. **False**
2. Numeric variable can hold only numbers. **True**

3. The condition in IF THEN ELSE statement is given by the logical operators. **True**

4. GOTO statement transfers the program control from one statement to another.
**True**

5. In READ – DATA statement, the data is provided in a program at the time of


execution. **True**

### C. Application Based Questions:

1. Vishal has created a program in QB64. He wants that the output of the program should
be displayed subject to true and false conditions. Suggest him the appropriate statement.

- **IF…THEN…ELSE** statement would be appropriate for displaying output based on true


and false conditions.

2. Smriti wants to give output of a program in infinite loop. Which statement will you
suggest her to use?

- **GOTO** statement can be used to create an infinite loop by redirecting the program
flow back to a previous label.

### D. Multiple Choice Questions:


1. **$** sign is used to represent an alphabet in a string.

- b. $

2. **IF…THEN** statement is used for making decision based on comparisons.

- c. IF…THEN

3. In IF…THEN…ELSE statement, if the condition is False, then the **ELSE** statement will
be processed.

- a. ELSE

4. **GOTO** statement is used to transfer the program control from one statement to
another.

- c. GOTO

5. **ELSEIF** statement is used when we want to have more choices in the IF…THEN
statement.

- a. ELSEIF

### E. Identify the errors:

1. IF A=5 Rs THEN GOTO START

- **Error:** The condition should be properly formatted. It should be `IF A = 5 THEN GOTO
START`.

2. IF A>B THEN PRINT A IS GREATER


- **Error:** The text to be printed should be enclosed in quotes. It should be `IF A > B
THEN PRINT “A IS GREATER”`.

3. IF A=10A THEN PRINT AS ELSE PRINT B

- **Error:** The condition and variable names are incorrect. It should be `IF A = 10 THEN
PRINT A ELSE PRINT B`.

4. IF Y$=”KABIR” THEN GOTO A : OTHERWISE GOTO B :

- **Error:** The `OTHERWISE` keyword is not valid in QB64. It should be `IF Y$ = “KABIR”
THEN GOTO A ELSE GOTO B`.

5. IF X=”SUNDAY” THEN PRINT, “HAVE FUN” ELSE PRINT, “FOLLOW THE ROUTINE”

- **Error:** The `PRINT` statement should not have a comma after it. It should be `IF X =
“SUNDAY” THEN PRINT “HAVE FUN” ELSE PRINT “FOLLOW THE ROUTINE”`.

### Answer the following:

1. **Constants and Variables:**

- **Constants** are fixed values that do not change during the execution of a program.

- **Variables** are storage locations that can hold data which may change during the
execution of a program.

2. **Use of Control Statements:**

- Control statements are used to manage the flow of execution in a program. They include
conditional statements (like IF…THEN) and loops (like FOR…NEXT).

3. **IF…THEN Statement:**
- The IF…THEN statement is used to execute a block of code only if a specified condition is
true. For example:

IF X > 10 THEN PRINT “X is greater than 10”

4. **IF…THEN…ELSE Statement:**

- The IF…THEN…ELSE statement allows for two possible execution paths based on a
condition. If the condition is true, the code after THEN is executed; otherwise, the code
after ELSE is executed.

For example:

IF X > 10 THEN PRINT “X is greater than 10” ELSE PRINT “X is 10 or less”

5. **END IF Statement:**

- The END IF statement is used to mark the end of an IF…THEN block, especially when
multiple lines of code are to be executed conditionally.

For example:

IF X > 10 THEN

PRINT “X is greater than 10”

PRINT “End of condition”

END IF

6. **GOTO Statement:**

- The GOTO statement is used to transfer control to a specific line or label in the program.
For example:

GOTO START

START:

PRINT “Program starts here”

You might also like