Operators variables - placement practice test

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 Answer

ANSWER: 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 Answer

ANSWER: 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 Answer

ANSWER: c. bool




4. 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 Answer

ANSWER: 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 Answer

ANSWER: 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

ANSWER: c. Containership



Post your comment

You may like