(Paper) BCA : CS-74 Introduction to Internet Programming Paper

Paper : BCA : CS-74 Introduction to Internet Programming Paper
Note: Question number 1 is compulsory. Answer any three questions from the rest.

Q.1. (a) Write a program in Java to perform the addition of two complex numbers.

(b) Explain what happens if private is applied to a method in a class. Give an example.

(c) Write the output of the following statements where int a = - 8, b = 4 ;
(i) ++b<<1
(ii) a >> 2
What are final variable, final method and final class ?

(d) What are final variable, final method and final class ?

(e) Write a program in Java that asks the user to choose "circle" or "rectangle". On choosing "circle" she has to enter its radius. If "rectangle" is chosen, she is prompted to input the lengths of its sides.
Use an overloaded method to calculate the area and output the value on the screen.

Q.2. (a) Write a program that prompts the user to enter an integer divisor and an integer dividend. The program should output the quotient and the remainder. Catch any arithmetic exception and output the suitable message.

(b) Define a constructor. Is it possible, to overload a constructor ? Justify your answer using an example.

Q.3. (a) What is finally block in Java ? How many finally blocks can be associated with a try block ? Give an appropriate example and explain.

(b) Describe the accessibility of unnamed, private, protected and public members within a package, subclass and globally.

Q.4. (a) Consider the following class definition :
public class Excellent extends Good
{ public Excellent (int i)
{
}
public Excellent(int i, int j)
{ super (i, k);
}
}
In how many ways can the instances of Excellent class be created ? Write the corresponding statements.

(b) Write a program to find the Least Common Multiple (LCM) of two integers.

Q.5. (a) Write a program to input characters from the keyword and output a table giving the different numbers of vowels.

(b) Is every Java program platform independent ? Justify your answer.