Multiple choice technology mainframe

Which of the following is not a valid Perform statement?

  1. Perform Para-1

  2. Perform Para-1 Thru Para-2

  3. Perform Section-2 Section

  4. Perform Para-1 20 times

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In COBOL, you perform paragraphs or sections. 'Perform Section-2 Section' is invalid syntax because appending the word 'Section' after the name in a PERFORM statement is incorrect. The other statements are valid standard COBOL syntax formats.

AI explanation

To answer this question, we need to understand the syntax and usage of the Perform statement in a programming language.

The Perform statement is used to execute a section of code multiple times or until a specific condition is met. It can be used in different ways:

A. Perform Para-1: This syntax executes the paragraph or section named "Para-1" once.

B. Perform Para-1 Thru Para-2: This syntax executes the paragraphs or sections from "Para-1" to "Para-2" in sequence.

C. Perform Section-2 Section: This syntax is not valid. It is missing the "Thru" keyword, which is required when specifying a range of paragraphs or sections.

D. Perform Para-1 20 times: This syntax executes the paragraph or section named "Para-1" 20 times in sequential order.

Therefore, the correct answer is C. The statement "Perform Section-2 Section" is not a valid Perform statement because it is missing the "Thru" keyword.