Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE EVENT_CODE APR2016 ASSESSMENT_CODE BT0074_APR2016 QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 4826 QUESTION_TEXT Explain Inner classes and anonymous classes SCHEME OF EVALUATION Inner classes - description + syntax= 2.5 + 2.5 = 5 Marks Anonymous classes - description + example=2.5+2.5= 5 Marks QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 73246 QUESTION_TEXT How relationships are classified in Java? Explain. SCHEME OF EVALUATION The types of relationships are: ● A Kind Of relationship ● A Is-A relationship ● A Part-Of-relationship ● A Has-A relationship (For classifying 2 marks) (Each classification’s explanation with example – 2 marks each) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 73249 QUESTION_TEXT Define Servlet. Describe the Servlet Life Cycle. SCHEME OF EVALUATION A servlet is a small pluggable extension to a server that enhances the server’s functionality. (1 mark) Servlet Life Cycle: It has 9 stages. They are: 1. The server loads the servlet when it is first requested by the client or if configured to do so, at server start-up. The servlet may be loaded from either a local or a remote location using the standard Java class loading facility. This step is equivalent to the following code: Class c=Class.forName(“com.sourcestream.MyServlet”); It should be noted that when referring to servlets, the term load often refers to the process of both loading and instantiating the servlet. 2. The server creates one or more instances of the servlet class. Depending on implementation the server may create a single instance that services all requests through multiple threads or create a pool of instances from which one chosen to service at each new request. This step is equivalent to the following Java code: Servlet s=(Servlet) c.newInstance(); where ‘c’ is the same Class object created in previous step. 3. The server constructs a ServerConfig object that provides initialization information to the servlet. 4. The server calls the servlet’s init() method, passing the object constructed in step 3 as a parameter. The init() method is guaranteed to finish execution prior to the servlet processing the first request. If the server has created multiple servlet instances (step 2), the init() method is called one time for each instance. 5. The server constructs a ServletRequest or HttpServletRequest object from the data included in the client’s request. It also constructs a ServletResponse or HttpServletResponse object that provides methods for customizing the server’s response. The type of object passed in these two parameters depends on whether the servlet extends the GenericServlet class or the HttpServlet class, respectively. 6. The server calls the servlet’s service() method passing the objects constructed in step 5 as parameters. When concurrent requests arrive, multiple service() methods can run in separate threads. 7. The service() method processes the client request by evaluating the ServletRequest or HttpServletRequest object and responds using ServletResponse or HttpServletResponse object. 8. If the server receives another request for this servlet, the process begins again at step 5. 9. When instructed to unload the servlet, perhaps by the server administrator or programmatically by the servlet itself, the server calls the servlet’s destroy() method. The servlet is then eligible for garbage collection. (Each step – 1 mark) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 115104 QUESTION_TEXT Explain the different methods of Input stream class. 1. SCHEME OF EVALUATION 2. 3. int read ( ) int read (byte [ ] b) int read (byte [ ] b, int off, int len) 4. int available ( ) 5. void close( ) – Explain briefly 2 × 5 = 10 marks) QUESTION_T DESCRIPTIVE_QUESTION YPE QUESTION_ID 115106 QUESTION_T Give a detailed description of Remote Method Invocation mechanism in EXT JAVA. RMI is built upon the specification of how local and remote objects interoperate. 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. 2marks A Remote Registry Server is a service that runs on a server and helps the objects on other hosts to remotely access its registered objects. The registry service maintains a database of all the named remote objects. 1mark SCHEME OF EVALUATION 3marks A Distributed Application Created Using RMI; Objects that are exported for remote access must implement the interface RemoteInterface. This interface identifies the object to be accessed remotely. All the methods that are to be invoked remotely must throw a RemoteException. This exception is used to handle the errors that may occur during the invocation of a remote method. 2marks Java's RMI approach is organized into a client/server framework. A local object that invokes a method of a remote object is referred to as a client object, and the remote object whose methods are invoked is referred to as a server object. 1mark 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.RMI uses the TCP protocol for transporting information. 1mark QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 115107 QUESTION_TEXT What is Java IDL? * It is a technology for distributed object that us objects interacting on different platforms across a network. * It is similar to RMI, Which supports distributed objects written entirely in the java programming language. It also enables objects to interact regardless of whether they are written in the java programming language or another language such as C,C++,COBOL. SCHEME OF EVALUATION * It is based on the common object request brokerage architecture, an industry –standard distributed object model. * A key feature of CORBA is IDL, a language-neutral interface definition language. Java IDL supports mapping for java. * 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. (2 marks each)