0% found this document useful (0 votes)
11 views

CU-2021 B.sc. (Honours) Computer Science Semester-1 Paper-CC-2 QP

Uploaded by

ramdas2546
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

CU-2021 B.sc. (Honours) Computer Science Semester-1 Paper-CC-2 QP

Uploaded by

ramdas2546
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

(1) V(1st Sm.)-Computer Sc.

-H/CC-2/CBCS

2021
COMPUTER SCIENCE — HONOURS
Paper : CC-2
Full Marks : 50

The figures in the margin indicate full marks.


Candidates are required to give their answers in their own words
as far as practicable.

Answer question no. 1 and any four questions from the rest.

1. Anwer any five questions of the following : 2×5


(a) Give the output :
float le, b, ar;
le = 1.50; b = 0.60;
ar = (1/2)*le*b;
printf (“%f”, ar);
(b) How is int main() different from void main()?
(c) “stdio.h and conio.h are mandatory in any C program.” Justify.
(d) What are the different modes in which a file can be operated?
(e) How is an “array of pointers” different from “pointer of array”?
(f) Correct the code if it is erroneous else give the output :
char c = ‘z’;
printf (“%d”, c);
(g) Can you recursively call main() from main()? Justify.
(h) Illustrate two cases where switch case is more preferable than if-else.

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

Please Turn Over


V(1st Sm.)-Computer Sc.-H/CC-2/CBCS (2)
3. (a) Write a C program that calculates ‘a raised to power b’ using recursion.
(b) Is recursion always better than iteration? Justify with an example.
(c) What does Scope of a variable mean? 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)

6. (a) Can you overload functions in C? Explain.


(b) ‘int main(int argc, char*argv[])’. What are the functions of these two arguments in this function
prototype?
(c) When is calloc() used and when is malloc() used in C? Why is realloc() needed when calloc() and
malloc() is already available? 2+2+(2+2+2)

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

You might also like