Visva-Bharati · Department of Mathematics
SEC-1A
Programming in C-Theory
B.Sc. Mathematics · Semester I2025
- 1(a) What is CPU? Name and discuss the functions of different units in CPU. [4]
- 1(b) Write down the full form of COBOL and VDU. [1]
- 2(a) Using standard symbols, draw a flowchart to print all even numbers from 1 to 2026 and compute their sum. [3]
- 2(b) Write appropriate declaration in C for the following group of variables.\par Integer variables: root1, root2\par Floating-point variables: big, sem1\par Character variables: c1, c2 [2]
- 3(a) What do you mean by algorithm? Design an algorithm to find the sum of digits of a given positive integer. [1+2]
- 3(b) Find the error/output.\par \begin{verbatim} # include < stdio.h > main() { int x = 100, y = 200, z = 0; z = x - y * x + x * 51/3; printf("% d", z); } \end{verbatim} [2]
- 4(a) A C program contains the following declarations\par \begin{verbatim} int i, j; long ix; short s; float x; double dx; char c; \end{verbatim} Determine the data type of the following expressions.\par (a) ix + j (b) ((int) dx)+ix (c) s+c*s (d) i + x [2]
- 4(b) A C program contains the following declarations and initial assignments\par \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.\par (a) (i - 3 * j)% (c + 2 * d)/(x - y)\par (b) i-- = (j > 0) ? j : 0\par (c) (x > y) \&\& (i > 0) !! (j < 5) [3]
- 5(a) Write down the syntax of the do while loop. Also state the basic differences of it with the while loop. [2]
- 5(b) Find the output (mentioning all the necessary steps involved) of the following C program.\par \begin{verbatim} # include < stdio.h > main() { int i = 0, x = 0; for(i = 1; i < 10; ++i){ if(i % 2 == 1) x+ = i; else x-- ; printf("% d", x); } printf("\n x =% d", x); } \end{verbatim} [3]
- 6(a) What is string constant? How does it differ from character constant? [2]
- 6(b) Write a C program to find the factorial of any positive integer. [3]