Java軟體工程面試題1

2021-07-13 16:33:27 字數 2801 閱讀 2139

寫出runtime exception

2.arraylist,linkedlist的區別?

3.stringbuilder,stringbuffer,stirng的區別
4.設計模式
5.hibernate or jdbc查詢user(id int primary key,name varchar(255)) id 為1的使用者名稱

connection conn = null;          statement stmt = null;             resultset result = null;             class.forname("

oracle.jdbc.driver.oralcedriver");             conn = drivermanager.getconnection("

jdbc:oracle:thin:@locast:1521:orcl", "scott", "tiger");             stmt = conn.createstatement();             result = stmt.executequery("select u.name from

user u where u.id='1'");             while(result.next())        result.close();        stmt.close();        conn.close();  

6.斐波那契數列:每個數等於前兩個數之和(1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...)

fib(n)= else }

迴圈法

int circle1 = 1; int circle2 = 1; int circle3; for (int i = 3; i <= n; i++) return circle2;

7 給定乙個資料夾,把文字檔案(.txt)放到listtxtfiles物件中,要考慮子資料夾filel.listfiles()返回乙個目錄下面的檔案file陣列

public listgetfiles(file filedir, string filetype) }  } }else } catch (exception e) return filelist; }

public static void main(string args)

}8.有三張表, 

drop table if exists `b`;

create table `b` (

`boe_header_id` int(11) not null,

`boe_line_id` int(11) default null,

`amount` varchar(11) default null,

`type` varchar(11) default null,

primary key (`boe_header_id`)

) drop table if exists `a`;

create table `a` (

`boe_header_id` int(11) not null auto_increment comment '單據頭id',

`dept_id` int(11) default null comment '報賬部門id',

`boe_date` varchar(11) default null comment '報賬日期',

primary key (`boe_header_id`)

) engine=innodb default charset=utf8;

-- ----------------------------

drop table if exists `c`;

create table `c` (

`dept_id` int(11) not null auto_increment,

`dept_name` varchar(11) default null,

primary key (`dept_id`)

) engine=innodb default charset=utf8;

編寫sql查詢出綜合部門在2023年1月份報銷費用型別為交通費的報賬金額總和?

select b.type,sum(b.amount) from b

left join  a on b.boe_header_id=a.boe_header_id

left join  c on a.dept_id=c.dept_id

where b.type='交通費' and c.dept_name='綜合部' and a.boe_date='2015.1';  

9.排序

/*** 排序 從小到大排列

* * @param arr

* @return

*/public static int sorttarr(int arr) }}

for (int i = 0; i < arr.length; i++)

return arr;

}折半查詢:先排序 -1 為沒有找到,找到直接返回要找數字的位置

public int searchnum(int arr, int findnum)

int start = 0;

int end = arr.length - 1;

while (start <= end) else if (findnum < middlenum) else

}return -1;

}

360軟體工程師面試題

1.1億個數,找不存在的數,位圖,2.火車1423456進站出站 排列順序問題,卡特蘭數,3.copystring注意指標為空,返回位址的問題。4.有9個球,3個輕的,3個中的,3個重的,輕中重直接沒有必然的關係,比如輕 重 2 中 是不一定成立的。問稱幾次把球分成3組 5.演算法題 輸入13個不大...

嵌入式軟體工程師面試題1

1 include 2 using namespace std 34 void getmemory char p,int num 78 int main void 問題出在void getmemory char p,int num 裡面,這裡面的 p其實是main 裡str的乙個副本,編譯器總要為函...

iOS軟體工程師面試題(高階)

1.寫一下uibutton與uitableview的層級結構 2.cocoa的foundation物件與core foundation物件通過什麼關鍵字進行轉換?這些關鍵字有什麼區別?3.kvo是什麼?內部是怎麼實現的?4.是否可以把比較耗時的操作放在nsnotificationcenter中處理?...