What will happen when the following code is run:
int x;
while(x<100)
{
cout<<x;
x++;
}
1) The computer will output "0123...99"
2) The computer will output "0123...100"
3) The output is undefined
Answer Posted / nk
Output is undefined because initially variable 'x' is not
initialized and may contain some garbage value.
However if we initialize 'x' to 0 then choice#1 is correct.
| Is This Answer Correct ? | 13 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of enum?
What does oop mean in snapchat?
What is overloading and its types?
What is destructor in oop?
What is the difference between abstraction and polymorphism?
What is the main purpose of inheritance law?
What is abstraction oop?
What is encapsulation in oop?
Get me an image implementation program.
what are the ways in which a constructors can be called?
What is object in oop?
What is an example of genetic polymorphism?
How to use CMutex, CSemaphore in VC++ MFC
Which language is pure oop?
Can we create object of abstract class?