My Report (&Account)

Java Interface Test – 2


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What will be the output of the following Java 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");
             }
        }
    }

2. What is the length of the application box made in the following Java program?

 
    import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet
    {
        Graphic g;
        g.drawString("A Simple Applet",20,20);    
    }

3. Which of this package is used for invoking a method remotely?

4. Which of these package is used for graphical user interface?

5. Which of these class allows us to get real time data about private and protected member of a class?

6. What will be the output of the following Java 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");
             }
        }
    }

7. Which of this package is used for handling security related issues in a program?

8. Which of this package is used for analyzing code during run-time?

9. What will be the output of the following Java 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");
             }
        }
    }

 

Start practicing “1000 MCQs on Java”, and once you are ready, you can take tests on all topics by attempting our “Java Test Series”.

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.