Remote Method Invocation (RMI)

1

What is the output of this program?

    import java.lang.reflect.*;
    class Additional_packages {	 
         public static void main(String args[]) {
	     try {
	         Class c = Class.forName("java.awt.Dimension");
		 Method methods[] = c.getMethods();
		 for (int i = 0; i < methods.length; i++)
		     System.out.println(methods[i]);
		 }
	     catch (Exception e){
             System.out.print("Exception");
             }
        }
    }

a) Program prints all the constructors of 'java.awt.Dimension' package.

b) Program prints all the methods of 'java.awt.Dimension' package.

c) Program prints all the data members of 'java.awt.Dimension' package.

d) program prints all the methods and data member of 'java.awt.Dimension' package.


2

What is the length of the application box made by this program?

    import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet {
        Graphic g;
        g.drawString("A Simple Applet",20,20);    
    }
A. 20
B. Default value
C. Compilation Error
D. Runtime Error

3

What is the output of this program?

    import java.lang.reflect.*;
    class Additional_packages {	 
         public static void main(String args[]) {
	     try {
	         Class c = Class.forName("java.awt.Dimension");
		 Field fields[] = c.getFields();
		 for (int i = 0; i < fields.length; i++)
		     System.out.println(fields[i]);
		 }
	     catch (Exception e){
             System.out.print("Exception");
             }
        }    
    }

a) Program prints all the constructors of 'java.awt.Dimension' package.

b) Program prints all the methods of 'java.awt.Dimension' package.

c) Program prints all the data members of 'java.awt.Dimension' package.

d) program prints all the methods and data member of 'java.awt.Dimension' package.


4

What is the output of this program?

    import java.lang.reflect.*;
    class Additional_packages {	 
         public static void main(String args[]) {
	     try {
	         Class c = Class.forName("java.awt.Dimension");
		 Constructor constructors[] = c.getConstructors();
		 for (int i = 0; i < constructors.length; i++)
		     System.out.println(constructors[i]);
		 }
	     catch (Exception e){
             System.out.print("Exception");
             }
        }
    }

A. Program prints all the constructors of 'java.awt.Dimension' package.

B. Program prints all the possible constructors of class 'Class'.

C. Program prints "Exception"

D. Runtime Error


5

Which of these package is used for all the text related modifications?

A. java.text
B. java.awt
C. java.lang.text
D. java.text.mofify