Mumbai University Previous year question papers Computer Programming I Dec 2008

Mumbai University Previous year question papers

I Year Examination Dec 2008

Computer Programming-I

N. B.: (1) Question NO.1 is compulsory.

(2) Attempt any four questions out of remaining six questions.

 (3) Assumptions made should be clearly stated.

(4) All computer programs and program segment only in Java.

1. (a) Explain life cycle of a thread.

(b) Write a program in java to find nCr and npr’

(c) Explain JVM in brief.

(d) Write a program to determine the sum of the series for a given value of n.

1 + V2+1/3 + + 1/n

2. (a) Compare and contrast overriding method and overloading method with suitable examples.

(b) Write a program in java for fitting a straight line through a set of points

(xi’Yj), i = 1, “‘J n. The straight line equation is Y = mx + c and the values of m and c are given by

n2:(XiYi)(Ixi) (2:Yi)

m =n (Ixf) – (LYi)2

1C =- n (2: y. -mIx,) I I 

3. (a) Write a program to display the following menus and submenus.

Menu demo

File Edit View

Undo

Cut

Copy

Paste

(b) Explain different types of inheritance with suitable examples.

4. (a) What is vector? How it is different from an array?

(b) What are the applications of wrapper classes?

(c) Assume that a bank maintains two kind of account for its customers. The saving’ account provides compound interest and withdrawal facilities but no cheque book facility. The current account provides cheque book facility but no interest. Current account holders should also maintain a minimum balance and if the balance falls below this level, a service charge is imposed.

Create a class account that stores customer name, account number and type of account. From this derive the classes current-acct and saving-acct to make them more specific to their requirements. Include the necessary methods in order to achieve the following tasks:

 (i) Accept deposit from a customer and update the balance.

(ii) Display the balance.

(iii) Compute and deposit interest

(iv) Permit withdrawal and update the balance

(v) Check for the minimum balance, impose penalty, if necessary, and update the balance.

5. (a’) ~xplairi Java Exception Handling with different examples.

(b) Write a program to create multiple threads.

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

6. (a) How do you add a class or an interface to a package? Explain with examples.

(b) Will the code compile? if not, why? if yes, write output.

(i) import circle;

class Import Class

{

1~

b

public static void main (String [ ] args)

{

circle. NewCircie nc = new circle.NewCircie ( ) ;

System.out.println (” Hellow World! “) ;

}

}

(ii) int m = 10;

int n = 7;

while ( m % n > = 0)

{

m=m+1;

n = n + 2;

}

(c) Explain Type Conversion and Type Casting in Java with examples.

7. Write short notes on (any four) :-

(a) HTML Applet Tags

(b)Parameter Passing to Applets

(c) Abstract Methods and Classes

(d) Features of Java

(e) Synchronization

(f) String Methods.

Leave a Comment