32.4k views
3 votes
Which of the following is a valid variable name? a. salesTax b. input-string c. 25Percent d. double

User JHilscher
by
8.3k points

1 Answer

2 votes

Answer:

The correct answer of the given question is option(A) i.e salesTax

Step-by-step explanation:

Variable are the storage area which value varies during the execution of aprogram .

some of the rules of variable are

1 Variable always start with alphabet.

2 We cannot give variable name any reserve keyword.

3 Variable cannot start with digit.

4 We cannot use special symbol like -,$ to declare any variable

In option (b ) input-string ,it is invalid variable because it uses special symbol "-" to declared the variable.

In option (c) 25Percent , it is invalid variable because it violate the rule of variable and start with digit.variable cannot start with digit

In option( d )double, it is invalid variable because it violate the rule of variable because double is keyword and variable never be a keyword.

So option(A) is correct it follow the rule of variable.

User Guillermo Mansilla
by
8.8k points