亚洲国产日韩欧美在线a乱码,国产精品路线1路线2路线,亚洲视频一区,精品国产自,www狠狠,国产情侣激情在线视频免费看,亚洲成年网站在线观看

Java筆試模擬試卷

時(shí)間:2021-05-12 15:40:41 SUN認(rèn)證 我要投稿

Java筆試模擬試卷

  Java 不同于一般的編譯執(zhí)行計(jì)算機(jī)語言和解釋執(zhí)行計(jì)算機(jī)語言。下面是關(guān)于Java筆試模擬試卷,希望大家認(rèn)真閱讀。

Java筆試模擬試卷

  試題1

  下列不屬于接口的是

  A. Statement

  B. PreparedStatement

  C. Driver

  D. DriverManager

  試題2

  關(guān)于ResultSetMetaData API描述錯(cuò)誤的是

  A. getColumnCount() 返回列的數(shù)目

  B. getColumnTypeName(int index) 返回指定列的類型的名稱

  C. getColumnType(int index) 返回字符串表示形式的指定列的類型

  D. isNullable 指定列是否為空

  試題3

  emp表數(shù)據(jù)如下

  EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO

  —– ———- ——— —– ———– ——— ——— ——

  7369 SMITH CLERK 7902 1980/12/17 800.00 20

  7499 ALLEN SALESMAN 7698 1981/2/20 1600.00 0.00 30

  下面代碼輸出的結(jié)果是:

  …

  ResultSet rs = stmt.executeQuery (“select comm from emp”);

  while(rs.next()) {

  System.out.println(rs.getDouble(1) + “,” +rs.wasNull());

  }

  A. 0, true

  0, false

  B. null, true

  0,false

  C. 0, false

  0, false

  D. 0, true

  0, true

  試題4

  下面的代碼用于將存放于文件中的圖片信息(mouse.bmp)和文本信息(some.xml)插入到Oracle數(shù)據(jù)庫(Oracle 10g 以上驅(qū)動(dòng))

  應(yīng)該填入的代碼是:

  public void testSaveLOB() throws Exception {

  Connection con = DBUtils.getConnection();

  PreparedStatement stmt = con

  .prepareStatement(“ into sd_user (id, photo,mem) values(?,?,?)”);

  stmt.setInt(1, 30);

  File file = new File(“d:/mouse.bmp”);

  FileInputStream fis = new FileInputStream(file);

  File xml = new File(“d:/some.xml”);

  InputStreamReader reader = new InputStreamReader(new FileInputStream(

  xml), “utf-8〃);

  int n = stmt.executeUpdate();

  System.out.println(n);

  fis.close();

  stmt.close();

  con.close();

  }

  A. stmt.setStream(2, fis, (int) file.length());

  stmt.setReader(3, reader, (int) xml.length());

  B. stmt.setBinaryStream(2, fis, (int) file.length());

  stmt.setCharacterStream(3, reader, (int) xml.length());

  C. stmt.setInputStream(2, fis, (int) file.length());

  stmt.setCharacterStream(3, reader, (int) xml.length());

  D. stmt.setBinaryStream(2, fis, (int) file.length());

  stmt.setFileReader(3, reader, (int) xml.length());

  試題5

  下面描述不屬于連接池的功能的.是

  A. 可以緩解連接頻繁的關(guān)閉和創(chuàng)建會(huì)造成系統(tǒng)性能的下降

  B. 可以大幅度提高查詢語句的執(zhí)行效率

  C. 可以限制客戶端的連接數(shù)量

  D. 可以提高系統(tǒng)的伸縮性

  試題6

  下面的代碼用于實(shí)現(xiàn)對(duì)emp表的分頁查詢(Oracle),在每頁10行的前提下查詢第8頁的語句是:

  A.

  String sql = “select ename,sal from emp where limit ?,?”

  PreparedStatement stmt = con.prepareStatement(sql);

  stmt.setInt(1,10*7+1+10);

  stmt.setInt(2,10*7+1);

  stmt.executeQuery();

  …

  B.

  String sql = “select ename,sal from emp limit ?,?”

  PreparedStatement stmt = con.prepareStatement(sql);

  stmt.setInt(1,10*7+1+10);

  stmt.setInt(2,10*7+1);

  stmt.executeQuery();

  C.

  String sql = “select ename, sal from emp

  (select enam, sal, rownum n from foo where rownum>=?)

  where n

  PreparedStatement stmt = con.prepareStatement(sql);

  stmt.setInt(1,10*7+1);

  stmt.setInt(2,10*7+1+10);

  stmt.executeQuery();

  D.

  String sql = "select ename, sal from

  (select ename, sal, rownum n from foo where rownum

  where n>=?”

  PreparedStatement stmt = con.prepareStatement(sql);

  stmt.setInt(1,10*7+1+10);

  stmt.setInt(2,10*7+1);

  stmt.executeQuery();

  試題7

  下面代碼空白處應(yīng)該填入的是:

  public void tstAuto() throws Exception {

  Class.forName(“com.mysql.jdbc.Driver”);

  Connection con = DriverManager.getConnection(

  “jdbc:mysql://localhost:3306/test”, “root”, “root”);

  con.setAutoCommit(false);

  PreparedStatement stmt = con

  .prepareStatement(“ into emp(name, hire_date, dept_id) values(?,?,?)”);

  stmt.executeUpdate(“ into dept (name, location)value(‘R&D’,Beijing’)”);

  // 獲取剛剛產(chǎn)生的主鍵

  … … …

  stmt.close();

  con.close();

  }

  A. ResultSet key = stmt.getKeys();

  B. int key = stmt.getGeneratedKeys();

  C. ResultSet key = stmt.getGeneratedKeys();

  D. int key = stmt.getKeys();

  試題8

  已知數(shù)據(jù)表emp的數(shù)據(jù)為:

  EMPNO ENAME

  —– ———-

  7369 SMITH

  7499 ALLEN

  7521 WARD

  下面代碼的運(yùn)行結(jié)果是

  int empno = 6000;

  String ename = “hello’ or ’1′=’1〃;

  Statement stmt = con.createStatement();

  ResultSet rs = stmt.executeQuery(“select count(*) from emp

  where empno=”+empno+” and ename=’”+ename+”‘”);

  rs.next();

  System.out.println(rs.getInt(1));

  A. 0

  B. 1

  C. 2

  D. 3

  試題9

  下面關(guān)于PreparedStatement的說法錯(cuò)誤的是

  A. PreparedStatement繼承了Statement

  B. PreparedStatement可以有效的防止SQL注入

  C. PreparedStatement不能用于批量更新的操作

  D. PreparedStatement可以存儲(chǔ)預(yù)編譯的Statement,從而提升執(zhí)行效率

  試題10

  下面關(guān)于Oracle數(shù)據(jù)庫連接URI正確的拼寫格式是:

  A. jdbc:oracle:thin:@hostname:1521:orcl

  B. jdbc/oracle/thin/@hostname:1521/orcl

  C. jdbc:oracle/thin/@hostname:1521/orcl

  D. jdbc:oracle:thin/@hostname:1521/orcl

【Java筆試模擬試卷】相關(guān)文章:

1.Java筆試題附答案

2.2017年Java基礎(chǔ)筆試題

3.java基礎(chǔ)筆試題及答案

4.2017年java模擬試題

5.JAVA模擬試題及答案

6.Java考試格林模擬習(xí)題

7.Java考試格林模擬試題

8.2017年Java筆試題及答案