Advance Java|Pre-board|2018

5th Semester

Morgan

1.What  is the use of result set?
A  ResultSet is a Java object that contains the results of executing an SQL query. It is used to store query  result.
2.What is applet? Write down its states?
Ans: A Java applet was a small application that is written in the Java programming language, or another programming language that compiles to Java bytecode, and delivered to users in the form of Java bytecode.  
Its states are :1.Newborn state
2.Running state
3.Idle state
4.End state
3.List out the differences of Get and Post?
  GET  requests a representation of the specified resource where as POST submits data to be processed (e.g., from an HTML form) to the identified resource.
5.What is XML?
Ans: XML stands for eXtensible Markup Language. That is used for encoding the program.
6.How can we create a session in servlet?
Ans:  ses = request.getSession(true);
ses.setAttribute(“Name”,”Value”)
7.Which method is used to set the dimension of the window in AWT or swing? Show its use.
Ans:  Void setSize(int newWidth,intnewHeight)
Void setSize(Dimension newSize)  are the method to set the dimension of the window.
8.What is servlet? Write down its states?
Ans: Java servlets are server side program that runs inside a web server and handles client request and dynamic for each request.
Its states are:1.Loaded and Instantiated
2.Instantiated by calling Init() method
3.process a client’s request by invoking   service() method
4.Terminated by calling destroy() method
5.Garbage collected  by JVM
9.Differentiate between AWT and swing.
Ans:   AWT :Components are heavy weight.
It doesnot follow MVC.
Swing: Components are light weight.
It follows MVC.
10.Define JDBC.
It is a standard Java API for database independent connectivity between Java programming language and a  wide range of databases.

NCCS

  1. What are the different methods to execute sql statements?

A Statement object is used to execute a simple SQL statement with no parameters. A PreparedStatement object is used to execute a pre-compiled SQL statement with or without IN parameters. A CallableStatement object is used to execute a call to a database stored procedure.

  1. What do you mean by enterprise application?

An enterprise application (EA) is a large software system platform designed to operate in a corporate environment such as business or government. EAs are complex, scalable, component-based, distributed and mission critical.

  1. What are the two types of applets?

i.Local applet
ii.Remote applet

  1. What is the use of adapter class?

Java adapter classes provide the default implementation of listener interfaces. If you inherit the adapter class, you will not be forced to provide the implementation of all the methods of listener interfaces. So it saves code.

  1. Define 3 tier architecture with example.

A three-tier architecture is a client-serverarchitecture in which the functional process logic, data access, computer data storage and user interface are developed and maintained as independent modules on separate platforms.For example : client browser.

  1. List methods of keyListener interface.
  • void keyPressed(KeyEvent e) Invoked when a keyhas been pressed.
  • void keyReleased(KeyEvent e) Invoked when a keyhas been released.
  • void keyTyped(KeyEvent e) Invoked when a key has been typed.
  1. What is a scriplet in jsp and what is its syntax?

In JavaServer Pages (JSP) technology, a scriptlet is a piece of Java-code embedded in the HTML-like JSP code. The scriptlet is everything inside the <% %> tags. Between these the user can add any valid Scriptlet i.e. any valid Java Code. Its syntax is:
<% code fragment %>

  1. What is the use of xml?

XML is a file extension for an Extensible Markup Language (XML) file format used to create common information formats and share both the format and the data on the World Wide Web, intranets, and elsewhere using standard ASCII text. XML is similar to HTML.

  1. How to delete a session in servlet?

By calling invalidate() method on session object, we can destory the session.
if(request.getParameter(“logout”) != null )
{
session.invalidate();
response.sendRedirect(“restanes.jsp”);
}

  1. What is Errorpage attribute?

The errorPage attribute tells the JSP engine which page to display if there is an error while the current page runs. The value of the errorPage attribute is a relative URL.

Prime

Qn.1)  Two key features of swing are:

  • It is lightweight and is platform independent.
  • It supports pluggable look and feel.

