CU-2021 B.sc. (Honours) Computer Science Semester-1 Paper-CC-2 QP
CU-2021 B.sc. (Honours) Computer Science Semester-1 Paper-CC-2 QP
-H/CC-2/CBCS
2021
COMPUTER SCIENCE — HONOURS
Paper : CC-2
Full Marks : 50
Answer question no. 1 and any four questions from the rest.
2. (a) Explain with suitable examples, the difference between ‘entry controlled loop’ and ‘exit controlled
loop’.
(b) Write a C program to input a month of a non-leap year and calculate the number of days passed
using Switch Case. Implement the ‘fall through’ feature in your program.
Example : if input month = 4; output will be : 31+28+31+30 = 120 days.
(c) Can a C function contain multiple ‘return’ statements? If yes, which of these get executed when
the function executed? 4+4+2
4. (a) If a structure and union have the same definition, will the size of the structure variable be the same
as the size of the union variable? Justify.
(b) How is ‘goto’ different from ‘break’?
(c) How does a break statement perform, if it is placed in a nested loop? Why are break and continue
categorized as jump statements? (1+2)+3+(1+3)
5. (a) Write a C program to find out the second largest element from an array without sorting the array.
(b) Name the C Library that contains the functions strcmp() and strcat(). How is strcmp() different from
strcat? 6+(1+3)
7. (a) How does call-by-value differ from call-by-address when the values of the formal and actual
parameters are considered? Illustrate with suitable examples.
(b) Give the output with proper explanation :
int*d;
int k;
for (k=0;k<12;k++)
{
int x=90;
d=&x;
}
printf(“Printing %d”, **d);
(c) Are memory leaks same as dangling pointers? Justify. 4+4+2
8. (a) Assume ‘int x[5]’ is a 1D array that is stored contiguously from memory location 1008. What will
be the output of the following statements? Explain.
printf (“%p”, x);
printf (“%p”, &x[2]);
printf (“%p”, &x[0]);
(b) What will be the size of a pointer pointing to a float variable and a pointer to a char variable?
(c) Write a C program to swap two variables without using a third variable. (2+2+2)+1+3