LOYOLA COLLEGE (AUTONOMOUS), CHENNAI – 600 034
B.Sc. DEGREE EXAMINATION – COMPUTER SCIENCE
FIRST SEMESTER – APRIL 2008
CS 1501 – PROGRAMMING IN C
Date : 07-05-08 Dept. No. Max. : 100 Marks
Time : 1:00 – 4:00
PART – A
Answer ALL the Questions: (10 x 2 = 20 marks)
- Give the structure of a ‘C’ program.
- List any 4 standard library functions in ‘C’.
- What is the difference between the Operators = and = = ?
- Explain Scanf() and Printf() functions.
- How arrays are declared and initialized?
- What do you mean by recursion?
- What is a pointer? How is it initialized?
- What is the major difference between structure and union?
- What does passing by reference mean?
- Give the general syntax of the following:
- Open statement
- Close statement
PART – B
Answer ALL the Questions: (5 x 8 = 40 marks)
- a) List and explain the rules that are to be followed while defining variables. Give examples.
- b) What are the relational and logical operators in ‘C’?
- a) Write a program for selecting largest of three values using a nested if …else statement.
- b) Give the general form of switch statement and explain with an example.
- a) Distinguish between automatic, external and static variables.
- b) Write a recursive function to generate the nth Fibonacci number.
- a) What do you mean by Self-referential structure?
- b) Write a program using pointers to compute the sum of all elements stored in an array.
- a) Write a C program to accept student’s information and save it into a file ‘student.dat’.
- b) Write a note on unformatted data file.
PART – C
Answer any TWO Questions: (2 x 20 = 40 marks)
- a) Discuss the steps involved in programming. (4)
- b) What are the data types available in ‘C’? (8)
- c) What are the loop control structures available in ‘C’? (8)
- a) Write a program that will read a text and count all occurrences of a particular word. (10)
- b) Write a program to perform Matrix Multiplication. (10)
- a) Write a Program that reads in an array of numbers and calculates and displays the row and column sums, as well as the grand total. Place the sum next to their respective rows and columns. (10)
- b) Write Short notes on:
- Function Prototypes (3)
- User defined data types (3)
- Strings (2)
- Break Statement (2)