Answer:

No. The ELSE statement must be alone on its line.

Keeping Branches Separate

The IF, THEN, ELSE, and END IF are like brackets that emphasize the parts of the two-way branch. The QBasic system requires that you put the ELSE and END IF on their own lines to keep the true and false branches clear.

PRINT "Enter a Number"
INPUT NUMBER
'
IF NUMBER >= 0 THEN
  PRINT "The square root is:", SQR( NUMBER )
ELSE  PRINT "There is no square root"       <---- Wrong!!!
  PRINT "Run the program again."
END IF
'
PRINT "Bye" 
END

So the above program is incorrect because the ELSE was not alone on its line.

QUESTION 7:

How would you fix the above program?