61.What is the difference between preemptive scheduling and time slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.
62.What an I/O filter?
An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.
63.How to Create Object without using the keyword “new” in java?
Without new, the Factory methods are used to create objects for a class. For example
Calender c=Calender.getInstance();
here Calender is a class and the method getInstance() is a Factory method which can create an object for Calendar class.
64.Some of the properties of polymorphism :
- There are different types of polymorphism, such as Static and Dynamic.
- Polymorphism allows having various forms of objects, variables and methods.
- The behavior is dependent on the type of data that has been used in operation.
65.How is JSP better than Servlet technology?
JSP is a technology on the server’s side to make content generation simple. They are document centric, whereas servlets are programs. A Java server page can contain fragments of Java program, which execute and instantiate Java classes. However, they occur inside HTML template file. It provides the framework for development of a Web Application.
Java TRAINING
Weekend / Weekday Batch
66.How to delete a Cookie in a JSP?
The following code explain how to delete a Cookie in a JSP :
- Cookie mycook = new Cookie(“name1″,”value1”);
- addCookie(mycook1);
- Cookie killmycook = new Cookie(“mycook1″,”value1”);
- killmycook . set MaxAge ( 0 );
- killmycook . set Path (“/”);
- killmycook . addCookie ( killmycook 1 );
67.What are the basic interfaces of Java Collections Framework ?
Java Collections Framework provides a well designed set of interfaces and classes that support operations on a collections of objects. The most basic interfaces that reside in the Java Collections Framework are:
Collection, which represents a group of objects known as its elements.
Set, which is a collection that cannot contain duplicate elements.
List, which is an ordered collection and can contain duplicate elements.
Map, which is an object that maps keys to values and cannot contain duplicate keys.
68.Is it necessary that each try block must be followed by a catch block?
It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block OR a finally block. And whatever exceptions are likely to be thrown should be declared in the throws clause of the method.
69.What does the JDBC Connection interface?
The Connection interface maintains a session with the database. It can be used for transaction management. It provides factory methods that returns the instance of Statement, PreparedStatement, CallableStatement and DatabaseMetaData.
70.What is the difference between preemptive scheduling and time slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.