Classical

Object Oriented Programming - Basics of C++

11:  

Consider the declarations
char a;
const char aa = 'h';
char *na;
const char *naa;

                       Which of the following statements
Statement I: aa = a;
Statement II: na = &a;
Statement III: na = &aa;
                                  is/are illegal?     

A.

Only I and II

B.

Only II and III

C.

Only I and III

D.

All the three statements are illegal

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Suhashini Chaurasia said: (12:39am on Wednesday 5th March 2014)
Since aa is constant its value cannot be changed in the program so statement I is false. Statement II

Write your comments here:



12:  

Forgetting to include a file (like cmath or math.h) that is necessary will result in

A.

compilation error

B.

warning when the program is run

C.

error at link time

D.

warning when the program is compiled

 
 

Option: C

Explanation :

Click on Discuss to view users comments.

Suhashini Chaurasia said: (12:43am on Wednesday 5th March 2014)
Compilation error: Message appears asError prog_name.cpp line_no:function 'func_name' should have prototypeSo correct answer is [A]

Write your comments here:



13:  

Which of the following comments about inline comments are true?   

A.

A function is declared inline by typing the keyword inline before the return value of the function.

B.

A function is declared inline by typing the keyword inline after the return value of the function.

C.

A function that is declared inline may not be treated inline.

D.

Both (a) & (c)

 
 

Option: D

Explanation :

Click on Discuss to view users comments.

Suhashini Chaurasia said: (2:01am on Wednesday 5th March 2014)
When i tried writing inline before or after return it is working well. So [B] option is also correct.

Write your comments here:



14:  

At what point of time a variable comes into existence in memory is determined by its  

A.

scope

B.

storage class

C.

data type

D.

all of the above

 
 

Option: B

Explanation :

Click on Discuss to view users comments.

Write your comments here:



15:  

Which of the following specifiers need not be honored by the compiler?  

A.

register

B.

inline

C.

static

D.

Both (a) & (b)

 
 

Option: D

Explanation :

Register and inline are not compiler directives but rather request to the compiler. These requests need not be honored by the compiler.

Click on Discuss to view users comments.

Write your comments here: