[Week 10] NPTEL Problem Solving Through Programming In C Assignment Answers 2023

[Week 1] NPTEL Problem Solving Through Programming In C Assignment Answers 2023
Join Our WhatsApp Group Join Now
Join Us On Telegram Join Now

NPTEL Problem Solving Through Programming In C Assignment Solutions

Nptel Problem Solving Through Programming In C

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

1. Bisection method is used to find
a Derivative of a function at a given point
b) Numerical integration of a function within a range
c) The root of a function
d) None of the above

Answer :- c

2. In _______the search starts at the beginning of the list and checks every element in the list
a) Linear search
b) Binary search
c) Hash search
d Binary tree search

Answer :- a

3. What is the worst-case time complexity of Linear Search?
a) O(1)
b) O(logn
c) O(n)
d) 0(m?)

[ihc-hide-content ihc_mb_type=”show” ihc_mb_who=”1,2,3″ ihc_mb_template=”1″ ]

Answer :- c

4. What is the worst-case complexity of bubble sort?
a) O(N log N)
b) O(log N)
c) O(N)
d) 0(3)

Answer :- d

5. What maximum number of comparisons can occur when a bubble sort is implemented?
Assume there are n elements in the array.
a) (1/2) (n-1)
b) (1/2) n(n-1)
c) (1/4) n(n-1)
d) None of the above

Answer :- b

6.

W10Q06
Answer :- b

7. What is the main disadvantage of the Bisection Method?
a) It is computationally expensive
b) It cannot find complex roots
c) It requires the function to be differentiable
d) It is not guaranteed to converge

Answer :- a

8.

W10Q08
Answer :- 30

9. What is the solution of the equation given below using the Bisection Method up to four decimal places? (Consider the root lying on positive quadrant only and compute the root till five iterations only)
f(x) = xe2x – 3x2 – 5

Answer :- 1.0312

10.

W10Q10
Answer :- d

[/ihc-hide-content]

Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. What is the worst case complexity of selection sort?
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)

Answer :- d

2. What is the best case and worst case complexity of ordered linear search?
a) O(nlogn), O(logn)
b) O(logn), O(nlogn)
c) O(n), O(1)
d) O(1), O(n)

Answer :- d

3. Given an array arr = {12, 34, 47, 62, 85, 92, 95, 99,105} and key = 34; what are the mid values (corresponding array elements) generated in the first and second iterations?
a) 85 and 12
b) 85 and 34
c) 62 and 34
d) 62 and 47

Answer :- b

4. When the Binary search is best applied to an array?
a) For very large size array
b) When the array is sorted
c) When the array elements are mixed data type
d) When the array is unsorted

Answer :- b

5. Consider the array A[ ]= {5,4,9,1,3} apply the insertion sort to sort the array. Consider the cost associated with each sort is 25 rupees, what is the total cost of the insertion sort for sorting the entire array?
a) 25
b) 50
c) 75
d) 100

Answer :- c

6. Select the code snippet which performs unordered linear search iteratively?

W09Q6a
W09Q6b
W09Q6c
W09Q6d
Answer :- a

7.

W09Q7
Answer :- d

8. Consider an array of elements arr[5]= {5,4,3,2,1}, what are the steps of insertions done while doing insertion sort in the array.

W09Q8a
W09Q8b
W09Q8c
W09Q8d
Answer :- a

9.

W09Q9

a) 0
b) 1
c) 01
d) None of the above

Answer :- b

10.

W09Q10

a) 10 10
b) 10 50
c) 50 50
d) Compilation error

Answer :- d
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. A function prototype is used for
a) Declaring the function logic
b) Calling the function from the main body
c) Telling the compiler, the kind of arguments used in the function
d) Telling the user for proper use of syntax while calling the function

Answer :- c

2. What is the default return type if it is not specified in function definition?
a) void
b) integer
c) double
d) float

Answer :- b

3.

W08Q03

a) 70
b) Garbage value
c) Compilation error
d) None

Answer :- c

4.

W08Q04

a) Infinite times
b) 32767
c) 65535
d) Till stack overflows

Answer :- d

5.

W08Q05

a) Only once
b) Zero times
c) Infinite times
d) Compilation error

Answer :- b

6.

W08Q06B
Answer :- 6

7.

W08Q07

a) 8 ,4, 0, 2, 14
b) 8, 4, 0, 2, 0
c) 2, 0, 4, 8, 14
d) 2, 0, 4, 8, 0

