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.

NPTEL Problem Solving Through Programming In C Week 6 Assignment Answers 2023

NPTEL Problem Solving Through Programming In C Week 6 Assignment Answers 2023

NPTEL Problem Solving Through Programming In C Week 6 Assignment Answers

Q1. Which statement is correct?

Answer: a. An index or subscript in array is a positive integer

1230+ students getting help from instant notifications, Join us on telegram.

Q2. Which of the following is the correct way to declare a one-dimensional integer array named “myArray” with 5 elements in C?

Answer: b. int myArray[5];

Q3. The elements of array are stored in contiguous memory due to

Answer: a. This way computers can keep track of only the address of the first element and the addresses of other elements can be calculated.

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

int myArray[] = {1, 2, 3, 4, 5}; 
printf("%d", myArray[5]);

Answer: a. 0

Q5. What is the output of the code snippet?

int myArray[5] = {10, 20, 30, 40, 50};
int sum = 0; 
for (int i=0; i<5; i++) { 
sum += myArray[i]; 
printf("The sum of the array is %d", sum);

Answer: 150

Q6. What is the maximum dimension of an array allowed in C?

Answer: d. No such limit exists

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

int main()
int i; 
int arr[3] = {1}: 
for (i=0; i< 3; i++) 
printf("%d", arr[i]); 
return 0;

Answer: c. 1 0 0

Q8. A one-dimensional array X has indices 1….50. Each element is an int. The array is stored at location 1000 decimal. The starting address of X[27] is _ (assume int takes 4 bytes).

Answer: 1104

Q9. Which of the following statements finds the minimum value in an integer array named “myArray” in C?

Answer: c.

int minVal = INT_MAX; 
for (int i=0; i<5; i++) {
if (myArray[i] <minVal) {  
minVal = myArray[i]; 

Q10. What will be the output?

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

Answer: a. i=5, j=5, k=2

NPTEL Problem Solving Through C Week 6 Programming Answers


largest = arr[0];

for(i = 1; i < n; ++i)
    if(largest < arr[i])
                     largest = arr[i];

printf("Largest element = %d", largest);

    return 0;


int w, temp;  
w = i - 1;   
i = 0;      

   while (i < w) 
      temp = arr[i];
      arr[i] = arr[w];
      arr[w] = temp;


int s;
  for (i=0;i < n1;++i)

  size =  n1 + n2;
  for(i=0, s=n1; s< size &&i < n2; ++i, ++s)
  array_new[s] = arr2[i];    


 while (pos < num)
    array[pos - 1] = array[pos];


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 4

Related Posts