Computer Science, asked by Payal63841, 9 months ago

What are the invalid variable names in following? Explain with reasons. My_Name, number10, $100, father’s name, marks%

Answers

Answered by VIKRANT17565
1

Answer:

My_Name (valid)

number10 (valid)

$100 (invalid)

father's name (invalid)

marks% (invalid)

Explanation:

variable names are inly made by using

1) Capital and small Alphabets

2) Using numbers

3) using underscore ( i.e. _ )

4) First character should not be a number

Answered by shilpa85475
1

Father’s name and marks% are invalid variable names.

EXPLANATION:  

  • A variable is an identifier that can store values. Value is accessed using variable names.
  • A valid variable name begins with a letter and can include letters, digits, and underscores. It may also begin with an underscore or $ sign.
  • The period, the underscore, and the characters $, #, and @ can be used within variable names. It must not begin with any number. Space is not allowed in between.
  • Java script is case sensitive, so the variable name my_bag is not the same as My_Bag.  
  • Thus, for all these reasons, valid variable names from the given list are: My_name, number 10, $100.
  • Father’s name and marks% are invalid as ‘ and % are not valid characters to be used. Also, father’s name has a space in between which is not allowed.

Similar questions