CU SEC-1 C Programming Language, 2025

University of Calcutta question paper, B.Sc. Honours Semester I, 2025. C Programming Language. Typed in LaTeX, searchable, with a printable PDF.

Open this paper in MathQP

  1. Write the output of the following C program: l texttt #include<stdio.h> texttt main() texttt hspace 2.0em texttt int a=5, b=10, Result; hspace 2.0em texttt Result = (a<b) (b==10); hspace 2.0em texttt printf(" %d", Result); texttt
  2. What will be the output of the following C program? Give reasons in support of your answer. l texttt #include<stdio.h> texttt main() texttt hspace 2.0em texttt int x=3, y=2, z; hspace 2.0em texttt z = (x++) + (++y); hspace 2.0em texttt printf("z= %d", z); texttt
  3. What is the difference between = and == operators in C? Give an example.
  4. Identify the error(s) in the following snippet: l texttt #include<stdio.h> texttt main() texttt hspace 2.0em texttt int x=3 hspace 2.0em texttt if x>0; hspace 4.0em texttt printf("Positive"); texttt
  5. Write the following expression in C: e x 4+3 tan x + cot (x 3+7)+5 sqrt x sec (3x) .
  6. What is the difference between while and do-while loops in C?
  7. Explain the concept of a function prototype in C.
  8. Write short notes on Compiler, Interpreter, Machine Language and High Level Language.
  9. (i) What is the output of the following C code? l texttt # include <stdio.h> texttt int main() texttt hspace 2.0em texttt int a=3; hspace 2.0em texttt printf(" %d %d", a, a++); texttt (ii) What is meant by an operator in C? Explain the functions of logical AND and logical OR operators.
  10. (i) Explain the use of for loop with an example. (ii) Write a C program to find the sum of all even numbers between 1 and 30.
  11. (i) Describe the different relational operators available in C. (ii) Write a program to read 20 integers from the keyboard and calculate their average.
  12. (i) What is an array? How do you initialize a 1D array? (ii) Write a C program to find the maximum element in a given array of 20 numbers.
  13. (i) Compare the float and double data types in terms of precision and memory. (ii) Write a C program to find the transpose of a 3 times 3 matrix.
  14. What is recursion? Write a function to evaluate factorial of n to show how the recursion works.
  15. (i) Write a C program to check whether a given positive integer is a Perfect Number. (ii) Write a program to read a list of 15 numbers and sort them in descending order.
  16. Write a C program that takes three real numbers a,b,c as user inputs, then identifies the nature of the roots of the quadratic equation ax 2+bx+c=0 , and finally prints the roots of the equation.
  17. (i) Write a program to find the value of 1- dfrac 13+ dfrac 15- dfrac 17+ dfrac 19- dots + dfrac 1 2025 . (ii) Write a C program to compute the value of f(x) for x=0,1,2, dots ,10 , where f(x) is defined as f(x)= x cos x, 0 le x le 2 xe x, 2<x le 5 log e(1+x), x>5.