



下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、第一题: ( 过程可以写在后面)学校的毕业话剧演出由四个小美女来出演小红帽、美羊羊、女巫和公主的角色。没人在排练时的角色与演出时的角色不同。排练时出演小红帽的人会撒谎,通过如下消息,请判断四人在演出和排练时分别出演什么角色。梅:“排练时,兰的角色是演出时竹的角色。”兰:“菊排练时扮演的是美羊羊。”竹:“演出时我演公主。”菊:“兰演出时扮演的是美羊羊。”第二题: 解数独题( 数独是九宫格 ( 即 3 格宽 x3 格高 ) ) 正方形状,每一格又细分为一个九宫格,在没一个小九宫格中,分别填上 19 个数字,让每一个大九宫格没一列,没一行的数字都不重复。81746948338527569665118
2、31、Which line contains a constructor in this class definition?精品文库public class Counter/(1)int current ,step;public Counter(int startVaue,int stepValue)/(2)set(startValue);setStepValue(steValue);public int get()return current;/(3)public void set(int value)current=value;/(4)public void setStepValue(in
3、t stepValue)step=stepValue;/(5)1)Code marked with (1) is a constructor2)Code marked with (2) is a constructor3)Code marked with (3) is a constructor4)Code marked with (4) is a constructor5)Code marked with (5) is a constructor2、An instance member.1)is also called a static member2)is always a variabl
4、e3)is never a method4)belongs to a single instance,not to the class as a whole5)always represents an operation3、Given the following class,which statements can be inserted at position I without causing the code to fail compilation?public class Q6db8int a ;int b=0;static int c;public void m()欢迎下载2精品文库
5、int d;int e=0;/Position 11)a+2)b+3)c+4)d+5)e+7、What is wrong with the following code?Class MyException extends ExceptionPublic class qb4abPublic void foo()TryBar();finallyBaz();catch(MyException e)Public void bar() throws MyExceptionThrow new Exception();Public void baz() throws RuntimeExceptionThro
6、w new RuntimeException();4、) Since the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause.欢迎下载36.7.精品文库5、) A the try block cannot be followed by both a catch and a finally block.6、) An empty catch block is not allowed.7、
7、) A catch block cannot follow a finally block.8、) A finally block must always follow one or more catch blocks.5、What will happen when you attempt to compile and run the following program by passing the Test class to the Java interpreter?Class TestPublic static void main“hello ”);Select the one right
8、 answer.the program does not compile because main() is not defined correctly.The program compiles but when you try to run the interpreter complies that it cannot find the main() method it needs to run.C) the program compiles but you cannot run it because the class is not declared as public .D) the p
9、rogram compiles and runs without an error but does not display anything in the standard output .E) the program compiles and displays “hello ”in the standard output when you in run it.6、Give those code snippets:Boolean b1=new Boolean(true);Boolean b2=new Boolean(true);Which expressions are legal Java
10、 expressions that return true?Select all valid answer.3. b1=b24. b1.equals(b2) C) b1&b2D) b1|b2E) b1&&b2F) b1|b2欢迎下载4精品文库7、Given this code snippet:trytryThis();return;catch(IOException x1)return ;catch(Exception x2)return ;finallyWhat will appear in the standard output if try This() thro
11、ws a NumberFormatException?Select the one right answer.a)Nothingb)"exception 1",followed by "finally"c)"exception 2",followed by "finally"d)"exception 1"e)"exception 2"选择:C8、Giver these class definitions;class Superclassclass Subclass1 exte
12、nds Superclassclass Subclass2 extends Superclassand these objects;Superclass a =new Superclass();欢迎下载5精品文库Subclass1 b=new Subclass1();Subclass2 c=new Subclass2();which of the following explains the result of the statement; b=(Subclass1)c;Selected the one right answer;a)Illegal at compile timeb)Legal
13、 at compile time but possibly illegal at runtimec)Definitely legal at runtime9、简述以下代码是在做什么事情?”);Throw new RuntimeException( “getEJBHome could tretrieve initial context ”10: 请从空白处填写代码,满足以下功能:A) 从请求中得到用户名和口令(请求通过 web 浏览器中的 HTML 页面提交, 页面中用户名对象名为 userName, 口令对象名为 password )B) 如果用户名为 ”admin ”, 口令为 passwo
14、rd , 则讲登陆成功,将页面转到loginSuccess.jsp 页面,并在session 存放用户名( username )和密码(password)C( 如果用户名和空灵为其他值,转到error.jspPublic class TestServlet extends HttpServlet欢迎下载6精品文库Public void service(HttpServletRequest request,HttpServletResponse resopnse)throws ServletException,IOException/Include following lins in all s
15、ervlet.Try/请在此添写代码If(userName.equals(“admin ”) && password.equals(“password ”)request.getsession.setAttribute("username",”admin ”);request.getsession.setAttribute("password",”password ”);Request.sendRedirect(“loginSuccess.jsp ”);elseRequest.sendRedirect(“error.jsp ”);catc
16、h(Exception e)典道的笔试分A-B 卷,题型有:1. 选择题 30 道(每道 2 分 共 60 分)2. 代码阅读题 4 道(每道 5 分 共 20 分)3. 程序逻辑题 2 道(每道 10 分 共 20 分)不管是 A-B 卷,考察的范围都是基础知识,这个是和几个做B 卷的同学那了解到的,主要的考点如下:欢迎下载7精品文库考点名称考试频率难易度备注数组高易值传递与址传高中递Main 函数低中线程低难Swing 与 awt低中Ascii 码高难请务必记住常用 ascii 码,代码题都有考运算符优先级低中去网上百度一下Oop 思想高中方法重载与重高易写包低易方法与类的命低易名规则逻辑
17、思维高难其他的记得不是很清楚了,不过不会超过基础知识这个范围,但光靠书(accp6.0 )上那些还不够,建议找些参考书学习一下,越基础越好。以下是 A 卷代码阅读题8、建一个数组,顺序输出10 位数,然后把这10 位数再倒序输出欢迎下载8精品文库publicclassTest publicstaticvoidmain(String args) int arr=newint1,2,3,4,5,6,7,8,9,10;System.out .println("-顺序输出 -");for( inti = 0; i < arr.length; i+) System.out .p
18、rint(arri+",");System.out .println();System.out .println("-倒叙输出 -");for( intj = arr.length-1; j >=0 ; j-) System.out .print(arrj+",");9、考的是方法重载,它是将两个方法的参数顺序颠倒了一下,看题的时候要注意。3.publicclassTest5 publicstaticvoidmain(Stringargs)int arr=newint1,2,3,4,5,6,7,8;a(arr);b(arr);a
19、(arr);staticvoida(intarr)for( inttemp:arr)欢迎下载9精品文库System.out .println(temp);staticvoidb(intarr)for( inti=0;i<arr.length;i+)arri*=i;输出结果是: 56以下是 A卷手写代码题:8.请用 1、 2、 3、 4 组成 N个数值不重复 且个十百位都不重复 的 3位数 , 一共有几个?分别是什么?共有: 24 个分别是:123,124,132,134,142,143,213,214,231,234,241,243,312,314,321,324,341,342,412
20、,413,421,423,431,432,参考答案:Int count=0;For(int i=1;i<=4;i+)For(int j=1;j<=4;j+)For(int k=1;k<=4;k+)If(i!=j&&i!=k&&j!=k)欢迎下载10精品文库Count+;一共有 24 个,公式: 4*3*2=24,具体数学公式请见排列算法。9.查询子串在父串中出现的次数:参考答案:设: str1为父串, str2为字串,则:publicclassTest6 publicstaticvoidmain(Stringargs)Stringstr1="hdsajkfhuisadhifnokfasdfdasdoksdfsdsfsok"String str2="ok"String temp="" ;intcount=0;for(temp=str1;temp!=null&&str2.length()<=s
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 婚后赠与个人协议书
- 国企钢厂联营协议书
- 婚内出轨忠诚协议书
- 学生校服征订协议书
- 多名股东合伙协议书
- 山东铁塔深化协议书
- 妻子生活保障协议书
- 养老机构消防安全管理行动计划
- 输气管道工程规划设计方案(参考模板)
- 年产2万个配电箱项目规划设计方案
- 教育革新:2024版《认识交通标志》课件
- (高清版)DB4202∕T 39-2024 城市桥梁与隧道运行监测技术规范
- 2024年社区警务工作规范考试题库
- 2020-2024年各地中考语文试卷【标点符号使用题】汇集练附答案解析
- 数据分析师历年考试真题试题库(含答案)
- 住宅小区园林景观绿化工程施工组织设计方案
- 物质的量说课
- 人教版八年级下册历史教案全册
- 企业网络设备资产清查合同
- 2024年北京普通高中学业水平等级性考试化学试题及答案
- C语言程序设计 课件 第5章-数组
评论
0/150
提交评论