0% found this document useful (0 votes)
34 views11 pages

MCQ2 1 11

Uploaded by

ADI PATIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views11 pages

MCQ2 1 11

Uploaded by

ADI PATIL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

1. Which of the below is the correct precedence order for arithmetic operations in Cobol?

Ans :Exponential
Multiply or Divide
Add or Substract

2. Recently Rohit joined as COBOL developer in your team and started working on COBOL programs.
He has to comment few lines of his COBOL program Which character you suggest tohim for
commenting the few COBOL statements?
Ans : *

3. What does below statement convey?ADD E F TO G H


Ans : E and F are added and result is stored in G and H.
Ans : E ,F,G are added and result is stored in G .
E ,F,H are added and result is stored in H .

4. Which type of condition will help you to check whether the variable has numeric data or not?
Ans : CLASS CONDITION

5. ON SIZE ERROR applies to which verb(s) in cobol?


ANS: verb1 only

6. Which is invalid division in Cobol?


Ans: Configuration Division

7. Which of the following symbol cannot be coded on position of a COBOL program?


Ans: )

8. which false about CONTINUE in Cobol?


Ans : it does nothing and hence its called as No operation statement

9. 01 WS-SAL PIC S9(7)V9(2) COMP-3 How many bytes WS-SAL occupies internally? Choosemost
appropriate option.
Ans : 5

10. COMPUTE X=Y is equivalent to which of the following statement? Choose most appropriate
option
Ans : MOVE Y TO X

11. Which type of condition is created using level number 88 ?


Ans : CONDITION NAMES

12. Which of the following is true with respect to GOTO and PERFORM?
Ans : GOTO transfers the control to another para permanently whereas PERFORM transfers
control and eventually returns back.

13. John has to accept two numbers from user.perform addition and then display the result.Help john
from where he can start writing these statements in cobol program
Ans : 12 to 72 columns

14. Choose a valid loop verb in COBOL program?


Ans : perform
15.Which of the following is true about INLINE PERFORM? Choose the best option.
Ans : END-PERFORM is mandatory and cannot call any other paragraphs

16.Which of the following is false about condition names condition?(Level 88)


Ans : .Value clause should not be present in condition names condition.

17.Choose the correct syntax of the INLINE PERFORM?


Ans : PERFORM
<statement>
END-PERFORM
18.How to get today’s data in COBOL? Note : Assume that WS-DATE is a working storage variable.
Ans : ACCEPT WS-DATA FROM DATE

19.What is the length of WS-CUSTREC record?


Ans : 34 bytes

20. What is incorrect with following shipper?


IF A <= B DISPLAY ‘HELLO’ GO TO NEXT SENTENCE ELSE MOVE 1 TO COUNT
Ans : .Cannot code GO TO along with Next sentence
END-IF is missing

21. Which character is not allowed in Cobol program on 7th coloum?


Ans : &
22. what is the output of the following code for the given01 ws-data pic x(2) value ‘AB’
EVALUATE WS-DATA WHEN WS-DATA IS EQUAL TO ‘AB’
DISPLAY WS-DATA WHEN WS-DATA IS EQUAL TO ‘GH’
DISPLAY WS-DATA WHEN WS-DATA IS EQUAL TO ‘AB’
DISPLAY ‘OTHER’ END-EVALUATE.
Choose appropriate option
Ans : SUCH EVALUATE DECLARATION IS NOT ALLOWED IN COBOL

23.What will be the output of following EVALUATE verb?01 WS-MARK PIC 9(3) VALUE 90.
88 PASS VALUES ARE 60 THRU 100.
88 FAIL VALUES ARE 00 THRU 059.EVALUATE TRUE
WHEN PASS DISPLAY ‘PASSED’ WHEN FAILDISPLAY ‘FAILED’
WHEN OTHER
DISPLAY ‘EITHER PASSED OR FAILED’
END-EVALUATE. Choose most appropriate option.
ANS : OUTPUT IN SPOOL: PASSED

24.What is the output of following section.01 WS-UID PIC X(10).


01 WS-PWD PIC 9(8). PROCEDURE DIVISION.
MOVE ‘USERID’ TO WS-UID.MOVE 1234 TO WS-PWD.
IF WS-UID = ‘USERID’ AND WS-PWD =12345
DISPLAY ‘VALID LOGIN’
DISPLAY ‘ENTER OTHER DETAILS’ ELSE
DISPLAY ‘INVALID UID AND PWD’ END-IF.STOP RUN.
Choose most appropriate option.

