How long does this loop run:
for(int x=0; x=3; x++)
a) Never
b) Three times
c) Forever
Answers were Sorted based on User's Feedback
Answer / pracheer gupta
what r u saying guys..
the loop will run c) forever
this is bcoz in the termination part it is actually x=3 and
not x==3.
x=3 will always evaluate to true and hence the loop is
executed infinite times.
| Is This Answer Correct ? | 94 Yes | 11 No |
Answer / manju
The correct and verified answer is the loop runs forever
the answer is c. it is so becoz in condition part we are
giving i=3 and not i==3.
so it executes infinite times.
| Is This Answer Correct ? | 32 Yes | 3 No |
Answer / eric
The loop will run forever.
K.premalatha is the foolest lady I have ever met.
| Is This Answer Correct ? | 17 Yes | 3 No |
Answer / john
the loop runs forever guys....
have you tried this? without trying u r giving the random answers?
Sentrix, Eric, Manju,Pracheer Gupta are right...
other guys please try it....
| Is This Answer Correct ? | 17 Yes | 4 No |
Answer /
#include<stdio.h>
main()
{
for(int x=0; x=3; x++)
printf("Forever.....");
}
| Is This Answer Correct ? | 14 Yes | 2 No |
Answer / divya
hai john I tried this in online compiler but it shows some errors....didnt give exact ans...Is there any other ways to conform this answer.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / awaneesh dubey
Never . It will show compile time error . boolean required
at the terminationa condition not int . i.e. it should be
for(int x=0; x==3; x++) not for(int x=0; x=3; x++) .
x=3 will cause compilation error. So answer is never .
| Is This Answer Correct ? | 1 Yes | 1 No |
How new/delete differs from malloc()/free?
difference between the c++ and c languages
What are friend functions in C++?
Differentiate between realloc() and free().
What is a container class? What are the types of container classes?
what are difference between c and c++?
What are c++ templates used for?
There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.
Can we declare a base-class destructor as virtual?
What is the use of volatile keyword in c++? Give an example.
What are proxy objects?
What are the types of container classes?