Upload
fellowbuddycom
View
97
Download
0
Embed Size (px)
Citation preview
www.fellowbuddy.com
Simplifying Students Life
Operators variables
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
2. Which of the following is not a casting operator in CPP?
a. explicit_cast
b. static_cast
c. dynamic_cast
d. reinterpret_cast
3. Logical expressions produce ____________ type results.
a. explicit
b. garbage
c. bool
d. static
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
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
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
www.fellowbuddy.com
Simplifying Students Life
Answers
1. ANSWER: b. per = total/float(m)
2. ANSWER: a. explicit_cast
Explanation:
CPP supports Four casting operators viz. const_cast, static_cast, dynamic_cast and
reinterpret_cast.
3. ANSWER: c. bool
4. 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. ANSWER: c. to resolve scope of global variables as well as functions of the classes
6. ANSWER: c. Containership