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
72590
QUESTION_TEXT
What is inheritance? Explain the types of relationships supported in
Java inheritance with example.
Inheritance is one of the cornerstones of object-oriented programming,
because it allows the creation of hierarchical classifications. Using
inheritance, you can create a general class that defines traits common
to a set of related items. This class can then be inherited by other, more
specific classes, each adding those things that are unique to it. In the
terminology of Java, a class that is inherited is called a superclass. The
class that does the inheriting is called a subclass. Therefore, a subclass
is a specialized version of a superclass. It inherits all of the instance
variables and methods defined by the superclass and add its own,
unique elements. (1 mark)
Types of Relationships
Relationships are classified as follows:
SCHEME OF
EVALUATION

A Kind-Of relationship

A Is-A relationship

A Part-Of-relationship

A Has-A relationship
(For each point with explanation and example – 2 marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72593
QUESTION_TEXT
What are the various methods available in RemoteObject class.
* RemoteArray
* RemoteBoolean
* RemoteByte
* RemoteChar
* RemoteClass
* RemoteDouble
* RemoteField
* RemoteFloat
SCHEME OF EVALUATION * RemoteInt
* RemoteLong
* RemoteShort
* RemoteString
* RemoteThread
* RemoteThreadGroup
* RemoteValue
Any 10 methods = 10 marks.
(1* 10 =Total 10 marks)
QUESTION_TYPE DESCRIPTIVE_QUESTION
QUESTION_ID
120578
QUESTION_TEXT
What is a package in Java? How do you define a package in Java?
Explain the class member access permissions in Java.
Java provides a mechanism for partitioning the class name space into
more manageable chunks. This mechanism is the package. The package is
both a naming and a visibility control mechanism. (1 Mark)
Defining a Package:
SCHEME OF
EVALUATION
Include a package command as the first statement in a Java source file.
Any classes declared within that file will belong to the specified package.
The package statement defines a name space in which classes are stored.
If you omit the package statement, the class names are put into the default
package, which has no name. The general form of the package statement:
package pkg;
Here, pkg is the name of the package
For example, the following statement creates a package called
MyPackage.
package MyPackage;
We can create a hierarchy of packages. To do so, simply separate each
package name from the one above it by use of a period
The general form of a multileveled package statement is :
package pkg1[.pkg2[.pkg3]];
For example, a package declared as package java.awt.image; needs to be
stored in java/awt/image, java\\awt\\image, or java:awt:image on your
UNIX, Windows, or Macintosh file system, respectively. (4 Marks)
Access Protection:
(5 marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120581
a.
What are the rules for overriding a method in Java?
b.
Write any three uses of Inheritance.
QUESTION_TEXT
a.
SCHEME OF
EVALUATION
1.
The method name and the order of arguments should be identical
to that of the superclass method.
2.
The return type of both the methods must be the same.
3.
The overriding method cannot be less accessible than the method
it overrides.
4.
An overriding method cannot raise more exceptions that those
raised by the superclass.
b.
1.
Inheritance reduces redundancy in code. Code redundancy means
writing the same code in different places, leading to unnecessary
replication of code. Inheritance helps you to reuse the code.
2.
Maintain code easily, as the code resides at one place. Any
changes made to the superclass automatically change the behavior of
the subclass.
3.
Extend the functionality of an existing class by adding more
methods to the subclass.
(10 marks)
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)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120583
Write a note on following, give example for each
QUESTION_TEXT
a.
Break statement
b.
Continue statement
a.
Break statement:
By using break, you can force immediate termination of loop, bypassing the
conditional expression and any remaining code in the body of the loop. When
a break statement is encountered inside a loop, the loop is terminated and
program control resumes at the next statement following the loop. (3 marks)
Ex:
//Using break to exit a loop
SCHEME OF
EVALUATION
class BreakLoop{
public static void main(String args[ ]) {
for(int i=0; i<100; i++){
if(I == 10) break; // terminate loop if i is 10
system.out.println(“Loop complete.”);
}
} (2 marks)
b.
Continue statement:
sometimes it is useful to force an early iteration of a loop. that is, you might
want to continue running the loop, but stop processing the remainder of the
code in its body for this particular iteration…..(3 marks)
ex:
//Demonstrate continue.
class Continue{
public static void main (String args[ ]) {
for (int i=0; i<10; i++) {
System.out.print (i+ “ “);
if (i%2 == 0) continue;
Sytem.out.println(“”);
}
}
}
(2 marks)