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: (3:39pm on Tuesday 4th 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: A

Explanation :

Click on Discuss to view users comments.

Suhashini Chaurasia said: (3:43pm on Tuesday 4th March 2014)
Compilation error: Message appears asError prog_name.cpp line_no:function 'func_name' should have prototypeSo correct answer is [A]
Sangeeth95 said: (6:00pm on Tuesday 27th March 2018)
I strongly agreed with suhashini Chaurasia

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: (5:01pm on Tuesday 4th 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: