COBOL Mock Test


Advertisements


This section presents you various set of Mock Tests related to COBOL Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

COBOL Mock Test I

Q 1 - Which data type is not available in COBOL?

A - Alphabetic (A)

B - Long (L)

C - Alphanumeric (X)

D - Numeric (9)

Answer : B

Explanation

Long data type is not available in COBOL. COBOL supports three data types Alphabetic, Numeric & Alphanumeric.

Answer : A

Explanation

COBOL stands for COmmon Business Oriented Language which was developed to automate the business process.

Answer : B

Explanation

Identification division contains entries that is used to identify the program. This is the the first division and only mandatory division.

Q 4 - How is sign stored in a COMP-3 field?

A - First Bit

B - Last Bit

C - First Nibble

D - Last Nibble

Answer : D

Explanation

In COMP-3 field, sign is stored in last nibble.

Q 5 - What will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program?

A - Program will give run time error.

B - Program will go in infinite loop.

C - Program will execute normally.

D - Program will throw compilation error.

Answer : B

Explanation

A Stop run ends the unit of work and returns control to the operating system whereas GOBACK returns control to calling program. So if we code GO BACK instead of Stop Run, it will go in infinite loop.

Q 6 - Which of the following file opening mode is invalid in COBOL?

A - APPEND

B - INPUT

C - OUTPUT

D - EXTEND

Answer : A

Explanation

Valid file opening modes in COBOL are INPUT, OUTPUT, I-O, and EXTEND. APPEND file mode is not available in COBOL.

Q 7 - What is the maximum size of a numeric field we can define in COBOL?

A - 9(20)

B - 9(18)

C - 9(31)

D - 9(10)

Answer : B

Explanation

COBOL applications use 31 digit numeric fields. However, compiler only supports a maximum of 18 digits. So we use a maximum of 18 digits.

Q 8 - What is the mode in which you will OPEN a file for writing?

A - OUTPUT

B - EXTEND

C - Either OUTPUT or EXTEND

D - INPUT-OUTPUT

Answer : C

Explanation

To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.

Q 9 - What is 77 level used for?

A - Renames

B - Redefine

C - Group Item

D - Elementary Level

Answer : D

Explanation

77 level is an elementary level item which cannot be subdivided.

Answer : B

Explanation

All COBOL statements must begin in area B which starts from 12 to 72 columns

Answer : B

Explanation

FILE-CONTROL paragraph appears in the Input-Ouput Section in the Environment Division which provides information of external data sets used in the program.

Q 12 - Can I redefine an X(10) field with a field of X(20)?

A - No

B - Yes

Answer : B

Explanation

Yes we can define a X(10) to X(20) as Redefines causes both fields to start at the same location, but it is not a good coding practice.

Q 13 - What is the length of PIC 9.999?

A - 4

B - 6

C - 5

D - 3

Answer : C

Explanation

Length of PIC 9.999 is 5 as '.' takes 1 byte. So total 1 byte for '.' and 4 bytes for 9.

Q 14 - How many times following loop will execute?

MOVE 5 TO X.
PERFORM X TIMES.
MOVE 10 TO X.
END-PERFORM.

A - 11

B - 5

C - 10

D - 15

Answer : B

Explanation

PERFORM loop will execute for 5 times. As it reads the first statement PERFORM 5 times. It replaces X with the value 5.

You can try same code using Try it option available below:

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 X PIC 99.

PROCEDURE DIVISION.
   MOVE 5 TO X.
   PERFORM X TIMES
   MOVE 10 TO X
   DISPLAY 'COUNT'
   END-PERFORM.
   STOP RUN.

Q 15 - Which cobol verb is used for updating a file?

A - READ

B - WRITE

C - UPDATE

D - REWRITE

Answer : D

Explanation

Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last record read.

Q 16 - Under which section we should make an entry in the program for a SORT file?

A - FD

B - SD

C - MD

D - None of these

Answer : B

Explanation

For sorting a file, we should make an SD entry in File Section.

Q 17 - How you will declare a Half Word Binary in program?

A - S9(8) COMP

B - S9(4) COMP

C - 9(8) COMP

D - 9(4) COMP

Answer : B

Explanation

S9(4) COMP is used to declare a Half Word Binary.

Q 18 - If 436 value is moved to a PP999 PIC clause, then what is edited value taken?

A - .00436

B - 00436

C - 436

D - 43600

Answer : A

Explanation

P is assumed decimal scaling position which is used to specify the location of an assumed decimal point when the point is not within the number that appears in the data item. .PIC PP999 means that numeric data item is of 3 characters and there are 5 positions after the decimal point.

Q 19 - Where can we specify OCCURS clause?

A - Elementary Item

B - Group Item

C - Both A & B

D - None of these

Answer : C

Explanation

In array declaration, we can specify occurs clause on Elementary item as well as on Group item also.

Q 20 - Which utility is used for compiling COBOL program?

A - IKJEFT01

B - IGYCRCTL

C - IGYCTCRL

D - None of these

Answer : B

Explanation

IGCRCTL utility is used to compile a COBOL program.

Q 21 - How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy?

A - 7 bytes

B - 8 bytes

C - 4 bytes

D - 10 bytes

Answer : B

Explanation

9(7) will take 7 bytes and 1 byte for SIGN TRAILING SEPARATE, so total 8 bytes it will take.

Answer : B

Explanation

Search All is a binary search method, which is used to find elements inside the table.

Answer : C

Explanation

Linkage section comes under data division which is used in called program.

Answer : B

Explanation

Input-Output section comes under Environment division which provides information about the files to be used in the program.

Q 25 - Which of the following statement will give you ‘Tutorials’ in TutorialsPoint string?

A - TutorialsPoint(1:9)

B - TutorialsPoint(9)

C - TutorialsPoint(9:1)

D - TutorialsPoint(9:9)

Answer : A

Explanation

In STRING(A,B), A is the staring position and B id the number of digits to select.

Answer Sheet

Question Number Answer Key
1 B
2 A
3 B
4 D
5 B
6 A
7 B
8 C
9 D
10 B
11 B
12 B
13 C
14 B
15 D
16 B
17 B
18 A
19 C
20 B
21 B
22 B
23 C
24 B
25 A

cobol_questions_answers.htm

Advertisements
E-Books Store