Wednesday, June 24, 2009
Monday, March 3, 2008
Spring
1. What is IOC (or Dependency Injection)?The basic concept of the Inversion of Control pattern (also known as dependency injection) is that you do not create your objects but describe how they should be created. You don't directly connect your components and services together in code but describe which services are needed by which components in a configuration file. A container (in the case of the Spring framework, the IOC container) is then responsible for hooking it all up.i.e., Applying IoC, objects are given their dependencies at creation time by some external entity that coordinates each object in the system. That is, dependencies are injected into objects. So, IoC means an inversion of responsibility with regard to how an object obtains references to collaborating objects.
2. What are the different types of IOC (dependency injection) ?
There are three types of dependency injection:
Constructor Injection (e.g. Pico container, Spring etc): Dependencies are provided as constructor parameters.
Setter Injection (e.g. Spring): Dependencies are assigned through JavaBeans properties (ex: setter methods).
Interface Injection (e.g. Avalon): Injection is done through an interface.
Note: Spring supports only Constructor and Setter Injection
3. What are the benefits of IOC (Dependency Injection)?
Benefits of IOC (Dependency Injection) are as follows:
Minimizes the amount of code in your application. With IOC containers you do not care about how services are created and how you get references to the ones you need. You can also easily add additional services by adding a new constructor or a setter method with little or no extra configuration.
Make your application more testable by not requiring any singletons or JNDI lookup mechanisms in your unit test cases. IOC containers make unit testing and switching implementations very easy by manually allowing you to inject your own objects into the object under test.
Loose coupling is promoted with minimal effort and least intrusive mechanism. The factory design pattern is more intrusive because components or services need to be requested explicitly whereas in IOC the dependency is injected into requesting piece of code. Also some containers promote the design to interfaces not to implementations design concept by encouraging managed objects to implement a well-defined service interface of your own.
IOC containers support eager instantiation and lazy loading of services. Containers also provide support for instantiation of managed objects, cyclical dependencies, life cycles management, and dependency resolution between managed objects etc.
Don't miss Spring Certification article.
4. What is Spring ?
Spring is an open source framework created to address the complexity of enterprise application development. One of the chief advantages of the Spring framework is its layered architecture, which allows you to be selective about which of its components you use while also providing a cohesive framework for J2EE application development.
5. What are the advantages of Spring framework?
The advantages of Spring are as follows:
Spring has layered architecture. Use what you need and leave you don't need now.
Spring Enables POJO Programming. There is no behind the scene magic here. POJO programming enables continuous integration and testability.
Dependency Injection and Inversion of Control Simplifies JDBC
Open source and no vendor lock-in.
6. What are features of Spring ?
Lightweight:
spring is lightweight when it comes to size and transparency. The basic version of spring framework is around 1MB. And the processing overhead is also very negligible.
Inversion of control (IOC):
Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects.
Aspect oriented (AOP):
Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services.
Container:
Spring contains and manages the life cycle and configuration of application objects.
MVC Framework:
Spring comes with MVC web application framework, built on core Spring functionality. This framework is highly configurable via strategy interfaces, and accommodates multiple view technologies like JSP, Velocity, Tiles, iText, and POI. But other frameworks can be easily used instead of Spring MVC Framework.
Transaction Management:
Spring framework provides a generic abstraction layer for transaction management. This allowing the developer to add the pluggable transaction managers, and making it easy to demarcate transactions without dealing with low-level issues. Spring's transaction support is not tied to J2EE environments and it can be also used in container less environments.
JDBC Exception Handling:
The JDBC abstraction layer of the Spring offers a meaningful exception hierarchy, which simplifies the error handling strategy. Integration with Hibernate, JDO, and iBATIS: Spring provides best Integration services with Hibernate, JDO and iBATIS
7. How many modules are there in Spring? What are they?
( Mouse on over to view the Image )
Spring comprises of seven modules. They are..
The core container:The core container provides the essential functionality of the Spring framework. A primary component of the core container is the BeanFactory, an implementation of the Factory pattern. The BeanFactory applies the Inversion of Control (IOC) pattern to separate an application's configuration and dependency specification from the actual application code.
Spring context:The Spring context is a configuration file that provides context information to the Spring framework. The Spring context includes enterprise services such as JNDI, EJB, e-mail, internalization, validation, and scheduling functionality.
Spring AOP:The Spring AOP module integrates aspect-oriented programming functionality directly into the Spring framework, through its configuration management feature. As a result you can easily AOP-enable any object managed by the Spring framework. The Spring AOP module provides transaction management services for objects in any Spring-based application. With Spring AOP you can incorporate declarative transaction management into your applications without relying on EJB components.
Spring DAO:The Spring JDBC DAO abstraction layer offers a meaningful exception hierarchy for managing the exception handling and error messages thrown by different database vendors. The exception hierarchy simplifies error handling and greatly reduces the amount of exception code you need to write, such as opening and closing connections. Spring DAO's JDBC-oriented exceptions comply to its generic DAO exception hierarchy.
Spring ORM:The Spring framework plugs into several ORM frameworks to provide its Object Relational tool, including JDO, Hibernate, and iBatis SQL Maps. All of these comply to Spring's generic transaction and DAO exception hierarchies.
Spring Web module:The Web context module builds on top of the application context module, providing contexts for Web-based applications. As a result, the Spring framework supports integration with Jakarta Struts. The Web module also eases the tasks of handling multi-part requests and binding request parameters to domain objects.
Spring MVC framework:The Model-View-Controller (MVC) framework is a full-featured MVC implementation for building Web applications. The MVC framework is highly configurable via strategy interfaces and accommodates numerous view technologies including JSP, Velocity, Tiles, iText, and POI.
8. What are the types of Dependency Injection Spring supports?
Setter Injection:Setter-based DI is realized by calling setter methods on your beans after invoking a no-argument constructor or no-argument static factory method to instantiate your bean.
Constructor Injection:Constructor-based DI is realized by invoking a constructor with a number of arguments, each representing a collaborator.
9. What is Bean Factory ?
A BeanFactory is like a factory class that contains a collection of beans. The BeanFactory holds Bean Definitions of multiple beans within itself and then instantiates the bean whenever asked for by clients.
BeanFactory is able to create associations between collaborating objects as they are instantiated. This removes the burden of configuration from bean itself and the beans client.
BeanFactory also takes part in the life cycle of a bean, making calls to custom initialization and destruction methods.
10. What is Application Context?
A bean factory is fine to simple applications, but to take advantage of the full power of the Spring framework, you may want to move up to Springs more advanced container, the application context. On the surface, an application context is same as a bean factory.Both load bean definitions, wire beans together, and dispense beans upon request. But it also provides:
A means for resolving text messages, including support for internationalization.
A generic way to load file resources.
Events to beans that are registered as listeners.
11. What is the difference between Bean Factory and Application Context ?
On the surface, an application context is same as a bean factory. But application context offers much more..
Application contexts provide a means for resolving text messages, including support for i18n of those messages.
Application contexts provide a generic way to load file resources, such as images.
Application contexts can publish events to beans that are registered as listeners.
Certain operations on the container or beans in the container, which have to be handled in a programmatic fashion with a bean factory, can be handled declaratively in an application context.
ResourceLoader support: Spring’s Resource interface us a flexible generic abstraction for handling low-level resources. An application context itself is a ResourceLoader, Hence provides an application with access to deployment-specific Resource instances.
MessageSource support: The application context implements M
Posted by
lavanya
at
12:08 AM
0
comments
Wednesday, January 16, 2008
JDBC Frequently Asked Questions
Q. How u connected DataBase in your project?
Q. Write program to connect DataBase?
a) class.forname("drivername");
Connection con = DriverManager.getConnection(url, username, pwd);
Statement stmt = con.createStatement("sql querry");
ResultSet rs = stmt.executeQurey();
while (rs.next()){
.........= rs.getInt();
..........................;
..........................;
}
Q. Why driver manager?
Q. Is DriverManager class or interface?
a) DriverManager is interface.
Q. Different types of statements?
a) 1. statement 2. preparedStatement 3. callableStatement
Q. what is the purpose of preparedStatement?
a) prepareStatement holds precompiled statements and it will take arguments.
Q. How to call stored procedures using jdbc?
a) using callable statement.
Q. Write a program for callable statement?
a) callableStatement stmt = con.createCallableStatement(procedure name, arguments.......);
Q. Different types of arguments for callableStatement?
a) 1. in parameters 2. out parameters 3. inout parameters.
Q. how to send outparameters?
a) stmt.registerOutParameter(param name, value, datatype);
Q. Different types of methods on statement?
a) 1. execute() 2. executeQuery() 3. executeUpdate()
Q. Return type for execute()?
a) boolean. either statement executed properly or not.
Q. Return type for executeQuery()?
a) int no of rows
Q. Return type for executeUpdate()?
a) int no of rows effected.
Q. What is connection pooling?
Q. How to get connection using connection pooling?
Q. How to implement connection pooling by your self?
Q. How will you insert or delete with a single java connection when you have referential integrity?
Q. How to get table name, column names and no of columns?
Q. JDBC driver types?
Q. What driver you are using in your database?
Q. 4th driver URL?
Q. How you add 10 records at a time in DataBase?
a) using executeBatch();
Q. What is ResultsetMetaData?
Q. ResultSet points to which location by default?
a) before first record.
Q. What are ResultSet constants?
Q. How you handle database exception numbers?
Q. Is there any other exception other than SQLEception?
Q. Connection, Statement are interfaces which class type they will create objects?
a) They will create ananymous class type objects.
Q. which loads driver class loader or JVM?
Q. What is the purpose of RowSet?
a) 1. It stores tabular data 2. It is bidirectional 3. It allows updation of table
Q. RowSet properties?
a) 1. setCommand
2. setEscapeProcessing -- default on
3. setFetchDirection
4. setFetchSize
5. setMaxFieldSize
6. setMaxRows
7. setQueryTimeOut -- default no limit
8. setShowDeleted -- default is not to show deleted rows
9. setTransactionIsolation -- default not to see dirty reads
10. setTypeMap -- default is null
Q. RowSet EventListeners?
a) 1. cursor movement
2. update, insert, delete
3. A change to entire rowset contents
Q. What are different kids of RowSets?
a) 1. connected -------- jdbc RowSet
2. disconnected ------ catchedRowSet, WebRowSet, JoinRowSet, FilteredRowSet
Q. What is the purpose of catchedRowSet?
a) 1. Obtain a connection to a dataSource and executeQuery.
2. Read the data from the resulting ResultSet Object and populate itself with that data.
3. Manipulate data and make changes to data while it is disconnected.
4. Reconnect to the data source to write changes back to it.
5. Check for conflicts with the datasource and resolve those conflicts.
Q. What is the advantages of WebRowSet?
a) It has all the advantages of catchedRowSet and
1. Write it self as an XML document
2. Read an XML document that describes a webRowSet.
Q. What is the advantages of JoinRowSet?
a) It has all the advantages of catchedRowSet, WebRowSet and It form equalent of an SOLJoin with out having to connect to a data source.
Q. What is the advantages of FilteredRowSet?
a) all the advantages of catchedRowSet, WebRowSet,JoinRowSet and apply filter critaria.
Q. Difference between connectedRowSet and disconnectedRowSet?
a) disconnected is light wait and serializable.
Q. Difference between ResultSet and RowSet?
a) ResultSet is single directional and not updatable.
RowSet is bidirectional and updatable.
Q. How to make a ResultSet Scrollable?
a) ResultSet.TYPE_SCROLL_INSENSITIVE
ResultSet.CONCUR_UPDATABLE
Posted by
lavanya
at
8:22 PM
0
comments
Labels: jdbc
Project Frequently Asked Questions
Q. Tell about ur self?
Q. Explain project?
Q. Which modules u have involved?
Q. Draw Project architecture?
Q. Draw Project directory structure?
Q. Difference between application server and webserver?
Q. Weblogic features?
Q. Which IDE you have used in your company?
Q. What is CVS?
Q. What design patterns your are using in your project?
Q. what UML diagrams you are using?
Q. Strengths and weaknesses technically?
Q. Explain MVC architecture?
Q. Difference between MVC1 and MVC2?
Q. How to maintain version in your system?
Q. How to retrieve dota of XML in XSL?
Posted by
lavanya
at
8:19 PM
0
comments
Labels: project
Core Java Frequently Asked Questions
Q. Is Java pure oop?
a) yes
Q. what are oop concepts?
a) 1. encapsulation 2. -abstraction 3. inheritance 4. polymorphism
Q. what is encapsulation?
a) Encapsulation is raping up of data and methods into a single class.
Q. what is abstraction?
a) hiding the details
Q. what is inheritence?
Q. what is polymorphism? Types? How can you achieve them?
a) many forms.
Q. What is runtime polymorphism?
Q. What is class? what is an instance? Difference between them?
Q. what is interface?
Q. Difference between overriding & overloading?
a) overriding - writing same method more than one time with different signature in the same
lass is called overriding.
overloading - writing same method with same signature in base class and derived class is
called overloading.
Q. Explain System.out.println();
a) System - system is a class in java.lang package.
out - out is an object of PrintStream type.
println() - println() is a method in that object.
Q. what is abstract class?
Q. Abstract class has constructors?
Q. If a class donot have constructors then what will happen?
Q. Who will call default constructors?
Q. what is concrete class?
Q. what is abstract method?
Q. what is final class?
Q. what is final method?
Q. what is final field?
Q. Can we change final field method?
Q. How to count no of instances for an object?
Q. Example class for final class from API?
Q. How to sort by using field?
Q. what is base class for java?
Q. what is base class for exception?
Q. how to handle exceptions in java?
Q. What is exception?
Q. Difference between abstract class and interface?
Q. Can we override or overload a static method with non static method?
Q. Is java support multiple inheritance?
Q. Can we use this in static method?
Q. Interface has constructors?
a) no
Q. Interface has constants?
a) yes
Q. Can we extend interface with another interface?
a) yes.
Q. How to convert Integer to String?
a) Integer.toString(int i);
Q) What is wrapper class?
Q. Different types of exceptions?
a) 1.checkedExceptions and 2. uncheckedExceptions.
Q. Differences between checked and unchecked exceptions?
Q. What exceptions you have handled in your project?
Q. How you handle NULLpointerExceptions?
a) using if else
Q. When garbage collector collects the objects?
a) If an object is no loger time used by the user and is set to null then garbage collector will collect the objects
Q. what is finally block? and why finally block?
Q. Is there any order imposed on writing catch blocks after try block?
a) yes.
Q. Difference between string and string buffer?
a) String - immutable
StringBuffer - mutable
Q. What is mutable and immutable?
a) Mutable - can alter the contents.
Immutable - can't alter the contents.
Q. How to handle threading in java? or How to write multithreading in java?
a) 1. Thread class 2. Runnable interface.
Q. when we will use runnable interface?
a) If you want to extend another class
Q. Thread life cycle?
Q. Thread States?
Q. How thread communication will happend?
a) 1. wait 2. notify 3. notify all
Q. What is dynathread?
a) A thread with least priority
Q. How will you set priorities of thread?
a) Using setPriority() method.
Q. Different types of priorities?
a) 1. MIN_PRIORITY 2. NORM_PRIORITY 3. MAX_PRIORITY
Q. Is stop() = sleep()?
a) No.
Q. How to stop next transaction for next 5min?
a) sleep(time);
Q. How to stop a thread?
a) using stop() method.
Q. What is multithreading?
Q. what is clonable?
Q. what is serialization?
a) Serialization is a process of writing a state of an object to a byte stream.
Q. How to make a class serializable?
a) Extend Serialozable interface.
Q. How can we serialize some instaces of objects rather than entire class? or how to stop serialization?
a) By specifing a field as trancient
Q. How to make a class deserializable?
Q. what is deserialization?
Q. How to deserialize Transient data?
a) We cant deserialize transient data.
Q. Where we use volatile?
a) if u specify a variable as volatile all threads will work on master data.
Q. What is singleton class?
Q. How to make a class singleton?
Q What is ananymous class?
Q. What is externalization?
a) Compressing or encryption of an object
Q. command for creating zar file?
Q. What is outputStream?
a) OutputStream is an abstract class.
Q. Equals which class method?
a) Object
Q. Difference between equals and ==?
Q. how to set class path?
Q. what is dynamic binding?
Q. what is DTD?
a) DTD is document type definition
Q. what is synchoronous and asynchoronous?
a) Synchronous - synchoronous is multiple threads can't access a resource at a time.
asynchrouns - asynchoronous is multiple threads can access a resource at a time.
Q. Difference between ArrayList and vector?
a) ArrayList - ArrayList is asynchronous and collection class
Vector - Vector is synchronous and legacy calss
Q. Methods in vector?
Q. Difference between iterator and enum?
a) iterator works as pointer for collection.
enum works as pointer for legacy.
Q. Write program for access elements from hash table?
Q. Difference between map and hashMap?
a) HashMap is following hashing techniques so accessing is easy compared to map.
Q. Difference between HashTable and HashMap?
a) HashTable is legacy and synchronous.
HashMap is collection and asynchoronous.
Q. Difference between vector and array?
a) array can store same type of objects.
vector can store different types of objects.
Q. Difference between arraylist and linkedlist?
a) ArrayList maintains index. It is useful for random access.
LinkedList is doubleLinked List it maintains 2 pointers add, delete elements at starting and ending is faster.
Q. Difference between collection and Collections?
Q. How to make a collection synchoronize?
a) Collections.synchronizedMap(new HashMap());
Collections.synchronizedSet(new HashSet());
Collections.synchronizedList(new List());
..................
Q. How to make a list read only?
a) Collections.unModifiableList();
Q. How to sort vector elements?
Q. What is the purpose of Arrays class?
a) Arrays class is for sorting and searching.
Q. How can your implement hashMap if you are not having it in java?
Q. What is cocoon?
a) cocoon is a frame work.
Q. Explain some sorting techniques?
Posted by
lavanya
at
4:28 AM
0
comments
Labels: Core Java
SQL Frequently Asked Questions
Q. SQL objects
SQL objects are schemas, journals, catalogs, tables, aliases, views, indexes, constraints, triggers, sequences, stored procedures, user-defined functions, user-defined types, and SQL packages. SQL creates and maintains these objects as system objects.
Schemas A schema provides a logical grouping of SQL objects. A schema consists of a library, a journal, a journal receiver, a catalog, and, optionally, a data dictionary.
Journals and journal receivers A journal and a journal receiver are used to record changes to tables and views in the database.
Catalogs An SQL catalog is a collection of tables and views that describe tables, views, indexes, packages, procedures, functions, files, sequences, triggers, and constraints.
Tables, rows, and columns A table is a two-dimensional arrangement of data that consists of rows and columns.
Aliases An alias is an alternate name for a table or view.
Views A view appears like a table to an application program. However, a view contains no data and only logically represents one or more tables over which it is created.
Indexes An SQL index is a subset of the data in the columns of a table that are logically arranged in either ascending or descending order.
Constraints A constraint is a rule enforced by the database manager to limit the values that can be inserted, deleted, or updated in a table.
Triggers A trigger is a set of actions that runs automatically whenever a specified event occurs to a specified table or view.
Stored procedures A stored procedure is a program that can be called with the SQL CALL statement.
Sequences A sequence is a data area object that provides a quick and easy way of generating unique numbers.
User-defined functions A user-defined function is a program that can be called like any built-in functions.
User-defined types A user-defined type is a distinct data type that you can define independently of the data types that are provided by the database management system.
SQL packages An SQL package is an object that contains the control structure produced when the SQL statements in an application program are bound to a remote relational database management system (DBMS).
Q. Differnce between oracle and sql server
1. Oracle runs on many platforms, SQL on Windows only
2. Oracle includes IFS (Internet File System), Java integration, SQL is more of a pure database
3. Oracle requires client install and setup (Not difficult, but very UNIX-like for Windows users)
4. SQL is #1 in Cost/Performance and overall Performance, although Oracle will refute that
5. Replication is much easier in SQL (I have been at clients where even the Oracle consultant couldn't get it working w/oracle)
6. Failover support in SQL is much, much easier
7. JDBC support is much better in Oracle, although Microsoft is working on it
8. ODBC support in both
9. SQL is ANSI-SQL '92 compliant, making it easier to convert to another ANSI compliant database, theoretically anyway (truth is every database has proprietary extensions). Oracle is generally more proprietary and their main goal is to keep their customers locked-in.
10. SQL natively supports ODBC, OLEDB, XML, XML Query, XML updates. Oracle natively supports proprietary connections, JDBC. Not sure about XML support though.
11. SQL Server is much easier to administrate, with GUI and command- line tools. Most of Oracle is command-line (Back in SQL 6.5 days I had a customer who was so proud that after a day's worth of work he had managed to script his database. I showed him how it was a 3 click operation in SQL ;-)
12. Oracle requires add-ons for transaction monitors, failover, etc. SQL has COM+, uses NT clustering and generally has everything built-in
13. SQL Analysis Services is included (A very powerful OLAP server). For Oracle it is a separate purchase.
14. Oracle will be used especially in large database. But if we use sql server in such a environment, the data processing will become very slower. Oracle database very closely supports Java rather than Sql server.
15. Oracle 7 was RDBMS, i.e it was a relation database and the one's after that i.e. 8 onwards Oracle introduced the concept of OODBMS. Which stands for Object Oriented Database Management Systems. With every major release Oracle has initiated a lot of changes for the better. Like a. (1) Getting PL/SQL closer to ANSI SQL standards b. (2) Automatic Management of Undo from 9i onwards c. (3) Introduction of special Grouping operators for queries d. (4) ISQL env for easier query processing e. (5) RAC (I dunno much about it) f. (6) AS(Application Server, integrated into the database)
16. SQL server GUI is easy to work. SQL serever is easy to maintain. Orcal data procssing is very good compared to SQL server17. Oracle is like apple and Sql Server is like Orange. For a Poor man Orange is better and for a rich man apple is better.
Q. What is Normal form? Different types of Normal forms?
Q. Advantages of SQL?
a) 1. It is portable.
2. It is non procedure language.
3. It is not a case sencitive.
4. There is no controle structures.
5. It is simple english like structure.
6. Easy to learn.
Q. what is DDL? and What are DDL commands?
a) DDL is data definition language which is used to create, alter, drop the data base objects such as tables, views, indexes, snap shots and sequences.
DDL commands are create, alter, drop.
Q. what is DML? and What are DML commands?
a) DML is data manipulation language. DML commands are insert, delete, update, select, commit, rollback, savepoint, truncate.
Q. what is DCL? and What are DCL commands?
a) DCL is data control language. DCL commands are grant, revoke, lock table.
Q. what are constraints in SQL?
a) 1. unique 2. not null 3. primary key 4. check 5. foreign key
null/not null: To represent blank ness or there is no blank
unique: To maintain unique values(no duplicates)
primary key: Unique + not null
Check: To validate a column ex: salary between 2000 and 6000
Foreign key: which refer one colum value with another column value of another tables primary key
Q. What is composit key?
a) It is compination of 2 or more columns. A composit key can be a primary key.
Q. What is syntax for create table?
a) 1. create table tableName (col1 datatype, col2 datatype........................);
2. syntax with constraints
create table tableName (col1 datatype [constraint
Q. What is syntax for alter table?
a) Alter table tableName [add/modify] (col name...............)
Q. Alter command with respect to constraints?
a) Alter table tableName [add/modify/drop] [enable/disable] (column name constraint constraint name constraint type)
Q. How to delete a column using alter command?
a) It is impossible using alter command.
Q) How to delete table?
a) Drop table tableName
Q) What is the syntax for insert data into table?
a) 1. full insertion
insert into tableName values (val1, val2........................val n)
2. partial insertion
insert into tableName (col1, col2, col3............col n) values (val1, val2, val3...............val n)
3. paramatric partial insertion
insert into tableName (col1, col2, col3...........col n) values (&val1, &val2, &val3........&val n)
Q) How to remove data from table?
a) Delete from tableName [where
Q) How to update data?
a) update tableName column =
Q) How to remove all records at a time?
a) truncate table table name
Q. is inner querries better or joins better?
a) joins are better they will take less comparisons.
Q. Why join?
a) Which produces meaningful out put from two or more tables.
Q. Different types of joins?
a) 1. equi join 2. non equi join
1. equi join: To get meaning ful data from two or more tables when a common column among the two tables.
2. non equi join: To get meaning ful data from two or more tables with out having any common column such type of joins are called non equi joins
Q. Difference between inner join and outer join?
a) if a row doesn't satisfy the join condition then the row will not appear in the query result for inner join. The missing rows can be returned if an outer join operator is used.
Q. Difference between left outer join and right outer join?
a) Left outer join will display all the data from left side table and matched data from the right side table.
Right outer join will display all the data from the right side table and matched data from the left side table
Q. what is self join?
a) A table which joins it self.
Q. What is a subquery?
a) Placing a select statement in the where clause of another statement the. statement which is used in the where clause is called inner querry and other is treated as outer querry.
Q. What is a view?
a) View is nothing but select statement. There is no physical existence for view. Views are masks placed upon tables. view are updatable and dynamic.
Q. What are the advantages of view?
a) 1. Simplify the querries.
2. Provides data security.
3. Reducing the data redundency.
4. We can fetch the data from 1 or more tables.
Q. Syntax for creating a view?
a) create view
Q. What is a forced view?
a) A view which is created with out base table.
Q. Syntax for creating a forced view?
a) create or replace forceview viewName as Query
Q. Is it possible to update a view?
a) yes if it dont have join condition, group function, group by clause, distinct clause
Q. Is it possible to add data to a view?
a) yes if it dont have join condition, group function, group by clause, distinct clause.
Q. How to create a squence?
a) To generate sequence numbers.
syn:- create sequence
Q. How to insert sequence value into a table?
a) insert into tablename values( sequenceName.nextValue,................);
Q. How to get current value of a sequence?
a) select sequence.currval from dual;
Q. How to alter a sequence?
a) Alter sequence
Q. How to delete a sequence?
a) Drop sequence sequenceName
Q. What is an index?
a) 1. Indexes are used to speed up the retrival operations on a table.
2. Indexes are also used to issue that no duplicate values enter into a column.
3. We may also create an index on multiple columns.
4. There is no limit for inxexes on a table.
Q. Syntax for index?
a) create [unique] index indexName on tableName (column list)
Q. How to remove an index?
a) Drop index indexNname
Q. What is a synonym?
a) A synonym is another name for a table or view. These can be created as public or private.
Public synonyms can be used by any user of the data base.
Private synonyms can be used only by the oner and by any users that have been granted suffitient privilizes.
There is no physical existence for synonyms.
Q. Syntax for synonyms?
a) create [public/private] synonym for tableName
Q. How to drop synonym?
a) Drop synonym synonymName
Q. What is a snapshot?
a) It is a read only table. If we remove actual table then also it will exist.
Q. Syntax for creating a snapshot?
a) create snapshot
Q. How to drop snap shot?
a) Drop snapshot
Q. What is a transaction?
a) The number of operations between two successive commits and two successive role backs.
Q. Syntax for commit?
a) commit
Q. Syntax for rollback?
a) It is used to cancle the transaction
Rollback [work] to [save point] save point name
Q. What is savepoint?
a) It is used to devide a transaction into small portions.
syn:
savePoint
Q. What is a role?
a) A role is a group of previlizes.
Q. What is a prevelize?
a) A kind of accessability on a pirticular databas objects.
Q. Different types of Roles?
a) 1. connect 2. Resource 3. DBA 4. Imp_Full_Database 5. exp_edit_patals
Q. How to grant Roles to a user?
a) grant [connect, resource, dba, imp_full_database, exp_edit_patals] to
Q. How to remove Roles for a user?
a) revoke roles from
Q. Different types of previlizes?
a. select, insert, update, delete, alter, index, references, all
Q. How to grant previlizes on a table to a user?
a) grant previlizes on table name to user name.
ex:- grant select on emp to batch1
Q. How to remove previlizes on a table from a user?
a) Revoke previlizes on table from users;
ex:- Revoke select on emp from batch1.
Q. different types of indexes?
Q. Difference between oracle and mysql?
Q. Difference between oracle and sqlserver?
Q. Difference between normal server and webserver?
Q. Write SQL query to retrieve employees who are in valid department?
Q. Write a query to retrieve names which are starting with 'L'?
Q. How to get employee name & manager name who are working under manager?
columns are empno, name, manager.
Q. Write a query to find second maximum salary?
Q. How to insert a row between 1 and 3?
Posted by
lavanya
at
2:54 AM
0
comments
Labels: SQL
Tuesday, January 15, 2008
JSP frequently asked questions
Q. what is JSP?
Q. Difference between jsp's and servlets?
Q. what are jsp elements?
a) 1. declaratives 2. scriptlets 3. directives
Q. what are jsp directives?
a) 1. page directive 2. include directive 3. taglib directive
Q. what are jsp implicit objects?
a) 1. out 2. request 3. response 4. session 5. application 6. page 7. page config 8. exception
Q. waht are action tags?
a) 1. jsp:include 2. jsp:forward 3. jsp:param 4. jsp:params 5: jsp:usebean 6. jsp:plugin 7. jsp:setProperty 8.jsp:getProperty
Q. How to make a page error page?
a) iserror = true in page directive
Q. Why exception object in JSP?
Q. Java script objects?
Q. Difference between application and pageConfig object?
Q. Difference between response.sendRedirect and jsp:forward
a) response.sendRedirect is static and work at client side.
jsp:forward is dynamic and work at server side.
Q. How to populate form fields form jsp to Data Base?
a) After submitting this page populate all values to the corresponding DTO object and this DTO is send as argumnet to DAO. That DAO will store data into the Data Base
Q. How can u retrieve java bean in JSP page? and what is the purpose of jsp:usebean?
a) By creating object for java bean using jsp:usebean
Q. Why jsp:usebean, jsp:setProperty, jsp:getProperty?
Q. What are the scopes in JSP?
a) 1. request 2. response 3. session 4.application
Q. Difference between jsp:include and include directive?
a) jsp:include is dynamic
include directive is static
Q. What you include by using include directive?
Q. How can u retrive the session data in JSP page?
a) after setting session = true in page directive u can access session object.
Q. How to make JSP page thread safe ?
a) By specifying threadsafe = true in page directive.
Q. Write syntax for jsp:usebean, jsp:setProperty and jsp:getProperty?
Q. Are you using JSTL?
Q. Custom tag example?
Posted by
lavanya
at
10:13 PM
2
comments
Labels: JSP