# IGNOU Question Paper Solutions/MCA/Semester 1/MCS-011 Problem Solving and Programming/December 2010

MCA (REVISED)

Term End Examination December – 2010

MCS-011 : PROBLEM SOLVING AND PROGRAMMING

Note : Question No. 1 is compulsory. Answer any three question form the rest.

Q.1. (a) Write an algorithm, in C to sort a given list of numbers in ascending order usingbubble sort. (10)

Q.1. (b) What is Pointer? Give example. Write a program to swap the value using pass by value” and “pass by reference” method. (10)

Q.1. © explain file handling in C. What is EOF and its value? Write a program to copy one file to another. (10)

Q.1. (d) Explain (with example) :- (2.5x4=10)

```   (i)    Unary Operators in C
(ii)   Array
(iii)  Syntax and semantic errors
(iv)   Size of Operator
```

Q.2. (a) Write a program in C to display the following output. (08)

```                1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
3 2 1 2 3
2 1 2
1
```

Q.2. (b) Write a program to subtract 2 matrices of size 3x3. (08)

Q.2. © explain function prototype with examples. (04)

Q.3. (a) What are various storage classes in C, give an example of each. (06)

Q.3. (b) Write loops that calculate the sum of given series : (07)

```   1+2+4+7+11+16+………….. with :-
(i)    do – while loop.
(ii)    for loop
```

Q.3. © Using an example, give steps to calculate the average and worst case complexity of and algorithm. (07) Q.4. (a) differentiate between :- (2.5x4=10)

```   (i)    & and &&.
(ii)    text and binary file.
(iii)    pointer to function and function pointer.
```

Q.4. (b) A C program contains the following declaration  :- (1x5=05)

```   int arr [3][2] = { {1,2}, {3,4}, {5,6} };
What is the meaning of the following :
(i)    * (arr +2)
(ii)    * (* (arr) + 1) +1
(iii)    * (* (arr) + 2)
(iv)    arr
Iv)    (* (arr) + 2) + 1
```

Q.4. © Write a program in C to concatenate 2 strings without using strcat () function. (05)

Q.5. (a) Write a program in C to implement binary search in a given list of numbers. Also give the average complexity of binary search. (10)

Q.5. (b) Using the concept of structures, write a program to display the salary, department and other details of employees of an organization. Make necessary assumptions wherever necessary. (05)

Q.5. © Explain dynamic memory allocation with examples. (05)