ImageVerifierCode 换一换
格式:DOC , 页数:29 ,大小:86KB ,
资源ID:7096345      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-7096345.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(SCJP模拟题3.doc)为本站会员(fmgc7290)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

SCJP模拟题3.doc

1、SCJP 模拟试题三-此套试题由 60 道题组成(实际考试为 60 道题) 。试题由单选题和多选题组成,单选题将提示:Select the most appropriate answer,多选题将提示:Select all correct answers。答案在最后。-Q. 1Which colour is used to indicate instance methods in the standard “javadoc“ format documentation:blue red purple orange Select the most appropriate answer.Q. 2Wh

2、at is the correct ordering for the import, class and package declarations when found in a single file?package, import, class class, import, package import, package, class package, class, import Select the most appropriate answer.Q. 3Which methods can be legally applied to a string object?equals(Stri

3、ng) equals(Object) trim() round() toString() Select all correct answers.Q. 4What is the parameter specification for the public static void main method?String args String args Strings args String args Select all correct answers.Q. 5What does the zeroth element of the string array passed to the public

4、 static void main method contain?The name of the program The number of arguments The first argument if one is present Select the most appropriate answer.Q. 6Which of the following are Java keywords?goto malloc extends FALSE Select all correct answersQ. 7What will be the result of compiling the follo

5、wing code:public class Test public static void main (String args ) int age;age = age + 1;System.out.println(“The age is “ + age);Compiles and runs with no output Compiles and runs printing out The age is 1 Compiles but generates a runtime error Does not compile Compiles but generates a compile time

6、error Select the most appropriate answer.Q. 8Which of these is the correct format to use to create the literal char value a?a “a“ new Character(a) 000a Select the most appropriate answer.Q. 9What is the legal range of a byte integral type?0 - 65, 535 (128) 127 (32,768) 32,767 (256) 255 Select the mo

7、st appropriate answer.Q. 10Which of the following is illegal:int i = 32; float f = 45.0; double d = 45.0; Select the most appropriate answer.Q. 11What will be the result of compiling the following code:public class Test static int age;public static void main (String args ) age = age + 1;System.out.p

8、rintln(“The age is “ + age);Compiles and runs with no output Compiles and runs printing out The age is 1 Compiles but generates a runtime error Does not compile Compiles but generates a compile time error Select the most appropriate answer.Q. 12Which of the following are correct?128 1 gives 64 128 1

