...
Question 12964 – Operating-Systems
January 11, 2024
Question 11110 – Computer-Networks
January 11, 2024
Question 12964 – Operating-Systems
January 11, 2024
Question 11110 – Computer-Networks
January 11, 2024

Question 162 – Programming-for-Output-Problems

Consider the following C program

How many lines of output does this program produce?

Correct Answer: D

Question 35 Explanation: 
→ Since there is one line of output for each loop, we need to determine the number of
times the loop executes. Since i is constant, we need to see the growth of j only.
→ Let the initial value of j be denoted by J1 and the subsequent values by Jn for n= 2, 3,… so that J denotes a progression of j. We see that Jn = 2Jn-1;

→ J1 = 2, which gives Jn = 2n-1;
n = 1, 2, …
→ The loop will execute as long as i/j=2.0/2n-1 >0.001 which gives n<3log210+2 (or) n<11.97.
→ Thus the loop will execute 11 times which is equivalent to say there will be 11 lines of output.
A
0-9 lines of output
B
10-19 lines of output
C
20-29 lines of output
D
More than 29 lines of output
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!