Ans: INVALID UID AND PWD


25. Which of the following statements are true wit respect to COBOL program structure?
Choose options.

Ans : Environment Division is optional to code Identification Division is Mandatory to code inevery
cobol program.

26. Consider the below code. Assume there are no syntax error01
WS-VALUE PIC 9(3)
88 DATA1 VALUES ARE 1 THRU 9
88 DATA2 VALUES ARE 2.5
What will be the output of below condition
MOVE 2 TO WS-VALUE IF DATA1 AND DATA2 THENDISPLAY
‘FIRST’
ELSE
IF DATA1 THEN DISLAY
‘SECOND’ELSE
DISPLAY ‘THIRD’END-IF
END-IF CHOOSE MOST APPROPRIATE OPTION

ANS: FIRST

27. SNIPPET
01 WS-CNO PIC 9(3)
01 WS-CNAME PIC X(20)
PROCEDURE DIVISION IF WS-
CNO = ‘ ‘
IF WS-CNAME= ‘ ‘
DISPLAY ‘CNO AND CNAME FIELDS ARE BLANK’ELSE
DISPLAY ‘CNAME IS ONLY BLANK’END-IF
ELSE
DISPLAY ‘CNO IS BLANK’ END-IFSTOP RUN

ANS: CNO IS BLANK

28. FOLLOWING SNIPPET. WORKING-STORAGE SECTIONWS-EMP-RATING PIC X


PROCEDURE DIVISION
MOVE ‘C’ TO WS WS-EMP-RATINGEVALUATE
TRUE WHEN WS-EMP-RATING= ‘A’
DISPLAY ‘ACHIEVED MORE THAN TARGET’WHEN WS-EMP-RATING=’B’
DISPLAY ‘ACHIEVED TARGET’WHEN WS-EMP-RATING=’C’
DISPLAY ‘NOT PERFOMED WELL’ END-EVALUATE.STOP RUN

ANS: NOT PERFORMED WELL

29. Consider the following partial code snippet:01


ws-count pic 9(1) value 1.
Perform until ws-count = 10
Add 1 To ws-count
Display “inside perform” End-perform.

ANS: Display statement will be executed 9 times.


30. SNIPPET
01 WS-ADD PIC X(10) VALUE ‘IND’
PROCEDURE DIVISION.
MOVE SPACES TO WS-ADD.EVALUATE
‘IND’
DISPLAY ‘ADDRESS IS INDIA’WHEN ‘IND’
DISPLAY ‘ADDRESS IS INDIA’WHEN ‘USA’
DISPLAY ‘ADDRESS IS USA’WHEN
OTHER
DISPLAY ‘OTHER COUNTRY’ END=EVALUATED.
ANS: OTHER COUNTRY

31. Working-storage section.


01 ws-cnt pic 9(2) value 4.
Procedure division.
Perform para1 ws-cnt times.Stop run.
Para1.
Continue.
How many times para1 will be executed?
ANS: 4

32. Consider the below code and find the output. Assume there are no syntax errors. Data division
Working-storage section
01 ws-num1 pic 9(2) value 01
01 ws-result pic 9(2) value 0
Procedure division A000-main.Add 1
to ws-num1
Perform B000-process 5 times
Compute ws-result = ws-num1+5
Display “result is:”ws-result
Stop run.
B000-process.
Add 1 to ws-num1

ANS: Result is 12

33. 01 v1 pic 9(1)


Perform para-1 with test before varying v1 from 3 by 2 until v1>6.How many times para-1 will be
executed?
ANS: 2

34. Working-storage section. 01 ws-cnt pic 9(2) value 1.Procedure division.


Move 2 to ws-cnt.
Perform 1000-para ws-cnt times.Stop run. 1000-Para.
Display ‘inside 1000 para’.
How many times 1000-para will be executed?

ANS: 2times
35. 01 num1 pic 99 value 50.01 num2 pic 99 value 30.01 res pic 99 value 00.
Compute RES = NUM2 – NUM1.
What is the value of RES after running COMPUTE statement?

ANS: 20

36. 01 NUM1 PIC 9(02) value 20. 01 NUM2 PIC 9(02) value 21.
What will be result of the following operation COMPUTE NUM1 = NUM1 * NUM2 + NUM1.

