Page 1 :
Sanskar Global School,Pratapgarh, Chapter 8- CONDITIONAL STATEMENTS IN QBASIC, Class-6th, Subject-Computer, Session 2020-21, Note: Copy it to your fair copy., C. Short Answer Type Questions:, Q1. Mention two control statements., Ans.1 Two control statements are Loop and Conditional statements. They help for, controlling the sequence of program’s execution., Q2. Mention any three conditional statements., Ans2. Three conditional statements are: IF-THEN, IF-THEN-ELSE, IF-ELSEIF-ELSE., Q3. Write the syntax of IF THEN Statement., Ans3. IF <condition> THEN (if the condition is true then statements are executed), <Statements>, END IF, D. Long Answer Type Questions:, Q1. What do you mean by conditional statements?, Ans1. Conditional statements specifies whether a particular task will be performed or not, on the basis of a specific condition. The program transfers control for executing the, statements based on whether the result of condition is true or false. These statements use, relational operators., Q2. Define IF THEN ELSE statement., Ans2. If Then Else is a conditional statement. It is also called bi-directional decision, making statement. If the condition is true then the statements in IF block are executed. If, the condition is false, then the statements following ELSE block are executed., Q3. When do we use IF ELSE IF ELSE statement?, Ans3. IF-ELSEIF-ELSE statement is used when we want to specify some additional, conditions in the IF-THEN statement, the IF-ELSEIF-ELSE statement is used., Syntax:, IF <condition 1> THEN <Statements> (if the condition 1 is true statement is executed), ELSEIF <condition 2> THEN <Statements>, (statements to be executed if condition 1 is false and condition 2 is true)
Page 2 :
ELSE < Statements>, (statements to be executed if both condition 1 and condition 2 are false), END IF, END IF, E. Find the error in the following code and correct it., INPUT “Enter a number”; Num, If Num >0, PRINT “Number is positive”, ELSE, PRINT “Number is negative”, END, Correction-: THEN statement is missing from the program. There should be THEN after IF, condition in the program., , EXERCISE, , A. Fill in the blanks:1) For controlling the sequence of program control statements are used., 2) Control statements are loop and conditional statements., 3) IF statement is used to make a choice between two options and only one option, which meets the condition is to be performed., 4) IF-THEN-ELSE is a bi-directional decision-making statement., B. Write true(T) or false(F)., 1) You can have as many ELSEIF statements as you want. (T), 2) While writing a program, you must have observed that it follows a, specific sequence, the same in which commands are written. (T), 3) In case you want to specify some additional conditions in the IF THEN, statement, the ELSEIF statement is used. (F), 4) To cover different situations, we can use IF-THEN statement multiple times. (F)