SUBJECT
CODE: 602 SUBJECT NAME: ADVANCED JAVA
Unit 5 : Java
Beans and RMI
1. Which of the following is not an Enterprise Beans type?
a) Doubleton
b) Singleton
c) Stateful
d) Stateless
Answer:A
2. Which of the following is not true about Java beans?
a) Implements java.io.Serializable interface
b) Extends java.io.Serializable class
c) Provides no argument constructor
d) Provides setter and getter methods for its properties
Answer:B
3. Which file separator should be used by MANIFEST file?
a) /
b) \
c) –
d) //
Answer:A
4. Which of the following is correct error when loading JAR
file with duplicate
name?
a) javA)io.NullPointerException
b) javA)lang.ClassNotFound
c) javA)lang.ClassFormatError
d) javA)lang.DuplicateClassError
Answer:C
5. Java Beans are extremely secured?
a) True
b) False
Answer:B
6. Which of the following is not a feature of Beans?
a) Introspection
b) Events
c) Persistence
d) Serialization
Answer:D
7. What is the attribute of java bean to specify scope of
bean to have single
instance per Spring IOC?
a) prototype
b) singleton
c) request
d) session
Answer:B
8. Which attribute is used to specify initialization method?
a) init
b) init-method
c) initialization
d) initialization-method
Answer:B
9. Which attribute is used to specify destroy method?
a) destroy
b) destroy-method
c) destruction
d) destruction-method
Answer:B
10. How to specify autowiring by name?
a) @Qualifier
b) @Type
c) @Constructor
d) @Name
Answer:A
11. What is Remote method invocation (RMI)?
a) RMI allows us to invoke a method of java object that
executes on another
machine
b) RMI allows us to invoke a method of java object that
executes on another
Thread in multithreaded programming
c) RMI allows us to invoke a method of java object that
executes parallely in same
machine
d) None of the mentioned
Answer:A
12. Which of these package is used for remote method
invocation?
a) javA)applet
b) javA)rmi
c) javA)lang.rmi
d) javA)lang.reflect
Answer:B
13. Which of these methods are member of Remote class?
a) checkIP()
b) addLocation()
c) AddServer()
d) None of the mentioned
Answer:D
14. Which of these Exceptions is thrown by remote method?
a) RemoteException
b) InputOutputException
c) RemoteAccessException
d) RemoteInputOutputException
Answer:A
15. Which of these class is used for creating a client for a
server-client operations?
a) serverClientjava
b) Client.java
c) AddClient.java
d) ServerClient.java
Answer:C
16. Which of these package is used for all the text related
modifications?
a) Java.text
b) Java.awt
c) java.lang.text
d) java.text.modify
Answer:A
17. What
will be the output of the following Java code?
import
javA)lang.reflect.*;
class
Additional_packages{
public
static void main(String args[]){
try{
Class c =
Class.forName("javA)awt.Dimension");
Constructor
constructors[] =
C)getConstructors();
for (int i = 0; i <
constructors.length;
i++)
System.out.println(constructors[i]);}
catch
(Exception e){
System.out.print("Exception");}}}
A) Program
prints all the constructors of ‘javA)awt.Dimension’ package
B)Program
prints all the possible constructors of class ‘Class’
C)Program
prints “Exception”
D)Runtime
Error
Answer:A
18. What will be the output of the
following Java code?
import javA)lang.reflect.*;
class Additional_packages
{
public static void main(String
args[])
{
try
{
Class c =
Class.forName("javA)awt.Dimension");
Field fields[] = C)getFields();
for (int i = 0; i < fields.length;
i++)
System.out.println(fields[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
A) Program prints all the
constructors of ‘javA)awt.Dimension’ package
B)Program prints all the methods of
‘javA)awt.Dimension’ package
C)Program prints all the data members
of ‘javA)awt.Dimension’ package
D)program prints all the methods and
data member of
‘javA)awt.Dimension’ package
Answer:C
19. What is the length of the application box made in the
following Java program?
import javA)awt.*;
import javA)applet.*;
public class myapplet extends Applet
{
Graphic g;
g.drawString("A Simple Applet",20,20);
}
A) 20
B)Default value
C)Compilation Error
D)Runtime Error
Answer:C
20. What
will be the output of the following Java program?
import
javA)lang.reflect.*;
class
Additional_packages
{
public
static void main(String args[])
{
try
{
Class c =
Class.forName("javA)awt.Dimension");
Method
methods[] = C)getMethods();
for (int i
= 0; i < methods.length; i++)
System.out.println(methods[i]);
}
catch
(Exception e){System.out.print("Exception");
}}}
A) Program
prints all the constructors of ‘java.awt.Dimension’ package
B)Program
prints all the methods of ‘java.awt.Dimension’ package
C)Program
prints all the data members of ‘java.awt.Dimension’ package
D)program
prints all the methods and data member of ‘java.awt.Dimension’
package
Answer:B
21) In a RMI Client Program, what are the exceptions which
might have to
handled?
A) RemoteException
B) NotBoundException
C) MalFormedURLException
D) All mentioned above
Answer:D
22) Which is a one-way communication only between the client
and the server and it
is not a reliable and there is no confirmation regarding
reaching the message to
the destination?
A) TCP/IP
B) UDP
C) Both A & B
D) None of the above
Answer:B
23) RMI Architecture consists of how many layers?
A) 5
B) 3
C) 4
D) 2
Answer:C
24) An RMI Server is responsible for,
A) Creating an instance of the remote object
B) Exporting the remote object
C) Binding the instance of the remote object to the RMI
registry
D) All mentioned above
Answer:D
25) In RMI Distributed object applications need to do?
A) Locate remote objects
B) Communicate with remote objects
C) Load class definitions for objects that are passed around
D) All mentioned above
Answer:D
26) In RMI applications which program obtains a remote
reference to one or
more remote objects on a server and then invokes methods on
them?
A) Server
B) Client
C) Both A & B
D) None of the above
Answer:B
27) In RMI program the following example shows the,
import java.rmi.*;
public interface Adder extends Remote{
public int add(int x,int y)throws RemoteException;
}
A) Create and start the remote application
B) Create and start the client application
C) Create the remote interface
D) Provide the implementation of the remote interface
Answer:C
28) In RMI program the following two steps are used to,
Either extend the UnicastRemoteObject class,
the exportObject() method of the UnicastRemoteObject class,
A) Provide the Implementation of the remote interface
B) Create the remote interface
C) Create and start the remote application
D) Compile the implementation class and create the stub and
skeleton objects using
the rmic tool
Answer:A
29) Which package is used for Remote Method Invocation (RMI)?
A) java.lang.rmi
B) java.lang.reflect
C) java.applet
D) java.rmi
Answer:D
30) Java supports RMI, RMI Stands for?
A) Random Method Invocation
B) Remote Memory Interface
C) Remote Method Invocation
D) Random Method Invocation
Answer:C
31) RMI uses a layered architecture; each of the layers could
be enhanced or
replaced without affecting the rest of the system?
A) True
B) False
Answer:A
32) RMI is a server-side component; It is not required to be
deployed on the server?
A) True
B) False
Answer:B
33) Which is built on the top of socket programming?
A) EJB
B) RMI
C) Both A & B
D) None of the above
Answer:B
34) RMI and EJB, provides services to access an object
running in another JVM
(known as remote object)?
A) True
B) False
Answer:A
35) In RMI Distributed object applications need to do?
A) Locate remote objects
B) Communicate with remote objects
C) Load class definitions for objects that are passed around
D) All mentioned above
Answer:D
36) In RMI applications which program obtains a remote
reference to one or
more remote objects on a server and then invokes methods on
them?
A) Server
B) Client
C) Both A & B
D) None of the above
Answer:B
37) In RMI program the following example shows the,
import java.rmi.*;
public interface Adder extends Remote{
public int add(int x,int y)throws RemoteException;
}
A) Create and start the remote application
B) Create and start the client application
C) Create the remote interface
D) Provide the implementation of the remote interface
Answer:C
38) In RMI program the following two steps are used to,
Either extend the UnicastRemoteObject class,
the exportObject() method of the UnicastRemoteObject class,
A) Provide the Implementation of the remote interface
B) Create the remote interface
C) Create and start the remote application
D) Compile the implementation class and create the stub and
skeleton objects using
the rmic tool
Answer:A
39) Which package is used for Remote Method Invocation (RMI)?
A) java.lang.rmi
B) java.lang.reflect
C) java.applet
D) java.rmi
Answer:D
40) Java supports RMI, RMI Stands for?
A) Random Method Invocation
B) Remote Memory Interface
C) Remote Method Invocation
D) Random Method Invocation
Answer:C
0 Comments