ANS: NUM1 will have the truncated value 40.

37. Consider the below code and find the output assume there are no syntax errors. Data division.Working-
storage section.
01 ws-num1 pic 9(2) value 99.
01 ws-num2 pic 9(2) value 0.
01 ws- result pic 9(2) value 0.Procedure division.
Move 2 to ws-num2
Compute ws-result=ws-num1 + ws-num2On size error display ‘error’ End-compute.
Display ws-num2.
Display ws-result. Stop run. 11.
WHAT is the output of following snippet

Ans : ERROR
02
00

38. WHAT is the output of following snippet?


01 A pic 99 value 94
01 B pic 9(2) value 23
C pic 9(2)
Procedure division.
0000-main-para Compute C = A + B
Display ‘c value is=’cStop run.

ANS: C VALUE IS=17

39. what is the content of A after execution of the following COBOL code?WORKING-STORAGE SECTION
01 A PIC ZZ9(2) PROCEDURE DIVISION MOVE 10 TO A DISPLAY STOP RUN

Ans : bb10

40. Consider the below variable declaration01 WS-EMP-DETAILS


01WS-EMPID PIC 9(4)
02 WS-EMPNAME WS-FIRSTNAME PIC A (10)
WS-LASTNAME PIC A (10)
Ans : WS-First Name and WS-Last Name must be of any level number from 03 to 43.
41. Consider the following cobol data names with different usage clause
01 WS-NUM1 PIC S9(9) COMP.
01 WS-NUM2 PIC S9(9).
01 WS-NUM3 PIC S9(9) COMP-3.

Ans : WS-NUM1

42. What is the outcome of the below code?01 WS-A PIC 9999
01 WS-B PIC 999 PROCEDURE DIVISION
MOVE 4567 TO WS-A MOVE WS-A TO WS-BDISPLAY WS-B

Ans : 567.

43. WS-SAL PIC S9(7)V9(2) COMP-3. How many bites WS-SAL occupies internally? Choosemost appropriate

Ans : 5

44. Consider the below variable. 01 WS-DATA PIC +9(5). What will be displayed by WS-DATA, if
-189 is moved to it? Note: ‘b’ in the option represents blank space

Ans : -00189

45. Consider the below variable 01 WS-DATA PIC $Z(2)99. What will be displayed by WS-DATA.If 18.99 is
moved to it? Choose most appropriate option?

Ans : Compilation error such Picture Clause cannot be declared.

46. Consider the below variable declaration.WS-EMP-DETAILS


WS-EMPID PIC 9(4) WS-EMPNAME PIC X(10).

Ans : WS-EMP-DETAILS must be of level number 01.


WS-EMPID and WS-EMPNAME must be of any level number from 02 to 49

47. Consider the following cobol code snippet A=3,B=2,C=10,D=501 WS-RESULT PIC9(01)
COMPUTE WS-RESULT = (A*B)+C/D What is the value of WS-RESULT?

Ans : 3
8

48. Consider the below variable declaration01 WS-EMP-DETAILS


01 WS-EMPID PIC 9(4)
02 WS- EMPNAME WS-FIRSTNAME PIC A(10).
02 WS-LASTNAME PIC A(10).
what should be the level number of WS-FIRSTNAME and WS -LASTNAME WS-EMP DETAILS is at the highest
level of the groupWS-FIRSTNAME AND WS-LASTNAME are thesub elements of WSEMPNAME.
Choose most appropriate

Ans : 03 to 49
49. In the below code, find out which variable declaration is invalid?WORKING-STORAGESECTION
04 WS-B PIC 9
77 WS-A PIC X(3)
77 WS-C PIC AAA
01 WS-D PIC 9(1) Choose most appropriate

Ans : WS-B

50. Consider the following partial code snippet01 WS-COUNT PIC 9(1) VALUE 5 PERFORM UNTILWS-COUNT=0
DISPLAY 1
END-PERFORM
SUBTRACT 1 FROM WS-COUNT.
How many times the statement “DISPLAY 1° will be executed? Note. Assume there Is nosyntactical error
in code Choosemost appropriate

Ans : 4

51. What is the size of WS-A variable in bytes? 01 WS-A PIC S9(6) COMP Choose most appropriate
Ans : 4

