Chapter No.11 CONTROL STATEMENTS

Chapter No.11 CONTROL STATEMENTS Q.11.01 Complete the following statements. i) The order in which program statements execute can be changed using a __...
Author: Iris Marshall
5 downloads 3 Views 551KB Size
Chapter No.11 CONTROL STATEMENTS Q.11.01 Complete the following statements. i) The order in which program statements execute can be changed using a ________________ statement. ii) The last line of the output using GOTO loop READ . . . . DATA statement is ________________ iii) In looping a statement is executed ________________ iv) IF . . . . THEN statement with GOTO forms a ________________ loop. v) ________________ Statements are used to form counter loop. Ans: i) Control ii) Out of data in iii) many times iv) Controlled v) FOR . . . . NEXT Q.11.02 Which of the following statements is True or False? i) The decision block controls the statement to be executed. ii) GOTO is a conditional statement. iii) STOP statement is used to terminate an endless loop. iv) GOTO loop perform repeated tasks quickly and efficiently. v) The statement “FOR K = 1 to 10 step -2” is incorrect. Ans: i) True ii) False iii) False iv) True

v) True

Q.11.03 Encircle one Choice A, B, C or D I each case i) Which of the following statements can be used for unlimited looping? (A) GOTO (B) FOR. . NEXT (C) IF THEN (D) ON GOTO ii) Which of the following statements transfers control unconditionally? (A) GOTO (B) FOR. . NEXT (C) IF THEN (D) ON GOTO iii) Which of the following statements can be used for counter loop? (A) GOTO

(B) FOR. . NEXT

(C) IF THEN

(D) WHILE .. WEND

iv) Which of the following statements can be used for multiple branching? (A) GOTO

(B) FOR. . NEXT

(C) IF THEN

(D) WHILE .. WEND

v) ON ERROR GOTO statement is used to detect (A) Logical Errors (B) Syntax Errors (C) Execution Errors (D) none vi) Name the error that you think to exit in the formula C = C*D/C (A) Logical (B) Syntax (C) Execution (D) none Ans: i) (A)

ii) (A)

iii) (B)

iv) (C)

1

v) (B)

vi) (D)

Q.11.04

Match the items given in Column I with those given in Column II

i) ii) iii) iv) v) vi)

Column I GOTO loop IF . . . THEN FOR . . . NEXT Nested Loop WEND ON . . . GOTO

a) b) c) d) e) f) h)

Column II Multiple choice WHILE N>5 N = N+2 ENDLESS N = 1 TO 5 N >=5 Loops within loop

Ans: i) (d)

ii) (f)

iii) (e)

iv) (g)

v) (b)

vi) (a)

Q.11.05 Predict the output, or give the ERROR message for each of the following programs. a) 10 READ A,B 20 PRINT A&B 30 GOTO 10 40 DATA 3,8,6,4 50 END Ans: Output: 3 0 8 6 0 4 Out of DATA in 10

b)

Ans: c)

Ans: d)

Ans:

10 READ A,B 20 PRINT A &B 30 DATA 5,7,8,4 40 GOTO 20 50 END Output: No error message will be displayed. This program will continue until you break. 10 LET X=17 20 IF (X>3) OR (X>18) THEN PRINT “YES” 30 PRINT “NO” 40 END Output: No Error message will be displayed. 10 LET X=23 20 IF NOT (X>3) THEN GOTO 50 30 PRINT “KNOT” 40 END Output Undefined line number in 20 2

e)

Ans:

Q.11.06 Ans:

10 LET J = 3 20 PRINT J + 2 30 PRINT “ABC” 40 LET J = J + 1 50 IF J

Suggest Documents