# COBOL Qb For Cbe13am1 Batch

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Sanjaycts
S
Sanjaycts
Community Contributor
Quizzes Created: 3 | Total Attempts: 2,985
Questions: 20 | Attempts: 823

Settings

COBOL QB FOR CBE13AM1 BATCH

• 1.

### 1). WORKING-STORAGE SECTION.                          01 WS-NUM1                     PIC 9(03) VALUE 100. 01 WS-NUM2                     PIC 9(02).         01 WS-NUM3                     PIC 9(02).         PROCEDURE      DIVISION.                               MOVE 200              TO WS-NUM2                           MOVE WS-NUM1  TO WS-NUM3                           MOVE WS-NUM2  TO WS-NUM3                           DISPLAY WS-NUM3            What is output stored in variable ws-num3?

• A.

10

• B.

20

• C.

00

• D.

30

C. 00
Explanation
The output stored in variable WS-NUM3 is "00". This is because the value of WS-NUM1 is 100, and it is moved to WS-NUM3. Then the value of WS-NUM2 is moved to WS-NUM3, which overwrites the previous value. Since WS-NUM2 has a value of 200, the final value of WS-NUM3 becomes "00".

Rate this question:

• 2.

### 3). WORKING-STORAGE SECTION.                          01 WS-NUM1                     PIC 9(03) VALUE 100.     PROCEDURE      DIVISION.                               MOVE 200     TO WS-NUM1     INITIALIZE WS-NUM1     DISPLAY WS-NUM1 .                   What is output stored in variable ws-num1

• A.

A).000

• B.

B).200

• C.

C).100

• D.

D).NONE

A. A).000
Explanation
The output stored in variable WS-NUM1 is "000". This is because the value of WS-NUM1 is initially set to 100, but then it is initialized to its default value, which is all zeros. Therefore, when it is displayed, it will show "000".

Rate this question:

• 3.

### 4).. WORKING-STORAGE SECTION.                          01 WS-NUM1                     PIC   S9(03) SIGN IS LEADING SEPARATE. HOW MANY BYTES  WS-NUM1 WILL OCCUPY?

• A.

A).3

• B.

B).4

• C.

C).5

• D.

D).2

B. B).4
Explanation
The WORKING-STORAGE SECTION is used to declare variables and data structures that are used within the program. In this case, the variable WS-NUM1 is declared with a PICTURE clause specifying that it is a signed numeric field with 3 digits and the sign is leading separate. In COBOL, each digit occupies one byte of storage, and the sign takes up an additional byte. Therefore, WS-NUM1 will occupy 4 bytes in total.

Rate this question:

• 4.

### 2). WORKING-STORAGE SECTION.                          01 WS-NUM1                     PIC 9(03) VALUE 100. 01 WS-NUM2                     PIC 9(03).         01 WS-NUM3                     PIC 9(03).         PROCEDURE      DIVISION.                               MOVE 200     TO WS-NUM2                     STOP RUN            MOVE WS-NUM1 TO WS-NUM3                           MOVE WS-NUM2 TO WS-NUM3                           DISPLAY WS-NUM1.

• A.

A). 10

• B.

B).00

• C.

C).20

• D.

D).NOTHING WILL BE DISPLAYED IN SPOOL

D. D).NOTHING WILL BE DISPLAYED IN SPOOL
Explanation
The program starts by initializing WS-NUM1 with a value of 100. Then, it moves a value of 200 to WS-NUM2 and stops the program. Since the program stops before reaching the DISPLAY statement, nothing will be displayed in the spool.

Rate this question:

• 5.

### 5). WORKING-STORAGE SECTION. 01 WS-NUM1                            PIC  +9(3). PROCEDURE DIVISION. MOVE -120    TO WS-NUM1 DISPLAY WS-NUM1

• A.

A).-120

• B.

B).+120

• C.

C).120

• D.

D).NONE

A. A).-120
Explanation
The correct answer is A) -120. In the given code, the value -120 is being moved to the variable WS-NUM1 in the working-storage section. After that, the value of WS-NUM1 is displayed, which will be -120. Therefore, the correct answer is -120.

Rate this question:

• 6.

### 6).OCCURS CAN BE DEFINED IN 01 LEVEL NO .TRUE OR FALSE?

• A.

True

• B.

False

B. False
Explanation
The statement "OCCURS CAN BE DEFINED IN 01 LEVEL NO" is false. In COBOL programming, the OCCURS clause is used to define arrays or tables, and it can be defined at the 01 level or any other level in the data division. Therefore, the correct answer is false.

Rate this question:

• 7.

### INDEX  NAME SHOULD BE DEFINED IN WORKING-STORAGE SECTION?

• A.

True

• B.

False

B. False
Explanation
The index name does not need to be defined in the working-storage section. In COBOL, the index name is typically defined within the procedure division using the INDEXED BY phrase in the OCCURS clause of a table declaration. This allows the index to be associated with a specific table and used for accessing and manipulating data within that table. Therefore, the correct answer is false.

Rate this question:

• 8.

### ORGANIZATION FOR KSDS FILE?

• A.

A).INDEXED

• B.

B).RELATIVE

• C.

C). SEQUENTIAL

• D.

D).NONINDEXED

A. A).INDEXED
Explanation
An organization for a KSDS (Key Sequenced Data Set) file refers to how the data is structured and accessed within the file. The correct answer, A) INDEXED, indicates that the file is organized using an index structure. This means that the file contains a separate index that allows for efficient random access to the data based on the key values. This organization is suitable for files where quick access to specific records is required.

Rate this question:

• 9.

### WORKING-STORAGE SECTION. 01 WS-PGM-NAME         PIC X(8) VALUE ‘PGMNAME’. PROCEDURE DIVISION. CALL WS-PGM-NAME .

• A.

A).STATIC CALL

• B.

B).DYNAMIC CALL

• C.

C).NONE

• D.

D).PGMNAME

B. B).DYNAMIC CALL
Explanation
The given code snippet does not include any explicit CALL statement to a specific program. Instead, it calls a data item named WS-PGM-NAME, which suggests that the program name is determined dynamically at runtime. Therefore, the correct answer is B) DYNAMIC CALL.

Rate this question:

• 10.

### WORKING-STORAGE SECTION. 01 WS-NUM1               PIC 9(2) VALUE  1. PROCEDURE DIVISON. MOVE 5 TO WS-NUM1 PERFORM 2100-PARA        THRU 2100-PARA-EXIT UNTIL WS-NUM1 < 4 HOW MANY TIMES 2100-PARA WILL BE EXECUTED

• A.

A).5

• B.

B).6

• C.

C).0

• D.

D).1

C. C).0
Explanation
The value of WS-NUM1 is initially set to 1 in the working-storage section. Then, in the procedure division, the value of WS-NUM1 is changed to 5 using the MOVE statement. After that, the program enters a loop where it performs the 2100-PARA section until WS-NUM1 is less than 4. However, since the value of WS-NUM1 is already 5, the loop condition is not met and the 2100-PARA section is not executed at all. Therefore, the answer is C).0

Rate this question:

• 11.

### WORKING-STORAGE SECTION. 01 WS-NUM1               PIC S9(7)V9(4)  COMP-3. HOW MANY BYTES WS-NUM1 FIELD WILL OCCUPY?

• A.

A).11

• B.

B).6

• C.

C).5

• D.

D).8

B. B).6
Explanation
The WS-NUM1 field is defined as PIC S9(7)V9(4) COMP-3, which means it is a signed numeric field with a total length of 6 bytes. The "S" indicates that it is a signed field, the "9(7)" indicates that it can hold up to 7 digits before the decimal point, the "V" indicates the presence of a decimal point, and the "9(4)" indicates that it can hold up to 4 digits after the decimal point. The COMP-3 attribute indicates that it is a packed decimal representation, which requires half a byte for each digit and an additional half byte for the sign. Therefore, the WS-NUM1 field will occupy 6 bytes in total.

Rate this question:

• 12.

### Can I redefine an X(200) field with a field of X(100) ?

• A.

A).YES

• B.

B).NO

• C.

C).NOT POSSIBLE

• D.

D).NONE

A. A).YES
Explanation
Yes, it is possible to redefine an X(200) field with a field of X(100). The "redefine" statement in programming allows for the reuse of memory space by defining a new field with the same starting location as the previous field. In this case, the X(100) field can be defined to start at the same location as the X(200) field, effectively redefining it.

Rate this question:

• 13.

### WHAT IS LEVEL NO 88 USED FOR?

• A.

A).RENAMES CLAUSE

• B.

B).CONDITION NAMES

• C.

C).ELEMENTARY ITEM

• D.

D).GROUP ITEM

B. B).CONDITION NAMES
Explanation
Level number 88 is used for condition names in COBOL. Condition names are used to define conditions or states that can be tested in a program. They are typically used in conjunction with the EVALUATE statement to perform different actions based on the condition being met. Level number 88 provides a way to define condition names in the data division of a COBOL program.

Rate this question:

• 14.

### What is the result of the following?   VAR1 is defined as PIC 9(7).   MOVE ‘1234567’ to VAR1

• A.

Compilation error

• B.

S0C7 abend at runtime

• C.

None of the above

• D.

VAR1 CONTAIN 1234567

A. Compilation error
Explanation
The given code will result in a compilation error because the value being moved to VAR1 is a character string '1234567', but VAR1 is defined as PIC 9(7), which means it can only hold numeric values.

Rate this question:

• 15.

