DAYANANDA SAGAR ACADEMY OF TECHNOLOGY AND MANAGEMENT (TC) UDAYAPURA, KANAKAPURA ROAD, BANGALORE- 82. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING. PROGRAMMING IN C AND DATA STRUCTURES [14PCD23] ASSIGNMENT-III Date:- 27-April-2015 Common to ISE-1&2 Note: 1. Students are hereby informed to submit the answers to the below mentioned questions as “Assignment” before 12- MAY-2015 [COMPULSARY]. 2. Write Expected Output for all the programs in Assignment-III. 1. a. What is a Structure? Explain structure declaration with syntax and example? (4M) b. Explain how to pass structure variable as parameter to the function with example?(6M) 2. a. Explain the array of structures with example. b. Write a C program to illustrate structure within a structure with explanation. (5M) (5M) 3. a. What is a file? Explain how the file open and close functions handled in C with syntax and example for each. (07M) b. Describe how to create typedef for structures with example. (03M) 4. Write a C program to maintain a record of a student details using an array of structures with fields (Roll num , Name, Marks and Grade). Also Print the marks of student given student name as input. (10M) 5. Explain the following functions with syntax and example for each (i) fscanf( ) (ii) fprintf( ) (iii) fgets( ) (iv) fputs( ) (v) fgetc( ) (vi) fputc( ) (10M) 6. a. Write a C program to count number of characters, number of lines and number of white spaces from a file. (06M) b. Define Preprocessor directives. Describe various preprocessors with example. (04M) 7. Given two files “ramayana.in” and “mahabharata.in” contains some details in these two files. Write a C program to create new file called “karnatak.in” and copy the contents of files “ramayana.in” and “mahabharata.in” into the output file in “karnatak.in” in sequence one after other. Display the contents of “karnatak.in” on to screen. (10M) 8. a. Define pointer. Explain how pointer variable declared and initialized. b. Describe pointers and Arrays with example. Page 1 (05M) (05M) 9. a. Write a C program using pointers to compute sum, mean and standard deviation of all elements stored in an array of n real numbers. (06M) b. Explain Dynamic memory allocation functions in C (04M) 10. a. Describe the difference between pointer variable and normal variable. b. Write a program to illustrate how to pass structures by reference (Pointers) . (03M) (07M) 11. a. Write a C program to compare two strings using mystrcmp() function. (User defined function) (03M) b. Write a C program to reverse the given string using mystrrev() function. (User defined function) (03M) c. Write a C program to concatenate two strings using mystrcat()function. ( User defined function) (04M) 12. a. Define Data Structure. What are the various data structures. b. What is Stack. What are the various operations performed on stack. Page 2 (04M) (06M)
© Copyright 2024