NPTEL Problem Solving Through Programming in C | NPTEL Week 4 Quiz Assignment | NPTEL Assignment Solutions

NPTEL Problem Solving Through Programming in C Week 4 Quiz Assignment | NPTEL Swayam Assignment Answers



nptel problem solving through proramming in C



MCQs (multiple choice questions) Nptel Week 3 Quiz Answers:

Q.1: The loop which is executed at least once is. Options are:

 a)  “while” loop
 b) “do-while” loop
 c) “for” loop
 d) None of the above

Answer is (b) “do-while” loop


Q.2 : In the C programming language negative numbers when used in if-else conditional checking, are treated as: Options are:

 a) TRUE
 b) FALSE
 c) Depends on the implementation
 d) None of these

Answer is (a) TRUE


Q.3: Choose the correct statement to use “if-else” statement in C Language. Options are:

 a) “else if” is compulsory to use with “if” statement.
 b) “else” is compulsory to use with “if” statement.
 c) “else” or “else if” is optional with the “if” statement.
 d) None of the above are correct

Answer is (c) “else” or “else if” is optional with the “if” statement.


Q.4: What is the output of the following C code ? Options are:

what is the output of the following C code

 a) True
 b) False
 c) Both ‘True’ and ‘False’ are printed
 d) Compilation error

Answer is (c) Both ‘True’ and ‘False’ are printed


Q.5: In the following example, tell which statement is correct. Options are:

In the following example, tell which statement is correct

 a) Condition1 will be evaluated first, and condition2 will be evaluated second
 b) Condition2 will be evaluated first, and condition1 will be evaluated second
 c) Condition1 will be evaluated first, condition2 will be evaluated only if the condition1 is TRUE
 d) Condition2 will be evaluated first, and condition1 will be evaluated only if condition2 is TRUE

Answer is (c) Condition1 will be evaluated first, condition2 will be evaluated only if the condition1 is TRUE



Q.6: Which one of the following is the correct syntax for Ternary Operator in C language? Options are:

 a) condition ? expression1 : expression2
 b) condition : expression1 ? expression2
 c) condition ? expression1 < expression2
 d) condition < expression1 ? expression2

Answer is (b) condition : expression1 ? expression2



Q.7: The purpose of the following  program fragment is to: Options are:

the purpose of the following  program fragment is to

 a) Transfer the content of s to b
 b) Transfer the content of b to s
 c) Exchange (swap) the content of s and b
 d) Negate the contents of s and b

Answer is (c) Exchange (swap) the content of s and b



Q.8: What will be the output. Options are:

What will be the output. Options are

 a) 11
 b) 33
 c) 31
 d) 13

Answer is (c) 31



Q.9: What will be the output ?(&& is logical AND operation). Options are:

what will be the output ?(&& is logical AND operation)


 a)   0
      1 2

 b)   1
      1 1

 c)    0
       0 0

 d)    0
       1 1

Answer is (d) 0
                      1 1



Q.10: What will be the value a,b and c after the execution of the following : Options are:

what will be the value a,b and c after the execution of the following

 a) a=5, b=6, c=2;
 b) a=6, b=7, c=1;
 c) a=6, b=6, c=2;
 d) a=5, b=7, c=1;


Answer is (c) a=6, b=6, c=2;


If you are facing any queries regarding this assignment solutions, then please drop comment in comment section.



Post a Comment

0 Comments