Answer :- d

8.

W08Q08

a) 55
b) 45
c) 66
d) 10

Answer :- a

9.

W08Q09

a) Maximum of a, b
b) Positive difference between a and b
c) Sum of a and b
d) Minimum of a and b

Answer :- d

10.

W08Q10
Answer :- 27.08
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. Which of the following statements are correct?
1) A string is a collection of characters terminated by ‘\0’.
2) The format specifier %s is used to print a string.
3) The length of the string can be obtained by strlen().
4) strcon() function is used to join two strings.

Answer :- b

2. The right method of initializing a 2D array is
a) int abc[2][2] = {1, 2, 3 ,4 }
b) int abc[ ][ ] = {1, 2, 3 ,4 }
c) int abc[2][ ] = {1, 2, 3 ,4 }
d) all of the above

Answer :- a

3. Array passed as an argument to a function is interpreted as
a) Address of all the elements in an array
b) Value of the first element of the array
c) Address of the first element of the array
d) Number of element of the array

Answer :- c

4.

W07Q04
Answer :- 10

5.

W07Q05

a) fellows
b) h
c) fello
d) Compiler error

Answer :- a

6.

W07Q06

a) n1=18, n2=17
b) n1=18, n2=18
c) n1=17, n1=17
d) n1=17, n2=18

Answer :- a

7.

W07Q07

a) gnirts
b) gnirt
c) string
d) no output is printed

Answer :- d

8. If the starting address of an float array Arr[10][10] is 2000, what would be the memory address of the element Arr[5][6]? (float takes 4 bytes of memory)
a) 2268
b) 2120
c) 2224
d) 2144

Answer :- c

9. In C, the placement of elements of a two dimensional array is
a) Row wise
b) Column wise
c) Diagonal wise
d) Bottom to top wise

Answer :- a

10.

W07Q10
Answer :- 0

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

Week 6 : Programming Assignment 1

Q1. Write a C Program to Count Number of Uppercase and Lowercase Letters in a given string. The given string may be a word or a sentence.

Answer :- #include<stdio.h>
int main() {
   int upper = 0, lower = 0;
   char ch[100];
   scanf(" %[^\n]s", ch);  /*A word or a sentence is accepted from test case data */

/* Complete the remaining part of the code to store number of uppercase letters
in the variable upper and lowercase letters in variable lower.
The print part of already written. You can declare any variable if necessary */
int i = 0;
   while (ch[i] != '\0') {
      if (ch[i] >= 'A' && ch[i] <= 'Z')
         upper++;
      if (ch[i] >= 'a' && ch[i] <= 'z')
         lower++;
      i++;
   }
printf("Uppercase Letters : %d\n", upper); /*prints number of uppercase letters */
   printf("Lowercase Letters : %d", lower); /*prints number of lowercase letters */
 
   return (0);
}

Week 6 : Programming Assignment 2

image 35
Answer :- 

Week 6 : Programming Assignment 3

image 36
Answer :- 
#include <stdio.h>
int main()
{
    int matrix_A[20][20], matrix_B[20][20], matrix_C[20][20];
    int i,j,row,col;
    scanf("%d",&row); //Accepts number of rows
    scanf("%d",&col); //Accepts number of columns 
 
    /* Elements of first matrix are accepted from test data */
    for(i=0; i<row; i++)
    {
        for(j=0; j<col; j++)
        {
            scanf("%d", &matrix_A[i][j]);
        }
    }

     /* Elements of second matrix are accepted from test data */
    
    for(i=0; i<row; i++)
    {
        for(j=0; j<col; j++)
        {
            scanf("%d", &matrix_B[i][j]);
        }
    }

/* Complete the program to get the desired output. Use printf() statement as below
    printf("%d ", matrix_C[i][j]); You can declare your own variables if required. 
*/
/* 
    Subtract both matrices and store the result in matrix C
  */
   for(i=0; i<row; i++)
    {
        for(j=0; j<col; j++)
        {
    
            matrix_C[i][j] = matrix_A[i][j] - matrix_B[i][j];
        }
    }

     for(i=0; i<row; i++)
    {
        for(j=0; j<col; j++)
        {
            printf("%d ", matrix_C[i][j]);
        }
        printf("\n");
    }

    return 0;
}

Week 6 : Programming Assignment 4

4. Write a C program to print Largest and Smallest Word from a given sentence. If there are two or more words of same length, then the first one is considered. A single letter in the sentence is also consider as a word.