52. Consider the following partial cobol code: 01 V1 PIC 9(1) VALUE 3 88 COND-1 what willbeoutput of above
code snippet? Choose most appropriate

Ans : OTHER

53. What will be output of following partial code?01 V1 PIC 9(1).


PERFORM UNTIL
Choose mostappropriate.

Ans : Compilation error due to variable V1 is not initialized

54. . Consider the below COBOL code snippet. What is the output generated on execution? Assumethere are
no syntax errors.
DATA DIVISION. WORKING-STORAGE SECTION.01 COUNTER PIC9(2).
PROCEDURE DIVISION.
MAIN-PARA INITIALIZE COUNTER.
PERFORM A000-PARA UNTIL. COUNTER > 10.A000-PARA.
DISPLAY ‘WELCOME TO COBOL’ ADD 3 TO COUNTER.

Ans : ‘WELCOME TO COBOL’ will be displayed 4 times

55. What is the content of A after execution of the following COBOL code?
WORKING-STORAGESECTION 01 A PIC ZZ9(2).
PROCEDURE DIVISION. MOVE 10 TO A DISPLAY A STOP RUN
Note: b in options indicates blank spaces Choose most appropriate option

Ans : 10
56. How many times PARA 1 gets executed?
01 WS-COUNT PIC 9(1) VALUE 3.PROCEDURE DIVISION.
MOVE 4 TO WS-COUNT
PERFORM PARA1 VARYING WS-COUNT FROM 1 BY 1 UNTIL WS-COUNT=4.STOP RUN PARA1.
DISPLAY INPUT DATA.

Ans : 3

57. Consider the below variable 001 WS-DATA PIC +9(5). what will be displayed by WS-DATA, if123 iS moved
to it? Note: ‘b’ in the option represents blank Space Choose most appropriate option.

Ans : +00123

58. Joe is declaring a dataname of type binary word to store length of record.Choose the correctdatabytes and
usage clause for declaring half word binary.

Ans.S9(4) COMP

59. Predict the output for the below code? Code snippet
PROCEDURE DIVISION
PERFORM A00-PARA THRU A00-PARA-EXIT.
STOP RUN.
A00-PARA
DISPLAY HEADER STARTING'.
A01-PARA
DISPLAY 'DATA'
A00-PARA-EXIT.
DISPLAY ‘HEADER ENDING’.

Ans : HEADER STARTING


DATA
HEADER ENDING

60. What would be the output of the below Cobol program?


ID DIVISION.
PROGRAM-ID. CONTN1.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NUMI PIC 9(2) VALUE 20.
01 NUM2 PIC 9(2) VALUE 30.
01 NUM3 PIC 9(3). PROCEDURE DIVISION.
COMPUTE NUM3 = NUMI + NUM2.IF NUM3 < 100 NEXT SENTENCE END-IF
DISPLAY 'HELLO..
AM IN NEXT SENTENCE’
DISPLAY 'LETS SEE HOW IT WORKS' DISPLAY THE VALUE OF NUM3 IS'NUM3.
DISPLAY 'THIS IS HOW IT WORKS'.
Ans : HELLO AM IN NEXT SENTENCE LETS SEE HOW IT WORKS
THE VALUE OF NUM3 IS 050 THIS IS HOW ITWORK
61. Which of the following COBOL EVALUATE statement syntacticaly NOT Okay ?
Ans :EVALUATE A
WHEN A=0
DISPLAY 'A=0'
WHEN A=5
DISPLAY'A=5'
END-EVALUATE

62. What is the output of Following program? IDENTIFICATION DIVISION PROGRAM ID HELLO DATADIVISION
WORKING STORAGE SECTION 01 WS-NUMA PIC 9(2) VALUE 10 01 WS-NUMB PIC 9(2) VALUE 10 01 WS-
NUMC PIC 9(2) VALUE 10 01 WS-NUMD PIC 9(2) VALUE 100 01 WS-NUME PIC 9(2) VALUE 10 PROCEDURE
DIVISION SUBTRACT WS-NAMA WS-NUMB WS-NUMC FROM WS- NUMD GIVING WS-NUME DISPLAY WS-
Name STOP RUN
Ans : 70

63. Which cobol verb is usedto move the data from one group data name to another
Ans : > MOVE corresponding

64. What is the output of following program?IDENTIFICATION DIVISION


