You are on page 1of 4
Dharmsinh Desai University Faculty of Technology, Nadiad Advanced C Programming B.Tech. ‘Sem — I(EC/CLICHAC) ‘Time Date: 8/6/2010 ~Wesinesday... Section - I Q-1A) Choose Appropriate(s). [03] 1) Inthe declaration FILE “fp; FILE is a) macro ’) variable ¢) keyword 4) none of these 9) Ifa file containing information of 5 structure variables; length of each variable is 20 bytes ‘What is the meaning of fseek(fp,2L,1)? 1a). 20 bytes forward from current location b) 40 bytes forward from current location ©) 2 bytes forward from current location _d) none of above 3) floodfill() is used for ‘a) to fill a color in closed figure b) to select the fill color. ¢) to select the fill pattern 4) None of above Q-1B) Do as directed. {07] 1). State True of False with justification: “scanf{,) can not be used to read values of bit fields. {02} 2) Identify the errors if any in following code. Also justification your answer. [02] Union ABC { int x1; float x2; jal = (12,23.4}; 3) Write the output of the following code: [02] maint ){ struct address char phone[15]; char eity[25];}; struct emp{ char name[25]; struct address a: struct emp a printf(“phone = %s\n", e.a, prinf(‘size of e = %d”, sizeofle)): i 4) Give one example of conditional compilation. [01] @2 Answer the following questions. we 1) Write a C program to draw a sine wave and cosine wave using line function. [05] 2) What is a command line argument? Write a program to print the content of file which is having minimum no. of occurrence of character ‘a’ from entered three files using commands line arguments. Assume that all there text files are already available. {05} --OR--- Q-2 Answer the following questions. (10) 1) Write a C program to draw the shape shown figure 1 [05] 2) Write a program using command line arguments to replace the all vowels with specified character and store it in another file. Also display the content of resultant file on output screen. 05] Q-3 Answer the following questions. {10} 1) Write a C program to create a file that contains information for 5 books: book name, publisher’s name and price. Then read the information from the file and display the book name having highest price. (Use fwrite() and fread() only) [05] 2) Write a maero definition that will check whether two entered strings are equal ornot [02] 3) What is the significance of int86() function in mouse programming? (02] 4) Find out the errors : # define Title “abe & ed” fol] —————--OR— Q-3 Answer the following questions. [10] 1) ‘Write a program to detect a left mouse click in the inner rectangular shown in figure 2. And display the message “click inside” else “click outside”. (05) 2) What is the significance of ferror( Jin C programming ? Which types of errors can be handled by it? Explain with suitable example. [05] PIO Section — U1 Q-4 A) Choose Appropriate(s). 04] 1) What is meaning of the declaration int (*x)[4]; ? a) x is pointer to an array of four elements b) x is pointer to a2-D array of size 4x4 ©) xisaarray of 4 pointers 4) None of above. 2) Which expression will print the third character of second string? char *state[3]= {"Gujarat”, "Rajasthan", "Maharashtra"} a) “(etate[1}+2) bY M(tatet1)#+2) —) *(state+1)*2)__d) None of above 3) Use of free() is a) Free the pointer variable. ’) Free the memory which is allocated by malloc or calloe functions. ©) Free the memory which is pointed by pointer variable. 4) All of above. 4) What is the value of variable a? Vint a= 5* - *pl/*p2 + 10 * 2where *pl = 3 and *p2 = 5 a) 20 b)17 20 ) None of above B) Do as Directed. [06] 1) State True or False with justification: “It is an error to use self-referential structure withowt tag. [02] 2) It pir is pointer to pointer which points to base address of 2-D character array of size 3x25- Write the expression for the following, {02} a) To print second string using pir b) To print the last character of third string using ptr. 3) What is NULL pointer? Write the importance of it related to DMA. (02) Q-5 Answer the following questions. 19} 1) What is funotion returning pointer? Why itis required? Write a program find the string which having maximum length from entered 3 strings. Demonstrate the use of fonetion returning pointer. [07] 2) Differentiate : float (*fptr)(); and float *fptr(): {03} ti ET ATswer ene roo Wing yueosew ee 1) Write a program to demonstrate the use of realloe () function. Can we replace the realloc() with malloc() or calloc(,) function? Justify your answer. 0s] 2) What is the output of the following code? And also explain the each expression used in printi(). (05) struct data {int *x; }*pt; void main(){ int 0,p=10; P pprintf("%u\n", Xptr->x*): ‘pringf("9ou\n" (Sptr->x) +); iprintf("%ou\n", “pir t+->x); i Q-6 Answer the following questions. (10) 1) "Write a user define function insert_sort() only which will insert the clement in sorted linked list. Assume the linked list is already created. 05] 2) Write a user define function delf jwhich will delete the partioulet element from a given an array of 50 integers. Use the concept of pointer as an argument of function. {05} ——0) Re Q-6 Answer the following questions. (10) 1) "Write a user define function sort() only which will create the sorted linked list. {0s} 2) Write a program to store the number of integers at run time, ‘And find occurrences of @ particular integer, Also find largest number from number of integers using dynamic memory allocation. {05} 4 190 as tat

You might also like