You are on page 1of 33

COBOL Exam

Questions and Answers

COBOL
Course Handbook

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation


The following are a series of COBOL Examination questions together with the answers.
The questions are in 2 sections. The first section is concerned with regular Procedural
COBOL. The second section addresses Object Oriented COBOL.
Rollover the answers area to reveal.
Question

Choice

1. Which of the following is an


INCORRECT specification for
a data-name?

Answer

a. var-var1
b. data1
c. two
d. all

2. What is the result of the following?


MOVE 1 TO VAR1
MOVE 2 TO VAR1
EVALUATE TRUE
WHEN VAR1 =
PERFORM

WHEN VAR2 =
PERFORM

WHEN OTHER
DISPLAY
END-EVALUATE.

a. PARA-1 will be performed


b. PARA-2 will be performed

1
PARA-1
2
PARA-2

c. Both PARA-1 and PARA-2 will be


performed
d. Compile error for incorrect use of
OTHER sentence

VAR1

3. Which of the following


PIC clauses is invalid as
a floating symbol?

a. +
b. $
c. S
d.

Print

X Close

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

4. What will happen to the code below when the end of file is reached:
PERFORM 210-READ-EMPLOYEE-RECORD.

IF NOT EMP-EOF
EVALUATE TRUE
WHEN EL-GROSS-PAY < 1 OR
EL-PAY-RATE > 45
DISPLAY INVALID PAY CLASS
WHEN OTHER
MOVE EL-PAY-RATE TO RATE-SUB
COMPUTE GROSS-PAY ROUNDED = EM-HOURS-WORKED *
PAY-RATE (RATE-SUB)
END-EVALUATE.
PERFORM 220-PRINT-EMPLOYEE-LINE
END-IF.
a. Nothing, because the code has a
syntax error
b. It will display INVALID PAY CLASS
and then print the employee-line
c. It will calculate the gross-pay and
then print the employee-line

5. What is the result of the following?


MOVE 0 TO VAR1
EVALUATE TRUE
WHEN VAR1 = 1
PERFORM PARA-1

WHEN VAR1 = 2
PERFORM PARA-2

WHEN OTHER
PERFORM PARA-3

END-EVALUATE.

6. Which of the following is an invalid


paragraph name?

a. PARA-1 will be performed


b. PARA-2 will be performed
c. Both PARA-1 and PARA-2 will be
performed
d. PARA-3 will be performed

a. A-1
b. 999X
c. A+1
d. ZZ9

Print

X Close

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

7. Which of the following is correct


definition of figurative constant in
COBOL?

Answer

a. Constants that are represented as


alphanumeric text also known as
non-numeric literals
b. Constants that are represented in
terms of digits, also known as literals
c. Data names that are initialized to
specific values in DATA DIVISION
and retain those values throughout
the execution of the program
d. Reserved words that are used as
substitutes for certain special
constants numeric and
alphanumeric

a. 8-16

8. Where does AREA A in COBOL


extends from?

b. 8-11
c. 12-72
d. 8-10

9. According to the given declarations in


Data Division. How many elementary
items are described below?
05 CALENDAR-DATE.
08 CALENDAR-DAY
08 CALENDAR-MON
08 CALENDAR-YEAR
05 FILLER
05 VAR1
05 VAR2
05 END-DATE.
10 FILLER
10 END-YEAR.

Print

PIC
PIC
PIC
PIC
PIC
PIC

99.
99.
99.
X(5).
XX.
X.

a. 3
b. 4
c. 5
d. 6

PIC X(4).
PIC 99.

X Close

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

10. Where does AREA B in COBOL


extend from?

Answer

a. 8-11
b. 8-16
c. 12-72

11. The FILE-CONTROL paragraph in a


COBOL program appears in:

a. Input-Output Section in
Environment Division
b. File Section in Data Division
c. Procedure Division, it can only be a
user-defined paragraph
d. Configuration Section in
Environment Division

