Advance Java Programming(Class Test-I)

25 Questions | Total Attempts: 4604

SettingsSettingsSettings
Advance Java Programming(Class Test-I) - Quiz


Questions and Answers
  • 1. 
    Swing components are
    • A. 

      Platform dependent

    • B. 

      Platform independent

    • C. 

      Both a & b

    • D. 

      Platform Oriented

  • 2. 
    Which of following are subclasses of java.awt.Component?
    • A. 

      Container

    • B. 

      LayoutManger

    • C. 

      Color

    • D. 

      Font

  • 3. 
    What is the purpose of JTable?
    • A. 

      JTAble object displays rows of data

    • B. 

      JTAble object displays columns of data

    • C. 

      JTAble object displays rows and columns of data

    • D. 

      JTAble object displays data in Tree form

  • 4. 
    Which of these are constants defined in WindowEvent class?
    • A. 

      WINDOW_ACTIVATED

    • B. 

      WINDOW_CLOSED

    • C. 

      WINDOW_DEICONIFED

    • D. 

      All of the above

  • 5. 
    Identify missing statement:-import java.awt.*;import java.applet.*;import javax.swing.*;public class Combo extends JApplet{    public void init()    {        Container c=getContentPane();        JComboBox jc=new JComboBox();        jc.addItem("AJP");        jc.addItem("STE");        jc.addItem("AMI");        jc.addItem("EDP");          }}/*<applet code="Combo.class" height=200 width=200></applet>*/
    • A. 

      Add(jc);

    • B. 

      Jc.add(c);

    • C. 

      c.add(jc);

    • D. 

      Add(c);

  • 6. 
    Which abstract class is the super class of all menu related classes?
    • A. 

      MenuComponent

    • B. 

      MenuBar

    • C. 

      MenuItem

    • D. 

      CheckboxMenuItem

  • 7. 
    In swing MVC architecture used in that M stands for
    • A. 

      Main

    • B. 

      Mulit-level

    • C. 

      Model

    • D. 

      Method

  • 8. 
    The default orientation to display the progress bar is?
    • A. 

      CENTER

    • B. 

      TOP

    • C. 

      HORIZONTAL

    • D. 

      VERTICAL

  • 9. 
    Which event is generated by List
    • A. 

      ActionEvent

    • B. 

      MouseEvent

    • C. 

      ItemEvent

    • D. 

      KeyEvent

  • 10. 
    MutableTreeNode is extends.................. interface
    • A. 

      TreePath

    • B. 

      TreeNode

    • C. 

      DefaultMutableTreeNode

    • D. 

      MutableTreeNode

  • 11. 
    What Layout manger should you use so that every component occupies the same size in the container?
    • A. 

      FlowLayout

    • B. 

      GridLayout

    • C. 

      CardLayout

    • D. 

      BorderLayout

  • 12. 
    Which of the following methods can be used to change the size of a Component object?
    • A. 

      Setsize()

    • B. 

      SetSize()

    • C. 

      GetSize()

    • D. 

      Size()

  • 13. 
    How to create TextArea with 50 rows & 80 columns ?
    • A. 

      New TextArea(80,50);

    • B. 

      New TextArea(50,80);

    • C. 

      New TextArea(80);

    • D. 

      TextArea(80,50);

  • 14. 
    In given constructor 3rd parammeter is ScrollBar(int,int,int,int,int)
    • A. 

      Height

    • B. 

      Width

    • C. 

      ThumbSize

    • D. 

      Boxsize

  • 15. 
    Event is called as?
    • A. 

      Object that describe a state change in processing

    • B. 

      Object that describe any change by the user and system

    • C. 

      Event is class defining only object

    • D. 

      Object that describe a state change in source

  • 16. 
    MouseDragged() method  present in listener
    • A. 

      MouseListener

    • B. 

      MouseEvent

    • C. 

      MouseMotionListener

    • D. 

      MouseAdapter

  • 17. 
    JCheckBox is component defined in .......................package
    • A. 

      Awt

    • B. 

      Net

    • C. 

      Javax

    • D. 

      Swing

  • 18. 
    Identify the output of Program:import java.awt.*;import java.awt.event.*;public class MyMenu extends Frame{MenuBar mbr;Menu m1;MenuItem i1,i2;MyMenu(){mbr=new MenuBar();m1=new Menu("File");i1=new MenuItem("About");i2=new MenuItem("Exit");m1.add(i1);m1.add(i2);mbr.add(m1);setMenuBar(mbr);setLayout(new FlowLayout());}public static void main(String args[]){MyMenu m=new MyMenu();m.setSize(400,400);m.setVisible(true);}}
    • A. 

      Option 1

    • B. 

      Option 2

    • C. 

      Option 3

    • D. 

      None of the above

  • 19. 
    Identify missing statements:import java.awt.*;import java.applet.*;public class Combo extends JApplet{    public void init()    {        Container c=getContentPane();        JComboBox jc=new JComboBox();        jc.addItem("AJP");        jc.addItem("STE");        jc.addItem("AMI");        jc.addItem("EDP");           }}/*<applet ="Combo.class" height=200 width=200></applet>*/
    • A. 

      Code; javax.swing.*; c.add(jc);

    • B. 

      Javax.swing.*; c.add(jc); code

    • C. 

      Javax.swing.*;

    • D. 

      C.add(j);

  • 20. 
    Find missing statement in program:import java.awt.event.*;import javax.swing.*;import java.awt.*;public class JButtonInAction extends JFrame implements .........................{  JButton rb, gb, bb ;  Container c;  public JButtonInAction( )  {    c = getContentPane();                  c.setLayout(new FlowLayout());              rb = new JButton("Red");    gb = new JButton("Green");    bb = new JButton("Blue");     rb.add................................(this);                  gb.addActionListener(this);    bb.addActionListener(this);     c.add(rb);    c.add(gb);  ................. ;                          setTitle("Buttons In Action");                setSize(300, 350);    setVisible(true);  }                                 public void actionPerformed(ActionEvent e)  {     String str = ........................................        if(str.equals("Red"))                               c.setBackground(Color.red);               else if(str.equals("Green"))                                      c.setBackground(Color.green);     else if(str.equals("Blue"))                                      c.setBackground(Color.blue);  }  public static void main(String args[])  {    new JButtonInAction();    }}
    • A. 

      ActionListener , c.add(bb); , ,ActionListener, e.getActionCommand();

    • B. 

      c.add(bb); ,ActionListener ,ActionListener, c.add(bb);

    • C. 

      ActionListener ,ActionListener, c.add(bb); , e.getActionCommand();

    • D. 

      ActionListener, c.add(bb); , e.getActionCommand();

  • 21. 
    What components needed to get following output?
    • A. 

      TabbedPane,List,Applet

    • B. 

      Applet,TabbedPane,Panel

    • C. 

      Panel,TabbedPane,List

    • D. 

      Applet,Panel,TabbedPane

  • 22. 
    What component is needed to get following output?
    • A. 

      Choice

    • B. 

      List

    • C. 

      JList

    • D. 

      JCombobox

  • 23. 
    Which method you can set or change the text in a Label?
    • A. 

      SetText()

    • B. 

      GetText()

    • C. 

      Both A & B

    • D. 

      None of above

  • 24. 
    The method in ActionEvent................................. returns actionCommand of the button
    • A. 

      GetId()

    • B. 

      GetActionCommand()

    • C. 

      GetModifiers()

    • D. 

      ParamString()

  • 25. 
    How to disable the default layout manger?
    • A. 

      SetLayout(false);

    • B. 

      SetLayout();

    • C. 

      SetLayout(null);

    • D. 

      Setnull();

Back to Top Back to top