MU First Year Engineering (Semester 2)
Structured Programming Approach
May 2012
Total marks: --
Total time: --
INSTRUCTIONS
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary


1 (a)(i) What will be the output of the following:-
#include
void show(int a, int b, int c){
printf("%d %d %d", a, b, c);
}
int j;
int *i = &j;
j = 2;
int k[] = {1, 2, 3};
void main(){
show(*i, j, *k);
}
2 M
1 (a)(ii) Select the correct option: A class becomes abstract when
(i) Keyword abstract preceeds the class name
(ii) All the functions in the class are pure virtual
(iii) Atleast one function in the class is pure virtual
(iv) It derives virtually from base class.
2 M
1 (a)(iii) What is the output of the following code:-
#include
#define m(a, b)(a > b ? a : b)
void main(){
int i = 5, j = 15;
printf("%d", m(++i, j++));
}
2 M
1 (a)(iv) Write the output of the following:-
#include
void swap(int i, int j){
int temp = i; i = j; j = temp;
}
void main(){
int k = 13, m = 45;
swap(k, m);
printf("k = %d, m = %d", k, m);
}
2 M
1 (a)(v) while(expression){}
To terminate this loop, the value of the expression should evaluate to true or false?
2 M
1 (b) Discuss the merits and demerits of Object Oriented Methodology.
10 M

2 (a) Write a program to find number of and sum of all integers greater than 200 and less than 350 that are divisible by 9.
10 M
2 (b) Write a program that reads an integer N followed by N numbers. It prints each number and the sum of numbers read so far.
10 M

3 (a) Differentiate between structures and unions from the operations on them and memory allocation point of view.
10 M
3 (b) Write a program to represent and process complex numbers as a structure. Process should include adding complex numbers and printing them in x + iy format.
10 M

4 (a) Write a method called delete(String str, int m) in an appropriate class that requires the input string with mthcharacter removed.
10 M
4 (b) Explain various storage classes in C.
10 M

5 (a) Class string has a data member str of type char*. Distinguish from the point of view of constructors following statements:-
(i) String name1("XYZ");
(ii) String name2(name1);
10 M
5 (b) What are destructors? State the necessity in 5(a).
10 M

6 (a) Write a program to add two matrices.
10 M
6 (b) Explain binary operator overloading using suitable example.
10 M

Write short notes on any two:-
7 (a) Runtime polymorphism
10 M
7 (b) Data Abstraction & Encapsulation
10 M
7 (c) Friend function
10 M



More question papers from Structured Programming Approach
SPONSORED ADVERTISEMENTS