Solutions Candidate Test
一. Core java (每题5分,共8题 ,总40)
1. Which declarations of identifiers are legal?
A. $persons
B. TwoUrs
C. *point
D. this
E. endline
2. Which are syntactically valid statement at”// point x”?
class Person {
private int a;
public int change(int m){ return m; }
}
public class Teacher extends Person {康乐公
public int b;
public static void main(String arg[]){
Person p = new Person();
Teacher t = new Teacher();
int i;
// point x
}}
A. i = m;
B. i = b;
C. i = p.a;
D. i = p.change(30)
3. What will happen when you attempt to compile and run the following code?
public class Static{
学习英语怎么说static{
int x = 5;
}
static int x,y;
public static void main(String args[]){
x--;
myMethod();
System.out.println(x + y + ++x);
}
public static void myMethod(){
y = x++ + ++x;
}
}
A. compiletime error
B. print 1
C. print 2
D. print 3
E. pirnt 7
F. print 8
4. Given the following code, what will be the output?
class Value{
public int i = 15;
}
public class Test{
public static void main(String argv[]){
Test t = new Test();
t.first();
}
public void first(){
int i = 5;
Value v = new Value();
v.i = 25;
cond(v, i);
System.out.println(v.i);
}
public void cond(Value v, int i){
i = 0;
v.i = 20;
Value val = new Value();
v = val;
System.out.println(v.i + " " + i);体育工作计划
}
}
A. 15 0 20
B. 15 0 15
C. 20 0 20
D. 0 15 20
5. What will be the result of executing the following code?
boolean a = true;
boolean b = fal;
boolean c = true;
if (a == true)
if (b == true)
if (c == true) System.out.println("Some things are true in this world");
el System.out.println("Nothing is true in this world!");
el if (a && (b = c))
System.out.println("It's too confusing to tell what is true and what is fal");
el System.out.println("Hey this won't compile");
A. The code won’t compile.
B. “some things are true in this world” will be printed
C. “hey this won’t compile” will be printed
D. None of the
6. What results from attempting to compile and run the following code?
public class Ternary{
public static void main(String args[]){
int a = 5;
System.out.println("Value is - " + ((a < 5) ? 9.0 : 9));
}
}
A. print:Value is -9
微信朋友圈权限
B. print:Value is -5
C. Compilation error
D. none of the
7. In the following pieces of code, A and D will compile without any error. True/Fal?
A. StringBuffer sb1 = "abcd";
B. Boolean b = new Boolean("abcd");
C. byte b = 255;
D. int x = 0x1234;
8. Which of the following collection class from java.util package are Thread safe?
A. Vector
B. ArrayList
C. Hashmap
D. Hashtable
二. J2EE (共2题, 每题5分, 总10)
9. In java web developing , which component is often u for C in M-V-C?
F. Resin
G. 部队班长职责Apache
H. Struts
I. Velocity
10. which url-pattern in rvlet config is legal?
A. /path/*.do
B. /*/do
C. /do/*
D. all above
11. which method is contained in Servlet class but not in HttpServlet?
A. doGet
B. doHead
C. rvice
D. doPost
三. Web编程 (共3题,每题5分, 共15分)
12. Which layout manager is ud when the frame is resized the buttons's position in the Frame might be changed?
A. BorderLayout
B. FlowLayout
C. CardLayout
D. GridLayout
13. Define a array in js, which is right?
A. var txt = new Array="G","J","T"
B. var txt = new Array(1:"G",2:"J",3:"Ts")
C. var txt = new Array("G","J","T")
D. var txt = new Array:1=("G")2=("J")3=("T")
14. which tech is AJAX ba on?
A. java
B. javascript
C. css
D. xml
四. ORACLE题 (3题, 每题5分, 共15)
15. 设有图书管理数据库:
图书(总编号C(6),分类号C(8),书名C(16),作者C(6),出版单位C(20),单价N(6,2))
读者(借书证号C(4),单位C(8),姓名C(6),性别C(2),职称C(6),地址C(20))
借阅(借书证号C(4),总编号C(6),借书日期D(8))
查询每个出版单位出版的书数量。SQL语句正确的是______。
A. SELECT MAX(出版单位) FROM 图书
B. SELECT 出版单位,count(*) FROM 图书 GROUP BY 出版单位
C. SELECT 出版单位, max(*) FROM 图书
D. SELECT 出版单位何处安身, 总编号 FROM 图书 GROUP BY 出版单位
16. 3个表同15.请统计每本书的借阅次数(包括0次的)
A. SELECT 图书.书名,COUNT(借阅. 总编号) FROM 图书,借阅 WHERE 图书.总编号=借阅.总编号 GROUP BY借阅.总编号
B. SELECT图书.书名,COUNT(借阅. 总编号) FROM 图书,借阅 WHERE 图书.小丑简笔画总编号(+)=借阅.总编号GROUP BY 图书.书名
C. SELECT图书.书名,COUNT(借阅. 总编号) FROM 图书,借阅 WHERE 图书.总编号=借阅.总编号(+) GROUP BY 图书.书名
D. SELECT 借阅.总编号,COUNT(借阅. 总编号) FROM 图书,借阅 WHERE 图书.下午好的图片总编号=借阅.总编号 GROUP BY借阅.总编号
17. 表结构同上.查询读者为女的数量.sql正确的是
A. SELECT count(*) FROM 读者
B. SELECT count(*) FROM 读者 WHERE 性别=’女’
C. SELECT count(*) FROM 读者 group by 性别
D. SELECT count(*) FROM 读者 ORDER BY 性别
五. PL/SQL测试
18. You are formulating a SQL statement to retrieve date from Oracle.
Which of the following SQL statments are invaild?
A. lect NAME,Jery_No where Jery_No=6;
B. lect NAME,Jery_No from PLAYERS;
C. lect * from PLAYERS where Jery_No=6;
D. lect Jery_No from PLAYERS;