SELECT COUNT(a.kehhao) FROM a INNER JOIN b ON a.kehhao = b.kehhao GROUP BY jigou
B.
SELECT COUNT(a.kehhao) FROM a INNER JOIN b ON a.kehhao = b.kehhao ORDER BY jigou
C.
SELECT SUM(a.kehhao) FROM a INNER JOIN b ON a.kehhao = b.kehhao ORDER BY jigou
D.
SELECT COUNT(a.kehhao) FROM a INNER JOIN b ON a.kehhao = b.kehhao HAVING jigou
5.
下列代码的输出结果是()。
public static void main(String[] args) {
Runnable r = new Runnable() {
public void run() {
System.out.print(“Cat”);
}
};
Thread t = new Thread(r) {
public void run() {
System.out.print(“Dog”);
}
};
t.start(); } A.
Cat B.
Dog C.
没有任何输出 D.
抛出运行时异常 6.
试图使用下面句子查询数据:
SELECT 100/NVL(quantity, 0) FROM inventory;
quantity为 NULL 空值时,将导致出错,其原因是:()。
A.
除数表达式为空值.
B.
函数参数数据类型不一致.
C.
空值不能被转成实际值
D.
除数表达式为零
7. 查询客户姓名以及他的推荐人,没有推荐人的客户信息不显示,下列sql语句正确的是: A. select a1.real_name customer, a2.real_name recommender from account a1 join account a2 on a1.id = a2.id; B. select a1.real_name customer, a2.real_name recommender from account a1 join account a2 on a1.recommender_id = a2.recommender_id; C. select a1.real_name customer, a2.real_name recommender from account a1 join account a2 on a1.recommender_id = a2.id; D. select a1.real_name customer, a2.real_name recommender from account a1, a2 on a1.recommender_id = a2.id; 8. 以下不可以改变线程的状态的方法是:()。 A.
start
B.
run
C.
isAlive
D.
sleep
9. 下列Oracle语句中,可以实现更新记录的是()。 A. UPDATE 数据表 SET 字段名称=值,… [WHERE 条件] [GROUP BY 字段名称] B. UPDATE 数据表,数据表,… SET 字段名称=值,… WHERE 条件 C. UPDATE 数据表 SET 字段名称=值,… [WHERE 条件] D. UPDATE 数据表 Set 字段名称=值,… [WHERE 条件] [ORDER BY 字段名称] 10. 下面关于PreparedStatement说法错误的是:()。 A. PreparedStatement是Statement的子接口。 B. 使用PreparedStatement预编译SQL可以有效的防止SQL注射。 C. PreparedStatement具有批处理执行SQL的功能。 D. PreparedStatement的setXXX方法可以用于设置预留的表名、字段名等参数。 11. IO 包中,唯一代表磁盘本身的对象类是()。 A.
FileInputStream B.
File C.
InputStream D.
BufferedReader 12.
下列代码的作用说法不正确的是:()。
class Card implements java.io.Serializable{} A.
开启序列化功能,使得Card类的对象可以存储到文件中 B.
开启序列化功能,使得Card类的对象可以在网络上传输 C.
使得Card类的子类的对象可以被序列化 D.
导致Card的子类的对象不可以被反序列化
13. 以下选项中可以用来从表 state中删除列 update_dt 的是( )。 A.
ALTER TABLE state DROP COLUMN update_dt;
B.
ALTER TABLE state DELETE COLUMN update_dt;
C.
DROP COLUMN update_dt FROM state;
D.
REMOVE COLUMN update_dt FROM state;
14.
下面关于ResultSet说法错误的是()。 A.
查询结束后,所有的结果数据将一次被存储在ResultSet对象中 B.
Statement对象close后,由其创建的ResultSet对象将自动的close C.
查询结束后,ResultSet中的游标指向第一条记录之上,因此要先调用一次next()才有可能取得记录 D.
WHERE address=‘北京’ AND address=’上海’ AND address=‘广州’ 16. 题目代码实现的功能是:把放入到TreeSet集合中的Student进行排序,首先按照num升序,如果num相同,再按照name降序。请问《插入代码1》和《插入代码2》处应填入的代码分别是: public class SortStudent { public static void main(String[] args) { TreeSet set=new TreeSet(); set.add(new Student(19,”tom”)); set.add(new Student(20,”jessica”)); set.add(new Student(19,”terry”)); } } class Student implements 《插入代码1》{ private int num; private String name; public Student(int num,String name){ this.name=name; this.num=num; } 《插入代码2》 } A. Comparable public int compareTo(Object o) { Student stu=null; if(o instanceof Student){ stu=(Student)o; } int result=this.num>stu.num 1:(this.num==stu.num 0:-1); if(result==0){ result=this.name.compareTo(stu.name); } return result; } B. Comparable public int compareTo(Object o) { Student stu=null; if(o instanceof Student){ stu=(Student)o; } int result=this.num>stu.num 1:(this.num==stu.num 0:-1); if(result==0){ result=stu.name.compareTo(this.name); } return result; } C. Compartor public int compare(Object o) { Student stu=null; if(o instanceof Student){ stu=(Student)o; } int result=this.num>stu.num 1:(this.num==stu.num 0:-1); if(result==0){ result=this.name.compareTo(stu.name); } return result; } D. Compartor public int compare(Object o) { Student stu=null; if(o instanceof Student){ stu=(Student)o; } int result=this.num>stu.num 1:(this.num==stu.num 0:-1); if(result==0){ result=stu.name.compareTo(this.name); } return result; } 17. 在Oracle中,删除表Student中的所有数据,可以使用的Sql是()。 A. DROP TABLE Student B. DELETE FROM Student C. DELETE * FROM Student D. DROP * FROM Student 18. 显示上个月的今天,这个月的今天,下个月的今天,精度到时、分、秒,下列sql语句正确的是: A. alter session set nls_date_format = ‘yyyy mm dd hh24:mi:ss’; select add_months(sysdate,-1),sysdate,add_months(sysdate,1) from dual; B. alter user set nls_date_format = ‘yyyy mm dd hh24:mi:ss’; select add_months(sysdate,-1),sysdate,add_months(sysdate,1) from dual; C. alter session set nls_date_format = ‘yyyy mm dd hh24:mi:ss’; select last_month(),this_month(),next_month() from dual; D. alter user set nls_date_format = ‘yyyy mm dd hh24:mi:ss’; select last_month(),this_month(),next_month() from dual; 19. 下面不属于接口的是:()。 A. java.sql.Connection B. java.sql.Driver C. java.sql.DriverManager D. java.sql.ResultSet 20.
可以在Oracle中获取当前时间的Sql语句是() A.
SELECT SYSDATE B.
SELECT SYSDATE FROM DUAL C.
SELECT DATE D.
SELECT DATE FROM DUAL 21. 下列异常类是RuntimeException的子类的是:()。 A.
ArrayIndexOutOfBoundsException
B.
Exception
C.
FileNotFoundException
D.
IOException
22. 查询tarena23和tarena20上的远程登录业务使用了哪些相同的资费标准,下列sql语句正确的是: A. select cost_id from service where unix_host = ’192.168.0.20′ intersect select cost_id from service where unix_host = ’192.168.0.23′; B. select cost_id from service where unix_host = ’192.168.0.20′ union select cost_id from service where unix_host = ’192.168.0.23′; C. select cost_id from service where unix_host = ’192.168.0.20′ union all select cost_id from service where unix_host = ’192.168.0.23′; D. select cost_id from service where unix_host = ’192.168.0.20′ minus select cost_id from service where unix_host = ’192.168.0.23′; 23.
阅读以下SQL语句:
INSERT INTO student(stu_no)VALUES(1001);
SAVEPOINT sp1;
DELETE FROM student;
SAVEPOINT sp2;
如果想要恢复student表中所有数据,并且结束该事务的正确做法是()。 A.
rollback to sp2; B.
rollback to sp1; C.
commit; D.
rollback; 24.
DELETE和 TRUNCATE 都可以用来删除表内容,以下描述正确的是:()。
A.
TRUNCATE 不需要 RollbackSegment
B.
DELETE 不需要RollbackSegment
C.
TRUNCATE在 提交COMMIT之前仍可回滚
D.
TRUNCATE还可以删除表结构
25. 下列属于DML语句的是 :() 。
A.
COMMIT
B.
INSERT
C.
DROP
D.
GRANT
26. 下列代码中对象锁的使用效率最高的是: A. public class Foo{ private Object o1,o2; public synchronized void methodA(){对o1进行操作} public synchronized void methodB(){对o1进行操作} public synchronized void methodC(){对o2进行操作} public synchronized void methodD(){对o2进行操作} } B. public class Foo{ private Object lock = new Object(); private Object o1,o2; public void methodA(){synchronized(lock){对o1进行操作}} public void methodB(){synchronized(lock){对o1进行操作}} public void methodC(){synchronized(lock){对o2进行操作}} public void methodD(){synchronized(lock){对o2进行操作}} } C. public class Foo{ private Object lock = new Object(),lock2 = new Object(); private Object o1,o2; public void methodA(){synchronized(lock){对o1进行操作}} public void methodB(){synchronized(lock){对o1进行操作}} public void methodC(){synchronized(lock2){对o2进行操作}} public void methodD(){synchronized(lock2){对o2进行操作}} }
D. public class Foo{ private Object lock = new Object(),lock2 = new Object(); private Object o1,o2; public void methodA(){synchronized(lock){对o1进行操作}} public void methodB(){synchronized(lock2){对o1进行操作}} public void methodC(){synchronized(lock){对o2进行操作}} public void methodD(){synchronized(lock2){对o2进行操作}} } 27. 下面关于事务(Transaction)的说法错误的是:()。 A.
事务具备ACID四个基本特性,即A(Atomicity)—原子性、C(Consistency)—一致性、I(Isolation)—隔离性、D(Durability)—持久性。 B.
事务的提交(Commit)指将事务中所有对数据库的更新写到磁盘上的物理数据库中去,事务正常结束。 C.
事务的回滚(Rollback)指在事务运行的过程中发生了某种故障,事务不能继续进行,将事务中对数据库的所有以完成的操作全部撤消,回滚到事务开始的状态。 D.
JDBC通过Connection对象控制事务,默认方式下,在执行完更改语句后需要必须要调用Connection的commit方法,对数据的更改才能生效。 28. 下列代码的运行结果是: public class WrappedString { private String s; public WrappedString(String s) { this.s = s; } public static void main(String[] args) { HashSet
在Oracle数据库中,关于主键约束与唯一约束说法错误的是()。 A.
主键列的数据类型不限,但此列必须是唯一并且非空 B.
一张数据表只能有一个唯一约束 C.
唯一性约束所在的列允许空值 D.
数据库支持两个列做联合主键 30.
在Oracle中,当数据量较大时,删除表中所有数据,效率较高的是()。
A.
DELETE FROM Student B.
DELETE FROM Student WHERE id>0 C.
TRUNCATE table Student D.
TRUNCATE table Student WHERE id>0 31. 在Oracle中,有表Person,如下: ID Name Tel 001 Amber 1234 002 Amy 2345 003 Emily 4567 004 Eric 5678 005 Roy 6789 SELECT Tel FROM Person WHERE Name = ‘A%’; 执行以上查询,结果是: A. 1234 B. 2345 C. 4567 D. 运行后结果是“未选定行” 32.
表student有两个字段stu_no和stu_name,现在使用序列seq_student给stu_no赋值,下列写法正确的是()。 A.
String sql =
“insert into student (stu_no,stu_name)values(seq_student.nextval, )”;
35. 下列代码运行的结果是: public class TestTwo implements Runnable { public static void main(String[] args) throws Exception { Thread t = new Thread(new TestTwo()); t.start(); System.out.print(“Started”); t.join(); System.out.print(“Complete”); }
public void run() { for (int i = 0; i < 4; i++) { System.out.print(i); } } } A. StartedComplete B. StartedComplete0123 C. Started0123Complete D. 0l23StartedComplete
二、 多选(5小题共10.0分) 1. 下列属于Set接口实现类的是: A. HashMap B. TreeMap C. HashSet D. TreeSet 2. 操作account表和service表,查询申请远程登录业务的客户的数据,下列sql语句正确的是: A. select real_name from account where in (select account_id from service); B. select real_name from account o where id exists (select 1 from service i where o.id = i.account_id);
C. select real_name from account where id in (select account_id from service); D. select real_name from account o where exists (select 1 from service i where o.id = i.account_id); 3. 下列语句在建表的同时在c2,c3列上创建了唯一约束,其中正确的是: A. create table test (c1 number constraint test_c1_pk primary key, c2 number constraint test_c2_uk foreign key, c3 number constraint test_c3_uk foreign key); B. create table test (c1 number constraint test_c1_pk primary key, c2 number , c3 number , constraint test_c3_uk foreign key(c2,c3));
C. create table test (c1 number constraint test_c1_pk primary key, c2 number , c3 number , constraint test_c3_uk unique(c2,c3)); D. create table test (c1 number constraint test_c1_pk primary key, c2 number constraint test_c2_uk unique, c3 number constraint test_c3_uk unique); 4. 请看下列代码: Map map=new HashMap(); map.put(“one”,100); map.put(“two”,200); map.put(“three”,300); 遍历map对象中的每一个元素,下列选项正确的是: A. Set set=map.keySet(); for(String key:set){ Integer value=map.get(key); System.out.println(key+”:”+value); } B. List list=map.keyList(); for(String key:list){ Integer value=map.getKey(key); System.out.println(key+”:”+value); } C. Set> set = map.entrySet(); for (Map.Entry per : set) { System.out.println(per.getKey() + “:” + per.getValue()); } D. List list=map.entryList(); for(Entry per:list){ System.out.println(per.getKey() + “:” + per.getValue()); } 5. 关于下列代码说法正确的是: Set set = new HashSet(); Random r = new Random(); int i = 0; while (set.size() <10) { set.add(r.nextInt(100)); i++; } A. 代码循环执行的次数一定为10次,重复的整数可以放入set集合中。 B. 代码将随机产生10个100以内的可重复的整数,并将其放入集合中。 C. 代码循环执行的次数可能会大于10次,重复的整数无法放入set集合中。 D. 代码将随机产生元素个数为10个的100以内不重复整数集合。 三、 完形填空(2小题共20.0分) 1.