1. Preprocessor directives begin with a B)# E) None of the above 2. Every comple
ID: 3727808 • Letter: 1
Question
1. Preprocessor directives begin with a B)# E) None of the above 2. Every complete C++ statement ends with a A) period B) # symbol C) semicolon D) ending brace E) None of the above 3. Are the following identifier names legal or illegal? If illegal, state the reason. A) dayOfWeek B) 2D Array C) _empNum D) Feb2007 E) hourlySrate F) bool Legal Illegal Legal Illegal Legal Illegal Legal Illegal Legal Illegal Legal Illegal 4. Which of the following are NOT a valid assignment statements? A) total = 19.2345; B) profit = 1 23; C) 72 = amount; D) letter = ‘W'. 5. What is wrong with the following program? critter 65.8; int A, B = 45; float critter coutExplanation / Answer
According to chegg guidelines i have to solve first four bits only but i will solve five bits.
1.
Option B correct.
2.
Option c correct.
3.
A) dayOfWeek --> True
B) 2D_Array --->False
Since identities cant start with the numbers.
C) _empNum --->True
D) Feb2007 --->True
E) hourly$rate --->True
F) bool --->False
bool is a data type so cant use as a identifier.
4.
Option c correct.
72=amount;
It is not a valid statement because we can assign values or variables to a variable not any decimal number.
Valid declaration:
amount=72;
5.
1.It rises variable declaration error, because critter=65.8 is first assigned after that declared.
2. Missing semicolon at the end of critter declaration.
3. print statement missing variable critter to print.
4. cout statement The value.....must enclosed in semicolon.
5. cout statement uses a and b instead of A and B.
float critter;
int A,B=45;
critter=65.8;
cout << "The value of critter is "<<critter<<endl;
cout << "The value of A is "<<A<<endl;
cout << "The value of B is "<<B<<endl;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.