Simple COBOL Quiz

Description: Simple COBOL Quiz
Number of Questions: 11
Created by:
Tags: cobol
Attempted 0/11 Correct 0 Score 0

Which one of the following is incorrect

  1. Divide A into B

  2. Divide A by B

  3. Divide A into B Giving C

  4. Divide A by B Giving C


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Divide A into B - This option is correct because it implies that A is being divided into equal parts, with B representing the number of parts.

Option B) Divide A by B - This option is incorrect because it does not specify the result of the division. It is missing the information about what the division is giving or producing.

Option C) Divide A into B Giving C - This option is correct because it specifies that A is being divided into B equal parts and the result of the division is C.

Option D) Divide A by B Giving C - This option is correct because it specifies that A is being divided by B, and the result of the division is C.

The correct answer is B.

Determine the size of the data item SPPPP9999

  1. 9

  2. 5

  3. 8

  4. 4


Correct Option: D

AI Explanation

To determine the size of the data item SPPPP9999, we need to understand how the data item is structured.

The data item SPPPP9999 consists of a combination of letters and numbers. Let's break it down:

  • The first character, "S", is a letter.
  • The next four characters, "PPPP", are letters.
  • The final four characters, "9999", are numbers.

In most programming languages, each character is usually stored using 1 byte of memory. Therefore, the size of the data item SPPPP9999 can be calculated as follows:

1 byte (for the first character "S") + 4 bytes (for the next four characters "PPPP") + 4 bytes (for the final four characters "9999")

= 1 + 4 + 4

= 9

So, the correct answer is A) 9.

  1. Any part of the file section

  2. Any part of the working-storage section

  3. Any part of the data division


Correct Option: C
  1. Multiply corresponding record1 by record2

  2. Add corresponding record1 to record2

  3. Move corresponding record1 to record2

  4. Subtract corresponding record1 from record2


Correct Option: A

A record can be described using which of these level numbers

  1. 01 to 49 (both inclusive) and 77

  2. 01 to 49 (both inclusive)

  3. All odd numbers from 01 to 49

  4. All even numbers from 01 to 49


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of level numbers in COBOL.

In COBOL, a level number is used to define the structure and hierarchy of data items within a record or data structure. It indicates the nesting level of the data item.

Let's go through each option to understand which level numbers can be used to describe a record:

Option A) 01 to 49 (both inclusive) and 77 - This option is incorrect. While level numbers 01 to 49 can be used to define data items within a record, level number 77 is used to define a special type of data item called a "condition name". It is not used to describe the structure of a record.

Option B) 01 to 49 (both inclusive) - This option is correct. Level numbers 01 to 49 can be used to define data items within a COBOL record. These level numbers represent the hierarchy of the data items, with level 01 being the highest level and level 49 being the lowest level.

Option C) All odd numbers from 01 to 49 - This option is incorrect. While level numbers 01 to 49 can be used to define data items within a record, there is no requirement or convention to use only odd numbers for defining levels.

Option D) All even numbers from 01 to 49 - This option is incorrect. While level numbers 01 to 49 can be used to define data items within a record, there is no requirement or convention to use only even numbers for defining levels.

The correct answer is option B) 01 to 49 (both inclusive). This option is correct because level numbers 01 to 49 can be used to describe the structure and hierarchy of data items within a COBOL record.

  1. Financial sector and engineering

  2. Graphic design and education

  3. None of these


Correct Option:
  1. Comp

  2. Comp-1

  3. Display

  4. Comp-3


Correct Option: D
Explanation:

To solve this question, the user needs to have an understanding of the different USAGE clauses in COBOL and the storage requirements for each of them.

  • A. Comp: This usage clause is a binary format that occupies 2 bytes of storage. Therefore, if the data item Var1 is described with PIC S9(4) and its usage clause is Comp, it would require 2 bytes of storage, which is less than the given 3 bytes. Hence, Option A is incorrect.

  • B. Comp-1: This usage clause is a packed decimal format that occupies 4 bytes of storage. Therefore, if the data item Var1 is described with PIC S9(4) and its usage clause is Comp-1, it would require 4 bytes of storage, which is more than the given 3 bytes. Hence, Option B is incorrect.

  • C. Display: This usage clause is an alphanumeric format that occupies 1 byte for each character of the data item. Since the data item Var1 is described with PIC S9(4), it would require 4 characters to store its value. Therefore, if the usage clause is Display, it would require 4 bytes of storage, which is more than the given 3 bytes. Hence, Option C is incorrect.

  • D. Comp-3: This usage clause is a packed decimal format that occupies 3 bytes of storage. Therefore, if the data item Var1 is described with PIC S9(4) and its usage clause is Comp-3, it would require 3 bytes of storage, which matches the given requirement. Hence, Option D is correct.

