Difficulty: Easy
Correct Answer: 1alpha
Explanation:
Introduction / Context:Variables in C must follow strict identifier rules to ensure the compiler can tokenize and parse code unambiguously. This question tests recognition of C identifier syntax and common invalid patterns such as starting with a digit or inserting spaces or special characters.
Given Data / Assumptions:
Concept / Approach:The validity of an identifier is checked against: first-character rule, allowed character set, and reserved-word avoidance. We evaluate each option against these rules and pick the only one that violates them.
Step-by-Step Solution:
Step 1: Check '_temp' → begins with underscore and uses only letters/underscore → valid.Step 2: Check '1alpha' → begins with digit '1' → violates first-character rule → invalid.Step 3: Check 'alpha1' → starts with a letter; digits allowed after first character → valid.Step 4: Check 'total_sum' → letters and underscore only; starts with letter → valid.Verification / Alternative check:Informal compiler mental check: if you wrote 'int 1alpha;' a compiler would emit an error at the '1' because tokens cannot begin with a digit for identifiers. The others would compile (assuming no prior conflicting declarations).
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:1alpha
Discussion & Comments