Which of the following are vaild identifiers and why/why not? 1 data_rec,2 switch,3 1 data,4 xyz 1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Which of the following are vaild identifiers and why/why not? 1 data_rec,2 switch,3 1 data,4 xyz 1

29th Mar 2017, 7:47 AM
Arpit Gupta
Arpit Gupta - avatar
6 Answers
+ 12
data_rec is started with letter and contain only letter and underscore. the rule is : 1. start with letter or underscore. 2. contain only letter, number or underscore.
29th Mar 2017, 8:14 AM
Agus Mei
Agus Mei - avatar
+ 5
data_rec is valid. switch is invalid (its a keyword) 1 data is invalid(contains special character (space) and starts with a number) xyz 1 is invalid (space )
29th Mar 2017, 7:51 AM
Meharban Singh
Meharban Singh - avatar
+ 2
its valid. In names of identifiers,only alphabets ,numbers,_ and $ signs are allowed. a number cant be first letter
29th Mar 2017, 8:14 AM
Meharban Singh
Meharban Singh - avatar
0
what about data_rec reason
29th Mar 2017, 7:52 AM
Arpit Gupta
Arpit Gupta - avatar
0
It is invalid as well: identifiers cannot contain spaces.
29th Mar 2017, 2:48 PM
Luca Garrera
0
What will be Data_rec Reason
10th Dec 2018, 1:07 PM
Mayurji Technical
Mayurji Technical - avatar