1) In C++, a legal identifiers may contain these kinds of characters ___________
ID: 3918906 • Letter: 1
Question
1) In C++, a legal identifiers may contain these kinds of characters _______________, ______________, ______________
2) Pick the C++ keywords out of the following list.
a) while
b) total_weight
c) double
d) if
e) number_of_bars
3) Which of the following are legal definitions with initializations? (Consider each line to be in a different scope so there is no multiple definition of identifiers.)
a) int count = 0, limit = 19;
b) int count(0), limit(19);
c) int count = 0, limit(19);
d) int limit = 19;
e) int namespace(0);
4) The value of the expression 20.0 * (9/5) + 32.0 is
a) 68.0
b) 52.0
c) expression has a syntax error so there is no value
d) 32.0
e) an incorrect expression, the / should be %
Explanation / Answer
Solution:
1. In C++, a legal identifiers may contain these kinds of characters
Ans: digits,(0-9) underscore (_) , alphabets (a-z)
Note: But the identifier name can not be start from the digit but it can start from underscore and alphabets.
2. Pick the C++ keywords out of the following list.
Ans: double, if, while
3. Which of the following are legal definitions with initializations? (Consider each line to be in a different scope so there is no multiple definition of identifiers.)
Ans: int count = 0, limit = 19;
int limit = 19;
4. The value of the expression 20.0 * (9/5) + 32.0 is
Ans: 52.0
Note: If you liked the solution then don't forget to give a thumbs up, for any query do comment below.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.