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.

You must login to ask a question.

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

A

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

Problem Solving Through Programming In C NPTEL Assignment Answers Week 7

Q1. Which of the following statement/s are false?

I. Array elements are stored in memory in contiguous locations.

II. An integer array always terminates with ‘\0’ (NULL).

a. I

b. II


c. Both I and II

d. None

Answer: b. II

1000+ Students are taking advantage of instant notification, Join us on telegram.


Q2. If two strings are identical, then strcmp() function returns

a. 1

b. 0

c. -1

d. None of these

Answer: b. 0


Q3. Which of the following function is more appropriate for reading in a multi word string?

a. scanf()

b. gets()

c. printf()

d. puts()

Answer: b. gets()


Q4. What will be printed after execution of the following code?

#include<stdio.h> 
int main(){
 int a[20]= {10, 20, 30, 40,50,60};
 printf("%d", 3[a]);
 return 0;
}

Answer: 40


Q5. What will be the output of the program?

#include<stdio.h> 
int main()
{
char str[] = "Array\0String";
 printf("%s", str);
 return 0;
}

a. Array

b. Array String

c. Array\0String

d. Compilation error

Answer: a. Array


Q6. What will be the output?

#include<stdio.h> 
#include<string.h> 
int main()
{
char str1[20]= "Programming", str2[20]= "Language";
 printf("%s", strcpy(str2, strcat(str1, str2)));
 return 0;
}

a. Programming

b. Language

c. ProgrammingLanguage

d. LanguageProgramming

Answer: c. ProgrammingLanguage


Q7. What will be the output?

#include <stdio.h> 
int main()
{ 
char str1[] = "I-LOVE-C";
char str2[] = {'T','-', 'L', 'O', 'V', 'E', '-', 'C'};
int n1 = sizeof(str1)/sizeof(str1[0]);
int n2 = sizeof(str2)/sizeof(str2[0]); 
printf("nl=%d, n2=%d", nl, n2); 
return 0;
}

a. n1= 8, n2=8

b. n1=9, n2=9

c. n1=8, n2=9

d. n1=9, n2=8

Answer: d. n1=9, n2=8


Q8. What will be the output?

#include <stdio.h> 
int main()
{
int i, m=1, num[6] = {1,2,3,4,5,6};
for(i=0; i<=5; i++) 
m=m*num[i]; 
printf("%d", m); 
return 0;
}

Answer: 720


Q9. What will be the output?

#include<stdio.h> 
#include<string.h> 
int main()
{
char p[] = "assignment"; 
char t;
int i, j; 
for(i=0, j=strlen(p); i<j; i++)
{
t = p[i]; 
p[i] = p[j-i]; 
P[j-i]=t;
}
printf("%s", p);
return 0;
}

a. assignment

b. tnemngissa

c. nothing will be printed

d. tttttttttt

Answer: c. nothing will be printed


Q10. What will be the output?

#include<stdio.h> 
#include<string.h> 
int main(){
char p[]="welcome", q[]="welcome";
if(p==q)
{ 
printf("Two strings are equal");
}
return 0;
}

a. Two strings are equal

b. Two strings are not equal

c. Would not print anything

d. Compilation error

Answer: c. Would not print anything


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 6

Related Posts