Question Bank (5 marks) · Q6
Q.Write the rules for forming variable name.
Karnataka PUCTextbookLong· 5mImportance★★★★★est
21% · 33/154 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →[!TLDR]
A variable name starts with a letter/underscore, uses only letters/digits/underscore, is not a keyword, has no spaces, is case-sensitive, and must be declared before use.
A variable is a named location in memory whose value may change during execution. The rules for forming a valid variable name are:
- The first character must be an alphabet (A-Z, a-z) or an underscore ( _ ).
- The following characters may be letters, digits (0-9) or the underscore.
- No blank spaces and no special characters (other than the underscore) are permitted.
- Keywords must not be used as variable names.
- Variable names are case-sensitive - Total and total are different.
- The name should be meaningful, and it must be declared with its data type before it is used.
Examples:
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.