100% found this document useful (1 vote)
18 views6 pages

Rescued Document

The document consists of multiple-choice questions and fill-in-the-blank exercises related to Java programming, specifically focusing on multithreading, event handling, and applet development. It covers concepts such as thread priority, event listeners, AWT classes, and Swing framework components. The content is structured into units with questions designed to test knowledge on Java programming fundamentals.

Uploaded by

s82726796
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
18 views6 pages

Rescued Document

The document consists of multiple-choice questions and fill-in-the-blank exercises related to Java programming, specifically focusing on multithreading, event handling, and applet development. It covers concepts such as thread priority, event listeners, AWT classes, and Swing framework components. The content is structured into units with questions designed to test knowledge on Java programming fundamentals.

Uploaded by

s82726796
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Java Important Objective bits

Unit-III
Choose the correct alternative.

1 What is multithreaded programming? [ ]


a) It’s a process in which two different processes run simultaneously
b) It’s a process in which two or more parts of same process run simultaneously
c) It’s a process in which many different process are able to access same
information
d) It’s a process in which a single process can access information from many
sources

2 Thread priority in Java is? [ ]


a) Integer b) Float c) double d) long

3 What will happen if two thread of the same priority are called to be processed [ ]
simultaneously?
a) Anyone will be executed first lexo-graphically
b) Both of them will be executed simultaneously
c) None of them will be executed
d) It is dependent on the operating system

4 Which of these are types of multitasking? [ ]


a) Process based b) Thread based c) Process and Thread based d) None

5 What will be the output of the following Java code? [ ]


classmultithreaded_programing {
publicstaticvoid main(String args[]) {
Thread t =Thread.currentThread();
System.out.println(t); } }
a) Thread[5,main] b) Thread[main,5]
c) Thread[main,0] d)Thread[main,5,main]

6 Which of the following is NOT a valid way to create a thread in Java?


a)Extending the Thread class.
b) Implementing the Runnable interface.
c) Using the start() method.
d) Using the Thread constructor with a Runnable object.

/
Fill in the blanks:
__Alive_____method is used to find out that a thread is still running or not.
1

2 _Runnable_________ interface is used to create a thread in java.

3 ___synchronized___________ keyword is used to declare a synchronized method in java

4 A thread that runs in the background and does not prevent the program from existing is known
as ___daemon_______________.

5 In java a thread can, be created by ____extending the thread class and implementing Runnable
interface __________

Unit-IV
Choose the correct alternative.

1 [ ]
Which of these methods are used to register a keyboard event listener?
a) KeyListener() b) addKistener()

c) addKeyListener() d) eventKeyboardListener()
2 [ ]
Which of these methods are used to register a mouse motion listener?
a) addMouse() b) addMouseListener()
c) addMouseMotionListner() d) eventMouseMotionListener()
3 [ ]
What is a listener in context to event handling?
a) A listener is a variable that is notified when an event occurs
b) A listener is a object that is notified when an event occurs
c) A listener is a method that is notified when an event occurs
d) None of the mentioned
4 [ ]
Event class is defined in which of these libraries?
a) java.io b) java.lang
c) java.net d) java.awt.event
5 [ ]
Which of these class is super class of all the events?
a) EventObject b) EventClass
c) ActionEvent d) ItemEvent
6 [ ]
Implement the Listener interfaces and overrides its methods is required to perform
in event handling.

a)True b) False c) Both a and b d) None

7 [ ]
Give the abbreviation of AWT?
/
a) Applet Windowing Toolkit b)Abstract Windowing Toolkit

c) Absolute Windowing Toolkit d) None of the above


8 [ ]
Which is used to store data and partial results, as well as to perform dynamic
linking, return values for methods, and dispatch exceptions?

a) window b) panel c) frame d) Container


9 [ ]
Which method can set or change the text in a Label?

setText() b) getText() c) Both A & B d)None


10 [ ]
Which are passive controls that do not support any interaction with the user?

Choice b)List c)Labels d)Checkbox

/
Fill in the blanks:

1 __java.awt_________ Package provides AWT classes in java.

___remove()_________ method is used to remove a component from a container in AWT


2

The Layout Manager arranges the components in a grid of rows and columns is
3 ___GridLayout____________.

4 __ActionListener____________ Event is generated when a user clicks a button in AWT

5 __java.awt.popupMenu_________class is used to create a popup menu in AWT.

6 _import java.awt.event.*;_______________ Package in java contains Classes for event


handling.

7 The purpose of the Action Event in java event Handling is ____represents an Actionevent
generated by a component like a button___________.
__ActionListener____________ event listener interface is used for handling action events in
java.
8

9 __Mouse Dragged__________ method is defined when Mouse Motion Adapter class


specified.

10 Mouse Event is a subclass of ___inputevent________ classes

Unit-V
Choose the correct alternative.

/
1 [ ]
When the ………………. method of the Applet class is called; it displays the result
of the Applet code on the screen.
A) paint( ) B) repaint( ) C) update( ) D) reupdate( )
2 [ ]
Before we try to write applets, we must make sure that Java is installed properly
and also ensure that either the java is installed properly and also ensure the java
……………. or a java-enabled browser is available.
A) viewer( ) B) appletviewer( ) C) appletrunner( ) D) browserviewer( )
3 We can change the text to be displayed by an applet by supplying new text to be [ ]
displayed by an applet by supplying new text to the applet through a
……………………… tag.

A) <EDIT> B) <CHANGE> C) <REPLACE> D) <PARAM>


4 [ ]
If you want to assign a value of 88 to the variable year, then which of the following
lines can be used within an <applet> tag.
A) number = getParameter(88) B) <number=99>
C) <param = radius value=88> D) <param name=number value=88>
5 [ ]
Text field can be created by which of the following methods.
i) TextField( ) ii) TextFieldString( )
iii) TextField(int) iv) TextField(string, int)
A) i, ii and iii only B) ii, iii and iv only
C) i, ii and iv only D) All i, ii, iii and iv
6 Which package contains the Java Swing classes? [ ]

a) java.lang b) java.io c) java.util d) javax.swing


7 Which of the following architecture does the Swing framework use? [ ]
a)MVC b) MVP c) Layered architecture d)Master-Slave architecture
8 Which language is used in the swing framework? [ ]
a) JavaScript b) Java c) React d) Python
9 To manage events, Java employs the ____? [ ]
Custom-based Event Model b) Retired Event Model

c)Delegation Event Model d) None of the Above


10 Which of the following component gives a drop-down list of options from which to [ ]
choose?

JPanel b) JButton c) JComboBox d) JBox

Fill in the blanks:


In java applet, we can display numerical values by first converting them into string and then
1 using the __drawstring()_____ method.

The __paint()___________method is automatically called the first time the applet is


2 displayed on the screen and every time the applet receives focus.

/
3 The ___update()__________method is called to clear the screen and calls the paint( ) method

The___graphics__________ class is an abstract class that represents the display area of the
4 applet.

5 Applet class is a subclass of the panel class, which is again a subclass of the
__container_________class
A __JFilechooser_________control is a dialogue window that allows the user to pick a file.
6

A __JSpinner__________is a one-line input field that allows the user to choose a number or
7 an object value from an ordered sequence

A __component________is the abstract foundation class for SWING's non-menu user


8 interface controls.

In Swing, the ____eventdrivenThread_________is used to render visuals and listen for


9 events.

The ___AbstractAction_________ class enables the development of abstract functions as


10 well as action interfaces.

You might also like