Computer Programming 3rd Semester ME MG University November 2013

MG University 3rd semester Btech question for Mechanical Engineering


Third Semester


AU 010 305


PE 010 305

MT 010 305

(New Scheme-Regular/Improvement/Supplementary)

Time : Three Hours Maximum:100 Marks


Part A

Answer all questions.

Each Question Carries 3 marks

1. List the various data types in C, giving example for each?

2. Write appropriate type declarations to create the following.

i)An array to record the weights of 60 students in a class

ii)A two dimensional array to classify students by sex and one of five occupations that the students intend to take up after the completion of their studies

iii)A three dimensional array to classify the students by age(15 years to 25 years), years of study(10 to 15 years) and one of 10 major subjects of study.

3. What are the two main components of a function definition? Illustrate with an example

4.What happens when a pointer to a structure is incremented?

5. What are the 2 methods to update a data file? Which is better?

Part B

Answer all questions

Each Question carries 5 marks

6. Explain if, if-else and switch statements with suitable examples

7. Explain union with an example and state the uses of union?

8. What is recursion? Explain with an example program?

9. What is linked list? Describe its functions, merits and demerits

10. Describe two bitwise shift operators? What requirement must the operators satisfy? What is the purpose of each operand?

Part C

Answer all questions

Each question carries 12 marks

11. a)Describe with the help of examples, all the operators in C, specifying the hierarchy of operations.

b)What is an escape sequence?Give an example and explain the purpose of the same.


12. Write a C program to compute x- x3/3! + x5/5! - x7/7! +..., up to 5 decimal place correction.


13. Write a C program to search an element from a list of sorted integers using binary search method.


14. Write a program to print the upper and lower triangles of a matrix

15. Write a function to accept 10 characters and to display whether each input character is a digit, a lower case or uppercase alphabet or a special symbol character? Write the main program to call it?


16. Write a program to input 100 students details as structure and display them. Structure fields( Register number, branch, semester, mark1, mark2.... mark 8, total)

17. Write a function, using pointers to add two matrices and to return the resultant matrix to the calling function


18. Write a C program to create a single linked list to read a set of N numbers and to print the list in ascending order


19. Associate a stream pointer point with a new stream oriented data file called sample.dat Open the data file so that information can either be read from or written in to the file. Show how the data file can be closed at the end of the program


20.Write a C program that will receive a file name and a line of text as command line argument and write the text to the file.