Operators variables - placement practice test
1. Which of the following is CPP style type-casting?
a. per = total/(float)m
b. per = total/float(m)
c. per = (float)total/m
d. None of these
View Answer / Hide AnswerANSWER: b. per = total/float(m)
2. Which of the following is not a casting operator in CPP?
a. explicit_cast
b. static_cast
c. dynamic_cast
d. reinterpret_cast
View Answer / Hide AnswerANSWER: a. explicit_cast
Explanation:
CPP supports Four casting operators viz. const_cast, static_cast, dynamic_cast and reinterpret_cast.
3. Logical expressions produce ____________ type results.
a. explicit
b. garbage
c. bool
d. static
View Answer / Hide Answer4. In CPP, the size of the character array should be one larger than the number of characters in the string.
a. True
b. False
View Answer / Hide AnswerANSWER: a. True
Explanation:
For sake of understanding, try following code in Turbo CPP editor.
void main()
{
char name[5] = “INDIA”; //This is invalid and cause error
char x_name[6]=”INDIA” // This is valid, one extra byte required for \0 character
}
5. Scope resolution operator is used______
a. to resolve the scope of global variables only
b. to resolve the scope of functions of the classes only
c. to resolve scope of global variables as well as functions of the classes
d. None of these
View Answer / Hide AnswerANSWER: c. to resolve scope of global variables as well as functions of the classes
6. A class can contain objects of other classes and this phenomenon is called__________
a. Relationship
b. Object Association
c. Containership
d. None of these
View Answer / Hide Answer