Computer Programming 5th Semester CE MG University December 2012

Previous question paper of 5th semester CE, MG University December 2012


Fifth Semester



(New Scheme-2010 Admission onwards)


Time : Three Hours Maximum:100 Marks


Part A

Answer all questions.

Each Question Carries 3 marks

1. Write any 3 types of constants and example to each

2. How a function declaration is different from a function definition ?

3. What is the null character and what is it used for, in the context of strings

4.What are the differences between malloc and calloc functions?

5. For what kinds of applications are unformatted data files well suited? Give an example

Part B

Answer all questions

Each Question carries 5 marks

6. What are the purposes of comma operator? Within which control statement does the comma operator usually appear

7. Write a C program, using while structure to accept a string and an integer and print the string as many times as the value of the integer

8. Explain the following string functions with example. strcpy( ),strcat( )

9. How can structure variable be declared? How do structure variable declarations differ from structure type declaration? Give an example

10. Explain the following functions: feof, fread, fseek, fopen and remove

Part C

Answer all questions

Each question carries 12 marks

11. How the data type in C are classified? Explain with examples? Also explain how memory size is allotted to each type?


12. Explain all the operator types used in C with suitable examples. Give their precedence and associativity?


13Write a C program to read a given string and display it in reverse order. Also print the vowels if any in it?


14. Write a C program which rewrites "when everything fails try patience" using recursion so that it terminates after 21 calls. Your program should consist of a single main function which calls itself recursively.

15. Write a C program which reads in the register number, Name and marks scored by them in 8 subjects. Prepare rank list and also obtain separate lists of students with first class, second class, failed


16. Read the permanent employee number, name and salary of the employees in a firm in to C program and prepare the payroll in descending order of the salaries.

17. Write a C program that read names and addresses of the people in a village and their property tax. Rearrange the names in to alphabetical order using structure variation within the program.


18. Write a C program to create a linear linked list of nodes containing roll number and interactively print out the list and total number of items in the list.


19. Write a complete C program to read a sentence from one file and write the reversed sentence to output file


20.(a) What is the purpose of the buffer area when working with a stream oriented data file? How is a buffer area defined?

(b) Write a C program to create a formatted file of real numbers. Then access each file record sequentially for calculating and displaying the sine of each record entry