CU SEC-A-1 C Programming Language, 2020

University of Calcutta question paper, B.Sc. General Semester III, 2020. C Programming Language. Typed in LaTeX, searchable, with a printable PDF.

Open this paper in MathQP

  1. The brain of computer system is
  2. Which one of the following is NOT a logical or relational operator?
  3. What will be the value of y after execution of the following program segment? l texttt main() texttt hspace 1.0em texttt int x,y,n = 6; hspace 1.0em texttt x=++n; hspace 1.0em texttt y=x++; hspace 1.0em texttt printf(" %d", y); texttt
  4. What is the right way to initialize array?
  5. What is the work of texttt break keyword?
  6. If C is a variable initialized to 1, how many times will the following loop be executed? l texttt while((C>0) (C < 60)) texttt hspace 1.0em texttt Loop body hspace 1.0em texttt C++; texttt
  7. What will be the value of m and n after execution of the following C code: l texttt int m = 10, n = 20; texttt m = m+n; texttt n = m-n; texttt m = m-n;
  8. The program segment l texttt int A = 25; texttt printf(" %d %d", A == 25, A > 25); will print
  9. What will be the output of the following program? l texttt #include<stdio.h> texttt void main() texttt hspace 1.0em texttt float val; hspace 1.0em texttt val = 5/2; hspace 1.0em texttt printf(" %f", val); texttt
  10. Which one of the following statements is incorrect?
  11. Write short notes on (i) Object oriented programming language and (ii) ALU. (3+3)
  12. Write down the C expressions for the following functions: (i) x y 2 + left ( dfrac yz z 10 right ) 5 (ii) cot 2x+|x log 10 x| (2+2)
  13. Distinguish between High-level Language and Low-level Language.
  14. Write short notes on: (i) Arithmetic operator (ii) Relational operator (iii) Logical operator. (2+2+2)
  15. How can you use texttt break and texttt continue statements in texttt for loop? Give an example to justify your answer.
  16. Write a C-program to print first 10 Fibonacci numbers generated by the recurrence relation: F n=F n-1 +F n-2 , for all n>1 and F 0=1 , F 1=1 .
  17. What are control structures in C? Discuss the differences between texttt while and texttt do-while loops in C.
  18. Write a C-program which reads two integers values texttt int1 and texttt int2 . If texttt int1 is less than texttt int2 , display the message texttt tall . If texttt int2 is less than texttt int1 , display the message texttt short . If both are equal, display the message texttt equal .
  19. Explain the structure of a texttt for loop in C. How texttt for loop can be implemented using texttt while loop? Illustrate with example. What is meant by texttt nested for loop? (2+3+2)
  20. What would be the assignment of the variables for the following statement for the data input 356 8735.75 874? texttt scanf(" %3d %5f %2d", a, b, c);
  21. Write three benefits of using functions. Distinguish between the user-defined function and the standard build-in functions.
  22. Write a program that reads two matrices of same order m times n and computes C=A+B along with sum of the elements of j th ( 1 le j le n ) column of the matrix C .
  23. Identify the invalid identifiers and justify your answer. (i) texttt temperature (ii) texttt switch
  24. Write a C program that accepts two integers from user and calculate their product.
  25. What would be printed on the screen if the following program is executed? l texttt main() texttt hspace 1.0em texttt int i,j; hspace 1.0em texttt for(i=1;i<=5;i++) hspace 2.0em texttt for(j=1;j<=i;j++) hspace 3.0em texttt printf(" %d",j); hspace 2.0em texttt printf(" textbackslash n"); hspace 1.0em texttt texttt
  26. Write a C program that compute quotient and remainder when a positive integer a is divided by a positive integer b .
  27. Identify the valid and invalid real constants and give reasons for invalidity. (i) texttt 42.5e2.5 (ii) texttt 4,275.30 (iii) texttt 621.
  28. Identify the valid and invalid C assignment statements from the following. Justify your answer. (i) texttt sum=sum+x (ii) texttt a*b=x*y
  29. Distinguish between function texttt Call by value and texttt Call by Address .
  30. Use texttt scanf() and texttt printf() to write a C-program to check whether three line segments form a triangle or not.
  31. Write a program to calculate the sum of k th power of integers from 1 to n using a function suitably defined by you.
  32. Write a program to illustrate the use of texttt switch() and texttt break .