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 encapsulation example?
What are the 5 oop principles?
What is new keyword in oops?
Why is object oriented programming so hard?
What is solid in oops?
Write a program to reverse a string using recursive function?
What is the main feature of oop?
Is this job good for future? can do this job post grduate student?
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
Which type does string inherit from?
What is advantage of inheritance?
What is oops and its features?
What is constructor overloading in oop?
Why is encapsulation used?
What is difference between multiple inheritance and multilevel inheritance?