Skip to content
Visva-Bharati · Department of Mathematics

MJMA-16

C Programming
B.Sc. Mathematics · Semester VI2026
  1. 1(a) What is CPU? Name and discuss the functions of different units in CPU. [[5]]
  2. 1(b) A Fibonacci sequence is defined as follows: $0,1,1,2,3,5,\cdots$ $(X_{n+1}=X_n+X_{n-1},n\ge1)$. Draw a flowchart to find all the numbers of this sequence which are $\le2026$. [[5]]
  3. 2(a) What do you mean by the efficiency of an algorithm? Design an algorithm to find the value of $\sin(x)$ defined by the infinite series $\sin(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}+\cdots$, correct upto five decimal places. [[1+4]]
  4. 2(b) What is a string constant? How do string constants differ from character constants? Do string constants represent numerical values? [[1+1+1]]
  5. 2(c) Write appropriate declarations and assign the given initial values in C for the following group of variables and array.\\Integer variables: $r_1=234,r_2=-43$\\Double precision variables: $d_1=2.88\times10^5$, $d_2=0.0666666$\\Character variables: $cv$=new line character\\One-dimensional character array: fruit=``MANGO'' [[2]]
  6. 3(a) How can the value of an expression be converted to a different data type? What is it called? [[1+1]]
  7. 3(b) A C program contains the following declarations and initial assignments \begin{verbatim} int i = 8, j = 5; float x = 0.005, y = -0.01; char c = 'c', d = 'd'; \end{verbatim} Determine the value of each of the following expressions by mentioning all the necessary steps involved. \begin{verbatim} (i) (i - 3 * j)% (c + 2 * d)/(x - y) (ii) i-= (j > 0) ? j : 0 (iii) (x > y) && (i > 0) ! ! (j < 5) (iv) fabs(x + y)+floor(x + y) \end{verbatim} [[6]]
  8. 3(c) Find the error/output of the following C program. Give proper justification in support of your answer. \begin{verbatim} # include < stdio.h > main() { int x, y, z; x = -5 % -2; y = 5 % -2; z = -5 % 2; printf("% d % d % d", x, y, z); } \end{verbatim} [[2]]
  9. 4(a) Write down the syntax of the do while loop. How does it differ from while loop? [[1+1]]
  10. 4(b) Find the output (mentioning all the necessary steps involved) of the following C program. \begin{verbatim} # include < stdio.h > main(){ int i, j, k, x = 0; for(i = 0; i < 5; + + i){ for(j = 0; j < i; + + j){ k = i + j - 1; if(i % 2 == 0) x + = k; else if(k % 3 == 0) x + = k - 2; printf("% d", x); }} printf("\n x =% d", x); } \end{verbatim} [[5]]
  11. 4(c) State (with suitable examples) differences between break statement and continue statement. [[3]]
  12. 5(a) What is a function when writing a C program? State two advantages to the use of functions. [[1+2]]
  13. 5(b) Write the first line of the function definition, including the formal argument declarations, for each of the following.\\(i) A function called \textit{value} accepts two double-precision quantities and a short -integer quantity, and returns nothing.\\(ii) A function called \textit{process} accepts an integer and two floating-point quantities, and return a double-precision quantity. [[3]]
  14. 5(c) Find the output (mentioning all the necessary steps involved) of the following C program. \begin{verbatim} # include < stdio.h > int funct1 (int count); main() { int a, count; for(count= 1; count<= 5; ++ count){ a =funct1(count); printf("% d", a); } } int funct1(int x){ return (x * x); } \end{verbatim} [[4]]
  15. 6(a) Find the output of the following C program. Give proper justification in support of your answer. \begin{verbatim} # include < stdio.h > main() { int v1, v2, v3; int list[ 5 ] = {-2, -1, 0, 1, 2}; v1 = + + list[ 1 ]; v2 = list[ 1 ] + +; v3 = list[ v1 + + ]; printf("% d % d % d", v1, v2, v3); } \end{verbatim} [[3]]
  16. 6(b) Describe the array that is defined in each of the following statements. Also indicate what values are assigned to the individual array elements. \begin{verbatim} (i) int p[ 2 ][ 4 ] = {{1, 3, 5, 7}, {2, 4, 6, 8}}; (ii) char flag[ 4 ]={'T', 'R', 'U', 'E'}; \end{verbatim} [[3]]
  17. 6(c) Write a C program to find the factorial of any positive integer using one-dimensional array. [[4]]