12. Program-id is a paragraph name in


IDENTIFICATION division

a. TRUE

13. If the Procedure Division of a program


contains the statement:
WRITE MASTER-REC
This suggests that the OPEN
statement for this file must NOT be:

a. OPEN INPUT

14. ROUNDED precedes the


ON SIZE ERROR

a. TRUE

Print

X Close

b. FALSE

b. OPEN I-O
c. OPEN EXTEND
d. OPEN OUTPUT

b. FALSE

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

15. A Numeric data item in COBOL can


have at most how many digits?

Answer

a. 10
b. 160
c. 18
d. 32
e. Almost unlimited

16. A Non Numeric data item in COBOL


can have at most how many
characters?

a. 10
b. 160
c. 18
d. 32
e. Almost unlimited

17. Can a 01 level have a PIC clause?

a. YES
b. NO

18. Which of the following are not valid


modes of opening an INDEXED file?

a. OPEN INPUT
b. OPEN OUTPUT
c. OPEN I-O
d. OPEN INDEXED

Print

X Close

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

19. Which of the following is true about


the file which is referenced in a
DELETE statement?

Answer

a. It must be opened in INPUT mode


b. It must be opened in OUTPUT mode
c. It must be opened in I-O mode
d. It must be opened in EXTEND mode

20. Which of the following are not


PROCEDURE DIVISION verbs?

a. START
b. SEEK
c. RERUN
d. DELETE
e. REWRITE
f. INSERT

21. Which of the statements may


indicate DUPLICATE alternative key
warning if it occurs in case of an
INDEXED ORGANISATION without
DUPLICATE phrase?

a. READ
b. REWRITE
c. WRITE
d. DELETE

22. In case of a data file, the ACCESS


MODE clause must always be
specified?

Print

X Close

a. TRUE
b. FALSE

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

23. Which statement(s) are true about the


FILLER clause?

Answer

a. FILLER can only be used in workingstorage section


b. FILLER can be used in any of the
data division sections
c. The word FILLER can be replaced
with spaces
d. You can move data into a FILLER in
procedure division
e. None of the above

24. A READ statement can have AT END


clause and INVALID KEY clause, but
both must not appear simultaneously

a. TRUE

25. What is the difference between


SEARCH and SEARCH ALL?

a. SEARCH requires the table


to be sorted

b. FALSE

b. SEARCHALL requires the table


to be sorted
c. There is no difference

26. With a READ statement either AT END


clause or INVALID KEY clause must be
specified

Print

X Close

a. TRUE
b. FALSE

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

27. The name of a program is


contained in:

Answer

a. Data Division
b. Procedure Division
c. Identification Division
d. Environment Division

28. In an indexed file, the START


statement enables the programmers
to start processing from any record
position

a. TRUE

29. The UNSTRING verb is used to transfer


data from several sources to one
receiving field

a. TRUE

30. The STRING verb can be used to


transfer characters from one
alphanumeric field to another
alphanumeric field starting at
some particular position in the
receiving field

a. TRUE

31. If the DELIMITED BY SIZE phrase is


used with STRING verb, the transfer of
characters into the receiving field
stops as soon as a blank is
encountered in the sending field

a. TRUE

Print

X Close

b. FALSE

b. FALSE

b. FALSE

b. FALSE

Back | Next

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

32. The INSPECT statement can be used


to check whether the value in a data
name is numeric

a. TRUE

33. UNSTRING ABC INTO


FIELD-1.
Indicate which one of the following is
correct:

a. There will be a syntax error, as the


statement does not contain any
DELIMITED BY phrase

b. FALSE

b. There will be a syntax error, as the


sending string must be identifier and
not a literal
c. The statement is correct and after
the execution of the statement
field-1 will contain the three
characters ABC from the left-most
position and the remaining positions
of field-1 will remain unchanged
d. The statement is correct and after
the execution of the statement
field-1 will contain the three
characters ABC from the left-most
position and the remaining positions
of field-1 will get filled with spaces.

