Which of the following variable names for data items are not syntactically correct?
-
CIBER-CITY
-
-NW-OF-FOOD
-
TOTAL-NO-OF-LINES-PER-PAGE
-
PHONE NUMBER
-
INDEX
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).
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.