Play and learn 300 000+ tabs online

Sunday, January 17, 2010

Servlet Questions


1. What are the types of ServletEngines?
Standalone ServletEngine:A standalone engine is a server that includes built-in support for servlets.

Add-on ServletEngine:Its a plug-in to an existing server.It adds servlet support to a server that was not originally designed with servlets in mind.

Embedded ServletEngine:

2.What is the difference between a Generic Servlet and Http Servlet?

Generic Servlet Http Servlet
Class which internally implements An abstract class which acts as a child class both for Servlet and ServletConfig GenericServlet and in addition provides interfaces. some additional methods
like doGet(),doPost(),doDelete() &
doPut().

3.What is a Session Id?

It is a unique id assigned by the server to the user when a user first accesses a site or an application ie. when a request is made.

4. List out Differences between CGI Perl and Servlet?

Servlet CGI

Platform independent Platform dependent.
Language dependent Language independent.

5. What is Bootstrapping in RMI?

Dynamic loading of stubs and skeletons is known as Boot Strapping.

6. What are different types of Exceptions?.
Runtime exceptions, Errors, Program Exceptions

7. What are types of applets?.
Trusted Applets: Applets with predefined security
Untrusted Applets: Applets without any security

8. When does an Exception occur?.

Whenever an error occurs in an Application,(either at compile time)or runtime,it raises an Exception.

9. What is servlet tunnelling?.
Used in applet to servlet communications, a layer over http is built so as to enable object serialization.

10. What is a cookie?.

Cookies are a way for a server to send some information to a client to store and for the server to later retrieve its data from that client.Web browser supports 20 cookies/host of 4kb each.

11.What is the frontend in Java?.Also what is Backend?.
Frontend: Applet
Backend : Oracle, Ms-Access(Using JDBC).

12. Define a JSP?.
Java Server Pages includes scripplets of Servletcode in an Html page.This creates dynamism in the other-wise static HTML.A JSP is a document that describes how to process a request to creeate response.

13. The length of an identifier is

14. Stored procedures can be called by Callable Statement.

15. Stack class implements LIFO(Last In First Out).

16. Servlet Class defines init.

17. Reference of any instance variable inside a static method is legal if declared static.

18. What will a read() function do?.
A method in Input Stream.It reads a single byte or an array of bytes.Returns no of bytes read or -1 if EOF(End of file)is reached.

19.To implement a Throwable array,which class is used.
Vector
LinkedList
Stack
ArrayList - Answer(To be Confirmed)

20. The method for precompiled SQL Statement in JDBC is prepareStatement().

21. Static binding occurs at
Compile Time
Runtime
Both at compile and runtime.

22. Virtual Methods are default in
Java
C
C++ - Answer
All

23. Storage space in java is of the form
Stack
Queue
Heap
List

24. What is java code embedded in a web page known as
Applets
Servlets
scriptlets
snippets

25. Which of the following attributes are compulsory with an tag?.
code,height & width.

26. What does 'CODEBASE' in an applet tag specify?.
Files absolute path.

27. What are AccessSpecifiers & Access Modifiers.
Access Specifiers: Give access previleges to outside applications or users. They are :-
Public: any one can access
private:only class members can access.cannot be inherited.
protected: can be accessed by a derived class.
default: can access data from the current directory.

Access Modifiers: Which gives additional meaning to data, methods and classes.
(i) Final: cannot be modified at any point of time.

28. Tools provided by JDK
(i) javac - compiler
(ii) java - interpretor
(iii) jdb - debugger
(iv) javap - Disassembles
(v) appletviewer - Applets
(vi) javadoc - documentation generator
(vii) javah - 'C' header file generator

29.Hostile Applets:Its an applet which when downloaded attempts to exploit your system's resources in an inappropriate manner.It performs or causes you to perform an action which you would not otherwise care to perform.

30.RemoteObjects: Objects that have methods that can be called accross virtual machines are 0000000000000000Remote Objects.An object becomes Remote by implementing Remote Interface.

31.Compiling: Conversion of Programmer-readable Text into Bytecodes,which are platform independent,is known as Compiling.

32.Java Primitive Data Types:
Byte-8-bit
short-16-bit
int-32-bit
Long-64-bit
Float-32-bit floating point
Double-64-bit floating point
Char-16-bit Unicode

33.What is a unicode?
Unicode is a standard that supports International Characters.

34. What are blocks?.
They are statements appearing within braces {}.

35. What are types of Java applications?.

(i) Standalone applications(No browser).
(ii) Applets(Browser).

36. What is the method that gets invoked first in a stand alone application?.

The main()method.

37. What is throwing an Exception?.
The act of passing an Exception Object to the runtime system is called Throwing an Exception.

38. What are the packages in JDK?.

There are 8 packages
(i) java.lang(ii)java.util(iii)java.io(iv)java.applet(v) java.awt
(vi) java.awt.image(vii)java.awt.peer(viii)java.awt.net

39. What is a thread?.
Its a single sequential stream of execution.

40. What is runnable?.
Its an Interface through which Java implements Threads.The class can extend from any class but if it implements Runnable,Threads can be used in that particular application.

41. What is preemptive and Non-preemptive Time Scheduling?.
Preemptive: Running tasks are given small portions of time to execute by using time-slicing.
Non-Preemptive: One task doesn't give another task a chance to run until its finished or has normally yielded its time.

42. What is synchronization?.
Two or more threads trying to access the same method at the same point of time leads to synchronization.If that particular method is declared as synchronized only one thread can access it at a time. Another thread can access it only if the first thread's task is complete.

43. What are the various thread priorities?.

(i) Min-Priority-value(1).
(ii) Normal-Priority-value(5).
(iii)Max-Priority-value(10).

44.What is Inter-Thread communication?.
To exchange information between two threads.

45.The package java.applet.* has only one class.

46.BorderLayout is the default layout of Dialog object.

47.executeQuery() returns ResultSet.

48.Throwable class is a sub-class of object and implements Serializable.

49.Super class of TextArea and TextField is TextComponent.

50. Skeletons are server side proxies and stubs are client side proxies.

51. GridBagConstraints class helps in positioning of parameters of a
component within an object laidout using GridBagLayout.

52. Netscape introduced JScript language - True

53. EventDelegation model was introduced by JDK 1.1 - False

54. StringTokenizer provides two constructors - False

55. java.applet is one of the smallest package in Java API - True

56. Drag and Drop API consist of java.awt.dnd package - False

57. What is IP?.
IP is Internet Protocol. It is the network protocol which is used to send information from one computer to another over the network over the internet in the form of packets.

58. What is a port?.
A port is an 16-bit address within a computer.Ports for some common Internet Application protocols.

File Transfer Protocol-21.
Telnet Protocol-23.
Simple Mail Transfer Protocol-25.
Hypertext Transfer Protocol-80.

59.What is hypertext?.
Sockets are endpoints of Internet Communication.They are associated with a host address and a port address.
Clients create client sockets and connect them to server sockets.UDP is a connectionless protocol.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.