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 BCA4020_APR2016
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
12946
QUESTION_TEXT
With an example program explain the use of super keyword in Java.
SCHEME OF
EVALUATION
•Whenever a subclass needs to refer to its immediate superclass, it can
do so by use of the keyword super. Ithas two general forms:
•The first calls the superclass’ constructor
•The second is used to access a member of the superclass that has been
hidden by a member of a subclass ( 2 Marks)
First use of super:
A subclass can call a constructor method defined by its superclass by
use of the following form of super:
super(parameter-list);
Example:
classBoxWeight extends Box {
double weight; // weight of box
// initialize width, height, and depth using super()
BoxWeight(double w, double h, double d, double m) {
super(w, h, d); // call superclass constructor
weight = m;
}
} ( 4 Marks)
Second use of super:
•It always refers to the superclass of the subclass in which it is used.
This usage has the following general form:
super. member
Here, member can be either a method or an instance variable
•This second form of super is most applicable to situations in which
member names of a subclass hide members by the same name in the
superclass
Example:
// Using super to overcome name hiding.
class A {
inti;
}
// Create a subclass by extending class A.
class B extends A {
inti; // this i hides the i in A
B(int a, int b) {
super.i = a; // i in A
i = b; // i in B
}
void show() {
System.out.println("i in superclass: " + super.i);
System.out.println("i in subclass: " + i);
}
}
classUseSuper {
public static void main(String args[]) {
B subOb = new B(1, 2);
subOb.show();
}
}
This program displays the following:
i in superclass: 1
i in subclass: 2
(4 Marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72589
QUESTION_TEXT
a.
b.
SCHEME OF
EVALUATION
Addresses on WWW are represented in Java by URL objects. A URL
represents any type of information which has to be linked with web. The
URL is set up to perform certain activities when a connection is made to
it such as loading a web page or downloading a file. URLs are a bit more
user friendly to work with than the sockets. (2 marks)
a. The URL Class: The URL class transforms a URL string into an
object that can then be manipulated using associated methods. These
methods serve purposes such as getting the filename, protocol, and
hostname. URL also has methods that can open and maintain the data
connection of an input stream.
b. URLConnection Class: URL Connection Class is another abstract
class used to create and control a connection to a platform and firewall
Specific location. It is a simplified version of connection interface for the
URL class.
c. The URLEncoder Class: the URLEncoder Class takes a string a text
and turns it into the x-www-form-urlencoded format, which is a MIME
format. This can then be used in conjunction with the URL class.
d. The URLStreamHandler Class: The URLStreamHandler Class is an
abstract class. Its purpose is to create a format for opening a stream
connection to a specific URL. This class is concerned with the protocol of
What is an URL Object in java?
Explain the various URL objects.
the URL. If programmer wants to create a new URL stream protocol, it is
necessary to implement the methods specified in this abstract class.
(2 marks each)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72591
QUESTION_TEXT
Explain the tools in the JDK
SCHEME OF
EVALUATION
Naming= 3marks
Description = 7 marks
TOTAL 10 MARKS
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72593
QUESTION_TEXT
What are the various methods available in RemoteObject class.
*
*
SCHEME OF EVALUATION *
*
*
RemoteArray
RemoteBoolean
RemoteByte
RemoteChar
RemoteClass
* RemoteDouble
* RemoteField
* RemoteFloat
* RemoteInt
* RemoteLong
* RemoteShort
* RemoteString
* RemoteThread
* RemoteThreadGroup
* RemoteValue
Any 10 methods = 10 marks.
(1* 10 =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
{
//statements that may cause an exception
}
SCHEME OF
EVALUATION
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
120582
QUESTION_TEXT
What is Java IDL? Explain.
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.
SCHEME OF
EVALUATION
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)