Mumbai University Previous year question papers Computer Programming II Dec 2009

Mumbai University Previous year question papers

I Year Examination Dec 2009

Computer Programming-II

N.. 1) Question NO.1is CO~PUISOry.

(2) Attempt any four questions from remaining six questions.

 

(3) Assume any data if required and state the assumption.

 

 

1. (a) What is object oriented programming paradigm? Explain each concept.

(b) What is the output of the followingprograms :-

(i) #include<iostream.h>

 

void mainO

{

List the basic concepts of it?

int i=1 ,j=1;

for (;;)

{

if(i>3)break;

else j+=i;

couk <j < <endl;

i+=j;

}

}

(ii) #include<iostream.h>

void mainO

{

int k=3, l=4, m;

m=++k + l–;

couk<“Value of m”«m«endl;

m=k+++–~

couk<“Value of m”«m«endl;

}

2. (a) Write a program that simulates a simple calculator. It reads two integers and one character. Ifthe character is a +, the sum is printed; if it is a -, the difference is printed; if it a *, the product is printed, if it is a I, the quotient is printed and if it is a %, the remainder is printed. (Hint: Use a switch statement.)

(b) Write a program that calculates the square roots of a quadratic equation. 10

3. (a) Explain storage class with one programming example. 10

(b) Write a program to read elements of a square matrix and print the trace (Le., the sum of the main diagonal elements) of a two-dimensional square array of integers. For example, itwould return 46 for the array

11 22 33

40 20 60

35 25 15

 4. (a) Explainrecursionandwritea recursiveprogramfor calculatingfactorial of a given numberN.

(b) Writea programthat readsa positiveintegern andthenprintsa triangle of asterisks in n rows. If n=4,then the outputwouldbe

5. (a) Explain Call-by-value and Call-by-reference with example.

 

(b) Write a program to find area of circle, area of rectangle and area of triangle using function overloading.

6. (a) Write a program that reads any positive integer n and prints the digits in words. 10

(For example, if input is1265 then output is one two six five).

(b) Write a program to check whether a given string is palindrome or not.

 

7. (a) What is virtual function? What is the need of virtual function?

(b) What do mean by dynamic initialization of variables? How it is achieved? Give an example.

(c) Explain the difference betweer1″aconstructor andad~stractbr in C+¥(.

(d) Explain Bit wise operators in C++.

Leave a Comment