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.
Very Helpful
ReplyDeleteThanku u some much for this .☺️
Welcome : ) ^_^
DeleteThank you very much bhi. It helps. Really helps.
ReplyDeleteWelcome : )
Deleteb)is invalid too
ReplyDeleteOk, I have corrected it.
DeleteAnswer of question (a) isn't mentioned..
ReplyDeletebecause a is correct.
DeleteBecause (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.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )