NPTEL Problem Solving Through Programming in C Week 5 Assignment Answers 2024

Sanket
By Sanket

NPTEL Problem Solving Through Programming in C Week 5 Assignment Answers 2024

1. Which looping construct is best when the number of iterations is known beforehand?

a) ‘while’ loop
b) ‘do-while’ loop
c) ‘for’ loop
d) all of the above are true

Answer :- For Answers Click Here 

2. In a ‘do-while’ loop, when is the condition tested?

a) Before the first iteration
b) After the first iteration
c) At the middle of each iteration
d) At the end of each iteration

Answer :- For Answers Click Here 

3. Which ‘for’ loop has range of similar indexes of ‘i’ used in for (i = 0; i < n; i++);?

a) for (i = n; i>0; i–);
b) for (i = n; i >= 0; i–);
c) for (i = n-1; i>0; i–);
d) for (i = n-1; i>-1; i–);

Answer :- For Answers Click Here 

4.

W05Q04b

a) 10
b) 0123456789
c) Infinite loop, no output
d) Syntax error

Answer :- 

5.

W05Q05b

a) 0
b) 1
c) No output
d) Compiler error

Answer :- 

6.

W05Q06b

a) 5
b) 4
c) 1
d) No output

Answer :- For Answers Click Here 

7.

W05Q07b

a) Syntax error
b) 0 1 2 3 4 5 6 7 8 9 10
c) 1 2 3 4 5 6 7 8 9 10
d) 0 1 2 3 4 5 6 7 8 9

Answer :- 

8.

W05Q08b

a) A run time error will be reported
b) The program will not enter into the loop
c) The loop will run infinitely
d) There will be a compilation error reported

Answer :- 

9.

W05Q09b

a) 5, 4
b) 7, 4
c) 5, 6
d) 6, 4

Answer :- 

10.

W05Q10b

a) 5
b) 6
c) 10
d) 11

Answer :- For Answers Click Here 
Share This Article
Leave a comment