9、 gives 64 128 1 gives 64 128 1 gives 64 Select all correct answersQ. 13Which of the following return true?“john“ = “john“ “john“.equals(“john“) “john“ = “john“ “john“.equals(new Button(“john“) Select all correct answers.Q. 14Which of the following do not lead to a runtime error?“john“ + “ was “ + “

10、here“ “john“ + 3 3 + 5 5 + 5.5 Select all correct answers.Q. 15Which of the following are so called “short circuit“ logical operators?Boolean flag = true; Panel p = new Frame(); Frame f = new Panel(); Panel p = new Applet(); Select all correct answers.Q. 17What is the result of compiling and running

11、 the following code:public class Test static int total = 10;public static void main (String args ) new Test();public Test () System.out.println(“In test“);System.out.println(this);int temp = this.total;if (temp 5) System.out.println(temp);The class will not compile The compiler reports and error at

12、line 2 The compiler reports an error at line 9 The value 10 is one of the elements printed to the standard output The class compiles but generates a runtime error Select all correct answers.Q 18Which of the following is correct:String temp = new String “j“ “a“ “z“; String temp = “j “ “ b“ “c“; Strin

13、g temp = “a“, “b“, “c“; String temp = “a“, “b“, “c“; Select the most appropriate answer.Q. 19What is the correct declaration of an abstract method that is intended to be public:public abstract void add(); public abstract void add() public abstract add(); public virtual add(); Select the most appropr

14、iate answer.Q. 20Under what situations do you obtain a default constructor?When you define any class When the class has no other constructors When you define at least one constructor Select the most appropriate answer.Q. 21Given the following code:public class Test Which of the following can be used

15、 to define a constructor for this class:public void Test() public Test() public static Test() public static void Test() Select the most appropriate answer.Q. 22Which of the following are acceptable to the Java compiler:if (2 = 3) System.out.println(“Hi“); if (2 = 3) System.out.println(“Hi“); if (tru

16、e) System.out.println(“Hi“); if (2 != 3) System.out.println(“Hi“); if (aString.equals(“hello“) System.out.println(“Hi“); Select all correct answers.Q. 23Assuming a method contains code which may raise an Exception (but not a RuntimeException), what is the correct way for a method to indicate that it

17、 expects the caller to handle that exception:throw Exception throws Exception new Exception Dont need to specify anything Select the most appropriate answer.Q. 24What is the result of executing the following code, using the parameters 4 and 0:public void divide(int a, int b) try int c = a / b; catch

18、 (Exception e) System.out.print(“Exception “); finally System.out.println(“Finally“);Prints out: Exception Finally Prints out: Finally Prints out: Exception No output Select the most appropriate answer.Q.25Which of the following is a legal return type of a method overloading the following method:pub

19、lic void add(int a) void int Can be anything Select the most appropriate answer.Q.26 Which of the following statements is correct for a method which is overriding the following method:public void add(int a) the overriding method must return void the overriding method must return int the overriding m

20、ethod can return whatever it likes Select the most appropriate answer.Q. 27 Given the following classes defined in separate files:class Vehicle public void drive() System.out.println(“Vehicle: drive“);class Car extends Vehicle public void drive() System.out.println(“Car: drive“);public class Test pu

21、blic static void main (String args ) Vehicle v;Car c;v = new Vehicle();c = new Car();v.drive();c.drive();v = c;v.drive();What will be the effect of compiling and running this class Test?Generates a Compiler error on the statement v= c; Generates runtime error on the statement v= c; Prints out: Vehic

22、le: driveCar: driveCar: drive Prints out: Vehicle: driveCar: driveVehicle: driveSelect the most appropriate answer.Q. 28Where in a constructor, can you place a call to a constructor defined in the super class?Anywhere The first statement in the constructor The last statement in the constructor You c

23、ant call super in a constructor Select the most appropriate answer.Q. 29Which variables can an inner class access from the class which encapsulates it?All static variables All final variables All instance variables Only final instance variables Only final static variables Select all correct answers.

24、Q. 30What class must an inner class extend:The top level class The Object class Any class or interface It must extend an interface Select the most appropriate answer.Q. 31In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:public cl

25、ass Test public static void main (String args ) Employee e = new Employee(“Bob“, 48); e.calculatePay(); System.out.println(e.printDetails(); e = null; e = new Employee(“Denise“, 36); e.calculatePay(); System.out.println(e.printDetails(); Line 10 Line 11 Line 7 Line 8 Never Select the most appropriat

26、e answer.Q. 32What is the name of the interface that can be used to define a class that can execute within its own thread?Runnable Run Threadable Thread Executable Select the most appropriate answer.Q. 33What is the name of the method used to schedule a thread for execution?init(); start(); run(); r

27、esume(); sleep(); Select the most appropriate answer.Q. 34Which methods may cause a thread to stop executing?sleep(); stop(); yield(); wait(); notify(); notifyAll() synchronized() Select all correct answers.Q. 35Write code to create a text field able to display 10 characters (assuming a fixed size f

28、ont) displaying the initial string “hello“:Q. 36Which of the following methods are defined on the Graphics class:drawLine(int, int, int, int) drawImage(Image, int, int, ImageObserver) drawString(String, int, int) add(Component); setVisible(boolean); setLayout(Object); Select all correct answers.Q. 3

29、7Which of the following layout managers honours the preferred size of a component:CardLayout FlowLayout BorderLayout GridLayout Select all correct answers.Q. 38Given the following code what is the effect of a being 5:public class Test public void add(int a) loop: for (int i = 1; i Select the most ap

30、propriate answer.Q. 47Which of the following correctly illustrate how an InputStreamReader can be created:new InputStreamReader(new FileInputStream(“data“); new InputStreamReader(new FileReader(“data“); new InputStreamReader(new BufferedReader(“data“); new InputStreamReader(“data“); new InputStreamR

31、eader(System.in); Select all correct answers.Q. 48What is the permanent effect on the file system of writing data to a new FileWriter(“report“), given the file report already exists?The data is appended to the file The file is replaced with a new file An exception is raised as the file already exist

32、s The data is written to random locations within the file Select the most appropriate answer.Q. 49What is the effect of adding the sixth element to a vector created in the following manner:new Vector(5, 10); An IndexOutOfBounds exception is raised. The vector grows in size to a capacity of 10 elemen

33、ts The vector grows in size to a capacity of 15 elements Nothing, the vector will have grown when the fifth element was added Select the most appropriate answer.Q. 50What is the result of executing the following code when the value of x is 2:switch (x) case 1:System.out.println(1);case 2:case 3:Syst

34、em.out.println(3);case 4:System.out.println(4);Nothing is printed out The value 3 is printed out The values 3 and 4 are printed out The values 1, 3 and 4 are printed out Select the most appropriate answer.Q. 51Consider the following example:class First public First (String s) System.out.println(s);p

35、ublic class Second extends First public static void main(String args ) new Second();What is the result of compiling and running the Second class?Nothing happens A string is printed to the standard out An instance of the class First is generated An instance of the class Second is created An exception

36、 is raised at runtime stating that there is no null parameter constructor in class First. The class second will not compile as there is no null parameter constructor in the class First Select the most appropriate answer.Q. 52 What is the result of executing the following fragment of code:boolean fla

37、g = false;if (flag = true) System.out.println(“true“); else System.out.println(“false“);true is printed to standard out false is printed to standard out An exception is raised Nothing happens Select the most appropriate answer.Q. 53Consider the following classes:public class Test public static void

38、test() this.print();public static void print() System.out.println(“Test“);public static void main(String args ) test();What is the result of compiling and running this class?The string Test is printed to the standard out. A runtime exception is raised stating that an object has not been created. Not

39、hing is printed to the standard output. An exception is raised stating that the method test cannot be found. An exception is raised stating that the variable this can only be used within an instance. The class fails to compile stating that the variable this is undefined. Select all correct answers.Q

40、. 54Examine the following class definition:public class Test public static void test() print();public static void print() System.out.println(“Test“);public void print() System.out.println(“Another Test“);What is the result of compiling this class:A successful compilation. A warning stating that the

41、class has no main method. An error stating that there is a duplicated method. An error stating that the method test() will call one or other of the print() methods. Select the most appropriate answer.Q. 55What is the result of compiling and executing the following Java class:public class ThreadTest

42、extends Thread public void run() System.out.println(“In run“);suspend();resume();System.out.println(“Leaving run“);public static void main(String args ) (new ThreadTest().start();Compilation will fail in the method main. Compilation will fail in the method run. A warning will be generated for method

43、 run. The string “In run“ will be printed to standard out. Both strings will be printed to standard out. Nothing will happen. Select the most appropriate answer.Q. 56Given the following sequence of Java statementsStringBuffer sb = new StringBuffer(“abc“); String s = new String(“abc“); sb.append(“def

44、“); s.append(“def“); sb.insert(1, “zzz“); s.concat(sb); s.trim(); Which of the following statements are true:The compiler would generate an error for line 1. The compiler would generate an error for line 2. The compiler would generate an error for line 3. The compiler would generate an error for lin

45、e 4. The compiler would generate an error for line 5. The compiler would generate an error for line 6. The compiler would generate an error for line 7. Select all correct answers.Q. 57What is the result of executing the following Java class:import java.awt.*;public class FrameTest extends Frame publ

46、ic FrameTest() add (new Button(“First“);add (new Button(“Second“);add (new Button(“Third“);pack();setVisible(true);public static void main(String args ) new FrameTest();Select from the following options:Nothing happens. Three buttons are displayed across a window. A runtime exception is generated (n

47、o layout manager specified). Only the “first“ button is displayed. Only the “second“ button is displayed. Only the “third“ button is displayed. Select the most appropriate answer.Q. 58Consider the following tags and attributes of tags:CODEBASE ALT NAME CLASS JAVAC HORIZONTALSPACE VERTICALSPACE WIDTH

48、 PARAM JAR Which of the above can be used within the and tags?line 1, 2, 3 line 2, 5, 6, 7 line 3, 4, 5 line 8, 9, 10 line 8, 9 Select all correct answers.Q. 59Which of the following is a legal way to construct a RandomAccessFile:RandomAccessFile(“data“, “r“); RandomAccessFile(“r“, “data“); RandomAccessFile(“data“, “read“); RandomAccessFile(“read“, “data“); Select the most appropriate answer.Q. 60Carefully examine the following code:public class StaticTest static System.out.println(“Hi there“);public void print() System.out.println(“Hello“);

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报