`

数据库及struts面试题

阅读更多
数据库部分
Q: What is SQL?

A: SQL stands for 'Structured Query Language'.
  结构化查询语言

Q: What is SELECT statement?

A: The SELECT statement lets you select a set of values from a table in a database. The values selected from the database table would depend on the various conditions that are specified in the SQL query.
select可以从数据库中的表格中选择一组数据。 

Q: How can you compare a part of the name rather than the entire name?

A: SELECT * FROM people WHERE empname LIKE '%ab%'
Would return a recordset with records consisting empname the sequence 'ab' in empname .
 

Q: What is the INSERT statement?

A: The INSERT statement lets you insert information into a database.
插入语句 用于向表格插入记录

Q: How do you delete a record from a database?

A: Use the DELETE statement to remove records or any particular column values from a database.
删除语句用于删除表格中某些记录

Q: How could I get distinct entries from a table?

A: The SELECT statement in conjunction with DISTINCT lets you select a set of distinct values from a table in a database. The values selected from the database table would of course depend on the various conditions that are specified in the SQL query. Example
SELECT DISTINCT empname FROM emptable 
 

Q: How to get the results of a Query sorted in any order?

A: You can sort the results and return the sorted results to your program by using ORDER BY keyword thus saving you the pain of carrying out the sorting yourself. The ORDER BY keyword is used for sorting.

SELECT empname, age, city FROM emptable ORDER BY empname
order by只能用于最后,对最后的查询结果进行排序,默认为升序,ASC,DEC

Q: How can I find the total number of records in a table?

A: You could use the COUNT keyword , example

SELECT COUNT(*) FROM emp WHERE age>40
注意聚集函数的使用,COUNT,SUM,MIN,MAX等

Q: What is GROUP BY?

A: The GROUP BY keywords have been added to SQL because aggregate functions (like SUM) return the aggregate of all column values every time they are called. Without the GROUP BY functionality, finding the sum for each individual group of column values was not possible. 


Q: What is the difference among "dropping a table", "truncating a table" and "deleting all records" from a table.

A: Dropping :  (Table structure  + Data are deleted), Invalidates the dependent objects ,Drops the indexes
Truncating:  (Data alone deleted), Performs an automatic commit, Faster than delete

Delete : (Data alone deleted), Doesn’t perform automatic commit


Q: What are the Large object types suported by Oracle?

A: Blob and Clob.

Q: Difference between a "where" clause and a "having" clause.

A: Having clause is used only with group functions whereas Where is not used with.
  TOP 

Q: What's the difference between a primary key and a unique key?

A: Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only.


Q: What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you avoid cursors?

A: Cursors allow row-by-row prcessing of the resultsets.

Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See books online for more information.

Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one rowundtrip, however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Furthere, there are restrictions on the SELECT statements that can be used with some types of cursors.

Most of the times, set based operations can be used instead of cursors.


Q: What are triggers? How to invoke a trigger on demand?
触发器
A: Triggers are special kind of stored procedures that get executed automatically when an INSERT, UPDATE or DELETE operation takes place on a table.

Triggers can't be invoked on demand. They get triggered only when an associated action (INSERT, UPDATE, DELETE) happens on the table on which they are defined.

Triggers are generally used to implement business rules, auditing. Triggers can also be used to extend the referential integrity checks, but wherever possible, use constraints for this purpose, instead of triggers, as constraints are much faster.


Q: What is a join and explain different types of joins.

A: Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table.

Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
 

Q: What is a self join?

A: Self join is just like any other join, except that two instances of the same table will be joined in the query. 


struts部分

Q: What is Struts?

A: The core of the Struts framework is a flexible control layer based on standard technologies like Java Servlets, JavaBeans, ResourceBundles, and XML, as well as various Jakarta Commons packages. Struts encourages application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller (MVC) design paradigm.

Struts provides its own Controller component and integrates with other technologies to provide the Model and the View. For the Model, Struts can interact with standard data access technologies, like JDBC and EJB, as well as most any third-party packages, like Hibernate, iBATIS, or Object Relational Bridge. For the View, Struts works well with JavaServer Pages, including JSTL and JSF, as well as Velocity Templates, XSLT, and other presentation systems.


The Struts framework provides the invisible underpinnings every professional web application needs to survive. Struts helps you create an extensible development environment for your application, based on published standards and proven design patterns.



Q: What is Jakarta Struts Framework?

A: Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.

 
Q: What is ActionServlet?

A: The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.
  [ Received from Dhiraj Sharma]  TOP

Q: How you will make available any Message Resources Definitions file to the Struts Framework Environment?

A: T Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through <message-resources /> tag.
Example:

<message-resources parameter=\"MessageResources\" />.


  [ Received from Dhiraj Sharma]  TOP

Q: What is Action Class?

A: The Action Class is part of the Model and is a wrapper around the business logic. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the execute() method. In the Action Class all the database/business processing are done. It is advisable to perform all the database related stuffs in the Action Class. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. The return type of the execute method is ActionForward which is used by the Struts Framework to forward the request to the file as per the value of the returned ActionForward object.

  [ Received from Dhiraj Sharma]  TOP

Q: What is ActionForm?

A: An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from a form on the client side.

  [ Received from Dhiraj Sharma]  TOP

Q: What is Struts Validator Framework?

A: Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class.
The Validator framework was developed by David Winterfeldt as third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.



  [ Received from Dhiraj Sharma]  TOP

Q: Give the Details of XML files used in Validator Framework?

A: The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean.

  [ Received from Dhiraj Sharma]  TOP

Q: How you will display validation fail errors on jsp page?

A: Following tag displays all the errors:
<html:errors/>

  [ Received from Dhiraj Sharma]  TOP

Q: How you will enable front-end validation based on the xml in validation.xml?

A: The <html:javascript> tag to allow front-end validation based on the xml in validation.xml. For example the code: <html:javascript formName=\"logonForm\" dynamicJavascript=\"true\" staticJavascript=\"true\" /> generates the client side java script for the form \"logonForm\" as defined in the validation.xml file. The <html:javascript> when added in the jsp file generates the client site validation script.

  [ Received from Dhiraj Sharma]  TOP

Q: How to get data from the velocity page in a action class?

A: We can get the values in the action classes by using data.getParameter(\"variable name defined in the velocity page\");

分享到:
评论

相关推荐

    最全的IT公司面试题集 CHM版的

    数据库面试题,英语面试,外企面试,软件测试面试题,Python面试题,Oracle面试题,MySql面试题,Web开发面试题,Unix面试题,程序员面试,网络技术面试题,网络安全面试题,Linux面试题,Hibernate面试题,Spring面试题,SQL ...

    最新Java面试题视频网盘,Java面试题84集、java面试专属及面试必问课程

    面试题包含了不同技术层面的面试问题,同时也能对一些没有面试开发经验的小白给予不可估量的包装, 让你的薪水绝对翻倍, 本人亲试有效.Java面试题84集、java面试专属及面试必问课程,所有的面试题有视屏讲解, 解答方案....

    程序员面试手册-超级全的程序员面试题-CHM版

    数据库面试题,英语面试,外企面试,软件测试面试题,Python面试题,Oracle面试题,MySql面试题,Web开发面试题,Unix面试题,程序员面试,网络技术面试题,网络安全面试题,Linux面试题,Hibernate面试题,Spring面试题,SQL ...

    2021年最新java面试题--视频讲解(内部培训84个知识点超详细).rar

    Java面试题48.struts2的执行流程或者struts2的原理 Java面试题49.Struts2的拦截器是什么 Java面试题50.Spring MVC的执行流程 Java面试题51.SpringMVC和Struts2的不同 Java面试题52.简单介绍一下Spring或者Spring的两...

    2021年最新最全最新IT技术面试题合集(CHM版本)

    内含最全最新IT技术面试合集,含有: Java面试题,J2EE面试题,.net面试题,PHP面试题,数据库面试题,英语面试,外企面试,软件测试面试题,Python...Hibernate面试题,Spring面试题,SQL Server面试题,Struts面试题,EJB面试题

    java面试题以及技巧

    │ │ │ Java程序员认证模拟题及详细分析.doc │ │ │ question.rar │ │ │ test4.doc │ │ │ 模拟题.rar │ │ │ 经典的104-147模拟题.rar │ │ │ │ │ ├─035 │ │ │ 2003.10.5.15.51.43.TestKing%...

    涵盖了90%以上的面试题

    hashmap的底层原理 hashmap产生死锁的原因 hashmap的容量为什么一定要是2的幂呢 TreeMap的底层原理 HashMap,Hashtable和ConcurrentHashMap的区别 ...还有好多,不想写了,太多了,都是题主呕心沥血总结的

    java 面试题 集 包含开源框架

    java 面试题 数据结构,struts spring 数据库

    javaSSH面试题

    常见的javassh面试题,例如hibernate的连接数据库,struts2,spring,的集合开发,常见的应用

    android和java面试大全集

    struts面试题 hibernate面试题 三大框架.txt JAVA题库.doc struts+spring+hibernate面试题.mht spring面试题 spring面试题 - 心动音符 - JavaEye技术网站.mht Struts,Hibernate,Spring的面试题_...

    Java常见面试题208道.docx

    面试题包括以下十九部分:Java 基础、容器、多线程、反射、对象拷贝、Java Web 模块、异常、网络、设计模式、Spring/Spring MVC、Spring Boot/Spring Cloud、Hibernate、Mybatis、RabbitMQ、Kafka、Zookeeper、MySql...

    开发、测试、资料面试题集锦

    开发、测试、资料面试题集锦, OCS项目面试题 1.你在项目中的工作? 2.后付费与预付费的流程有什么区别? 3.简述扣费流程 4.批价流程 5.测试流程 6.自己写5个UNIX命令,自己解释 7.写一个正则表达式的...

    java,ssh,数据库面试题整理

    java面试问题整理,文档中包含几套java的笔试题,java面试中问到的问题整理,struts,hibernate,spring的面试问题整理。

    java面试题及技巧4

    │ │ │ Java程序员认证模拟题及详细分析.doc │ │ │ question.rar │ │ │ test4.doc │ │ │ 模拟题.rar │ │ │ 经典的104-147模拟题.rar │ │ │ │ │ ├─035 │ │ │ 2003.10.5.15.51.43.TestKing%...

    java面试题及技巧3

    │ │ │ Java程序员认证模拟题及详细分析.doc │ │ │ question.rar │ │ │ test4.doc │ │ │ 模拟题.rar │ │ │ 经典的104-147模拟题.rar │ │ │ │ │ ├─035 │ │ │ 2003.10.5.15.51.43.TestKing%...

    JAVA面试题最全集

    15.MVC (Struts的工作流程) 16.什么是MDA 17.tcp与udp的区别 18.链表与散列表和数组的区别 19.堆和栈的区别 20.ejb的分类及区别 21.你对现在软件业以及国内软件业的看法 22.谈谈java多线程 23.谈谈文件...

    java面试题库2021.pdf

    目录 一、 JavaSE 部分 1、 Java 基础 ①Java 基础部分(基本语法, Java 特性等) ②关键字 ③面向对象 ④集合部分 2、 Java 高级知识 ①线程 ②锁 ...3、 Struts ①MVC 模式与 Struts 体系 ...十、 场景题 十一、 UML

    java面试题大全(2012版)

    7、STRUTS的应用(如STRUTS架构) 121 8、说说struts1与struts2的区别。 121 9、hibernate中的update()和saveOrUpdate()的区别,session的load()和get()的区别。 122 10、简述 Hibernate 和 JDBC 的优缺点? 如何书写一...

    java面试题.rar

    搜集最全面的java面试题,java核心,javascript,数据库,oracle,存储过程,servlet,spring,struts,spring,ibatis等等

    三大框架SSH)面试题

    三大框架(Spring,Struts,Hiberbate)面试题

Global site tag (gtag.js) - Google Analytics