COBOL Qb For Cbe13am1 Batch

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Sanjaycts
S
Sanjaycts
Community Contributor
Quizzes Created: 3 | Total Attempts: 3,082
| Attempts: 864 | Questions: 20
Please wait...
Question 1 / 20
0 %
0/100
Score 0/100
1. WHAT IS LEVEL NO 88 USED FOR?

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.

Submit
Please wait...
About This Quiz
COBOL Qb For Cbe13am1 Batch - Quiz

This COBOL quiz for the CBE13AM1 batch assesses knowledge of the WORKING-STORAGE SECTION, PROCEDURE DIVISION, and data handling in COBOL. It includes questions on variable initialization, data types,... see moreand control structures, crucial for learners aiming to master COBOL programming. see less

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

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.

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

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.

Submit
4.  ORGANIZATION FOR KSDS FILE?

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.

Submit
5. 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.

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.

Submit
6.  Can I redefine an X(200) field with a field of X(100) ?

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.

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

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.

Submit
8. 6).OCCURS CAN BE DEFINED IN 01 LEVEL NO .TRUE OR 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.

Submit
9. 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?

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

Submit
10. ).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

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

Submit
11. 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?

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

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

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.

Submit
13. 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

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

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

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.

Submit
15. 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

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

Submit
16. WORKING-STORAGE SECTION. 01 WS-PGM-NAME         PIC X(8) VALUE 'PGMNAME'. PROCEDURE DIVISION. CALL WS-PGM-NAME .

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.

Submit
17.  INDEX  NAME SHOULD BE DEFINED IN WORKING-STORAGE SECTION?

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.

Submit
18. 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

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.

Submit
19. ). 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.

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.

Submit
20. What is the result of the following?   VAR1 is defined as PIC 9(7).   MOVE '1234567' to VAR1

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.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 10, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 10, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 25, 2013
    Quiz Created by
    Sanjaycts
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
WHAT IS LEVEL NO 88 USED FOR?
In WRITE statement it is required to mention the record name and not...
If A=10, B=20, C=30,D=0        ...
 ORGANIZATION FOR KSDS FILE?
2). WORKING-STORAGE...
 Can I redefine an X(200) field with a field of X(100) ?
4).. WORKING-STORAGE...
6).OCCURS CAN BE DEFINED IN 01 LEVEL NO .TRUE OR FALSE?
01 WS-NUM1     PIC 9(2)....
).01 ...
1). WORKING-STORAGE...
WORKING-STORAGE SECTION....
3). WORKING-STORAGE...
5). WORKING-STORAGE SECTION....
WORKING-STORAGE SECTION....
WORKING-STORAGE SECTION....
 INDEX  NAME SHOULD BE DEFINED IN WORKING-STORAGE SECTION?
01...
). How many times PARA-1 is executed when SUB is with PIC 9....
What is the result of the following?...
Alert!

Advertisement