CIS 241 QUIZ 2 (Ch 4-6)

advertisement
CIS 241 QUIZ 3 (Ch 7-9)
Name: _______________________________
Date: _________________
1. All of the following are correct ADD statements in COBOL EXCEPT:
A. ADD 15 TO BALANCE
B. ADD BONUS TO REGULAR-PAY GIVING TOTAL-PAY
C. ADD REGULAR-PAY TO 500
D. ADD 15 20 30 GIVING AMOUNT
E. ADD AMOUNT1 TO 30 GIVING AMOUNT2
2. Which of the following SUBTRACT statements is NOT correct?
A. SUBTRACT AMT1 FROM AMT2
B. SUBTRACT A FROM 10
C. SUBTRACT AMT1 FROM 10 GIVING AMT2
D. SUBTRACT AMT1 AMT2 FROM AMT3
E. SUBTRACT AMT1 AMT2 AMT3 FROM BALANCE1 BALANCE2
3. Which of the following MULTIPLY statements are NOT correct?
A. MULTIPLY AMT1 BY AMT2 BY AMT3 GIVING TOTAL
B. MULTIPLY AMT1 BY AMT2
C. MULTIPLY 10 BY AMT
D. MULTIPLY 10 BY 20 GIVING TOTAL
E. MULTIPLY AMT1 BY 10 GIVING TOTAL
4. Which of the following DIVIDE statements is NOT correct?
A. DIVIDE AMT1 INTO AMT2
B. DIVIDE AMT1 INTO AMT2 GIVING TOTAL
C. DIVIDE AMT1 BY AMT2
D. DIVIDE AMT1 BY AMT2 GIVING TOTAL
E. DIVIDE AMT1 INTO 20 GIVING TOTAL
5. Which of the following COMPUTE statements is NOT correct?
A. COMPUTE Y = Y + 1
B. COMPUTE Y ROUNDED = AMT1 + AMT2
C. COMPUTE Y = AMT1 * AMT2 ON SIZE ERROR DISPLAY 'Y TOO SMALL'
D. COMPUTE Y = AMT1 ***
E. COMPUTE Y = X
Name: ______________________________
Date: _________________
6. Which of the following statements is NOT correct?
A. COMPUTE Y = FUNCTION MIN (1 2 3 4 5)
B. COMPUTE Y = SQRT (X)
C. COMPUTE Y = FUNCTION RANDOM
D. MOVE FUNCTION MAX (A B C D E F) TO Y
E. COMPUTE Y = FUNCTION ANNUITY ( 0.10, 120)
7. Each of the following terms is valid in a COBOL IF-statement EXCEPT:
A. THEN
B. ELSE
C. OTHERWISE
D. END-IF
E. CONTINUE
8. Given the statement:
IF A = 1 OR B = 2 OR C = 3
PERFORM 300-A-RTN
ELSE
PERFORM 300-B-RTN
END-IF
When will 300-B-RTN be performed?
A. A = 1, B = 2, C = 3
B. A = 0, B = 0, C = 0
C. A = 1, B = 0, C = 0
D. A = 0, B = 0, C = 3
E. A = 0, B = 2, C = 0
9. Each of the following is true about a condition-name EXCEPT:
A. It is coded on level 88.
B. It must have a PIC clause.
C. It has a truth value.
D. It is used to make programs easier to read and debug.
E. It must have a VALUE clause.
10. Which of the following conditions is NOT true?
A. IF 056 = 56
B. IF +87 = 087
C. IF 'ABC' = ' ABC'
D. IF 'ABC' = 'ABC '
E. IF 7 = 7.00
2
Name: ______________________________
Date: _________________
11. Which of the following is incorrectly coded?
A. IF A < 20 OR > 30
B. IF A = 7 OR > 8
C. IF A OR B = 4
D. IF A = 4 OR B NOT = 3
E. IF A > = 4
12. Given A = 5, which of the following is NOT true?
A. A NOT > 5
B. A NOT > = 5
C. A > = 5
D. A = 10 OR < 6
E. A NOT > 5 AND < 10
13. Given: PERFORM 300-LABEL-RTN, which of the following is NOT true?
A. 300-LABEL-RTN will be executed exactly once.
B. Every sentence will be executed within 300-LABEL-RTN.
C. A condition must be true before 300-LABEL-RTN will be executed.
D. This is used for executing 300-LABEL-RTN from one or more points of a program.
E. This is an example of modularization.
14. Which PERFORM depends on the physical placement of the paragraphs to determine
which paragraphs are executed?
A. In-Line PERFORM
B. PERFORM paragraph-name UNTIL..
C. PERFORM paragraph-name N TIMES
D. PERFORM ..THRU
E. PERFORM ..VARYING
15. Which of the following is TRUE about a PERFORM 200-CALC-RTN UNTIL?
A. It has a scope terminator.
B. It does not name a paragraph.
C. It has code within.
D. It tests a condition.
E. It is an in-line PERFORM
16. Which one of the following does NOT involve iteration?
A. In-Line PERFORM UNTIL
B. Simple In-Line PERFORM
C. PERFORM VARYING
D. PERFORM paragraph-name UNTIL
E. PERFORM N TIMES
3
Name: ______________________________
Date: _________________
17. Which of the following uses an explicit counter that it initializes and increments?
A. In-Line PERFORM UNTIL
B. PERFORM paragraph-name
C. PERFORM paragraph-name VARYING
D. PERFORM paragraph-name UNTIL
E. PERFORM paragraph-name N TIMES
18. Given the statement:
PERFORM 300-RTN VARYING NUM FROM 2 BY 3 UNTIL NUM > 8.
Which of the following is NOT true?
A. After execution, NUM = 8.
B. 300-RTN will be executed 3 times.
C. NUM must be defined in the DATA DIVISION.
D. The value of NUM must not be modified within 300-RTN.
E. The condition is checked prior to looping.
19. Which of the following is TRUE about the GO TO statement?
A. It tests a condition.
B. It is a conditional statement.
C. It is an example of CASE structure.
D. It permanently transfers control to another paragraph.
E. It is recommended for use in top-down structured programming.
20. Given the statement:
PERFORM 300-RTN VARYING I FROM 2 BY 3 UNTIL I > 6
AFTER J FROM 5 BY –2 UNTIL J < 2.
Which of the following is NOT true?
A. After execution, I = 8.
B. After execution, J = 1.
C. 300-RTN will be executed 8 times.
D. Both I and J must be defined in the DATA DIVISION.
E. The major loop is controlled by I.
4
Download