# NPTEL Problem Solving Through Programming In C Assignment 6 Answers

NPTEL Problem Solving Through Programming In C Assignment 6 Answers 2022:- In this post, We have provided answers to NPTEL Problem Solving Through Programming In C Assignment 6 week 6. We provided answers here only for reference. we urge you to do your assignment with your own knowledge.

## About Problem Solving Through Programming In C

This course is aimed at enabling the students to Formulate simple algorithms for arithmetic and logical problems, Translate the algorithms to programs (in C language), Test and execute the programs and  correct syntax and logical errors, and Implement conditional branching, iteration and recursion, Decompose a problem into functions and synthesize a complete program using the divide and conquer approach.

CRITERIA TO GET A CERTIFICATE

This course will have an unproctored programming exam also apart from the Proctored exam, please check the announcement section for the date and time. The programming exam will have a weightage of 25% towards the Final score.

Final score = Assignment score + Unproctored programming exam score + Proctored Exam score

Assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.

( All assignments in a particular week will be counted towards final scoring – quizzes and programming assignments).

Unproctored programming exam score = 25% of the average scores obtained as part of Unproctored programming exam – out of 100

Proctored Exam score =50% of the proctored certification exam score out of 100

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE ASSIGNMENT SCORE >=10/25 AND UNPROCTORED PROGRAMMING EXAM SCORE >=10/25 AND PROCTORED EXAM SCORE >= 20/50. If any one of the 3 criteria is not met, you will not be eligible for the certificate even if the Final score >= 40/100.

## NPTEL Problem Solving Through Programming In C Assignment 6 Answers 2022

1. What is the right way to initialise an array in C?

a) int ar{}= {1,2, 5,6,93
b) int ar[5]= {1,2, 5,6,9}
c) int ar (5} = {1,2, 5,6,93
d) int ar)={1,2, 5,6.9

`Answer:- b`

2. An integer array of dimension 10 is declared in a C program. The memory location of the first byte of the array is 1000. What will be the location of the 9th element of the array? (Assume integer takes 4 bytes of memory and the element stored at 1000 is identified as 1st element)

a) 1028
b) 1032
c) 1024
d) 1036

`Answer:- b`

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW

3. What will be the output after execution of the program?

`Answer:- a`

4. Which of the statements is/are correct?

a) An array may contain more than one element
b) All elements of array have to be of same data type
c) The size of array has to be declared upfront
d) All of the above

`Answer:- d`

5. What actually gets passed when you pass an array as an argument to a function

a) Value of elements in array
b) First element of the array
c) Base address of the array
d) Address of the last element of array

`Answer:- c`

6. Find the output of the following C program

`Answer:- c`

👇For Week 07 Assignment Answers👇

7. What will be the output?

`Answer:- c`

8. An array of the void data type

a) can store any data-type
b) only stores element of similar data type to first element
c) acquires the data type with the highest precision in it
d) It is not possible have an array of void data type

`Answer:- For Answer Click Here`

9. What will be the output?

`Answer:- 20`

10. How many ‘a’ will be printed when the following code is executed?

`Answer:- 6`

## NPTEL Problem Solving Through Programming In C Assignment 6 Answers 2021

Q1. What is the right way to initialize an array in C?

(a) int arr{}={1,2, 5,6,9}

(b) int arr[5]={1,2, 5,6,9}

(c) int arr{5}={1,2, 5,6,9}

(d) int arr()={1,2, 5,6,9}

Ans:- (b) int arr[5]={1,2, 5,6,9}

Q2. An integer array of size 10 is declared in a C program. The memory location of the first byte of the array is 1000. What will be the location of the 8th element of the array? (Assume integer takes 4 bytes of memory and the element stored at 1000 is identified as 1st element).

a) 1028

b) 1032

c) 1024

d) 1036

Q3. What will be the output after execution of the program?

``````#include<stdio.h>
int main()
{
int i, a[4] ={3,1,2,4}, result;
result = a[0];
for(i=1; i<4; i++)
{
if(result<a[i])
continue;
result = a[i];
}
printf("%d", result);
return 0;
}``````

(a) 1

(b) 2

(c) 3

(d) 4

Ans:- (a) 1

Q4. Which of the statements is correct?

(a) an array contains more than one element

b) All elements of array has to be of same data type

c) The size of array has to be declared upfront

d) All of the above

Ans:- d) All of the above

NPTEL ALL WEEK ASSIGNMENT ANSWERS:-

Q5. To compare two arrays, we can do it by using

(a) comparison operator ‘==’ directly on arrays

(b) ‘ switch case’

(c) ‘for’ loop

(d) ‘ternary operator’ on arrays

Ans:- (c) ‘for’ loop

Q6. Find the output of the following C Program?

``````#include<stdio.h>
int main()
{
int a;
int arr[5] = {1,2,3,4,5};
arr[1] =++arr[1];
a = arr[1]++;
arr[1] = arr[a++];
printf("%d, %d", a, arr[1]);
return 0;
}``````

(a)      5, 4

(b)      5, 5

(c)      4, 4

(d)      3, 4

Ans:- (c)      4, 4

## ALSO READ : NPTEL – Online Courses,Certificate And full details

Q7. What will be the output?

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

(a) i=5, j=5, k=2

(b) i=6, j=5, k=3

(c) i=6, j=4, k=2

(d) i=5, j=4, k=2

Ans:- (a) i=5, j=5, k=2

Q8. Array elements are stored in memory in the following order

(a)       Contiguous

(b)       Random

(c)       Both contagious and random

(d)       None of the above

Q9. What will be the output?

``````#include<stdio.h>
int main()
{
int n = 2;
int sum = 5;
switch(n)
{
case 2: sum = sum-2;
case 3: sum*=5;
break;
default:
sum = 0;
}
printf("%d", sum);
return 0;
}``````

Ans:- 15

Q10. How many ‘a’ will be printed when following code will be executed?

``````#include <stdio.h>
int main()
{
int i = 0;
char c = 'a';
while (i <5)
{
i++;
switch (c)
{
case 'a':
printf("%c ", c);
break;
}
}
printf("\n");
return 0;
}``````

Ans:- 5

NPTEL ALL WEEK ASSIGNMENT ANSWERS:-

NPTEL Problem solving through Programming In C Assignment 6 Answers:- We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.