Answer :- 
#include<stdio.h>
#include<string.h>
int main()
{
    char str[100]={0},substr[100][100]={0}; 
//str[100] is for storing the sentence and substr[50][50] is for storing each word.
    
scanf("%[^\n]s", str); //Accepts the sentence from the test case data.

/* Complete the program to get the desired output.
The print statement should be as below
 
printf("Largest Word is: %s\nSmallest word is: %s\n", -------,--------);

*/
int i=0,j=0,k=0,a,minIndex=0,maxIndex=0,max=0,min=0;
char c; 
while(str[k]!='\0')  //for splitting sentence into words 
    {
        j=0;
        while(str[k]!=' '&&str[k]!='\0' && str[k]!='.')
        {
            substr[i][j]=str[k];
            k++;
            j++;
        }
        substr[i][j]='\0';
        i++;
        if(str[k]!='\0')
        {
            k++;
        }        
    }
    int len=i;
    max=strlen(substr[0]);
    min=strlen(substr[0]);

    //After splitting getting length of string and finding its index having max length and index having min length
    for(i=0;i<len;i++)
    {
       a=strlen(substr[i]);
       if(a>max)
        {
            max=a;
            maxIndex=i;
        }
        if(a<min)
        {
            min=a;
            minIndex=i;
        }
    }    
  printf("Largest Word is: %s\nSmallest word is: %s\n",substr[maxIndex],substr[minIndex]);
  return 0;  
}
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. What is an array in C?
a) A collection of similar data elements with the same data type.
b) A built-in function that performs mathematical calculations.
c) A keyword used for declaring variables.
d) A data type used to store characters only.

Answer :- A

2. What is the index of the first element in an array?
a) 0
b) 1
c) -1
d) The index can vary depending on the array size.

Answer :- A

3. Which loop is commonly used to iterate through all elements of an array in C?
a) for loop
b) while loop
c) do-while loop
d) switch loop

Answer :- A

4. An integer array of 15 elements is declared in a C program. The memory location of the first byte of the array is 2000. What will be the location of the 13th element of the array? Assume int takes 2 bytes of memory.
a) 2013
b) 2024
c) 2026
d) 2030

Answer :- B

5.

W06Q05

Option (a)
Option (b)
Option (c)
Option (d)

Answer :- D

6.

W06Q06

a) 1 3 5
b) 1 2 3 4 5
c) 1 2 3
d) 1 4

Answer :- A

7. What is be the output?

W06Q07

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

Answer :- A

8.

W06Q08

a) 1
b) 2
c) 3
d) 4

Answer :- D

9.

W06Q09
Answer :- 8

10.

W06Q10

a) 5, 4
b) 5, 5
c) 4, 4
d) 3, 4

Answer :- C

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

Week 6 : Programming Assignment 1

Write a C Program to find Largest Element of an Integer Array.
Here the number of elements in the array ‘n’ and the elements of the array is read from the test data.
Use the printf statement given below to print the largest element.

printf(“Largest element = %d”, largest);

Answer :- 

Week 6 : Programming Assignment 2

Write a C Program to print the array elements in reverse order (Not reverse sorted order. Just the last element will become first element, second last element will become second element and so on)
Here the size of the array, ‘n’ and the array elements is accepted from the test case data. The last part i.e. printing the array is also written.
You have to complete the program so that it prints in the reverse order.

Answer :- 

Week 6 : Programming Assignment 3

Write a C program to read Two One Dimensional Arrays of same data type (integer type) and merge them into another One Dimensional Array of same type.

Answer :- 

Week 6 : Programming Assignment 4

Write a C Program to delete duplicate elements from an array of integers.

Answer :- 
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. The statement that transfers control to the beginning of the loop is called
a) break
b) continue
c) goto
d) None of the above

Answer :- B

2. In C three way transfer of control is possible using
a) Unary operator
b) Logical operator
c) Ternary operator
d) None

Answer :- C

3.

W05Q03

a) ‘while vs do-while’ once
b) ‘Out of loop’ infinite times
c) Both ‘while vs do-while’ and ‘Out of loop’ once
d) ‘while vs do-while’ infinite times

Answer :- D

4.

W05Q04A

a) 5
b) 10
c) No output
d) Compilation error

Answer :- C

5.

W05Q05

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

Answer :- C

6.

W05Q06

a) After loop x=1
b) 1
After loop x=2
c) 1 2 3 4 5 6 7 8 9 10
d) No output

