CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE EVENT_CODE JAN2016 ASSESSMENT_CODE MIT103_JAN2016 QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 12944 QUESTION_TEXT List and explain the various features of Java. The various features of Java are: •Simple •Secure •Portable •Object-oriented •Robust SCHEME OF EVALUATION •Multithreaded •Architecture – neutral •Interpreted •High performance •Distributed •Dynamic Brief explanation of each feature (any 10) Marks: 1x10=10 QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 12948 QUESTION_TEXT Explain Remote Method Invocation in detail. SCHEME OF EVALUATION Explanation should include the following: •RMI allows objects in different Java Virtual Machines belonging to different hosts to send and receive message. • Local objects are objects that execute on the local machine • Remote objects are objects that execute on all the other machines. •Objects on remote hosts are exported so that they can be invoked remotely. •An object exports itself by registering itself with a Remote Registry Server. It is a service that runs on a server and helps the objects on other hosts to remotely access its registered objects. •Objects that are exported for remote access must implement the interface RemoteInterface •Java’s RMI approach makes use of stubs and skeletons. A stub is a local object on the client’s machine that acts as a proxy for a remote object. The skeleton is the proxy of the client machine’s object that is located on the remote host. •The stub the skeleton communicates through a remote reference layer. RMI uses the TCP protocol for transporting information. (Marks: 10) 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 120580 QUESTION_TEXT Explain the different data types available in java programming language. Primitive Data types: SCHEME OF EVALUATION 1. byte 2. short 3. int 4. long 5. float 6. double 7. char 8. boolen Abstract/Derived Data Types: 1. String (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. SCHEME OF EVALUATION 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) 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: SCHEME OF EVALUATION //Using break to exit a loop 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)