C++ Sample Questions

You might also like

You are on page 1of 2

questionStatement Comeau C/C++ comes with its own version of Standard C++ library called: Choose the correct

statements regarding inline functions:<br/>1) It speeds up execution.<br/>2) It slows down execution.<br/>3) It increases the code size.<br/>4) It decreases the code size.<br/>5) It slightly breaks your encapsulation.

answerA stdlib

answerB libcomo

answerC slibrary

answ erD clibrar y

answ erE

Choose the incorrect statement: Choose the correct option for the following program fragment:<br/>void main( ) <br/>{<br/>int x = 10 ;<br/>int &p = x ;<br/>cout << *(&p) << &x ;<br/>} For a method to be an interface between the outside world and a class, it has to be declared _____. What is the correct value which the program returns to the operating system upon the successful completion of it? Which of the following operators can be used to compare two variables? Which of the following is not a valid escape code? When requesting for multiple datum, which of the following can work as a seperator?

1, 3 C++ allows any operator to be overloaded . Prints 10 and the address of x.

2, 4 Assignment operators cannot be overloaded.

2, 4, 5 Operator precedence can be changed.

1, 3, 5

1, 4

None of the above. Result s in compil e error.

Results in run time error.

Prints 10 and the address of p.

Both 1 and 3.

friend

protected

public

-1 := \t A space To overload functions, different return types of overloaded functions is a necessary condition.

1 != \v A tab character To overload functions, different return types along with different argument types is a necessary condition.

0 equal \f A new line character To overload functions, different return types is not a necessary condition. Only argument types must be different

extern Progra ms do not return a value. none \w All of the above

Which of the following statements is true?

None of the above.

You might also like