Pregunta de entrevista de Amadeus

1. How to achieve automatic type conversion from type X to type Y? a. X can define the member function operator Y() b. a) or b) can be used c. Y can define the constructor Y(const X&) d. none of the above 2. class Coordinate{ int x; int y; public: Coordinate(int a=0, int b=0) { x=a; y=b; }; }; What are the values for the following object: Coordinate point(10); a. x=10,y=0 b. x=0,y=10 c. x=10,y=10 d. x=0,y=0 3. What type of argument can the following function take : Void foo(); a. any number or type of arguments b. a character c. an integer d. no an integer argument of any type 4. Consider the following function declarations in a header file: void doit(char *, int); int doit(char *) ; float doit(float, float) ; Which of the following declarations cannot follow in the same header: a. void doit(int, char *); b. int doit(int) ; c. float doit(char *) ; d. int doit(int, int) ;

Respuestas de entrevistas

Anónimo

30 ago 2013

The answer is c. float doit(char *) because here the declaration that is the function parameters are the same as that of int doit(char *). The return type does not matter here

1

Anónimo

21 may 2016

1. c) Y can define the constructor Y(const X&) 2. a. x=10,y=0 3. d. no an integer argument of any type - In C++language . any number or type of arguments - In C language 4. c. float doit(char *) 5. a. A::name

1

Anónimo

21 may 2016

6.destructs only first. Leaks the memory.