34. Which of the following statements


allows more than 2 alternative paths
of execution?

a. Evaluate statements
b. if statements
c. perform statement
d. copy statement

Print

X Close

Back | Next

10

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

35. PERFORM PARA-A VARYING A


FROM 1 BY 1 UNTIL A = 13.
How many times would the
statements in PARA-A execute?

Answer

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

36. How do you define a variable of


COMP-3?

a. 01 WS-VAR PIC S9(4) COMP-3


b. 01 WS-VAR USAGE COMP-3
c. 01 WS-VAR COMP-3
d. 01 WS-VAR COMP-3 USAGE

37. 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

38. In File-Control what are the 2 names?

a. The names of the 2 data files

b. RANDOM
c. DYNAMIC
d. ACCESS MODE has nothing to
do with it

b. The relationship between internal file


name and external file name
c. The data items used by the file
d. The procedure names to use in
paragraphs

Print

X Close

Back | Next

11

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

39. 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.
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

40. 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

41. What is the result of the following?


DIVIDE A INTO B GIVING C

a. C=A/B
b. The remainder of B/A is stored in C
c. C=B/A
d. The remainder of A/B is stored in C

Print

X Close

Back | Next

12

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

42. Which of the following is incorrect

Answer

a. SUBTRACT A B C FROM D E F
b. SUBTRACT A B C FROM D E
GIVING F G
c. SUBTRACT A FROM D,
B FROM E, C FROM F
d. SUBTRACT A FROM B
GIVING D E F

43. What is the linkage section?

a. It is must for called program


b. It is must for calling program
c. Used for displaying messages in
sub program
d. Temporary storage for called
program

44. Which files will be closed at run time


with the following code:
CLOSE TBLFILE.
EMPFILE
PAYLIST.

a. All 3 files

45. If WS-OLD and WS-NEW are both PIC


X(10), what will be the value in WSNEW if WS-OLD contains ABCDEFG
move WS-OLD(4:3) to WS-NEW

a. Nothing, since the MOVE contains a


syntax error

b. Just TBLFILE
c. TBLFILE and EMPFILE
d. None will close since there is a
syntax error

b. 444
c. ABC
d. DEF

Print

X Close

Back | Next

13

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

46. After the above move, is WS-NEW


greater than or less than WS-OLD

Answer

a. WS-NEW is greater than WS-OLD


b. WS-OLD is greater than WS-NEW

47. With the following data division definitions:


working-storage section .
01 array-pos
pic 99.
01 ws-table.
03 ws-element pic x(4) occurs 10
indexed by tab-ix.
which of the following is valid COBOL syntax?
a. move 6 to array-pos
display ws-element(tab ix)
b. set tab-ix to 6
display ws-element(tab ix)
c. Both of these
d. Neither of these

48. With the following data division definitions, what will num-data2 contain after
the 2 procedure statements?
working-storage section.
01 num-data1
pic s9(5)v99.
01 num-data2
pic 9(4).
procedure division.
move -21.6 to num-data1
move num-data1 to num data2
a. Undefined, since num-data2 is not
signed
b. -21.6
c. 21.6
d. 216.00

Print

X Close

Back | Next

14

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

49. With the following data division definitions, what will num-data2 contain after
the 2 procedure statements?
working-storage section.
01 num-data1
pic s9(5)c99.
01 num-data2
pic 9(4)
procedure division.
move -12345.67 to num-data1
move num-data1 to num data2
a. Undefined, since num-data2 is
not signed
b. -1234
c. -2345
d. 1234
e. 2345

50. When creating a mixed language


application between C# (or VB) and
COBOL, do you need to put the C#
and COBOL in the same project?

Print

X Close

a. True
b. False

Back | Next

15

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

51. In the following code, what is the sequence of paragraphs at execution time?
PROG.
PERFORM PARA-1 THRU PARA-3
STOP RUN.
PARA-1.
DISPLAY IN PARA 1
GO TO PARA-4.
PARA-2.
DISPLAY IN PARA-2.
PARA-3.
DISPLAY IN PARA-3.
PARA-4.
DISPLAY IN PARA-4.
PARA-5.
DISPLAY IN PARA-5.
GO TO PARA-3.
a. PROG, PARA-1, PARA-2, PARA-3
b. PROG, PARA-1. PARA-4, PARA-5,
PARA-3
c. PROG, PARA-2, PARA-3

52. Which of the following statements is


true:

a. In COBOL you can only PERFORM


Sections
b. In COBOL you can only PERFORM
Paragraphs
c. In COBOL you can only use GO TO
to move the execution point to a
Paragraph
d. In COBOL you can only use GO TO
to move the execution point to a
Section
e. All the above
a. None of the above

Print

X Close

Back | Next

16

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

53. Assuming you have a sequential file


defined by the following Select
statement:
SELECT INFILE ASSIGN
INNAME
Which of the following clauses is
valid:

a. FILE STATUS IS FILE STATUS

54. In data division which of the following


sections allow you to put VALUE
clauses:

a. WORKING-STORAGE SECTION.

b. FILE-STATUS IS FILE-STATUS
c. FILE STATUS IS FILE-STATUS
d. FILE-STATUS IS FILE STATUS
e. None of the above

b. FILE SECTION.
c. LINKAGE SECTION.

55. When you MOVE a pic x(20) data field


to a pic x(10) data field, which of these
is true?

a. The receiving pic x(10) field will


contain the first 10 characters from
the sending pic x(20) field
b. The receiving pic x(10) field will
contain the last 10 characters from
the sending pic x(20) field

Print

X Close

Back | Next

17

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

56. When you MOVE a pic x(10) data field


to a pic x(20) data field, which of
these is true?

Answer

a. The receiving pic x(20) field will


contain the 10 characters from the
sending pic x(10) field left aligned
with the remaining 10 characters left
blank
b. The receiving pic x(20) field will
contain the 10 characters from the
sending pic x(10) field left aligned
with the remaining 10 characters left
unchanged from whatever was there
before
c. The receiving pic x(20) field will
contain the 10 characters from the
sending pic x(10) field right aligned
with the remaining 10 characters left
blank
d. The receiving pic x(20) field will
contain the 10 characters from the
sending pic x(10) field right aligned
with the remaining 10 characters left
unchanged from whatever was there
before

57. The figurative constants ZERO, ZEROS,


ZEROES all mean the same thing?

a. TRUE

58. The use of single quotes and


double quotes in the definition
of a literal have exactly the
same meaning.

a. TRUE

Print

X Close

b. FALSE

b. FALSE

Back | Next

18

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

59. The use of STOP causes which


of the following to happen:

Answer

a. The program terminates


b. The program waits for a user to
press the Enter key
c. The program waits for a user to
press the Enter key and then
terminates

60. You can define the same data name


more than once in a program

a. TRUE

61. You can define the same data name


more than once in a program, if the
data name is defined at level 01

a. TRUE

62. You can use the same data name


more than once in a program, if the
data name is defined at level below
level 01

a. TRUE

63. Which of these COBOL lines will cause


syntax errors at compilation time?

a. if valid-rec and in-name


unequal spaces

b. FALSE

b. FALSE

b. FALSE

b.

perform valid-record.

c. else
d.

perform invalid-record

e. end-if

Print

X Close

Back | Next

19

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

64. When reading from an indexed file, is the following syntax valid:
move 1111 to record-key
read infile key is record-key
at end
perform end-of-file-routine
end-read
a. TRUE
b. FALSE

65. When reading sequentially from an indexed file, is the following syntax valid:
move 1111 to record-key
start infile key > record-key
invalid key
perform not-found
not invalid key
read infile next
end-start
a. TRUE
b. FALSE

66. Post 1985, which of the following


phrases is valid when testing if two
data items have not got the same
value:

a. DATA-1 NOT EQUAL TO DATA-2


b. DATA-1 NOT = DATA-2
c. DATA-1 UNEQUAL DATA-2
d. DATA-1 <> DATA-2
e. All of the above
f. None of the above

Print

X Close

Back | Next

20

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

67. Assuming that WS-DATA is working


storage data and FS-DATA is a level 01
record in a file, is the following COBOL
statement valid?
WRITE WS-DATA TO FS-DATA

a. TRUE

68. Assuming that WS-DATA is working


storage data and FS-DATA is a level 01
record in a file, is the following COBOL
statement valid?
WRITE FS-DATA TO WS-DATA

a. TRUE

69. Under an FD statement the file record


definition cannot contain value
clauses but it can contain level 88
condition names:

a. TRUE

70. The following 88 syntax is valid


88 VALID-DATA PIC 9(4)
VALUE 20 THRU 2000.

a. TRUE

71. Which of the following is true?

a. When a program A calls program B,


the data names in the call statement
must be identical to the data names
in the linkage section of the called
program

b. FALSE

b. FALSE

b. FALSE

b. FALSE

b. When a program A calls program B,


the data names in the call statement
must be in the same order as the
data names in the linkage section of
the called program
c. Both a. and b
d. Neither a. not b

Print

X Close

Back | Next

21

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

72. What would be the output to the


screen after executing the following
code:
PROCEDURE DIVISION.
PROG.
PERFORM PARA-1
THRU PARA-3
STOP RUN.
PARA-1.
DISPLAY 1
GO TO PARA-4.
PARA-2.
DISPLAY 2.
PARA-3.
DISPLAY 3.
PARA-4.
DISPLAY 4.
PARA-5.
DISPLAY 5
GO TO PARA-2.

a. 1,2,3,4,5

73. This program causes an infinite loop


PROCEDURE DIVISION.
PROG.
PERFORM PARA-1
STOP RUN.
PARA-1.
DISPLAY 1
GO TO PARA-4.
PARA-2.
DISPLAY 2.
PARA-3.
DISPLAY 3.
PARA-4.
DISPLAY 4.
PARA-5.
DISPLAY 5
GO TO PARA-2.

a. TRUE

Print

X Close

Answer

b. 1,2,3,1,4,5
c. 1,4,5,2,3
d. 1,4,5,1,2,3

b. FALSE

Back | Next

22

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

74. This program causes an infinite loop


PROCEDURE DIVISION.
PROG.
PERFORM PARA-2
STOP RUN.
PARA-1.
DISPLAY 1
GO TO PARA-4.
PARA-2.
DISPLAY 2.
PARA-3.
DISPLAY 3.
PARA-4.
DISPLAY 4.
PARA-5.
DISPLAY 5
GO TO PARA-2.

Answer

a. TRUE
b. FALSE

75. Has the following code got a problem?


process-file.
move 0 to file-flag
open input my-file
read my-file
perform until file-flag = 1
display my-file-record
read my-file
end-perform
close my-file.
a. Problem
b. No Problem

Print

X Close

Back | Next

23

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

Answer

76. Has the following code got a problem?


process-file.
move 0 to file-flag
open input my-file
perform until file-flag = 1
display my-file-record
read my-file at end
move 1 to file-flag
end-read
end-perform
close my-file.
a. Problem
b. No Problem

77. Which of these lines of code have a syntax error?


01 MY-DATA
PIC X(20).
03 MY-FNAME
PIC X(10)
03 MY-SNAME
PIC X(10).
a. First line
b. First and second line
c. Third line
d. All 3 lines
e. None of them

Print

X Close

Back | Next

