Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Sorry, you do not have permission to ask a question, You must login to ask a question.

SIKSHAPATH Latest Articles

Problem Solving Through Programming In C NPTEL Assignment Answers Week 4 2022

A

Students, are you looking for help in problem solving through programming in C NPTEL week 4 assignment answers? So, here in this article, we have provided problem solving through programming in C week 4 assignment answer’s hint.

Problem Solving Through Programming In C NPTEL Assignment Answers Week 4

Q1. The loop which is executed at least once is

a. “while” loop

b. “do-while” loop
c. “for” loop

d. None of the above

Answer: b. “do-while” loop

For instant notification of any updates, Join us on telegram.


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

a. TRUE

b. FALSE

c. Depends on the implementation

d. None of these

Answer: a. TRUE


Q3. Choose the correct statement to use “if-else” statement in C Language

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: c. “else” or “else if” is optional with the “if” statement


Q4. What is the output of the following C code?

#include <stdio.h>
int main(){
int a = 1;
 if(a--)
 printf("True\n");
 if(++a)
 printf("False\n");
 return 0; 
}

a. True

b. False

c. Both ‘True’ and ‘False’ are printed

d. Compilation error

Answer: c. Both ‘True’ and ‘False’ are printed


Q5. In the following example, tell which statement is correct

if((condition1==1) && (condition2==1))
 printf("Swayam");

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: c. Condition1 will be evaluated first, condition2 will be evaluated only if the condition1 is TRUE


Q6. Which one of the following is the correct syntax for Ternary Operator in C language?

a. condition ? expression1 : expression2

b. condition : expression1 ? expression2

c. condition ? expression1 < expression2

d. condition < expression1 ? expression2

Answer: a. condition ? expression1 : expression2


Q7. The purpose of the following program fragment is to

b=s+b;

s=b-s;

b=b-s;

(where s and b are two integers)

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: c. Exchange (swap) the content of s and b


Q8. What will be the output?

#include <stdio.h> 
int main(){
int x=0;
 x = printf("3");
 printf("%d",x);
 return 0;
}

a. 11

b. 33

c. 31

d. 13

Answer: c. 31


Q9. What will be the output? (&& is logical AND operation)

#include <stdio.h> 
int main() {
 int i=0,j=1;
 printf("\n %d", i++ && ++j);
 printf("\n %d %d", i,j);
 return 0;
}

a. 0

1 2

b. 1

1 1

c. 0

0 0

d. 0

1 1

Answer: Option D


Q10. What will be the value of a, b, and c after the execution of the following

int a = 5, b = 7, c = 111; 
c/= ++a*b--;

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: c. a=6, b=6, c=2;


TELEGRAM FOR NOTIFICATIONClick Here
Follow on Google News (in one click)Click Here

Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.


Also Available:

Problem Solving Through Programming In C NPTEL Assignment Answers Week 3

Problem Solving Through Programming In C NPTEL Assignment Answers Week 5

Related Posts

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock