Pimpri Chinchwad Polytechnic, Akurdi

16 Questions | Total Attempts: 58

SettingsSettingsSettings
Please wait...
Pimpri Chinchwad Polytechnic, Akurdi

Computer DepartmentAcademic Year - 2016 -2017Subject - AJP (17625)Class Test - I


Questions and Answers
  • 1. 
    …………….class  is used to display hierarchical data.
    • A. 

      JTable

    • B. 

      JPanel

    • C. 

      JApplet

    • D. 

      JTree

  • 2. 
    At the top of the AWT Hierarchy is the …………..class.
    • A. 

      Component

    • B. 

      Container

    • C. 

      Frame

    • D. 

      Applet

  • 3. 
    The general form to set a specific type of layout manager
    • A. 

      Void setLayout(LayoutManager lm)

    • B. 

      Void setLayout(LayoutManager lm)

    • C. 

      Void setLayout(layoutManager lm)

    • D. 

      Void setLayout(Layoutmanager lm)

  • 4. 
    Text area that is 80 character-widths wide and 10 character-heights tall can be created with which syntax?
    • A. 

      New TextArea(80, 10)

    • B. 

      New TextArea(10, 80)

    • C. 

      New TextArea(10)

    • D. 

      New TextArea(80)

  • 5. 
    Which of the following is not awt control ?
    • A. 

      ButtonGroup

    • B. 

      Checkbox

    • C. 

      CheckboxGroup

    • D. 

      Button

  • 6. 
    Default Layout of Dialog class
    • A. 

      FlowLayout

    • B. 

      BorderLayout

    • C. 

      GridLayout

    • D. 

      Null Layout

  • 7. 
    Which of these methods are used to determine type of event
    • A. 

      GetId()

    • B. 

      GetEvent()

    • C. 

      GetSource()

    • D. 

      GetActionCommand()

  • 8. 
    Import javax.swing.*;/*<applet code="Demo" width=500 height=500></applet>*/public class Demo extends Japplet{public void init(){Jlabel l = new Jlabel("Sample");add(l);l.setIcon("images/copy.gif");}}
    • A. 

      Label will be displayed with only image

    • B. 

      Label will be displayed with only caption

    • C. 

      Label will be displayed with both image and icon

    • D. 

      Error will be generated No such method

  • 9. 
    Which is correct code for given output
    • A. 

      Import java.awt.*; import java.applet.*; public class LayDemo extends Applet {    public void init()    {       Button b1=new Button ("OK");      Button b2=new Button("Cancel");       FlowLayout f=new FlowLayout(200,200);       setLayout(f);       add(b1);      add(b2);    } }

    • B. 

      Mport java.awt.*; import java.applet.*; public class LayDemo extends Applet {    public void init()    {       Button b1=new Button ("OK");      Button b2=new Button("Cancel");      FlowLayout f=new FlowLayout(FlowLayout.RIGHT);      setLayout(f);      add(b1);        add(b2);    } }

    • C. 

      Import java.awt.*; import java.applet.*; public class LayDemo extends Applet {    public void init()   {       Button b1=new Button ("OK");       Button b2=new Button("Cancel");       setLayout(new FlowLayout());      add(b1);      add(b2);    } }

    • D. 

      Import java.awt.*; import java.applet.*; public class LayDemo extends Applet {    public void init()   {       Button b1=new Button ("OK");       Button b2=new Button("Cancel");        BorderLayout b=new BorderLayout();        setLayout(b);      add(b1,”East”); add(b2,”East”);  }}

  • 10. 
    Import java.net.*;class Networking{public static void main(String[] args) throws UnknownHostException {InetAddress obj1 = InetAddress.getByName("sanfoundary.com");InetAddress obj2 = InetAddress.getByName("sanfoundary.com");boolean x = obj1.equals(obj2);System.out.print(x);     }    }
    • A. 

      0

    • B. 

      1

    • C. 

      True

    • D. 

      False

  • 11. 
    JButton generate what type of event?
    • A. 

      ActionEvent

    • B. 

      MouseEvent

    • C. 

      WindowEvent

    • D. 

      Both ActionEvent and MouseEvent

  • 12. 
    Which of the following is not one of the seven methods for handling window events?
    • A. 

      WindowClosing

    • B. 

      WindowClosed

    • C. 

      WindowOpened

    • D. 

      WindowOpening

  • 13. 
    Import java.applet.*;import java.awt.*; /*<applet code="ButtonExample" width=100 height=200></applet>*/ public class ButtonExample extends Applet{         public void init(){                 Button Button1 = new Button("Ok");                Button Button2 = new Button("Cancel");                add(Button1);                add(Button2);                               Button2.setEnabled(false);        }}
    • A. 

      Creates 2 Buttons on Applet. Method setEnabled won't effect

    • B. 

      Creates 2 Buttons. Button1 is accessible. Button2 is not accessible

    • C. 

      Gives error setEnabled can't be applied to Button class

    • D. 

      None of These

  • 14. 
    Public class Demo extends Applet{public void init(){ Button N = new Button("NORTH");   Button S = new Button("SOUTH");   Button E = new Button("EAST");   Button W = new Button("WEST");   Button C = new Button("CENTER");setLayout(new BorderLayout());      setBackground(Color.red);      setForeground(Color.white);      add("North", N);      add("South", S);      add("Center", C);      add("West", W);      add("East", E);}}What will be output after executing this code?
    • A. 

      Option 1

    • B. 

      Option 2

    • C. 

      Option 3

    • D. 

      Option 4

  • 15. 
    Import java.applet.*;import java.awt.*;/* */ public class ChoiceExample extends Applet{         Choice language = null;               public void init(){                 language = new Choice();                language.add("Java");                language.add("C++");                language.add("VB");                language.add("Perl");               add(language);                 }               public void paint(Graphics g){                 String str = // value to be assignedg.drawString(str,50,50);        }     }To display second item in the list
    • A. 

      Language.getItem(2);

    • B. 

      Language.select(2);

    • C. 

      Language.get(2);

    • D. 

      Language.select(2);

  • 16. 
    Import java.awt.*;    import java.applet.*;    public class myapplet extends Applet {        public void paint(Graphics g) {            g.drawString("A Simple Applet", 0, 0);            }    }What will be displayed in applet window?
    • A. 

      Blank window

    • B. 

      Only trailing part of string

    • C. 

      Error 0,0 coordinates does not exists

    • D. 

      A simple applet at the center of applet window

Back to Top Back to top