Before I resigned, I gave my company a set of interview questions. What do you think is difficult ??
Oracle Database assessment:
1. Write a jdbc connection to the database and add, delete, modify, and query data code (simply write it ).
Answer:
PublicstaticvoidMain (String [] args ){
//TODOAuto-generated method stub
Connection cn =Null;
CallableStatement cstmt =Null;
Try{
// Do not do this here, because the driver name is written to the program.
Class.ForName("");
Cn = DriverManager.GetConnection("");
Insert:
Cstmt = cn. prepareCall ("{call insert_Student (?,?,?)} ");
Cstmt. registerOutParameter (3, Types.INTEGER);
Cstmt. setString (1, "wangwu ");
Cstmt. setInt (2, 25 );
Cstmt.exe cute ();
System.Out. Println (cstmt. getString (3 ));
............................................................................. Other code
}Catch(Exception e ){
//TODOAuto-generated catch block
E. printStackTrace ();
}
Finally
{
Try{
If(Cstmt! =Null)
Cstmt. close ();
If(Cn! =Null)
Cn. close ();
}Catch(SQLException e ){
//TODOAuto-generated catch block
E. printStackTrace ();
}
}
}
2. Use an SQL statement to recursively query all Regions of the upper-level (including the Kaifu district) of the Kaifu district. The result is similar
Hunan Province
Changsha City
Kaifu District
(Note: The involved data table base_region region table)
Answer:
Select br. region_name from base_region br where br. parent_id! =-1 start with br. region_code = '201312'
Connect by prior br. parent_id = br. region_code order by region_code
3. Use an SQL statement to query the number of all enterprises and the number of enterprises with enterprise accidents. The result is similar
Total number of enterprises with accidents
530 23
(Note: The involved data table base_enterprise_info enterprise information table Base_enterprise_accident enterprise accident table)
Answer
Select
Sum (decode (A. title, 'entnumber', cnt, 0) as "total enterprise count ",
Sum (decode (A. title, 'accidentnumber', cnt, 0) as "Number of enterprises with accidents"
From (
Select 'entnumber' title, to_char (count (be. ent_id) cnt from base_enterprise_info be
Union all
Select 'accidentnumber' title, to_char (count (be. ent_id) cnt from base_enterprise_info be, Base_enterprise_accident ba where
Be. ent_id = ba. ent_id
)
4. Create
Database Design: Design Department Information depart and user information
Basic requirements: 1) the Department must be hierarchical (similar to the tree structure)
2) users can appear in multiple departments at the same time
3) you only need to design tables.
Java machine questions
1. What are the features of the List, Map, and Set interfaces when accessing elements?
2. A large number of design patterns are used in the java io stream, such as the decorate mode of the decorate. Can I copy one?
3. Read and retrieve all names from text files similar to the following, print the duplicate names and number of repetitions, and sort by repetition (from large to small ):
Text:
1, Zhang San, 28
2, Li Si, 35
3, Zhang San, 28
4, Wang Wu, 35
5, Zhang San, 28
6, Li Si, 35
7, Zhao 6, 28
8, Tian Qi, 35
.
Js machine questions
1. Write the javascript code used to verify that all input content in the HTML text box is numbers?
Answer: <input type = "text" id = "d1" onblur = "chkNumber (this)"/>
<Script type = "text/javascript"/>
Function chkNumber (eleText)
{
Var value = eleText. value;
Var len = value. length;
For (var I = 0; I <len; I ++)
{
If (value. charAt (I)> "9" | value. charAt (I) <"0 ")
{
Alert ("contains non-numeric characters ");
EleText. focus ();
Break;
}
}
}
</Script>
2. Determine if the second date is greater than the first date?
(Requirements:
How can I use a script to determine whether the string entered by the user is in the following time format:-11-21? ensure that the user input is in this format and is in the time format, for example, the month is not greater than 12, in addition, I need to enter two parameters, and the last one is later than the previous one. Only JAVASCRIPT is allowed.
)
Answer: <script type = "text/javascript">
Window. onload = function ()
{
Document. getElementById ("frm1"). onsubmit =
Function (){
Var d1 = this. d1.value;
Var d2 = this. d2.value;
If (! VerifyDate (d1) {alert ("the first date format is incorrect"); return false ;}
If (! VerifyDate (d2) {alert ("the second date format is incorrect"); return false ;}
If (! CompareDate (d1, d2) {alert ("the second date is smaller than the first date"); return false ;}
};
}
Function compareDate (d1, d2)
{
Var arrayD1 = d1.split ("-");
Var date1 = new Date (arrayD1 [0], arrayD1 [1], arrayD1 [2]);
Var arrayD2 = d2.split ("-");
Var date2 = new Date (arrayD2 [0], arrayD2 [1], arrayD2 [2]);
If (date1> date2) return false;
Return true;
}
Function verifyDate (d)
{
Var datePattern =/^ \ d {4}-(0? [1-9] | 1 [0-2])-(0? [1-9] | [1-2] \ d | 3 [0-1]) $ /;
Return datePattern. test (d );
}
</Script>
<Form id = "frm1" action = "xxx.html">
<Input type = "text" name = "d1"/>
<Input type = "text" name = "d2"/>
<Input type = "submit"/>
</Form>