COBOL Interview Questions -3



COBOL Interview Questions -3

Postby Ravi Teja » Wed Dec 08, 2010 3:57 pm

If i am incorrect,please correct me

(1) How many bytes does a s9(7) SIGN LEADING SEPARATE field occupy?

a) 8 bytes
b) 9 bytes
c) 7 bytes
d) 6 bytes


(2) Each module of a structured program should have -------- Entry point and -------- exit point

a) Three,Five
b) Two,one
c) One, One
d) Two, Two


(3) Which of the following files can be opened in all the 4 modes?

a) indexed
b) relative
c) sequential
d) All of the above


(4) Just one -------- statement allows several alternative paths of execution

a) evaluate
b) if statements
c) perform statement
d) copy statement


(5) What keyword is used for class testing?

a) Alphanumeric
b) Hexadecimal
c) Numeric edited
d) Numeric


(6) Which of the following statement is not allowed when a relative file is opened to I/O mode and the access mode is random

a) read
b) write
c) rewrite
d) start



(7)
PERFORM PARA-A THRU PARA-A-EXIT VARYING A FROM 1 BY 1 UNTIL A=13.
How many times would the statements in PARA-A execute?


a) 13
b) 14
c) 12
d) 11


(8) Say whether the following is True or False MARKS GRADE 80-100 A, 80-101 B, 80-102 C
EVALUATE MARKS
WHEN 80 THRU 100
MOVE "A" TO GRADE
WHEN 80 THRU 101
MOVE "B" TO GRADE
WHEN 80 THRU 102
MOVE "C" TO GRADE
END-EVALUATE


a) True
b) False
c) Compilation Error
d) None of the above


(9) A compiler checks for:

a) Runtime errors
b) Syntax errors
c) a & b
d) None of the above


(10) How do you define a variable of COMP-1?

a) 01 WS-VAR PIC S9(4) COMP-1.
b) 01 WS-VAR USAGE COMP-1.
c) 02 WS-VAR COMP-1.
d) 01 WS-VAR COMp-1 USAGE.


(11) There is a file whose ORGANISATION is INDEXED.you want to read the records from the file in RANDOM fashion as well as sequentially.then which of the access mode would you specify?

a) SEQUENTIAL
b) RANDOM
c) DYNAMIC
d) ACCESS MODE has nothing to do with it


(12) When you will get the abend SB14?

a) Data set opened in output mode
b) PS dataset opened in extend mode
c) PDS member opened in extend mode
d) PDS member opened in input mode


(13) Which one of the following cannot cause more than one execution of the paragraph(s) that may be named in the statement.

a) The simple PERFORM statement
b) The PERFORM with TIMES option
c) The PERFORM with UNTIL option
d) The PERFORM with VARYING option


(14) Consider the following piece of code
01 GROUP-ITEM
05 AMOUNT-1 PIC 99V9 USAGE COMP VALUE 50
05 AMOUNT-2 PIC 9(4)V99 USAGE COMP
PROCEDURE DIVISION
MOVE ZERO TO GROUP-ITEM.
ADD 50 TO AMOUNT-1.

what will be the content of AMOUNT-1?


a) 50
b) 100
c) 0
d) unpredictable


(15) Consider the following program segment.
P1.
PERFORM P2 THRU P3 ARYING A FROM 1 BY 1 UNTIL A = 4.
DISPLAY A.
STOP RUN.
P2.
ADD 1 TO A.
ADD A TO SUM
P3.
EXIT.

Indicate which of the following will take place.


a) Compiler will detect a syntax error as the EXIT verb is not required in his case.
b) There will be an infinite loop.
c) The program will ultimately stop after displaying 4
d) None of the above.


(16) A=10, B=5, C=10, D=5, E=0 What will be the value of E after the following statement ADD A, B TO C, D GIVING E.

a) 15
b) 10
c) Runtime Error
d) Syntax Error


If i am incorrect,please correct me
Thank You
Ravi Teja
 
Posts: 15
Joined: Fri Dec 03, 2010 11:22 am
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL TEST-3 WITH ANSWERS

Postby Robert Sample » Wed Dec 08, 2010 5:46 pm

1. Your answer disagrees with section 5.3.15 of the COBOL Language Reference manual:
If the SEPARATE CHARACTER phrase is specified, then:

* The operational sign is presumed to be the LEADING or TRAILING character position, whichever is specified, of the elementary numeric data item. This character position is not a digit position.

* The character S in the PICTURE character string is counted in determining the size of the data item (in terms of standard data format characters).


3. Check section 6.2.26 of the COBOL Language Reference manual to see why your answer is wrong.

7. Considering the default is WITH TEST BEFORE, would you care to change your answer?

8. Your answer is wrong -- EVALUATE doesn't work that way; see the COBOL Language Reference manual for details.

14. Considering the MOVE ZERO TO GROUP-ITEM will NOT take into account the USAGE COMP variables, would you like to change your answer?
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to Interview Questions

 


  • Related topics
    Replies
    Views
    Last post