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


Please Help Members By Posting Answers For Below Questions

What is the purpose of enum?

569


What is oops concept with example?

568


write a program to find 2^n+1 ?

1538


What is new keyword in oops?

583


What is encapsulation and abstraction? How are they implemented in C++?

626






What is the diamond problem in inheritance?

565


What are different oops concepts?

562


What is the advantage of oop over procedural language?

617


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

2562


What is abstraction with example?

592


What is difference between pop and oop?

593


what's the basic's in dot net

1732


What are the 3 pillars of oop?

607


How do you define a class in oop?

612


i got a backdoor offer in process global,Bangalore..Can i work with it?

2314