# P. G. D. C. A. (Semester - II),2010 Question Paper,‘C’ PROGRAMMING,University Of Pune Question Paper

University Of Pune Question Paper
P. G. D. C. A. (Semester - II) Examination - 2010
‘C’ PROGRAMMING
(Old 2005 Pattern)
Time : 3 Hours] [Max. Marks : 80
Instruction :
Assume appropriate header files are included.
Q.1) (A) What will be the Output ? Give reasons : (Any Three) [20]
(a) void main( )
{
int x, i, y;
x = 3;
y = 1;
for (i = 1; i < 7; i++);
{
printf(“%d”, i);
if(i == x)
{
printf(“#”);
printf(“\n”);
x = (x + 3) – y;
y+ = 1;
}
}
printf(“#”);
}
(b) void main( )
{
int x, y, z;
x = y = z = –1;
z = ++x || ++y && ++z;
printf(“x = %d\ty = %d\tz = %d”, x, y, z);
}
(c) void main( )
{
static char * s[] = {“pune”, “delhi”, “bangalore”};
printf(“d%”, sizeof(s))’
printf(“\n%d”, sizeof(s[1]));
printf(“\n%d”, sizeof(*s[1]));
}
(d) void main( )
{
int b[] = {10, 20, 30, 40 50};
int i, * ptr;
ptr = &b[4] – 4;
for(i = 0; i < 4; i++)
{
printf(“%d\t”,*ptr);
ptr++;
}
}
(e) int func(int);
void main( )
{
int n = 10;
printf(“\n%d”, func(n));
}
int func(int n)
{
if(n > 0)
return(n + func(n – 2));
else
return 0;
}
(B) (a) What is Recursion ? Explain with example. [05]
(b) Explain any four string functions with an example. [05]
Q.2) Solve any five : [50]
(a) Accept a number, find sum of digits of the number and reverse
the number.
i.e. if the number is 978, output sum = 24, reverse = 879.
(b) Write a ‘C’ program to accept ‘n’ numbers from user, store these
numbers into an array and sort numbers of an array.
(c) Write a program to find factorial of a number using function.
(d) Write a ‘C’ program to accept a string from user and generate
the following pattern (e.g. input is string “abcd”)
a
a b
abc
a b cd
abc
a b
a
(e) Write a ‘C’ program to accept ‘n’ numbers from user and find
out maximum elements out of them by using dynamic memory
allocation.
(f) Write a ‘C’ program to check whether given string is palindrome
or not.
(g) Write a ‘C’ program to create student structure having fields
roll_no, stud name, marks of 6 subjects. Calculate total and
percentage of marks.
(h) Write a ‘C’ program to copy contents of one file into another
file.