Friday, December 19, 2008

MCS-011 : PROBLEM SOLVING AND PROGRAMMING June-2006

MCA (Revised)
Term-End Examination
June, 2006

MCS-011 : PROBLEM SOLVING AND PROGRAMMING

Time : 3 hours Maximum Marks : 100 (Weightage 75%)

Note : Question number 1 is compulsory. Attempt any three questions from the rest.

1. (a) Design an algorithm, draw a corresponding flow chart and write a program in C, to print the fibonacci series. 10

(b) Write a program that does not use the inbuilt string functions to perform the following : 10

(i) to compare two strings
(ii) to copy a string

© Design an algorithm, and write a program to find the factorial of a number using recursion. 10

(D) A C program contains the following declarations : 10
int i, j;
long iX
short S
float X.
double dX;
char C;

Determine the resultant data type of each of the following expressions :

(i) i + C
(ii) X + C
(iii) dX + X
(iv) ((int) dX) + iX
(v) i + X
(vi) S + j
(vii) iX + j
(viii) S + C
(ix) iX + C
(x) i + 1

2. (a) Summarize the purpose of the format strings (like %s, %d, %c) that are commonly used within the printf function, with an example for each. 10

(b) When can two matrices of order a x b and c x d be subtracted ? Also write a program in C to find the difference of two such matrices.10

3 (a) Design an algorithm, draw a corresponding flow chart and write a C program to check whether a given string is a palindrome or not. 10

(b) Explain the meaning of each of the following functions prototypes and mention the return data type of each of them : 10

(i) double f(double a, int b);
(ii) void f(long a, short b. unsigned c);
(iii) unsigned f(unsigned a. unsigned b);
(iv) int (*f) (char*, int);
(v) int * f(char*. int);

4. (a) What is the difference between a function and a macro? Find the largest number among two numbers using a function definition as well as a macro. Which is more efficient in terms of execution time and code size ? 10

(b) Write a program to sort a list of strings in alphabetical order, using an array of pointers. 10

5.(a) Write a program, using "structures', to calculate the gross salary and net salary, if the details of an employee along with the basic pay, attendance and
deductions are given as input. 10

(b) Write a program to count the number of characters, number of words and number of lines in a given file. 10

No comments:

Post a Comment