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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / d n gavade
The Answer is 3)The Output is undefined because x is not
initialised and its datatype is auto int so that its inital
value will be garbage.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / deepanker aggarwal
the answer is 3 because x is not initialised and it may
contain any garbage value
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / rakesh
the output is undefined
because c++ do not implicitly initialised the varible. it
gives garbage value for uninitialized variables
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ibrazileasum
The initial value of x is not defined to '0' hence the complier will not start from 0 as initial value. This is a garbage error to the compiler
| Is This Answer Correct ? | 0 Yes | 0 No |
which are the 4 members functions in c++ objects that can either be declared explicitly by programmer or implementation if nt available.
State what is encapsulation and friend function?
What is function overloading and operator overloading?
What is operator overloading? Give Example
11 Answers CTS, IBM, TCS,
What is the diamond problem in inheritance?
why we are declare the function in the abstract class even though we are declaring it in Derived class?
write a program that takes input in digits and display the result in words from 1 to 1000
What are the 3 pillars of oop?
what is oppes
What is encapsulation example?
what is a virtual class?
5 Answers Cap Gemini, IBM, Infosys, Trinity Technologies,
what is difference between String s=new String("vali"); String s="vali"