河軟-java測試附答案_第1頁
河軟-java測試附答案_第2頁
河軟-java測試附答案_第3頁
河軟-java測試附答案_第4頁
河軟-java測試附答案_第5頁
已閱讀5頁,還剩10頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、河軟-java測試復(fù)制1、創(chuàng)建數(shù)據(jù)庫使用以下哪項 單選題 *create mytestcreate table mytestdatabase mytestcreate database mytest(正確答案)2、若要在基本表S中增加一列CN(課程名),可用 單選題 *ADD TABLES ALTER(CN CHAR()ALTER TABLES ADD(CN CHAR()(正確答案)ADD TABLES(CN CHAR()ALTER TABLES (ADD CN CHAR()3、刪除經(jīng)銷商1018的數(shù)據(jù)記錄的代碼為( ) from distributors where distri_num=1

2、018 單選題 *drop tabledelete *drop columndelete(正確答案)4、以下語句錯誤的是 單選題 *alter table emp delete column addcolumn;(正確答案)alter table emp modify addcolumn char(10);alter table emp change addcolumn addcolumn int;alter table emp add addcolumn int;5、mysql函數(shù)中返回不小于x的最小整 單選題 *ceil()(正確答案)floor()round()random()6、res

3、ultMap標(biāo)簽中,用于指定非主鍵字段的標(biāo)簽是? 單選題 *idresult(正確答案)resultMapselect7、下面配置正確的是 單選題 * select last_insert_id() insert into user (username,birthday,sex,address)values(#username,#birthday,#sex,#address) (正確答案) select last_insert_id() insert into user (username,birthday,sex,address)values($username,$birthday,$sex

4、,$address) select last_insert_id() insert into user (username,birthday,sex,address)values(#username,#birthday,#sex,#address) select last_index_id() insert into user (username,birthday,sex,address)values(#username,#birthday,#sex,#address) 8、表示查詢語句返回結(jié)果的列名的屬性是 單選題 *resultTypekeyPropertykeyColumn(正確答案)o

5、rder9、清理一級緩存的方法是 單選題 *clear()clearCache()(正確答案)clearAll()closeAll()10、多個SqlSession 可以共用 單選題 *本地緩存一級緩存二級緩存(正確答案)三級緩存11、構(gòu)造者類 單選題 *ResourcesSqlSessionFactoryBuilder(正確答案)SqlSessionSqlSessionFactory12、如何關(guān)閉session 單選題 *session.openAll();session.open();session.close();(正確答案)session.closeAll();13、如何啟動redis

6、服務(wù) 單選題 *redis-server(正確答案)redis-cliredis-server ./redis-cliredis-cli ./redis-server14、查看服務(wù)端是否啟動 單選題 *redis-cliredis-cli shutdownredis-cli ping(正確答案)redis-cli quit15、安裝Redis時,我們默認(rèn)的安裝目錄是 單選題 */home/local/usr/local(正確答案)/etc/local/usr/home/16、linux哪個命令可以將普通用戶轉(zhuǎn)換成超級用戶 單選題 *superpasswordtarsu(正確答案)17、用命令“

7、rm -i”,系統(tǒng)會提示什么來讓你確認(rèn) 單選題 *命令行的每個選項是否直的刪除(正確答案)是否有寫的權(quán)限文件的位置18、vim中哪條命令是不保存強(qiáng)制退出 單選題 *:wq:wq1:q!(正確答案):quit19、如果用戶想對某一命令詳細(xì)了解,可用 單選題 *lshelpman(正確答案)dir20、在JAVA中,Object類是所有類的父親,用戶自定義類默認(rèn)擴(kuò)展自O(shè)bject類,下列選項中的()方法不屬于Object類的方法。 單選題 *equals(Object obj)getClass()toString()trim()(正確答案)21、System中獲取當(dāng)前系統(tǒng)時間 單選題 *gc()e

8、xit()getProperties()currentTimeMillis()(正確答案)22、下列代碼中是將StringBuffer對象中的內(nèi)容反轉(zhuǎn)然后形成新的字符串的是 單選題 *public StringBuffer delete(int start,int end)public StringBuffer reverse()(正確答案)public StringBuffer append(boolean b)public StringBuffer deleteCharAt(int index)23、public class Test public static void main(Str

9、ing args) String s = ;char result = s.charAt(8);System.out.println(result);運(yùn)行結(jié)果: 單選題 *sc(正確答案)ho24、下列代碼中遍歷鍵值對對象的集合,得到每一個鍵值對的對象的代碼是( )。public class IntegerDemo public static void main(String args) Map map = new HashMap();map.put(hello, world);map.put(java, c+);map.put(sql, os);System.out.println(map)

10、;SetMap.Entry set = map.entrySet();for (Map.Entry me : set) String key = me.getKey();String value = me.getValue();System.out.println(key + - + value); 單選題 *SetMap.Entry set = map.entrySet();for (Map.Entry me : set) (正確答案)String key = me.getKey();Map map = new HashMap();25、下面代碼運(yùn)行的結(jié)果是ArrayList al = ne

11、wArrayList();al.add(true);al.add(123);al.add(“abc”);System.out.println(al); 單選題 *編譯失敗(正確答案)true,123true,123,abc;abc;26、在JAVA中,LinkedList類和ArrayList類同屬于集合框架類,下列()選項中的方法是LinkedList類有而ArrayList類沒有的。 單選題 *add(Object o)add(int index,Object o)remove(Object o)removeLast()(正確答案)27、public class ExampleString

12、 str = new String(good);char ch = a , b , c ;public static void main(String args)Example ex = new Example();ex.change(ex.str,ex.ch);System.out.print(ex.str + and );System.out.print(ex.ch);public void change(String str,char ch )str = test ok;ch0 = g;運(yùn)行結(jié)果() 單選題 *good and abcgood and gbc(正確答案)test ok a

13、nd abctest ok and gbc28、下面那個不是Spring特點 單選題 *容器面向?qū)ο?正確答案)面向切面控制反轉(zhuǎn)29、scope:prototype的生命周期不正確的是? 單選題 *當(dāng)使用對象時,創(chuàng)建新的對象實例只要對象在使用中,就一直活著當(dāng)對象長時間不用時,被 java 的垃圾回收器回收了當(dāng)執(zhí)行程序時,創(chuàng)建新的對象實例(正確答案)30、那一個不是數(shù)據(jù)訪問集成中的模塊 單選題 *JMS 模塊ORM 模塊Web 模塊(正確答案)JDBC 模塊31、如何通過vim編輯打開/tmp/test.conf 填空題 *_答案解析:cd /tmpvim /tmp/test.conforvim

14、 /tmp/test.conf32、(1)查詢平均成績大于60分的同學(xué)的學(xué)號和平均成績(2)查詢男生、女生的人數(shù);填空題 *_答案解析:(1)產(chǎn)尋學(xué)生的id,和成績,然后用avg函數(shù)來求得同一id號的學(xué)生平均成績,并用having進(jìn)行成績的篩選select student_id,avg(number) from score group by student_id having avg(number)60;(2)select * from (select count(1) as M from student where gender=男) as A,(select count(1) as W f

15、rom student where gender=女) as B;33、打印出楊輝三角形(要求打印出10行如下圖)程序分析:1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 填空題 *_34、打印出如下圖案(菱形) * * * * * * * 填空題 *_35、完成數(shù)組去重 填空題 *_答案解析:public class Test public static void main(String args) String arrStr = Java, C+, Php, C#, Python, C+, Java;test1(arrStr);test2(arrSt

16、r);test3(arrStr);test4(arrStr);/方法1:通過List去重public static void test1(String arrStr) List list = new ArrayList();for (int i=0; iarrStr.length; i+) if(!list.contains(arrStri) list.add(arrStri);System.out.println(list);/返回一個包含所有對象的指定類型的數(shù)組/String newArrStr = list.toArray(new String1);/System.out.println

17、(Arrays.toString(newArrStr);/方法2:通過Map去重public static void test2(String arrStr) Map map = new HashMap();for (String str : arrStr) map.put(str, str);System.out.println(map.keySet();/方法3:通過Set去重public static void test3(String arrStr) Set set = new HashSet();for (String str : arrStr) set.add(str);Syste

18、m.out.println(set);/方法4:通過lambda去重(jdk1.8)public static void test4(String arrStr) Stream stream = Arrays.stream(arrStr);List list = stream.distinct().collect(Collectors.toList();System.out.println(list);36、用插入排序的方式,完成數(shù)組從小到大的排序 填空題 *_答案解析:public class InsertDemo public static void main(String args) i

19、nt arr = new int 4, 3, 2, 1 ;int arr2 = getInsert(arr);for (int a : arr2) System.out.print(a + );public static int getInsert(int arr3) / 4,3,2,1/ 第一次比較:i=1 j=1 3,4,2,1/ 第二次比較:i=2 j=2 3,2,4,1/ j=1 2,3,4,1/ 第三次比較 i=3 j=3 2,3,1,4/ j=2 2,1,3,4/ j=1 1,2,3,4for (int i = 1; i 0; j-) if (arr3j - 1 arr3j) in

20、t temp = arr3j - 1;arr3j - 1 = arr3j;arr3j = temp;return arr3;37、用三個線程按順序循環(huán)打印abc三個字母,比如abcabcabc。 填空題 *_答案解析:public class Demo1 public static void main(String args) Demo1 demo1 = new Demo1();PrintLetter printLetter = demo1.new PrintLetter();new Thread(demo1.new PrintThread(printLetter, B).start();new Thread(demo1.new PrintThread(printLetter, A).start();new Thread(demo1.new PrintThread(printLetter, C).start();/ Collections.synchronizedList()private class PrintLetter private char letter = A;public char get

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論