21. | Which of the following differentiates between overloaded functions and overridden functions? |
a. | Overloading is a dynamic or runtime binding and overridden is a static or compile time binding. |
b. | Overloading is a static or compile time binding and overriding is dynamic or runtime binding. |
c. | Redefining a function in a friend class is called overloading, while redefining a function in a derived class is called as overridden function. |
d. | Redefining a function in a derived class is called function overloading, while redefining a function in a friend class is called function overriding. |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (b).Overloading is a static or compile time binding and overriding is dynamic or runtime binding.
|
22. | Which of the following is not a member of class? |
a. | Static function |
b. | Friend function |
c. | Const function |
d. | Virtual function |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (b).Friend function
|
23. | Consider the following statements S1, S2 and S3 :
S1 : In call-by-value, anything that is passed into a function call is unchanged in the caller's scope when the function returns. S2: In call-by-reference, a function receives implicit reference to a variable used as argument. S3: In call-by-reference, caller is unable to see the modified variable used as argument. |
a. | S3 and S2 are true |
b. | S3 and S1 are true |
c. | S2 and S1 are true |
d. | S1, S2, S3 are true |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (d).S1, S2, S3 are true
|
24. | How many tokens will be generated by the scanner for the following statement?
x = x * (a+b) - 5; |
a. | 12 |
b. | 11 |
c. | 10 |
d. | 7 |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (b).11
|
25. | When the following code is executed , what will be the value of x and y ?
int x =1, y= 0; y=x++; |
a. | 2,1 |
b. | 2,2 |
c. | 1,1 |
d. | 1,2 |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (a).2,1
|
26. | What is the output of the following program ?
(Assume that the appropriate preprocessor directives are included and there is no syntax error) main ( ) { char S[ ] = "ABCDEFGH"; printf ("%C",* (& S[3])); printf ("%s", S + 4); printf ("%u", S); /* Base address of S is 1000 */ } |
a. | ABCDEFGH1000 |
b. | CDEFGH1000 |
c. | DDEFGHH1000 |
d. | DEFGH1000 |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (d).DEFGH1000
|
27. | Which of the following, in C++, is inherited in a derived class from base class ? |
a. | constructor |
b. | destructor |
c. | data members |
d. | virtual methods |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (c).data members
|
28. | Given that x = 7.5, j = -1.0, n = 1.0, m = 2.0
The value of - - x + j = = x > n >= m is : |
a. | 0 |
b. | 1 |
c. | 2 |
d. | 3 |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (a).0
|
29. | Which of the following is incorrect in C++ ? |
a. | When we write overloaded function we must code the function for each usage |
b. | When we write function template we code the function only once |
c. | It is difficult to debug macros |
d. | Templates are more efficient than macros |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (d).Templates are more efficient than macros
|
30. | When the inheritance is private, the private methods in base class are in the _______________ derived class (in C++). |
a. | inaccessible |
b. | accessible |
c. | protected |
d. | public |
View Answer Report Discuss Too Difficult! Search Google |
Answer: (a).inaccessible
|