Tuesday, September 6, 2011

wipro old papers

25. What will happen if we have this code:

char a[3] = {'d','w','\0'};
char b[3];
b = a;

a) "b" will be the same as "a"
b) "b" will be unchanged
c) Compiler error
d) Other
e) I don't know


26. Is this code legal: int a; int b[a]; ?
a) Yes
b) No
c) I don't know


27. If we have:
int a=9; //in the global space...
 void f() { int a; a = 4; } 

And if we type: cout << a; in the main() function, what will be the result?
a) 9
b) 0
c) 4
d) Other
e) I don't know
28. If we have this code:

class A { public: int a; };  
A *obj;

How do we access the "a" variable?
a) obj.a
b) obj-a
c) obj->a
d) obj::a
e) I don't know


29. Which of these has the highest precedence?a) ++
b) ()
c) *
d) /
e) +
f) I don't know


30.What should you do to free the memory after running this code?
char *a; a = new char[20];
a) delete [] a;
b) delete a[];
c) delete a;
d) I don't know 

No comments:

Post a Comment