COMPUTER PROGRAMMING FUNDAMENTALS
WHAT IS PROGRAMMING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
print something
|
|
tell how many times should the loop repeat
|
|
store a string value
|
|
none of the above
|
Detailed explanation-1: -The formula for calculating the number of times the inner loop executes is the number of times the outer loop repeats multiplied by the number of times the inner loop repeats.
Detailed explanation-2: -The loop runs twice. After two times, the condition evaluates to false. If you want the loop to run ten times, you change the condition such that it evaluates to false when the increment expression has ran ten times. The loop runs ten times.
Detailed explanation-3: -A counting loop typically uses a variable to count from some initial value to some final value. This variable is often called the index variable.
Detailed explanation-4: -In general, you should use a for loop when you know how many times the loop should run. If you want the loop to break based on a condition other than the number of times it runs, you should use a while loop.