Answer :- D

7.

W05Q07

a) Error
b) I love C – will be printed 3 times
c) I love C – will be printed 6 times
d) I love C – will be printed 5 times

Answer :- B

8.

W05Q08

a) 1
b) 2
c) 3
d) Error

Answer :- B

9.

W05Q09

a) n!=0
b) n==0
c) n%10==0
d) n/10==0

Answer :- A

10.

W05Q10

a) 8,10
b) 8,9
c) 6, 9
d) 7, 10

Answer :- C

NPTEL Problem Solving Through Programming In C Week 5 Programming Assignment 2023

Week 5 : Programming Assignment 1

Q1. Write a C program to check whether a given number (N) is a perfect number or not.
[Perfect Number – A perfect number is a positive integer number which is equals to the sum of its proper positive divisors. For example 6 is a perfect number because its proper divisors are 1, 2, 3 and it’s sum is equals to 6.]

Answer :- 
#include <stdio.h>
int main()
{
    int N;
    scanf("%d",&N);
    int sum=0;
	for(int i = 1; i <= N / 2; i++)
    {
        if(N % i == 0)
        {
            sum += i;
        }
    }

    if(sum == N){
        printf("%d is a perfect number.", N);
    }
	else{
        printf("%d is not a perfect number.", N);
    }
    return 0;
}

Week 5 : Programming Assignment 2

Q2. Write a C program to count total number of digits of an Integer number (N).

Answer :- 
#include <stdio.h>
int main()
{
    int N;
    scanf("%d",&N);
    int temp, count;
    count=0;
    temp=N;
    while(temp>0)
    {
     	count++;
     	temp/=10;
    }
    printf("The number %d contains %d digits.",N,count);
}

Week 5 : Programming Assignment 3

Q3. Write a C program to check whether the given number(N) can be expressed as Power of Two (2) or not.
For example 8 can be expressed as 2^3.

Answer :- 
#include <stdio.h>
int main()
{
    int N;
    scanf("%d",&N);
    int temp, flag;
    temp=N;
    flag=0;

    while(temp!=1)
    {
        if(temp%2!=0){
            flag=1;
            break;
        }
        temp=temp/2;
    }

    if(flag==0)
        printf("%d is a number that can be expressed as power of 2.",N);
    else
        printf("%d cannot be expressed as power of 2.",N);
}

Week 5 : Programming Assignment 4

Q4. Write a C program to find sum of following series where the value of N is taken as input

1+ 1/2 + 1/3 + 1/4 + 1/5 + .. 1/N

Answer :- 
#include<stdio.h>
int main()
{
    int N;
    float sum = 0.0;
    scanf("%d",&N);
    int i;
    for(i=1;i<=N;i++)
    {
      	sum = sum + ((float)1/(float)i);
    }
    printf("Sum of the series is: %.2f",sum);
}
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. Which of the following statement is correct?

a) Operator precedence determines which operator is performed first in an expression with more than one operator with different precedence. Associativity is used when two operators of same precedence appear in an expression
b) Operator associativity determines which operator is performed first in an expression with more than one operator with different associativity. Precedence is used when two operators of same precedence appear in an expression
c) Operator precedence and associativity are same.
d) None of the above

Answer :- a

2. Find the output of the following C code?

#include <stdio.h>

int main() {
    int a = 50, b = 20, c = 6, d = 3, result;
    result = a + a * -b / c % d + c * d;
    printf("%d", result);
    return 0;
}

a) 67
b) -36
c) 66
d) -37

Answer :- a

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

#include <stdio.h>

int main() {
    int h = 8;
    int b = 4 * 6 + 3 * 4 < h * 5 ? 24 : 3;
    printf("%d\n", b);
    return 0;
}

a) 0
b) 3
c) 4
d) Compilation error

Answer :- c

4. Find the output of the following C code?

#include <stdio.h>

int main() {
    int x = 1;
    if ((3 * 25) > (2 * 53))
        printf("IITKGP\n");
    else if (x &= 0)
        printf("IITD\n");
    else
        printf("IITM\n");
    return 0;
}

a) IITKGP
b) IITD and IITM
c) IITKGP and IITM
d) IITM

Answer :- a

5. What will be the output?

W03Q05

a) Condition is true
b) Condition is false
c) Error
d) No output possible

Answer :- a

6. What is the output of the following program?

W03Q06

a) Programming on C 0
b) NPTEL 0
c) NPTEL 3
d) Compilation error

Answer :- b

7. What is the output of the C program given below

W03Q07

a) true
b) false
c) Compiler dependent
d) Compiler error

Answer :- b

8. What will be the output?

W03Q08

a) 0
b) 1
c) 10
d) 30

Answer :- b

9. What will be the output

W03Q09

a) TRUE
b) FALSE
c) Syntax Error
d) Compilation Error

Answer :- b

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

W03Q10

a) 10
b) 11
c) 20
d) Compiler error

Answer :- b
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. Which of the following is not a C variable?

a) Count123
b) Count_123
c) Count@123
d) X_123_Count

Answer :-c) Count@123

In C programming, variable names can consist of letters (both uppercase and lowercase), digits, and underscores, but they cannot include special characters like '@' or other symbols. Therefore, "Count@123" is not a valid C variable name.

The other options, "Count123," "Count_123," and "X_123_Count," are valid C variable names and can be used in C programming to represent variables.

2. A function

a) is a block of statements to perform some specific task
b) is a fundamental modular unit to perform some task
c) has a name and can be used multiple times
d) All the above options are true

Answer :- d) All the above options are true.

All of these options are true when describing functions in programming. A function is a reusable block of code that performs a specific task or operation. It is designed to be modular, which means it can be called multiple times from different parts of the program, promoting code reusability and organization. The function is identified by its name, and when the function is called by its name, the block of code within the function is executed.

3. The execution of any C program is

a) Sequential
b) Parallel
c) Multi-threading
d) None of these

Answer :- a) Sequential

The execution of any C program is typically sequential, which means the instructions in the program are executed one after the other, in the order they appear in the source code. Each instruction is executed in a step-by-step manner, and the program follows a specific flow from the start of the main function to its end, unless certain control flow statements like loops or conditional statements cause branching in the execution flow.

4. Syntax error occurs when

a) The rules of grammar of the programming language is violated
b) The statements in the program have no meaning
c) The program gives wrong or undesired output
d) Some illegal operation (e.g. divide by zero) is performed

Answer :- a) The rules of grammar of the programming language are violated

Syntax errors occur when the rules of grammar and syntax of the programming language are violated. These errors prevent the program from being successfully compiled or interpreted because the code does not conform to the language's syntax rules. Examples of syntax errors include missing semicolons at the end of statements, mismatched parentheses or brackets, using incorrect keywords, and improper indentation.

5. If integer needs two bytes of storage, then the minimum value of a signed integer in C would be

a) -65535
b) 0
c) -32,767
d) -32,768

Answer :- d) -32,768

If an integer needs two bytes of storage, it means it can store values within a range of 2^15 (because each byte has 8 bits, so 2 bytes have 16 bits, but one bit is reserved for the sign, leaving 15 bits for the magnitude of the integer).

6. What will be the output of the program given below?

W02Q06

a) 9
b) 0
c) 1001
d) Compilation Error

Answer :- d) Compilation Error

7. What is the Output?

W02Q07

a) 8.00
b) 4.00
c) 0.00
d) 16.00

Answer :- d) 16.00

8.

W02Q08

a) a=a-b; b=a-b; a=a+b;
b) a=a%b; b=a+b; a=a/b;
c) a=a+b; b=a-b; a=a-b;
d) None of the above

Answer :- c) a = a + b; b = a - b; a = a - b;

9. What will be the output?

W02Q09

a) 1 3
b) 3 1
c) 1 1
d) 3 3

Answer :- b) 3 1

10. When executed the following code will print_______.

W02Q10
Answer :- 18
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

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

1. What type of device is computer webcam?

a) Memory
b) Output
c) Storage
d) Input

Answer :- d) Input

A computer webcam is an input device. It captures video and sometimes audio, allowing users to input live images and video into their computers. It is commonly used for video conferencing, online meetings, video chatting, live streaming, and other applications where real-time video input is required.

2. Set of instructions to be provided to an electronic machine to perform a task is called

a) Programming
b) Processing
c) Computing
d) Compiling

Answer :- a) Programming

Programming involves providing a set of instructions to an electronic machine or computer to perform a specific task. These instructions are written in a programming language and are used to control the behavior of the machine, enabling it to execute the desired operations and achieve the intended results. The process of converting the human-readable programming code into machine-executable instructions is known as compiling (option d), but the overall act of providing instructions to perform a task is referred to as programming. Options b and c are related concepts but not the precise term used for this purpose.