### ). How many times PARA-1 is executed when SUB is with PIC 9.     PERFORM PARA-1 VARYING SUB FROM 1 BY 1 UNTIL SUB = 10.       PARA-1.          DISPLAY SUB.

• A.

10 times

• B.

9 times

• C.

Keep looping (as SUB WILL BECOME 0 WHEN INCREASED TO 10)

• D.

None of these

C. Keep looping (as SUB WILL BECOME 0 WHEN INCREASED TO 10)
Explanation
The PERFORM statement in the given code is a loop that executes the PARA-1 paragraph multiple times. The VARYING clause is used to increment the SUB variable from 1 by 1 until it reaches 10. Therefore, the PARA-1 paragraph will be executed 10 times. The answer "Keep looping (as SUB WILL BECOME 0 WHEN INCREASED TO 10)" accurately describes the behavior of the loop.

Rate this question:

• 16.

### 01 WS-NUM1     PIC 9(2).        01  WS-NUM2  PIC 9(2). PROCEDURE DIVISION. MOVE 10 TO WS-NUM1,WS-NUM2 IF WS-NUM1 = WS-NUM2    CONTINUE ELSE   DISPLAY ‘TWO NO ARE NOT EQUAL’ END-IF.    DISPLAY ‘TWO NO ARE EQUAL’ WHAT IS THE OUTPUT  OF THE ABOVE CODE?

• A.

TWO NO ARE NOT EQUAL

• B.

TWO NO ARE EQUAL

• C.

NONE

• D.

NOTHING WILL DISPLAYED

B. TWO NO ARE EQUAL
Explanation
The output of the above code will be "TWO NO ARE EQUAL". This is because the code first moves the value 10 to both WS-NUM1 and WS-NUM2 variables. Then it checks if WS-NUM1 is equal to WS-NUM2. Since both variables have the same value of 10, the condition is true and the code will display "TWO NO ARE EQUAL".

Rate this question:

• 17.

### 01 WS-GROUP.                                          05 WS-A                             PIC 9(03).     05 WS-B                             PIC 9(03).                                                    01 WS-GROUP1 REDEFINES WS-GROUP.                      05 WS-C                             PIC 9(03).     05 WS-D                             PIC 9(03). MOVE 100    TO  WS-C MOVE 200  TO WS-D MOVE 300 TO WS-A MOVE 400 TO WS-B DISPLAY WS-C

• A.

A).400

• B.

B).300

• C.

C).200

• D.

D).100

B. B).300
Explanation
The value of WS-C is displayed, which is 300. This is because the value of WS-C is moved from 100 to WS-C using the MOVE statement. Therefore, the correct answer is B) 300.

Rate this question:

• 18.

### In WRITE statement it is required to mention the record name and not the file name

• A.

True

• B.

False

A. True
Explanation
The explanation for the given correct answer is that in a WRITE statement, it is necessary to specify the name of the record that is being written, rather than the name of the file. The WRITE statement is used in programming languages to write data into a file, and it requires the record name to identify the specific record that is being written. The file name is typically specified separately when opening or accessing the file. Therefore, the statement that it is required to mention the record name and not the file name in a WRITE statement is true.

Rate this question:

• 19.

### If A=10, B=20, C=30,D=0                Then the result of operation ______________                    ADD A B TO C GIVING D

• A.

A).60

• B.

B).50

• C.

C).00

• D.

D).10

A. A).60
Explanation
The given operation is "ADD A B TO C GIVING D". This means that the values of A and B are added together and the result is stored in C. Therefore, the sum of A (10) and B (20) is 30, which is stored in C. The value of D is not relevant to the operation. So, the correct answer is A).60, which represents the sum of A and B.

Rate this question:

• 20.

### ).01  WS-STR1                   PIC X(6).        01 WS-STR2                   PIC X(10).       01 WS-STR3                   PIC X(15). MOVE ‘SACHIN’   TO WS-STR1 MOVE’ TENDULKAR’  TO WS-STR2 STRING WS-STR1 DELIMITED BY SIZE,                WS-STR2 DELIMITED BY SPACE INTO WS-STR3 DISPLAY WS-STR3

• A.

SACHINTENDULKAR b b-BLANK SPACE

• B.

SACHIN TENDULKAR

• C.

SACHINTENDULKAR

• D.

NONE

C. SACHINTENDULKAR
Explanation
The given code declares three variables: WS-STR1, WS-STR2, and WS-STR3, all of which are character strings. The code then assigns the value "SACHIN" to WS-STR1 and "TENDULKAR" to WS-STR2 using the MOVE statement. The STRING statement is then used to concatenate WS-STR1 and WS-STR2, with WS-STR1 being delimited by its size and WS-STR2 being delimited by a space. The result is stored in WS-STR3. Finally, the code displays the value of WS-STR3, which is "SACHINTENDULKAR".

Rate this question:

Related Topics