Menu

Objective Type Questions & Answers


Object Oriented Programming through Java MCQs - Unit-5



1. Which of these functions is called to display the output of an applet?

A . display()

B . paint()

C . displayApplet()

D . PrintApplet()

Answer



2. Which package contains the Java Swing classes? 

A . java.lang

B . java.io

C . java.util

D . javax.swing

Answer



3. Which layout manager is used by default for JFrame? 

A . BorderLayout

B . FlowLayout

C . GridLayout

D . CardLayout

Answer



4. Which class is used to create a button in Java Swing? 

A . JButton

B . JLabel

C . JRadioButton

D . JTextArea

Answer



5. What is the purpose of the setVisible() method in JFrame? 

A . To set the size of the frame

B . To set the title of the frame

C . To make the frame visible on the screen

D . To close the frame

Answer



6. Which of these methods can be used to output a string in an applet?

A . display()

B . print()

C . drawString()

D . transient()

Answer



7. Which of these methods is a part of Abstract Window Toolkit (AWT) ?

A . display()

B . paint()

C . drawString()

D . transient()

Answer



8. Which of these modifiers can be used for a variable so that it can be accessed from any thread or parts of a program?

A . transient

B . volatile

C . global

D . No modifier is needed

Answer



9. Which of these operators can be used to get run time information about an object?

A . getInfo

B . Info

C . instanceof

D . getinfoof

Answer



10. ______________________ follows MVC (Model View Controller) architecture.

A . Swing

B . AWT

C . Both A & B

D . None of the above

Answer



11. _________ is not a part of JFC (Java Foundation Classes) that is used to create GUI application?

A . Swing

B . AWT

C . Both A & B

D . None of the above

Answer



12. The ActionListener interface is used for handling action events,For example,it`s used by a

A . JButton

B . JCheckbox

C . JMenuItem

D . All of these

Answer



13.  Java applets are used to create _______________ applications 

A . Graphical

B . User interactive

C . Both a & b

D . None of these

Answer



14.  An Applet is a ________ of Panel: 

A . Subclass

B . Superclass

C . Both a & b

D . None of these

Answer



15. Which method is used to add components to a container in Java Swing? 

A . add()

B . setComponent()

C . insert()

D . append()

Answer



16. Which class is a subclass of Component?  

A . Container

B . Window

C . Frame

D . none

Answer



17. What is the purpose of the setLayout() method in Java Swing? 

A . To set the background color of a component

B . To set the size of a component

C . To set the layout manager for a container

D . To set the font style for a component

Answer



18. The ____ method is used to obtain the current size of a window. 

A . getSize()

B . setSize()

C . None

D . Both

Answer



19. Which class is used to display text in Java Swing? 

A . JTextField

B . JTextArea

C . JLabel

D . JList

Answer



20. Which class is used to display images in Java Swing? 

A . JButton

B . JLabel

C . JRadioButton

D . JTextArea

Answer



21. Which of these events will be generated if we close the applet? 

A . ActionListener

B . ItemListener

C . MouseListener

D . WindowListener

Answer



22. What is the default layouts for a applet, a frame and a panel?          

A . Flow layout, Border layout, Flow layout

B . Flow layout, Flow layout, Border layout

C . Border layout, Flow layout, Flow layout

D . Border layout,Border layout, Flow layout

Answer



23. An Applet has its Layout Manager set to the default of FlowLayout. What code would be the correct to change to another Layout Manager?  

A . setLayoutManager(new GridLayout());

B . setLayout(new GridLayout(2,2));

C . setGridLayout(2,2,))

D . setBorderLayout();

Answer



24. Which method is used to set the text content of a JTextField? 

A . setText()

B . append()

C . setLabel()

D . setContent()

Answer



25. Which of the following architecture does the Swing framework use?

A . MVC

B . MVP

C . Layered architecture

D . Master-Slave architecture

Answer



26. What is the purpose of the setDefaultCloseOperation() method in JFrame? 

A . To set the size of the frame

B . To set the title of the frame

C . To specify the default close operation for the frame

D . To close the frame

Answer



27. Which class is used to display tabbed panes in Java Swing? 

A . JTabbedPane

B . JSlider

C . JProgressBar

D . JSpinner

Answer



28. The ………………… method called the first time an  applet is loaded into the memory of a  computer.

A . init( )

B . start( )

C . stop( )

D . destroy( )

Answer



29. From the following statements which is a drawback for Applet?

A . It works at client side so less response time

B . Most of the web browsers support applets.

C . It can be executed by browsers running under many platforms, including Linux, Windows, and Mac Osetc.

D . Plugin is required at client browser to execute applet

Answer



30. A ____ is the abstract foundation class for SWING`s non-menu user interface controls?

A . Container

B . Jcomponent

C . Component

D . Panel

Answer



31. A ____ is the basic class for all SWING UI components?

A . Container

B . Jcomponent

C . Component

D . JPanel

Answer



32. An ____ is a change in the state of an item?

A . Spinner

B . Event

C . Occurrence

D . Activity

Answer



