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

In most of the compilers now all declared variables are
usually initialised with 0. So in most compilers result
would be #1. But in some cases the garbage values may creep
up.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the importance of oop?

601


Why is abstraction used?

597


What is static modifier?

623


What is the purpose of polymorphism?

664


What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2089






What is abstraction in oop with example?

635


What is meant by multiple inheritance?

728


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1409


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

1631


What is the main feature of oop?

612


What is the main purpose of inheritance law?

660


what type of question are asked in thoughtworks pair programming round ?

1749


What is encapsulation selenium?

549


What is difference between oop and pop?

606


What is for loop and its syntax?

590