Computer Studies Paper 2, WASSCE (SC), 2021

Question 5

 

Write a QBASIC program to grade any score entered from the keyboard as either ‘poor’ for a score that is below 50% or” Satisfactory” for a score that is equal to or above 50%. The program execution should stop as soon as a score that is less than zero is entered.

 

 

Observation

   

   The question tested the candidates’ knowledge in BASIC programming.

 

 

The expected answer is:
QBASIC Program to grade scores
10           REM    Program to grade entered scores
20           CLS
30           Score = 0                                                         
40                       DO       UNTIL Score < 0                     
50                       INPUT “Enter a score:”; Score
60                       IF Score < 50 THEN                
70                                   PRINT “Poor”             
80                       ELSE                                                  
90                                   PRINT “Satisfactory”  
100                     END    IF
110         LOOP                                                             
120         END         

                                                                              

OR

 

DIM       SCORE AS INTEGER
               Score = 0
                           DO       WHILE Score >= 0      
                           INPUT “Entre a score:”; Score
                           SELECT CASE (SCORE)        
                           CASE 50 TO 100                    
                           PRINT “SATISFACTORY”  
                           CASE 0 TO 49                        
                           PRINT “POOR”                      
                           END SELECT                         
               LOOP

END

     
OR


REM PROGRAM TO GRADE ENTERED SCORES
REM USING SELECT CASE..END STRUCTURE
CLS
DIM       SCORE AS INTEGER
                           DO       UNTIL Score < 0         
                           INPUT “Entre a score:”; Score
                           SELECT CASE (SCORE)        
                           CASE 50 TO 100                                
                           PRINT “SATISFACTORY”                
                           CASE 0 TO 49            
                           PRINT “POOR”                      
                           END SELECT                         
               LOOP
END                           

     

 

OR

REM PROGRAM FOR “GRADING SYSTEM”
CLS
Score = 0
                           DO       while Score >=
                           INPUT Score                                     
                           IF Score >=0 THEN                 
                           IF Score <50 THEN                 
                                       PRINT “poor”                                     
                           ELSE
IF score >=50 THEN PRINT “satisfactory”
END IF
END IF

LOOP                                                                            
END


OR

 

REM PROGRAM FOR “GRADING SYSTEM”
CLS
Score = 0
                           DO       UNTIL  Score< 0         
                           INPUT Score                         
                           SELECT CASE (SCORE)
                           IF Score >=0 THEN                 
                           IF Score <50 THEN                 
                                       PRINT “poor”                         
                           ELSE
IF score >=50                          
THEN PRINT “satisfactory”                
END IF
END IF

LOOP

                                                       
END

 

The candidates exhibited poor knowledge of BASIC programming.