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 / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

2007


What is an advantage of polymorphism?

837


What are the components of marker interface?

815


Why we use classes in oop?

799


Whats is abstraction in oops?

853


IS IT NECESSARY TO INITIALIZE VARIABLE? WHAT IF THE INSTANCE VARIABLE IS DECLARED final ? IS IT NECESSARY TO INITIALIZE THE final VARIABLE AT THE TIME OF THEIR DECLARATION?

1832


What is the real time example of encapsulation?

813


What is the diamond problem in inheritance?

842


why reinterpret cast is considered dangerous?

2133


What is object-oriented programming? Webopedia definition

971


What is byval and byref? What are differences between them?

1967


What is destructor give example?

830


Why is static class not inherited?

851


What do you mean by variable?

783


What is the difference between encapsulation and polymorphism?

862