PCCW Solutions Candidate Test
一. Core java (每题 5 分,共 8 题 ,总 40)
1. Which declarations of identifiers are legal?
E. pirnt 7
F. print 8
A. $persons
B. TwoUsers
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
}}
i = m;
i = b;
i = p.a;
i = p.change(30)
{
A.
B.
C.
D.
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
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;
second(v, i);
System.out.println(v.i);
}
public void second(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 = false;
boolean c = true;
if (a == true)
if (b == true)
if (c == true) System.out.println("Some
things are true in this world");
else System.out.println("Nothing is true in
this world!");
else if (a && (b = c))
System.out.println("It's too confusing
to tell what is true and what is false");
else
System.out.println("Hey
1
this won't compile");
11. which method is contained in Servlet class
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 these
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 these
7.
In the following pieces of code, A and D will
compile without any error. True/False?
A. StringBuffer sb1 = "abcd";
B. Boolean b = new Boolean("abcd");
C.byte b = 255;
D.int x = 0x1234;
8. Which of the following collection classes
from java.util package are Thread safe?
A. Vector
B. ArrayList
C.Hashmap
D.Hashtable
二.
9.
J2EE (共 2 题, 每题 5 分, 总 10)
In java web developing , which component is
often use for C in M-V-C?
F. Resin
G.Apache
H.Struts
I. Velocity
10. which url-pattern in servlet config is legal?
A. /path/*.do
B. /*/do
C./do/*
D.all above
but not in HttpServlet?
A. doGet
B. doHead
C.service
D.doPost
三. Web 编程 (共 3 题,每题 5 分, 共 15 分)
12. Which layout manager is used 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 base 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 出版单位
2
16. 3 个表同 15.请统计每本书的借阅次数(包括 0
次的)
D.group by COW_NAME;
E.There are no errors in this statement;
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. select NAME,Jersey_No where
Jersey_No=6;
B. select NAME,Jersey_No from PLAYERS;
C. select * from PLAYERS where
Jersey_No=6;
D. select Jersey_No from PLAYERS;
19.
Inspect the following SQL statment:
SELECT
COW_NAME,MOD(CARTON,FILL_STATUS)
FROM COW_MILK
GROUP BY COW_NAME;
Which of following lines contains an error?
A.select COW_NAME;
B.mod(CARTON,FILL_STATUS);
C.from COW_MILK;
20. You are coding a complex PL/SQL block
where several procedures call
other procedures.You have one outermost
procedure that calls all other
procedures.If you wanted to prevent the user of
outermost procedure from
having the procedure fail due to an
unanticipated problem,you would
include which of the following exceptions?
A.no_data_found;
B.others;
C.zero_divide;
D.too_many_rows;
21. You are attempting to develop a PL/SQL
application.Which of the following keywords allow
you to associate a user-defined error message
with an exception condition?
A. Pragma
B. others
C. raise_application_error
D. exception
22. You are processing some data changes in
your SQL*PLUS session as part of one
transaction. Which of the following choices does
not typically indicate the end of a transaction?
A.Issuing an update statement.
B.Issuing a commit statment.
C.Issuing a rollback statment.
D.Ending your session
23. You have just removed 1,700 rows from a
table that were no longer needed.In order to save
the changes you've made to the database,which
of the following statement are used?
A.savepoint.
B.commit.
C.rollback.
D.set transation.
24. You are creating some tables in your
database as part of the logical data model.
Which of the following constraints have an
index associated with them that is generated
automatically by Oracle?
3
A.UNIQUE
B.FOREIGN KEY
C.CHECK
D.NOT NULL
25. You are using SQL operation in Oracle.All of
the following DATE functions return a Date
datatype,except one.Which one is it?
A.NEW_TIME
B.LAST_DAY
C.ADD_MONTHS
D.MONTHS_BETWEEN.
into the BANK_ACCT table.Which of the following
statements will enable you to execute the same
statment again and again,entering different
values for variables at stement runtime?
A.insert into BANK_ACCT(ACCTNO,NAME)
VALUES(12346,'SMITH');
B.insert into BANK_ACCT(ACCTNO,NAME)
VALUES(VAR1,VAR2);
C.insert into BANK_ACCT(ACCTNO,NAME)
VALUES(&VAR1,&VAR2);
D.insert into BANK_ACCT(select
26. You issue a select statment on the
BANK_ACCT table containing the order by
clause.Which of the following uses of the order by
clause would produce an error?
ACCTNO,NAME from EMP_BANK_ACCTS);
30. You execute the following SQL
statment:select ADD_MONTHS('28-APR-97',120)
from dual.What will Oracle return?
A.order by acctno DESC.
B.order by 1;
C.order by sqrt(1);
D.order by acctno ASC;
27. You execute the query select 5+4 from
DUAL.You have never insertd data into the DUAL
table before.Which of the following statement
best describes the DUAL talbe?
A.Dictionary view containing two schema
names
B.Table with one column and one row used in
various operations
C.Dictionary view containing two index names
D.Table with two columns and no rows used in
various operations
28. You issue the following statment:
select
DECODE(ACCTNO,123456,'CLOSED',654321,'
SEIZED',
590395,'TRANSFER','ACTIVE')
from BANK_ACCT;
if the value for ACCTNO is 503952,what
infomation will this statment display?
A.ACTIVE
B.TRANSFER
C.SEIZED
D.CLOSED
29. You are entering several dozen rows of data
A.28-APR-03
B.28-APR-07
C.28-APR-13
D.28-APR-17
31. On Monday,June 26,2037,at 10:30 at
night,you issue the following statement against
an Oracle database:
ALTER SESSION SET
NLS_DATE_FORMAT='DAY MONTH
DD,YYYY:HH:MIAM';
Then, you issue the following statement
SELECT SYSDATE FROM DUAL;
What will Oracle return?
A.26-JUN-37
B.June 26 2037,22:30
C.26-JUN-2037
D.MONDAY JUNE 26,2037:10:30PM
32. You wish to join the data from two tables,A
and B,into one result set and display that set in
your session.Tables A and B have a common
column,called C in both tables.Which of the
following choices correctly displays the where
caluse you would use if you wantd to see the data
in table A where the value in column C=5,even
when there was no corresponding value in table
B?
A.where A.C=5 AND A.C=B.C;
B.where A.C=5 AND A.C=B.C(+);
C.where A.C=5 AND A.C(+)=B.C(+);
4
D.where A.C=5;
33. Each of the following statment is true about
referential integrity,except one. Which is it?
A.The referencing column in the child table
must correspond with a primay key in the parent.
B.All values in the referenced column in
parent table must be present in the referencing
column in the child.
START WITH 394
INCRMENT BY 12
NOMINVALUE
NOMAXVALUE
NOCACHE
NOCYCLE
Three users have already issued SQL
statment to obtain NEXTVAL,and
C.The datatype of the referenced column in
four more have issued SQL statment to
the parent table must be identical to the
referencing column in the child.
obtain CURRVAL.If you issue a
SQL statment to obtain the NEXTVAL,what
D.All values in the referencing column in the
will ORACLE return?
child table must be present in the referenced
column in the parent.
34. You have a situation where you need to use
the NVL() function.ALL the following statement
about the nvl() function are true except
one.Which is it?
A.406
B.418
C.430
D.442
37. Afer creating a view,you realize that serveral
columns were left out
A.nvl() returns the second value passed if the
Which of the following statements would you
first value is null.
B.nvl() handles values of many different
datatypes.
C.nvl() returns NULL if the first value is not
equal to the second.
D.Both the values passed for nvl() must be
the same datatype.
35. You are developing a stored procedure that
handles table data.The %rowtype expression in
PL/SQL allows you to declare which ofthe
following kinds of variables?
A.Records
B.VARCHAR2s
C.PLS_INTEGERs
D.NUMBERS
36. You create a sequence with the following
statement:
issue in order to add some
columns to your view?
A.alter view
B.create or replace view
C.insert into view
D.create view
六. 算法题 (5 分)
38. 编写 Java 代码,打印如下的杨辉三角。
1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
七. 主观题(2 题, 每题 5 分, 共 10)
39. 存储过程在软件开发中有什么样的优势和劣
势,有什么样的缺点。
CREATE SEQUENCE MY_SEQ
40. 简述 Servlet 的生命周期
5