24

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

78. The following code syntax is valid:


PERFORM MY-UPDATE VARYING
MY-IND FROM 1 BY 1 UNTIL
MY-IND > 10
READ IN-FILE
END-PERFORM

a. TRUE

79. Is the following EVALUATE


syntax valid?
EVALUATE TRUE ALSO WS-DATA
WHEN A = B ALSO A
PERFORM PROC-1
WHEN B = C ALSO B
PERFORM PROC-2
WHEN OTHER ALSO OTHER
PERFORM PROC-3
END-PERFORM

a. Valid

80. Is the following IF syntax valid


IF A = B
PERFORM PROC-1
ELSE
PERFORM PROC-2.
END-IF

a. Valid

Print

X Close

Answer

b. FALSE

b. Invalid

b. Invalid

Back | Next

25

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

81. If A is the same value as B, what gets


displayed on the screen after the
following code is executed?
IF A = B
DISPLAY HELLO
DISPLAY FRED
ELSE
DISPLAY GOODBYE .
DISPLAY JIM.

Answer

a. HELLO
FRED
b. GOODBYE
JIM
c. HELLO
FRED
JIM
d. The code does not compile

82. On an indexed file MY-FILE, with the prime key CUST-NO is the following
syntax valid?
START MY-FILE KEY IS CUST-NO > 67
INVALID KEY
DISPLAY KEY NOT FOUND
NOT INVALID KEY
DISPLAY KEY OK
END-START
a. VALID
b. INVALID

83. On an indexed file MY-FILE with the prime key CUST-NO is the following
syntax valid?
READ MY-FILE NEXT KEY IS CUST-NO
INVALID KEY
DISPLAY KEY NOT FOUND
END-READ
a. VALID
b. INVALID

Print

X Close

Back | Next

26

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

84. On an indexed file MY-FILE with the


prime key CUST-NO and alternate
keys CUST-FNAME and CUST-SNAME
is the following syntax valid?
MOVE JONES TO CUST-SNAME
READ MY-FILE ALTERNATE
KEY IS CUST-SNAME
INVALID KEY
DISPLAY KEY NOT
FOUND
END-READ

Answer

a. VALID
b. INVALID

85. On an indexed file MY-FILE with the prime key CUST-NO and alternate keys
CUST-FNAME and CUST-SNAME is the following syntax valid?
MOVE FRED TO CUST-FNAME
READ MY-FILE KEY IS CUST-FNAME
INVALID KEY
DISPLAY KEY NOT FOUND
NOT INVALID KEY
DISPLAY CUST-FNAME FOUND
END-READ
a. VALID
b. INVALID

Print

X Close

Back | Next

27

Visual COBOL

01 Procedural COBOL

Modern COBOL for the next generation

Question

Choice

86. On an indexed file MY-FILE with the


prime key CUST-NO and alternate
keys CUST-FNAME and CUST-SNAME;
and record name MY-RECORD is the
following syntax valid?
MOVE 1234 TO CUST-NO
WRITE MY-RECORD KEY IS
CUST-NO
INVALID KEY
DISPLAY WRITE
FAILED
NOT INVALID KEY
DISPLAY WRITE
SUCESSFUL
END-READ

a. VALID

87. A data item WS-NUMBER is defined in


working-storage section as
$$$,$$$.99. If the value -2345.67 is
moved to it, what will the display look
like after DISPLAY WS-NUMBER

a. $2,345.67

88. What is the name of the .NET


intermediate language?

a. .NET IL

Answer

b. INVALID

b. $2,345.67
c. $ 2,345.67
d. -2,345.67$

b. MSIL
c. RTS
d. CLR
e. JCM

Print

X Close

Back | Next

28

Visual COBOL

02 Object COBOL

Modern COBOL for the next generation

Question

Choice

Answer

89. The following code syntax is valid:


