1) Which is a good choice of identifier? A) _abc B) RATE C)x D)A 2) Before a var
ID: 3851886 • 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) Option A Which is _abc
Its good naming convention to start with _
2) Option B which is initialized
3) Option A which is assigned a value
4) Option D which is while
5) Option A which is can never be assigned a value
6) Option A which is be used in any way any identifier can be used
7) Option A which is xy_z
8) Option C which is A C++ declaration introduces only an identifiers spelling and specifies its type
9) Here only option D is correct rest are wrong
10) Option D which is int
int takes only 2 bytes
11) Option C which is /
Divide gets executed first as its executes from right to left
12) Option B which is #include <cmath>
math function is used to take the sqroot
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.