Therefore, the answer is: D. Comp-3.

Which level used in RENAME clause

  1. Level 88

  2. Level 77

  3. Level 66

  4. Level 01


Correct Option: C

AI Explanation

To answer this question, we need to understand the RENAME clause in programming languages like COBOL.

In COBOL, the RENAME clause is used to change the name of a data item or a group of data items. The new name assigned to the data item or group is called the renamed item.

The level indicator in COBOL is used to specify the level of a data item or a group. It determines the hierarchical structure of the data item. The level numbers used in COBOL are 01, 66, 77, and 88.

Option A) Level 88 - This option is incorrect because the level 88 is used for condition names, not for renaming data items.

Option B) Level 77 - This option is incorrect because the level 77 is used for elementary data items, not for renaming data items.

Option C) Level 66 - This option is correct because the level 66 is used for renaming a data item or a group of data items.

Option D) Level 01 - This option is incorrect because the level 01 is used for the highest level of a data item or a group, but not specifically for renaming.

Therefore, the correct answer is C) Level 66. This option is correct because the level 66 is used in the RENAME clause to rename a data item or a group of data items.

In COBOL CANCEL statement used in which type of CALL

  1. Dynamic CALL

  2. Static CALL

  3. Both A and B

  4. None of the above


Correct Option: A
Explanation:

To solve this question, the user needs to have knowledge of the COBOL programming language and the different types of CALL statements used in it.

The CANCEL statement is used to cancel an active COBOL program, either from within the program or by another program. Specifically, it is used to cancel a dynamic CALL statement.

Therefore, the correct answer is:

The Answer is: A. Dynamic CALL

using an ____number of digits for PACKED DECIMAL (COMP-3) is 5% to 20% Faster than using an_____ number of digits .

  1. Even, Even

  2. Odd, Even

  3. Odd, Odd

  4. Even, Odd


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of PACKED DECIMAL (COMP-3) and how the number of digits affects its performance.

PACKED DECIMAL (COMP-3) is a data type used in computer programming to store decimal numbers. It is commonly used in languages like COBOL. In this format, each digit is encoded in a nibble (half a byte), and the sign is stored in the last nibble.

Now let's analyze each option to understand why the correct answer is option B:

Option A) Even, Even - This option suggests using an even number of digits for PACKED DECIMAL (COMP-3) in both cases. However, this is not the correct answer because the performance is not affected by using an even number of digits in both cases.

Option B) Odd, Even - This option suggests using an odd number of digits for PACKED DECIMAL (COMP-3) in the first case and an even number of digits in the second case. This is the correct answer because using an odd number of digits in the first case can result in faster performance compared to using an even number of digits.

Option C) Odd, Odd - This option suggests using an odd number of digits for PACKED DECIMAL (COMP-3) in both cases. However, this is not the correct answer because the performance is not affected by using an odd number of digits in both cases.

Option D) Even, Odd - This option suggests using an even number of digits for PACKED DECIMAL (COMP-3) in the first case and an odd number of digits in the second case. However, this is not the correct answer because the performance is not affected by using an odd number of digits in the second case.

Therefore, the correct answer is option B) Odd, Even. This option is correct because using an odd number of digits for PACKED DECIMAL (COMP-3) can result in faster performance compared to using an even number of digits.

Which one is incorrect in the following??

  1. If A is greater than B go to Para-A

  2. If C is not positive go to Para-C

  3. If D is not alphanumeric go to Para-D

  4. If E = 3 or 4 go to Para-valid


Correct Option: C
- Hide questions