Computer Science, asked by attrialisha02, 7 months ago

Which of the following is an invalid variable? a) my_string_1 b) 1st_string c) and d) _ 3.​

Answers

Answered by kanishknegi2006
0

The correct answer is (B) 1st_string

Answered by Jasleen0599
3

Option B) 1st_string

1st_string is an invalid variable.

  • Only any alphabet (upper/lower case) or the character "_" may begin a variable name (underscore). Variable names are not permitted to contain white space. Numeric characters aren't allowed to begin variable names. Special characters like! @#%&* are not allowed in the variable name.
  • underscore and $ dollar sign are two examples of special characters that can be used in variable names in addition to capital letters A–Z, lowercase letters a–z, and digits 0–9. A digit cannot be the first character. Variable names can't have blank spaces in them. Java keywords are incompatible with variable naming.
  • The underscore character or a letter must begin the name of a variable in Python. A number cannot come first in a variable name. Only underscores (A-z, 0-9, and _) and alphanumeric characters are permitted in variable names.
  • Variable names must begin with the underscore (_) symbol or an alphabet (A-Z and a-z) character. For instance, the variable names var, X, _name, etc. are acceptable, however 1a, $age, etc. are not. The alphabet (A-Z and a-z), underscore (_), and digits (0-9) are allowed in variable names, but additional symbols like %, &, @, etc. are not permitted.

#SPJ2

Similar questions