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 the purpose of enum?
What is oops concept with example?
write a program to find 2^n+1 ?
What is new keyword in oops?
What is encapsulation and abstraction? How are they implemented in C++?
What is the diamond problem in inheritance?
What are different oops concepts?
What is the advantage of oop over procedural language?
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.
What is abstraction with example?
What is difference between pop and oop?
what's the basic's in dot net
What are the 3 pillars of oop?
How do you define a class in oop?
i got a backdoor offer in process global,Bangalore..Can i work with it?