Multiple choice technology mainframe

Which of the following variable names for data items are not syntactically correct?

  1. CIBER-CITY

  2. -NW-OF-FOOD

  3. TOTAL-NO-OF-LINES-PER-PAGE

  4. PHONE NUMBER

  5. INDEX

Reveal answer Fill a bubble to check yourself
B,D,E Correct answer
Explanation

In COBOL, variable names must follow specific rules: cannot start with a hyphen (B), cannot contain spaces (D), and cannot be reserved words (E - INDEX is a reserved verb). Option A is valid (hyphen in middle is fine). Option C is valid (multiple hyphens allowed).

AI explanation

To determine which of the following variable names for data items are not syntactically correct, let's go through each option:

A. CIBER-CITY - This option is syntactically correct. Variable names can contain letters, numbers, and underscores, but cannot start with a number.

B. -NW-OF-FOOD - This option is not syntactically correct. Variable names cannot start with a hyphen or any special characters.

C. TOTAL-NO-OF-LINES-PER-PAGE - This option is syntactically correct. Variable names can contain underscores to separate words.

D. PHONE NUMBER - This option is not syntactically correct. Variable names cannot contain whitespace or spaces.

E. INDEX - This option is syntactically correct. Variable names can be single words and can contain letters, numbers, and underscores.

Therefore, the variable names that are not syntactically correct are B. -NW-OF-FOOD, D. PHONE NUMBER, and E. INDEX.