33. Which of the following function is used to generate the application`s top-level window?

A . JPanel

B . JFrame

C . JCombo

D . JWindow

Answer



34. ____ is a container for other components and is used to build bespoke panels for organizing and arranging components?

A . JPanel

B . JFrame

C . JCombo

D . JBox

Answer



35. Which of the following component gives a drop-down list of options from which to choose?

A . JPanel

B . JButton

C . JComboBox

D . JBox

Answer



36. The ____ class serves as the foundation for all Swing components.

A . JButton

B . JComponent

C . JTextField

D . JPanel

Answer



37. In _____________the components are platform independent?

A . AWT

B . Swing

C . Both

D . None of the above

Answer



38. An ____ is a java program that runs in a web browser.

A . Application

B . AWT

C . Applet

D . JFrame

Answer



39. A ____ is a Swing framework component that offers a scroll bar that may be used to scroll content in a container.

A . JScrollPanel

B . JScrollBox

C . JScroll

D . JScrollBar

Answer



40. The ____ function allows you to paint with a Graphics object.

A . AllPaint()

B . Jpaint()

C . Repaint()

D . paint()

Answer



41. Which applet java.awt.component class provides the life cycle method?

A . public void paint(Graphics g)

B . public void destroy()

C . public void stop()

D . public void init()

Answer



42. What invokes immediately after the start() method and also any time the applet needs to repaint itself in the browser?

A . a.stop()

B . b. init()

C . c. paint()

D . d. destroy()

Answer



43. What is used to run an Applet?

A . An html file

B . An AppletViewer tool(for testing purpose)

C . Both A & B

D . None of the above

Answer



44. When an applet is terminated which of the following sequence of methods calls take place?

A . stop(),paint(),destroy()

B . destroy(),stop(),paint()

C . destroy(),stop()

D . stop(),destroy()

Answer



Fill in the Blanks


45. Is Applet and Application both are same in the swing framework?(Yes/No)________________

Answer


46. Applet works at client side so less response time.(True / False)?

Answer


47.The APPLET tag is used to start an applet from both an HTML document and from an applet viewer(True/False)?

Answer


48. All Applets must import java.applet and java.awt.(True/False)?

Answer


49. The APPLET tag is used to start an applet from both an HTML document and from an applet viewer(True/False)?

Answer


50. Applet runs inside the browser and does not work at client side(True/False)?

Answer




Relevant Materials :

Object Oriented Programming through Java MCQs - Unit-1 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-2 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-3 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-4 - [ OOP_JAVA ]

Object Oriented Programming through Java MCQs - Unit-5 - [ OOP_JAVA ]


Similar Materials :

R - Programming MCQs - Unit-1 - [ R-Programming ]

R - Programming MCQs - Unit-2 - [ R-Programming ]

R - Programming MCQs - Unit-3 - [ R-Programming ]

R - Programming MCQs - Unit-4 - [ R-Programming ]

R - Programming MCQs - Unit-5 - [ R-Programming ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-1 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-2 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-3 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-4 - [ FLAT ]

Formal Languages and Automata Theory (FLAT) MCQs - Unit-5 - [ FLAT ]

PPS MCQs - Unit-1 - [ PPS ]

PPS MCQs - Unit-2 - [ PPS ]

PPS MCQs - Unit-3 - [ PPS ]

PPS MCQs - Unit-4 - [ PPS ]

PPS MCQs - Unit-5 - [ PPS ]

Design and Analysis of Algorithms MCQs - Unit-1 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-2 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-3 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-4 - [ DAA ]

Design and Analysis of Algorithms MCQs - Unit-5 - [ DAA ]

Software Engineering MCQs - Unit-1 - [ SE ]

Software Engineering MCQs - Unit-2 - [ SE ]

Software Engineering MCQs - Unit-3 - [ SE ]

Software Engineering MCQs - Unit-4 - [ SE ]

Software Engineering MCQs - Unit-5 - [ SE ]

Data Mining MCQs - Unit-1 - [ DM ]

Data Mining MCQs - Unit-2 - [ DM ]

Data Mining MCQs - Unit-3 - [ DM ]

Data Mining MCQs - Unit-4 - [ DM ]

Data Mining MCQs - Unit-5 - [ DM ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-1 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-2 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-3 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-4 - [ COA ]

Computer Organization and Architecture (COA) Objective Question Bank-Unit-5 - [ COA ]

Data Structures Objective Type Question Bank-Unit-1 - [ DS ]

Data Structures Objective Type Question Bank-Unit-2 - [ DS ]

Data Structures Objective Type Question Bank-Unit-3 - [ DS ]

Data Structures Objective Type Question Bank-Unit-4 - [ DS ]

Data Structures Objective Type Question Bank-Unit-5 - [ DS ]

Database Management System Objective Type Question Bank-Unit-1 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-2 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-3 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-4 - [ DBMS ]

Database Management System Objective Type Question Bank-Unit-5 - [ DBMS ]

Cyber Forensics Objective Type Question Bank-Part-2 - [ Cyber Forensics ]

Cyber Forensics Objective Type Question Bank-Part-1 - [ Cyber Forensics ]

Java Programming Objective Type Question Bank - [ Java Programming ]

Java Programming Objective Type Questions-Part-1 - [ Java Programming ]

Java Programming Objective Type Questions-Part-2 - [ Java Programming ]