Mumbai University Previous year question papers Computer Programming I June 2008

Mumbai University Previous year question papers

I Year Examination June 2008

Computer Programming-I

N.S. (1) Question NO.1 is compulsory.

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

(3) Assu.mptions made should be clearly stated.

(4) Answers to questions should be grouped and written together, i,e. all answers to sub questions of individual questions like 01, 02, 03 etc. should be answered one below other.

(5) All computer programs and program segment only in JAVA.

1. (a) Explain Applets in JAVA in terms of the following :-

(i) Creating an executable Applet

(ii) Designing a Web page which references an Applet

(iii) Adding Applets to HTML File

(iv) Running the Apph=:t

 

(v) The Basic Applet Life Cycle, init(), start(), stop(), and destroyO

(b) Write Object Oriented programs in JAVA to exemplify different types of visibility modifiers namely

(i) public

(ii) protected

(Hi) private

(iv) private protected

(v) friendly (default)

2. (a) Write an object Oriented Program in JAVA that uses Euclid’s Algorithm to display the greatest common divisor of two integers. The greatest c(Jmmondivisor of two numbers is the largest number that divides into both numbers. Here is how the algorithm works?

(i) Find the remainder after dividing the larger number by the smaller number, using the modulus operator.

(ii) Change the larger number to the smaller number and change the smaller number to the remainder frpm step (i)

(iii) Keep doing this until the remainder is zero Incorporate member functions for data input, displaying the result, default constructor and constructors with two parameters. Also create objects to reference the member functions.

(b) Develop a JAVA program that determines the number of days in a given semester. Input to the program is the year, month, and day information of the first and the last days of a semester. The program should accept the date” information as a single string instead.of accepting the year, month and day information separately. The input string must be in the MM/DD/YYYYformat.

3. (a) Write a JAVA program to compute the distances S fallen by an object in freefall. The formula is = 80 + \fat +h * a* t2 Make a table of S for t = 1, 5, 10, 15, 2Q . . . . . . 100.

(b) Write an obj~ct oriented program to arrange the names of students in descending order of their total marks, input data consists of student details such as name, ID.no, Marks of Mathematics, Physics, Chemistry. Use array of objects.

4. With the help of suitable JAVAprograms describe following:

(i) Over loading functions

(ii) Overriding functions

(iii) Final methods and classes

(iv) Abstract methods and classes

(v) Finalize 0 method.

5. (a) Write detailed note on Exception handling in JAVA in terms of following :-

(i) Try-catch

(ii) The finally keyword

(iii) Catching multiple exceptions

(iv) The throws keyword. Throwing Exception.

(b) With the help of suitable program explain Multithreaded programming  in terms of following:

(i) Creating threads, extending, the’ thread class

(ii) Stopping and blocking a thread

(iii) Lifecycle of a thread.

6. Lnterface Matrix

final static int M=5,N=5;//Matrix indices

void re~dMatrixO;//Read a Matrix

void displayMatrixO;//Display a Matrix

void addMatrixO;I/ Add two’Matrix

void multMatrix();//Multiplay twomatrix.

void transposeMatrixO/ITranspose of Matrix

implement the above interface using a suitable JAVA class program and also develop the main program.

7. Write notes on the following with the. help of suitable program segments in JAVA:

(a) Vectors

(b) Strings-

(c) Packages

(d) Interfaces

Leave a Comment