1) Which is a good choice of identifier? A) _abc B) RATE C)x D)A 2) Before a var
ID: 3852450 • Letter: 1
Question
1) Which is a good choice of identifier?
A) _abc B) RATE C)x D)A
2) Before a variable in C++ is used, it must be
A)defined B)initialized C)contain only letters, digits and underscores D)used in some expression
3) A L-value is
A)assigned a value B)an expression that can only be placed on the left of any operator such as +,*,/,etc C)can never have a value fetched from it D)is designed for use by a left-handed person
4) Which is a C++ keyword?
A) total_weight B)number_of_bars C) .a D) while
5) An r-value is
A) can never be assigned a value B) is designed for use by a right-handed person C) can have a value fetched from it D) an expression that can only be placed on the right of any operator such as +,*,/,etc
6)In C++, a variable that has been defined but not initialized may
A) be used in any way any identifier can be used B) not be used at all C)not be used as an r-value D)not be used as an L-value
7)Which is a legal identifier?
A) xy_z B) xyz! C)9xyz D) X+yz
8)Which statement is correct?
A)In C++ the compiler will infer the type intended for a variable from the context in which the variable occurs B)A C++ declaration is a definition but does not allocate storage for an identifiers value (or functions body etc.) C)A C++ declaration introduces only an identifiers spelling and specifies its type D) In C++ the variables Alpha, ALPHA and AlphA are the same identifier
9)Which is an invalid definition with initialization? (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 namespace(0); C) int count(0), limit(19); D)int count=0, limit=19;
10)Which is the smallest data type that can be used to store a integer number whose range is -10,000 to 10,000?
A) short B)unsigned long C)char D)int
11) In the C++ statement:
x = m - 3 * n + 4 / n;
assume x, m and n are int variables. Which operation is performed first?
A)+ B) * C) / D)-
12)Which include statement is required in order to get the statement below to work:?
time = sqrt(2 * height / 32.2);
A) #include "stdafx.h" B) #include <cmath> C) #include< iostream> D) #include <iomanip>
Explanation / Answer
1) Which is a good choice of identifier?
A) _abc B) RATE C)x D)A
Answer is B) RATE.
2) Before a variable in C++ is used, it must be
A)defined B)initialized C)contain only letters, digits and underscores D)used in some expression
Answer is A)defined
3) A L-value is
A)assigned a value B)an expression that can only be placed on the left of any operator such as +,*,/,etc C)can never have a value fetched from it D)is designed for use by a left-handed person
Answer is B)an expression that can only be placed on the left of any operator such as +,*,/,etc
4) Which is a C++ keyword?
A) total_weight B)number_of_bars C) .a D) while
Answer is D) while
5) An r-value is
A) can never be assigned a value B) is designed for use by a right-handed person C) can have a value fetched from it D) an expression that can only be placed on the right of any operator such as +,*,/,etc
Answer is D) an expression that can only be placed on the right of any operator such as +,*,/,etc
6)In C++, a variable that has been defined but not initialized may
A) be used in any way any identifier can be used B) not be used at all C)not be used as an r-value D)not be used as an L-value
Answer is D)not be used as an L-value
7)Which is a legal identifier?
A) xy_z B) xyz! C)9xyz D) X+yz
Answer is A) xy_z
8)Which statement is correct?
A)In C++ the compiler will infer the type intended for a variable from the context in which the variable occurs B)A C++ declaration is a definition but does not allocate storage for an identifiers value (or functions body etc.) C)A C++ declaration introduces only an identifiers spelling and specifies its type D) In C++ the variables Alpha, ALPHA and AlphA are the same identifier
Answer is A)In C++ the compiler will infer the type intended for a variable from the context in which the variable occurs
9)Which is an invalid definition with initialization? (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 namespace(0); C) int count(0), limit(19); D)int count=0, limit=19;
Answer is B) int namespace(0);
10)Which is the smallest data type that can be used to store a integer number whose range is -10,000 to 10,000?
A) short B)unsigned long C)char D)int
Answer is A) short
11) In the C++ statement:
x = m - 3 * n + 4 / n;
assume x, m and n are int variables. Which operation is performed first?
A)+ B) * C) / D)-
Answer is D)-
12)Which include statement is required in order to get the statement below to work:?
time = sqrt(2 * height / 32.2);
A) #include "stdafx.h" B) #include <cmath> C) #include< iostream> D) #include <iomanip>
Answer is B) #include <cmath>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.