Download CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CUSTOMER_CODE
SMUDE
DIVISION_CODE
SMUDE
EVENT_CODE
APR2016
ASSESSMENT_CODE MCA4030_APR2016
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
12947
QUESTION_TEXT
Explain the life cycle of an Applet in Java. Also give the Java Applet
skeleton.
SCHEME OF
EVALUATION
The Applet life cycle uses the 4 methods: init(), start(), stop() and
destroy().
•init() - The init( ) method is the first method to be called. This is where
we should initialize variables. This method is called only once during the
run time of the applet.
•start() - The start( ) method is called after init( ). It is also called to
restart an applet after it has been stopped. Whereas init( ) is called once
the first time an applet isloaded, start( ) is called each time an applet’s
HTML document is displayed onscreen. So, if a user leaves a web page
and comes back, the applet resumes execution at start().
•stop() - The stop( ) method is called when a web browser leaves the
HTML document containing the applet - when it goes to another page,
for example. When stop( ) is called, the applet is probably running. You
should use stop( ) to suspend threads that don’t need to run when the
applet is not visible. You can restart them when start( ) is called if the
user returns to the page.
•destroy() - The destroy( ) method is called when the environment
determines that your applet needs to be removed completely from
memory. At this point, you should free up any resources the applet may
be using.
(2 x 4 = 8 Marks)
Applet Skeleton:
import java.awt.*;
importjava.applet.*;
/* <applet code="AppletSkel" width=300 height=100></applet> */
public class AppletSkel extends Applet {
// Called first.
public void init() {
// initialization
}
/* Called second, after init(). Also called whenever the applet is
restarted. */
public void start() {
// start or resume execution
}
// Called when the applet is stopped.
public void stop() {
// suspends execution
}
/* Called when applet is terminated. This is the last method executed. */
public void destroy() {
// perform shutdown activities
}
// Called when an applet's window must be restored.
public void paint(Graphics g) {
// redisplay contents of window
}
} ( 2 Marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72592
QUESTION_TEXT
Describe the three types of operators in java
Arithmetic operators description= 2.5 marks
Increment and decrement description = 2.5 marks
SCHEME OF EVALUATION Logical operators description = 2.5 marks
Comparison operators description = 2,5 marks
(2.5 * 4=Total 10 marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120576
QUESTION_TEXT
What are the different Exception handling techniques? Explain with an
example.
Try Block
Try
{
SCHEME OF
EVALUATION
//statements that may cause an exception
}
Nested try statement ( example) ( 3.5 marks)
Catch Block
try
{
//statements that may cause an exception
}
Catch ( )
{
// error handling code example (3.5 marks)
}
finally block
finally
{
closeFile( );
(3marks)
}
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120577
Explain in detail the access specifiers supported by Java.
QUESTION_TEXT
Explanation
SCHEME OF EVALUATION
i.
Public with example (3 marks)
ii.
Private with example (3 marks)
iii.
Protected with example (4 marks)
QUESTION_TYPE DESCRIPTIVE_QUESTION
QUESTION_ID
120579
Briefly explain the various constants and methods used in
QUESTION_TEXT i.
ii.
i.
ActionEvent class
AdjustmentEvent class
ActionEvent Class:
An ActionEvent is generated when a button is pressed, a list item is
double-clicked, or a menu item is selected. The ActionEvent class defines
four integer constants that can be used to identify any modifiers
associated with an action event: ALT_MASK, CTRL_MASK,
META_MASK, and SHIFT_MASK. In addition, there is an integer
constant, ACTION_PERFORMED, which can be used to identify action
events. (2 Marks
)
ActionEvent has these three constructors:
ActionEvent(Object src, int type, String cmd)
SCHEME OF
EVALUATION
ActionEvent(Object src, int type, String cmd, int modifiers)
ActionEvent(Object src, int type, String cmd, long when, int modifiers)
Here, src is a reference to the object that generated this event. The type of
the event is specified by type, and its command string is cmd. The
argument modifiers indicates which modifier keys (ALT, CTRL, META,
and/or SHIFT) were pressed when the event was generated. The when
parameter specifies when the event occurred. You can obtain the
command name for the invoking ActionEvent object by using the
getActionCommand( ) method, shown here:
String getActionCommand( )
For example, when a button is pressed, an action event is generated that
has a command name equal to the label on that button. (3 marks)
ii.
AdjustmentEvent class
An AdjustmentEvent is generated by a scroll bar. The AdjustmentEvent
class defines integer constants that can be used to identify them.
(2 Marks)
In addition, there is an integer constant,
ADJUSTMENT_VALUE_CHANGED that indicates that a change has
occurred.
The constructor:
AdjustmentEvent(Adjustable src, int id, int type, int data)
src is a reference to the object that generated this event. The id equals
ADJUSTMENT_VALUE_CHANGED
The type of the event is specified by type, and its associated data is data.
The getAdjustable( ) method returns the object that generated the event.
The type of the adjustment event may be obtained by the
getAdjustmentType( ) method. (3 Marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120582
QUESTION_TEXT
What is Java IDL? Explain.
SCHEME OF
EVALUATION
1.
Java IDL is a technology for distributed objects – i.e. objects
interacting on different platform across a network. IDL stands for
Interface Definition Language.
2.
Java IDL is similar to RMI, which supports distributed objects
written entirely in the Java programming language.
However, Java IDL enable objects interact regardless of whether they’re
written in the Java programming language or another language such as
C, C++, COBOL or others.
3.
Java IDL is based on the Common Object Request Brokerage
Architecture, an industry standard distributed object model.
4.
A key feature of CORBA is IDL, a language –neutral Interface
Definition Language. Each language that supports CORBA has its own
IDL mapping and as its name implies, Java IDL supports the mapping
for Java. CORBA and the IDL mappings are the work of an industry
consortium known as the OMG or Object Management Group.
5.
TO support interaction between objects in separate programs Java
IDL provides an Object Request Broker, or ORB. The Orb is a class
library that enables low level communication between Java IDL
applications and other CORBA compliant applications.
(10 marks)