PROGRAM-ID PGM1
PROCEDURE DIVISION
A-PARA
DISPLAY 'A'
PERFORM B-PARA THRU D-PARAB-PARA
DISPLAY ‘B’
STOP RUN.
C-PARA
DISPLAY 'C’
D-PARA
DISPLAY 'D'

Ans : A B

65. Which of the following is incorrect?


Ans . IF A = B OR IF A = C
PERFORM 100-MAIN-PARA
END IF.

66. How many forms the DISPLAY-PARA will be excuted in the below snippet?
PERFOEM DISPLAY-PARA VARYING X FROM 0 BY 1 UNTIL X=10.
Note;Pic clause of X is 99

Ans : 1

67. How many times PARA 1 gets excuted?


Ans : 1
68. . Predict the output of below Cobol program
IDENTIFICATION DIVISION
PROGRAM-ID EDITPIC
DATA DIVISION
WORKING STORAGE SECTION.
01 WS-DATA4 PIC 9(4)V9(2) VALUE 0013.60.
01 WS-EDIT4 PIC ZZ99.99.
01 WS-DATA5 PIC 9(4) VALUE 34.
01 WS-EDITS PIC **.
PROCEDURE DIVISION.
MOVE WS-DATA4 TO WS-EDIT4.DISPLAY WS-EDIT4.
MOVE WS-DATAS TO WS-EDIT5.DISPLAY WS-EDIT5.
STOP RUN
Note: 'b' in option represent a blank space

Ans : bb13.60
**34

69. What is the output of following program?IDENTIFICATION DIVISION


PROGRAM-ID. HELLO.
DATA DIVISION
WORKING STORAGE SECTION.01 WS-NUM1 PIC 9(2)
01 WS-NUM2 PIC 9(3).PROCEDURE DIVISION A000-FIRST-PARA
MOVE 250 TO WS-NUM1.MOVE 150 TO WS-NUM2.
IF WS-NUM1> WS-NUM2 THENDISPLAY 'IN IF BLOCK'
ELSE
DISPLAY 'IN ELSE BLOCK'END-IF
STOP RUN.

Ans : IN ELSE BLOCK

71. 01 WS-A PIC 9(5) VALUE 7654301 WS-B PIC 9(3)


PROCEDURE DIVISIONMOVE WS-A TO WS-B DISPLAY WS-B
STOP RUN
What is the output of the above code snippet?

Ans : 543

72. Which among the following is a valid elementary variable declaration in the Working Storage section of
COBOL's Data Division? (Choose two correct options)

Ans.: 77 VARIABLE1 PIC 9(5) VALUE 00123 01 VARIABLE1 PIC 9(5) VALUE 123
VARIABLE1 PIC 9(5) VALUE 12
Ans : 77 VARIABLE1 PIC 9(5) VALUE 00123 01 VARIABLE1 PIC 9(5) VALUE 123

73. Predict the output of below Cobol program.


IDENTIFICATION DIVISION. PROGRAM-ID PGM2 DATA DIVISION
WORKING STORAGE SECTION01 WS-CNT PIC 9(1) VALUE 2.PROCEDURE DIVISION
A000-MAIN-PARA
PERFORM PARA1 UNTIL WS-CNT > 11.
PARA1 DISPLAY ‘Hello’ STOP RUN
Ans .Run time error(Abend)
Ans : hello display 1 times

74. Which of the following is invalid COBOL verb?


Ans : RECEIVE

75. Which among the following is a valid group variable declaration in the Working Storage sectionof COBOL's
Data Division? (Choose most appropriate option)
Ans : 01 VARIABLE1.

76. What is the maximum length of a user defined variable in Cobol?


Ans : 30

77. 01 WS-A PIC N(5) VALUE PROD01 WS-B PIC N(3)


PROCEDURE DIVISIONMOVE WS-A to WS-BDISPLAY WS-B
STOP RUN.
What is the output of the above code snippet?
Ans : PRO

78. Which of the following statements are true wit respect to COBOL program structure?Chooseoptions.
Ans : Environment Division is optional to code
Identification Division is Mandatory to code in every cobol program

79. 01 WS-A PIC 9(5) VALUE 76543


01 WS-B PIC 9(3)
PROCEDURE DIVISIONMOVE WS-A TO WS-B DISPLAY WS-B
STOP RUN
What is the output of the above code snippet?
Ans : 543

You might also like