171. find a bug in following code .......
Microsoft Interview Questions and Answers
(Continued from previous question...)
171. find a bug in following code .......
Question:
find a bug in following code :
class A
{
public:
static int i;
void print()
{
cout<< i << endl ;
}
};
int main()
{
A a;
a.print();
}
maybe an answer1:
1 bug:
static is a declaration not a definition, because you can not define static data inside a class so you have to define it outside the class, after class definition either in header file
(Continued on next question...)
Other Interview Questions
- Write a function that takes an input string and a pattern string ......
- Microsoft Intelligence-based interview
- 173. A program has two functions 'reader_func' and 'writer_func' .......
- 144. If [a1,a2,a3...,an,b1,b2...bn] is given input change......
- Given a BST and integer value K.....
- Suppose you are given a cube and each face of the cube contains an array. ....
- Microsoft Interview Questions 3
- 188. Implement Stack using Queues?
- If you are given 2 number U and V then Write a program....
- 144. If [a1,a2,a3...,an,b1,b2...bn] is given input change......
- More...
|