Q. From the following, find out which assignment statement will produce an error. State reason(s) too.


(a) x = 55

(b) y = 037

(c) z = 0o98

(d) 56thnumber = 3300

(e) length = 450.17

(f) !Taylor = 'Instant'

(g) this variable = 87.E02

(h) float = .17E - 03

(i) FLOAT = 0.17E - 03


Answer =


(b) It is invalid because numbers never start with 0.

(c) It is invalid octal integer literals.

(d) Invalid identifiers because digits cannot be used as the first character of the identifier.

(f) Invalid identifiers because specific characters cannot be used for identifiers.

(g) Because identifiers cannot accept space (white space).

(h) Keywords cannot be used as identifiers.

(i) invalid syntax of exponent form.


9 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Very Helpful
    Thanku u some much for this .☺️

    ReplyDelete
  2. Thank you very much bhi. It helps. Really helps.

    ReplyDelete
  3. b)is invalid too

    ReplyDelete
  4. Answer of question (a) isn't mentioned..

    ReplyDelete
    Replies
    1. Because (a) will not show any error. And we dont need to explain why it didn't. So it is skipped. Whereas the other questions wipp show error and hence are explaoned why.

      Delete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post