Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


a=0;
while(a<5)
printf("%d\n",a++);
how many times does the loop occurs?
a.infinite
b.5
c.4
d.6

Answers were Sorted based on User's Feedback



a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? ..

Answer / bharath kumar

Hello,

The answer is b.

a=0+1=1
a=1+1=2
a=2+1=3
a=3+1=4
a=4+1=5

While a variable is storing the 5 result a is nither less
then are equal to 5 hence the application will come out of
the loop.So while loop had run 5 times.

Is This Answer Correct ?    28 Yes 4 No

a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? ..

Answer / guest

b

Is This Answer Correct ?    20 Yes 5 No

a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? ..

Answer / vikram

the output will be:
0
1
2
3
4
hence the loop will be executed 5 times,hence the answer is b

Is This Answer Correct ?    17 Yes 2 No

a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? ..

Answer / deepu_ashu

as the value of "a" increases after printing the value.
so it will print the value
0
1
2
3
4
but after printing the value 4 ,it becomes 5 for the next iteration.
so the condition becomes false.
the loop will not execute any more.

Is This Answer Correct ?    12 Yes 1 No

a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? ..

Answer / vignesh1988i

THIS LOOP OCCURS 5 TIMES. AT THE SIXTH TIME IT BECOMES FALSE

Is This Answer Correct ?    12 Yes 2 No

a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? ..

Answer / sruthi

answer is b

Is This Answer Correct ?    9 Yes 1 No

a=0; while(a<5) printf("%d\n",a++); how many times does the loop occurs? ..

Answer / ankit rastogi

ans should be (a)infinite
bcoz every time a will be initialize with 0......
and increment values are displayed
a=1
a=2
a=3
a=4...................upto infinity......

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More C Interview Questions

Why is c platform dependent?

0 Answers  


What is an object?

5 Answers  


main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }

27 Answers   Advent Global Solutions, CitiGroup, Valeo Lighting Systems India Private Limited, Vishal Transformers, Wipro, Zencer,


How to calculate Total working time using Login and logout?

2 Answers   CTS, Cygnus, Infosys, Signal Networks, TCS, Wipro,


What is the ANSI C Standard?

0 Answers   Celstream,


What is array in C

0 Answers  


what is the most appropriate way to write a multi-statement macro?

1 Answers  


Tell me what is null pointer in c?

0 Answers  


how can we print  hellow world programme without using semicolon

3 Answers  


Write a C program that reads a series of strings and prints only those ending in "ed"

2 Answers   Accenture,


Explain argument and its types.

0 Answers  


Write a program to exchange two variaables without temp

9 Answers   Geometric Software,


Categories