Method-ID Calculate.
Procedure Division.
Compute CircleArea = 3.14 * Radius *
Radius
Compute Circumference = 6.28 * Radius
.
End Class.
End Method.
a. TRUE
b. FALSE

90. Which of the following code syntax is valid?


1. Invoke type CircleCalculations::New()
Returning circleObject
2. set circleObject to CircleCalculations::New()
a. The first one
b. The second one
c. Both
d. Neither

91. The declaration of a CircleObject is:


circleObject type
CircleCalculations.

Print

X Close

a. TRUE
b. FALSE

Back | Next

29

Visual COBOL

02 Object COBOL

Modern COBOL for the next generation

Question

Choice

Answer

92. Is the following EVALUATE syntax valid:


EVALUATE TRUE ALSO WS-DATA
WHEN A = B ALSO A
PERFORM PROC-1
WHEN B = C ALSO B
PERFORM PROC-2
WHEN B ALSO D = E
PERFORM PROC-3
END-PERFORM

a. Valid

93. What is the correct syntax for


describing an Object Instance item:

a. 01 circleObject is
CircleCalculations.

b. Invalid

b. 01 circleObject type
CircleCalculations.
c. 01 circleObject pic 999
type CircleCalculations.
d. 01 circleObject pic X(20)
type CircleCalculations.

94. Which of the following can be the


correct syntax for creating a new
object:

a. Set circleObject to
CircleCalculations::New()
b. Set circleObject to type
CircleCalculations::New()
c. Invoke type
CircleCalculations::New()
Returning circleObject
d. Move
CircleCalculations::New()to
circleObject

Print

X Close

Back | Next

30

Visual COBOL

02 Object COBOL

Modern COBOL for the next generation

Question

Choice

95. A client to a Web Service can be:

Answer

a. A Web Form
b. A Win Form
c. A Console Application
d. Any of these
e. None of these

96. If you want to have an implicit get


method on an object instance data
item, you need to define the property
clause alongside the instance data
definition. Which of these would be
incorrect?

a. 01 data-name pic 99
property.

97. If you want to have an implicit set


method on an object instance data
item, you need to define the property
clause alongside the instance data
definition. Which of these would be
incorrect?

a. 01 data-name pic 99
property.

Print

X Close

b. 01 data-name pic 99
property no set.
c. 01 data-name pic 99
property no get.

b. 01 data-name pic 99
property no set.
c. 01 data-name pic 99
property no get.

Back | Next

31

Visual COBOL

02 Object COBOL

Modern COBOL for the next generation

Question

Choice

98. Which of the following is a class


method:

Answer

a. Method-ID
CalculateCircumference
static.
Linkage Section.
01 Is-radius
pic 99.
01 Is-circumfernce
pic 99999v9.
Procedure Division Using by
value Is-radius
Returning Is-circumference.
Compute Is-circumference
= 2 * 3.14 * Is-radius
Exit Method
b. Method-ID
CalculateCircumference.
Linkage Section.
01 Is-radius
pic 99.
01 Is-circumfernce
pic 99999v9.
Procedure Division Using by
value Is-radius
Returning Is-circumference.
Compute Is-circumference
= 2 * 3.14 * Is-radius
Exit Method

Print

X Close

Back | Next

32

Visual COBOL

02 Object COBOL

Modern COBOL for the next generation

Question

Choice

99. Which of the following is a class


method invocation:

Answer

a. Invoke type
CircleCalculations.
CalculateArea(radius)
returning circle-area
b. Invoke type CircleCalculati
ons::CalculateArea(radius)
returning circle-area
c. Invoke CircleCalculations::
CalculateArea(radius)
returning circle-area

100.In the definition of Object Instance


data, which of the following is valid
syntax?

a. 01 Circumference
pic
999v9
property set.
b. 01 Circumference
pic
999v9
property no set.
c. 01 Circumference
999v9
property.

Print

X Close

pic

Back | Next

33

You might also like