retagged by
3,242 views

1 Answer

5 votes
5 votes
Correct answer is D:

Explanation:

Control flow of for loop is like:

1. Initialize

2. Condition check

3. Execute loop body

4. Update

5. Repeate from 2 to 4 untill condition holds.

So this is how control flow of for loop is to be implemented.

Now, in given question:

for(putchar('c');putchar('a');putchar('r'))
        putchar('t');

1. Initializarion:  putchar('c') results: c

2. Condition check : putchar('a') results : a

3. Executions of loop body : putchar('t') results : t

4. Updation : putchar('r') results : r

5. Repition : atratratratratratr......

final result: catratratratratrat......

As we can see it is an infinte loop so the correct answer is: D

if it would have been implemented using Recursion, then this will be continued until the runtime stack get exhausted. But just because it has been implemented using for loop it will be continuing itself like this forever.
Answer:

Related questions

3 votes
3 votes
3 answers
1
admin asked Mar 31, 2020
1,775 views
What is the correct way to round off $x$, $a$ $\text{float}$ to an $\text{int}$ value?$y=(\text{int})(x+0.5)$$y=\text{int} (x+0.5)$$y=(\text{int}) x+0.5$$y=(\text{int})(\...
5 votes
5 votes
6 answers
2
admin asked Mar 31, 2020
2,098 views
What error would the following function give on compilation? f(int a, int b) { int a; a=20; return a; }Missing parenthesis is $\textit{return}$ statement.Function should ...
4 votes
4 votes
1 answer
3
admin asked Mar 31, 2020
2,035 views
Prior to using a pointer variable it should bedeclared.initialized.both declared and initialized.none of these.
2 votes
2 votes
1 answer
4
admin asked Mar 31, 2020
1,123 views
If space occupied by two strings $s_1$ and $s_2$ in 'C' are respectively $m$ and $n$, then space occupied by string obtained by concatenating $s_1$ and $s_2$ is alwaysles...