3. Which of the following language does the computer understand?

a) Computer understands only C Language
b) Computer understands only Assembly Language
c) Computer understands only Binary Language
d) Computer understands only BASIC

Answer :- c) Computer understands only Binary Language

Computers at their core understand and process instructions in binary language, which consists of 0s and 1s. This binary language represents the fundamental building blocks of all data and instructions that computers can interpret and execute. All high-level programming languages, like C, Assembly, BASIC, Python, Java, etc., need to be translated into binary instructions through compilation or interpretation before the computer can execute them. However, it is binary language that the computer's hardware can directly understand and act upon.

4. Which of the following is known as the language made up of binary-coded instructions?

a) High level
b) BASIC
c) C
d) Machine

Answer :- d. Machine

The language made up of binary-coded instructions is known as "Machine Language." Machine language is the lowest-level programming language that is directly understood and executed by a computer's hardware. It consists of binary-coded instructions represented in the form of 0s and 1s, which the computer's central processing unit (CPU) can directly interpret and execute.

5. Algorithm is-

a) A process or set of rules to be followed in calculations or other problem-solving operations, especially by a human.
b) A process or set of rules to be followed to solve numerical problems only.
c) A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
d) A process or set of rules to be followed in to solve logical problems only.

Answer :- c) A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.

An algorithm is a step-by-step procedure or a set of rules to be followed for solving a specific problem or performing a task. It can be used by both humans and computers to arrive at a solution. However, in the context of the given options, option c is the most accurate definition because it explicitly mentions that algorithms can be used by computers in problem-solving operations. Algorithms are essential in computer programming as they define the logic and steps required to achieve a particular goal or outcome.

6. A 2D diagram to represent the steps to be followed to solve a problem is known as

a) Flow-chart
b) Pseudo-code
c) Both (a) and (b)
d) None of these

Answer :- a) Flow-chart

A 2D diagram that represents the steps to be followed to solve a problem is known as a flowchart. It is a graphical representation of an algorithm or a process, using various shapes and arrows to depict the sequence of steps and decisions involved in the problem-solving process. Flowcharts are commonly used in programming, software development, and other fields to illustrate the logical flow of operations and to make complex processes more understandable. Pseudo-code (option b) is a high-level, human-readable representation of an algorithm using a combination of natural language and simple code-like statements but not a 2D diagram. So, the correct answer is option 

7. Which one of the following statement is the most appropriate?

a) Pseudo code is basically a diagrammatic representation of the algorithm. Whereas in flowchart normal English language is translated into the programming languages to be worked on.
b) Flowchart is diagrammatic representation of the algorithm. Pseudo code is just another name of algorithm.
c) Pseudo code is another name of programming. Whereas in flowchart is diagrammatic representation of algorithm.
d) Flowchart is basically a diagrammatic representation of the algorithm. Whereas in pseudo code normal English language is translated into the programming languages to be worked on.

Answer :- a) Pseudo code is basically a diagrammatic representation of the algorithm. Whereas in flowchart normal English language is translated into the programming languages to be worked on.

This statement accurately describes the differences between pseudo code and flowcharts. Pseudo code is a method of representing an algorithm using a combination of natural language and simple code-like statements, making it more readable and understandable for humans. On the other hand, flowcharts are graphical representations of algorithms that use shapes and arrows to depict the sequence of steps and decisions. In flowcharts, normal English language is not directly translated into programming languages; instead, the graphical symbols represent different programmatic constructs.

8. The input N from the user is 6. The output of the following algorithm is
W01Q08
a) 21
b) 720
c) 1
d) 1024

Answer :- c) 1

9. What will be the output of the algorithm given below?
W01Q09
a) 51
b) 52
c) 50
d) Compilation error

Answer :- d) Compilation error

10. The section of the CPU that selects, interprets and sees to the execution of program instructions

a) Memory
b) Register Unit
c) Control Unit
d) ALU

Answer :- c) Control Unit
Course NameProblem Solving Through Programming In C
CategoryNPTEL Assignment Answer
Home Click Here
Join Us on TelegramClick Here

2 thoughts on “[Week 10] NPTEL Problem Solving Through Programming In C Assignment Answers 2023”

  1. Pingback: NPTEL Problem Solving Through Programming In C Week 6 Assignment Answers 2023 » UNIQUE JANKARI

  2. Pingback: NPTEL Problem Solving Through Programming In C Week 6 Assignment Answers 2023 - DBC Itanagar

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top