TCS
Company
Programming
Basics
How many times is the loop executed in the following program? for (i = 0, j = 10; i <= 100; i++){ j = j * i; }
Read Solution (Total 23)
-
- 101 is right
- 6 years agoHelpfull: Yes(15) No(0)
- 101 is right because it is starting from zero upto 100 it runs 101 times
- 6 years agoHelpfull: Yes(2) No(0)
- 101times,initially i=0, then increment 1,the condition is i
- 6 years agoHelpfull: Yes(1) No(0)
- 101 times.....
- 6 years agoHelpfull: Yes(1) No(0)
- 100 times
because there is no change in the value of j in the loop condition
so, until i becomes 99 it will enter the loop - 6 years agoHelpfull: Yes(0) No(3)
- 101 is the correct answer
- 6 years agoHelpfull: Yes(0) No(0)
- 101 is correct answer because i starts from 0 to 100
here j value does not effect on loop - 6 years agoHelpfull: Yes(0) No(0)
- No sufficient information for the question
- 6 years agoHelpfull: Yes(0) No(0)
- tell me how it is
- 6 years agoHelpfull: Yes(0) No(0)
- start from i=0 and the condition is i
- 6 years agoHelpfull: Yes(0) No(0)
- The answer doesnot depend on the value of 'j' (as 'j' is not included in condition check), so avoid it. Now, as 'i' starts from 0, the loop repeats from 0 to 100 (as i
- 6 years agoHelpfull: Yes(0) No(0)
- 101 times
- 6 years agoHelpfull: Yes(0) No(0)
- 101 is the correct answer because the value of j is constant.in the loop the value of i will be incremented but j remains constant.
- 6 years agoHelpfull: Yes(0) No(0)
- 101 is the right answer
- 6 years agoHelpfull: Yes(0) No(0)
- 101
loop wll be repeated till 100 - 6 years agoHelpfull: Yes(0) No(0)
- 1
as j=10 doesnt satisfy in next step - 6 years agoHelpfull: Yes(0) No(0)
- 101 is right
- 6 years agoHelpfull: Yes(0) No(0)
- 101 times....
- 6 years agoHelpfull: Yes(0) No(0)
- 101, Because 0 to 100 there are 101 items and for all those items the loop will execute
- 6 years agoHelpfull: Yes(0) No(0)
- The main looping condition depends on i.
i goes from 0 to 100 by incrementing i = i+1 after each looping.So answer 101 times - 5 years agoHelpfull: Yes(0) No(0)
- 101 because loop start from 0
- 5 years agoHelpfull: Yes(0) No(0)
- Loop will executes 101 times
From i=0 to upto 100 - 3 years agoHelpfull: Yes(0) No(0)
- 100 times the loop executed
- 2 years agoHelpfull: Yes(0) No(0)
TCS Other Question