2008 Calicut University Mechanical Engineering THIRD SEMESTER B.TECH. (ENGINEERING) DEGREE EXAMINATION Question paper
THIRD SEMESTER B.TECH. (ENGINEERING) DEGREE EXAMINATION, JUNE 2008
CH 04 302 - COMPUTER PROGAMMING IN C
(Common to all except CS, IT, PT)
Time : Three Hours Maximum : 100 Marks
1.Part A: (8*5=40 marks)
I. (a) What is a generalized algorithm? Why should programs be general in nature?
(b) Discuss the various advantages and limitations of flow charting.
(c) State the rules to be followed while using string constants.
(d) State the use of enum data type in C.
(e) Nested if statements. Explain with necessary examples.
(f) Explain while loop with an example.
(g) What are the different random access functions in files?
(h) Explain the concept of merging two data files in C.
Part B:(4*15=60 marks)
II. (a) Draw a block diagram to illustrate the basic organisation of a computer system and explain the functions of the various units.
(b) The first 20 records in a data set are to be read and printed. Draw a flow chart for the algorithm to do this job. Make sure that the processing stops after the twentieth record. (9 + 6 = 15 marks)
Or
(a) Draw a flow chart to illustrate the logic to convert a number from the base 10 to a new base using the division remainder technique.
(b) (i) What is a compiler? Why is it required? A computer supports five high-level languages.How many compilers will this computer have?
(ii) Illustrate the machine independent characteristic of high level languages. (7 + 4 + 4 = 15 marks)
III. (a) List the features that makes C a popular programming language.
(b) What are enumeration variables? How are they declared? What is the advantage of using them in a program ?
(c) Describe the purpose of the qualifiers const and volatile. (3 x 5 = 15 marks)
Or
(a) State the different types of operators used in C. Explain about each operators with example.
(b) Determine the value of each of the following logical expressions if a = 5, b - 10 and c = -6.
(i) a>b&&ac (iii) a = = c ! | b > a (iv) b > 15 & & c <>" 0 (v) (a/2.0 = = 0.0 && b/2.0 = 0.0) \ | c < 0.0.
(5 + 10 = 15 marks)
IV. (a) Write a program to find the number of and sum of all integers greater than 100 and less than 200 that are divisible by 7. (b) Find errors, if any, in each of the following segments :
(i) if(x + y = z&&y>0) print
(ii) if(code>l);
a=b+c -
else a = 0.
iii) if((p<0) | | (q<0»
print f ("sign is negative"); (9 + 6 = 15 marks) Or
(a) Write a program to compute the sum of the digits of a given integer number."
(b) Main is a user defined function. How does it differ from other user defined functions.
(c) Write a function space (x) that can be used to provide a space of x positions between two output numbers. (3 x 5 = 15 marks)
V. (a) Given are two-dimensional arrays A and B which are sorted in ascending order. Write a program to merge them into a single sorted array C that contains every item from arrays A and B, in ascending order.
(b) Write a program which will read a text and count all occurences of a particular word. (8 + 7 = 15marks)
Or
(a) What is meant by the following terms? (i) Nested structure ; (ii) Array of structures.
(b) Distinguish between the following functions : (i) getc and getchar ; (ii) printf and fprintf
(iii) feof and ferror. (9 + 6 = 15 marks)
0 comments :
Post a Comment