Qn.2)  WindowListener is interface which force you to override all of the methods, while WindowAdapter is implementation of WindowListener and you only need to override the method(s) that you interest to deal with.
WindowListener is interface which mean you can’t instantiation the WindowListener, while WindowAdapter is concrete class that you can use new operator to instantiation.
Qn.3)   Statement for Jtable:
                   public class TableExample {
TableExample(){
 
JTable jt=new JTable(data,column);
Jt.setBounds(x,y,w,h);
Qn.4)  DTD is used to:

  • define a document type for an SGML-family markup language (SGML, XML, HTML).
  • defines the document structure with a list of validated elements and attributes

Qn.5) Servlet API is used to compile Servlets.
Qn.6)  Exception related servlets are:

  • lang.String
  • lang.Throwable

 
Qn.7)  A deployment descriptor (DD) refers to a configuration file for an artifact that is deployed to some container/engine. In the Java Platform, Enterprise Edition, a deployment descriptor describes how a component, module or application (such as a web application or enterprise application) should be deployed.
Qn.8) JDBC – Driver Types:

  • JDBC-ODBC Bridge Driver
  • JDBC-Native API
  • JDBC-Net pure Java

 
Qn.9)  Request Dispatcher is an interface whose implementation defines an object which can dispatch the request to any resources on the server.
RequestDispatcher interface is used to forward or include the response of a resource in a   Servlet.
Qn.10) XML is a text-based markup language which has the self-describing structure and can effectively define another markup language. On the other hand, HTML is a predefined markup language and has a limited capability.
XML provides logical structuring of the document while HTML structure is predefined where “head” and “body” tags are used. When it comes to language type HTML is case insensitive. As against, XML is case sensitive.
 
pre-baord
1.What is AWT?
Abstract Window Toolkit (AWT) is a set of application program interfaces ( API s) used by Java programmers to create graphical user interface ( GUI ) objects, such as buttons, scroll bars, and windows. AWT is part of the Java Foundation Classes ( JFC ) from Sun Microsystems, the company that originated Java.
2.List any five Event Classes?
1.ActionEvent 2.KeyEvent 3.MouseEvent 4.WindowEvent 5.ComponentEvent.
3. What is prepared statement?
PreparedStatement in Java is one of several ways to execute SQL queries using JDBC API. Java provides Statement, … Out of these three, Statement is used for general purpose queries, PreparedStatement is used for executing parametric query and CallableStatement is used for executing Stored Procedures.
4.What is Applet?
An applet is a small Internet-based program written in Java, a programming language for the Web, which can be downloaded by any computer. The applet is also able to run in HTML. The applet is usually embedded in an HTML page on a Web site and can be executed from  within a browser.
5.What is cookie?
A cookie is a small piece of information that is persisted between the multiple client requests.A cookie has a name, a single value, and optional attributes such as a comment, path and domain qualifiers, a maximum age, and a version number.
6.list out the life cycle methods of a servlet program.
Here are the five steps of servlet life cycle.
Step 1: Loading of Servlet. When the web server (e.g. Apache Tomcat) starts up,
the servletcontainer deploy and loads all the servlets.
Step 2: Creating instance of Servlet.
Step 3: Invoke init() method.
Step 4: Invoke service() method.
Step 5: Invoke destroy() method.
7. what is web server?
A web server is server software, or hardware dedicated to running said software, that can satisfy World Wide Web client requests. A web server can, in general, contain one or more websites. A web server processes incoming network requests over HTTP and several other related protocols
8. what is XML Schema?
An XML Schema is a language for expressing constraints about XML documents. It is used to provide a list of elements and attributes in a vocabulary and associate types, such as integer, string, etc., or more specifically such as hatsize, sock_colour, etc., with values found in documents.
9.how is JTable created?
JTable t=new JTable();
10. what is MouseListener?
A MouseListener is a type of listener that notified whenever you change the state of mouse. It is notified against MouseEvent. The MouseListener interface is found in java.awt.event package. It has five methods  mouseClicked, mouseEnter mouseExited, mousePressed and mouseReleased.