Section – A
Q.1. Find the output of the following:-
(a).class MAIN{
void calculate( int a, int b)
{ show( a+b);
System.out.print(“Calculating”) }
public MAIN( int x, int y)
{calculate( x,y);
System.out.print(“ In Initialize “ + x+” & “ +y +”Place”); }
void show( int x)
{System.out.print(I am Printing: ” + x);}
Public static void main(String args[])
{MAIN ob=new Mani(10,-90);
}
}
void calculate( int a, int b)
{ show( a+b);
System.out.print(“Calculating”) }
public MAIN( int x, int y)
{calculate( x,y);
System.out.print(“ In Initialize “ + x+” & “ +y +”Place”); }
void show( int x)
{System.out.print(I am Printing: ” + x);}
Public static void main(String args[])
{MAIN ob=new Mani(10,-90);
}
}
(b). i. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{ display(11, 19 );
}
void display(int i, int j ){
System.out.println(i>>j);
System.out.println(i<<j);
}
{ display(11, 19 );
}
void display(int i, int j ){
System.out.println(i>>j);
System.out.println(i<<j);
}
ii. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{ manipulate(11 ); }
void manipulate(int i){
int n=i*5;
System.out.println(“i= ” + i%i++ );
i%=--n+1;
System.out.println(“n= ” + n );
}
{ manipulate(11 ); }
void manipulate(int i){
int n=i*5;
System.out.println(“i= ” + i%i++ );
i%=--n+1;
System.out.println(“n= ” + n );
}
Q2. Find Errors and Rewrite correct code the following program code:-
(a) .public class MAINPRO {
int a,b;
public void MAINPRO(int x, int y)
{ x=100;
y=200; }
public static void main(String args[])
{ MAINPRO(120, 50) obj = new MAINPRO(10);
a=20;
b=30; }
}
int a,b;
public void MAINPRO(int x, int y)
{ x=100;
y=200; }
public static void main(String args[])
{ MAINPRO(120, 50) obj = new MAINPRO(10);
a=20;
b=30; }
}
(c). Write a Java Class ABC and define two class methods like “swapByVal()” for swapping two number by value , “swapByRef()” for swapping variable value by using reference parameter. And also display swaped value on screen, these method call in main () method.
(d). Write NetBean IDE code to display following output: 1! + 2! + 3! + 4! + ……… + N!
Section – B
Q4. Differentiate with example :-
(a) Testing & Debugging
(b) Try & Catch and Throws.
Q5. Answer the following questions
(a). What is Error? Explain different type of errors.
(b) Design an application having an interface like:
Implement functionality by writing methods with passing the argument of three textboxes in, clacSum(), calcAvg() & calcMax(). Invoke these methods from buttons event handlers.
Q6. Answer the following questions
I. Write down Problem solving Methodology and Techniques
II. Difference between Primitive data type and User define data type.
II. Difference between Primitive data type and User define data type.
Q7. Answer the following questions [any two ]
(a). Write a program & design IDE form to define two method calcCI() & calcSI() to pass Principal Amount & Time as a argument and return Simple Interest & Compound Interest respectively as per following criteria :-
Amount | Time | Rate |
1-5000 | 0-5 | 10% |
5000-10000 | 6-8 | 15% |
10000- 20000 | 9-12 | 20% |
20000-50000 | 13-20 | 25% |
>50000 | >20 | 30% |
(b). Write Java method and integer number of series terms as a argument to print following series. 1, 2, 4, 8, 16, 32,………..
c). Write a Java code to display following Code:-
0
0 2
0 2 4
0 2 4 6
0 2 4 6 8
0
0 2
0 2 4
0 2 4 6
0 2 4 6 8