ICSE Class 10 Computer Applications
Question 11 of 25
Values and Data Types — Question 11
Back to all questions 11
Question Question 11
Distinguish between the following:
i. Token and Identifier
| Token | Identifier |
|---|---|
| Each individual component of a programming statement is referred to as a token. | Identifiers are fundamental building blocks of the program and are used to name different components of a program such as variables, methods and objects. |
| Tokens in Java are categorised into 5 types — Keywords, Identifiers, Literals, Punctuators, Operators. | Identifier is a type of token in Java. |
ii. Keyword and Identifier
| Keyword | Identifier |
|---|---|
| Keywords have a special meaning for Java compiler. | Identifiers are used to name different components of a program such as variables, methods and objects. |
| Keywords are reserved by the compiler for its own use. | An identifier must not be a Keyword. |
iii. Character and String Constant
| Character Constant | String Constant |
|---|---|
| Character Constants are written by enclosing a character within a pair of single quotes. | String Constants are written by enclosing a set of characters within a pair of double quotes. |
| Character Constants are assigned to variables of type char. | String Constants are assigned to variables of type String. |
iv. Integer and float Constant
| Integer Constant | Float Constant |
|---|---|
| Integer Constants represent whole number values like 2, -16, 18246, 24041973, etc. | Float Constants represent fractional numbers like 3.14159, -14.08, 42.0, 675.238, etc. |
| Integer Constants are assigned to variables of data type — byte, short, int, long, char | Float Constants are assigned to variables of data type — float, double |