Saurastra University 2006 Post Graduate Diploma Computer Science
*SP-9179*
SP-9179 Seat No._
P.G.D.C.A. (Sem. I) Examination April/May - 2006 Paper - 2 : Problem Solving Using C
Time : 3 Hours] [Total Marks : 100
1 Answer the following questions : (any two) 20
(a) Write a note on UDF in C. How we can pass pointer as an argument. Explain with example.
(b) Explain dynamic memory allocation with related function and suitable example.
(c) Write a note on structure and pointer to structure with suitable example.
2 (a) Write output of following programs : 10
(1)
main ( )
{
int x = 5, y = 7, z = 8; for (; 50 < 100 ; x++, y++)
{
white (y > = x)
{
break;
printf (\n%d %d %d, x, y, ++z);
y--;
}
if (x ==5) break; else continue;
}
}
SP-9179] 1 [Contd..
{
int x = 5, y = 10, *a, *b, *c. a = &y; b =&x;
*a = ++y - x++;
*b = y + x; x = (*a + b) + (a - *b);
*c = *b;
printf (x = %d and y = %x, x, y);
}
(b) Attempt following : (any one)
10
(1) Write a program to prepare two dimensional array to store %rate of DA for two cities and 3 categories of workers. Elements of array contains % age for DAT for each city and category. Input worker name city code, category of worker basic salary from keyboard. Find appropriate %rate of DA from array and calculate DA. Display Gross salary on screen and also display total rupees to be paid by company to all employees. Put provision to terminate program.
(2) Write a function that accepts characters into a string by using pointer. Compute the length of the array using a pointer (string is terminated by null character). Print the string in reverse order using pointer.
(i) Distinguish the following :
3
10
(a) Structure v/s Union
(b) Static v/s Automatic
(c) while loop v/s do....while loop
(d) ++a v/s a++
(e) Buffered file v/s Unbuffered file.
[Contd.
(ii) Explain following functions with syntax and 10
example : (any five)
(a) fseek ( ) (b) scanf ( ) (c) fprintf ( )
(d) fabs ( ) (e) isdigit ( ) (f) strcat ( )
(g) getch ( )
4 Answer the following questions : (any four) 20
(a) Distinguish recursive and non-recursive functions with suitable example.
(b) Explain back slash codes with examples.
(c) What are bit fields? How are they useful?
(d) Explain with suitable example :
(i) Function call by value
(ii) Function call by reference.
(e) List the operators available in C. Explain any two with example.
(f) Explain nesting of loops with example.
5 (i) Fill in the blanks
5
_function clears end-of-file indicator only.
(a)
(b)
(c)
(d) (e)
The format %lu is for_data type.
Default initial value of external storage class is_
The local variables are stored in ________ area of
memory.
If data type of UDF is not declared, _____type will
be returned by UDF.
Attempt the following : (any two)
(ii)
20
(a) Write a C program to develop following series using recursive function.
1 8 27 64 125 ........up to N-step
(b) Write a program to create a random data file having following structure :
no as integer
name as character 20
ph_no as character of 6
Append records in data file and put duplication check for field no.
Put
provision to terminate program.
(c) Input a sentence from keyboard and calculate the average of upper case letters and average of lower case letters separately.
SP-9179] 3 [ 300 ]
d by dei ftp:/ .dooudei
Attachment: |
Earning: Approval pending. |