Java程序員應(yīng)聘編程能力測(cè)試(英文版)_第1頁
Java程序員應(yīng)聘編程能力測(cè)試(英文版)_第2頁
Java程序員應(yīng)聘編程能力測(cè)試(英文版)_第3頁
Java程序員應(yīng)聘編程能力測(cè)試(英文版)_第4頁
Java程序員應(yīng)聘編程能力測(cè)試(英文版)_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、Java Certification Mock ExamJohn HuntEmail: jjhaber.ac.ukURL: /www.aber.ac.uk/jjh/JavaAs with any examination technique is an important aspect of the examination process.In most situations there are mock examinations that you can use to obtain experience.This is the intention of this Java Certificat

2、ion Mock Exam.This mock exam is solely intended to help those intending to take Suns Certified JavaProgrammer 1.1. examination practice the style of questions used in the examination.It should not be used as a way of learning Java nor should it be treated as a form ofrevision.Note some care has been

3、 taken to ensure that the style of questions are the same asthose in the actual exam, but that no questions from the examination are actuallyincluded. The style is based on one persons experience of taking the Java Certificationexamination and it should therefore not be assumed that this mock exam i

4、s an exactreflection of the actual exam.This mock examination consists of 65 questions (the actual exam consists of 60questions).Just as in the actual examination a mixture of style of questions are included. Theserange between questions that require a single answer and those that require 1 or morea

5、nswers. The former are indicated by: Select the most appropriate answer.Java Certification Mock Exam 1/36The latter by: Select all correct answers.Note a question that has the above request may require only one option, it is for you todecide. However, if you do not identify all the options for that

6、question, then you willscore zero for that question. One free format question is included as an example of thatstyle of questioning.As in the actual exam you should not attempt to identify any trends relating to As, Bsor Cs. That is, do not assume that because the answer A has not appeared for a whi

7、lethere is a good chance that it will soon.For the actual examination the pass mark is 70% you should therefore aim to achieveat least 46 correct answers in this mock examination.The correct answers are give at the end of the examination.Disclaimer: This mock examination is in no way sanctioned by S

8、un Microsystemsand no guarantees are provided about the similarity of these questions to those in theactual exam.Q. 1Which colour is used to indicate instance methods in the standard javadoc formatdocumentation:A. blueB. redC. purpleD. orangeJava Certification Mock Exam 2/36Select the most appropria

9、te answer.Q. 2What is the correct ordering for the import, class and package declarations when foundin a single file?A. package, import, classB. class, import, packageC. import, package, classD. package, class, importSelect the most appropriate answer.Q. 3Which methods can be legally applied to a st

10、ring object?A. equals(String)B. equals(Object)C. trim()D. round()E. toString()Select all correct answers.Q. 4What is the parameter specification for the public static void main method?A. String args B. String argsC. Strings args D. String argsSelect all correct answers.Q. 5What does the zeroth eleme

11、nt of the string array passed to the public static void mainJava Certification Mock Exam 3/36method contain?A. The name of the programB. The number of argumentsC. The first argument if one is presentSelect the most appropriate answer.Q. 6Which of the following are Java keywords?A. gotoB. mallocC. ex

12、tendsD. FALSESelect all correct answersQ. 7What will be the result of compiling the following code:public class Test public static void main (String args ) int age;age = age + 1;System.out.println(The age is + age);A. Compiles and runs with no outputB. Compiles and runs printing out The age is 1C. C

13、ompiles but generates a runtime errorJava Certification Mock Exam 4/36D. Does not compileE. Compiles but generates a compile time errorSelect the most appropriate answer.Q. 8Which of these is the correct format to use to create the literal char value a?A. aB. aC. new Character(a)D. 000aSelect the mo

14、st appropriate answer.Q. 9What is the legal range of a byte integral type?A. 0 - 65, 535B. (128) 127C. (32,768) 32,767D. (256) 255Select the most appropriate answer.Q. 10Which of the following is illegal:A. int i = 32;B. float f = 45.0;C. double d = 45.0;Select the most appropriate answer.Q. 11What

15、will be the result of compiling the following code:Java Certification Mock Exam 5/36public class Test static int age;public static void main (String args ) age = age + 1;System.out.println(The age is + age);A. Compiles and runs with no outputB. Compiles and runs printing out The age is 1C. Compiles

16、but generates a runtime errorD. Does not compileE. Compiles but generates a compile time errorSelect the most appropriate answer.Q. 12Which of the following are correct?A. 128 1 gives 64B. 128 1 gives 64C. 128 1 gives 64D. 128 1 gives 64Select all correct answersQ. 13Which of the following return tr

17、ue?A. john = johnB. john.equals(john)C. john = johnJava Certification Mock Exam 6/36D. john.equals(new Button(john)Select all correct answers.Q. 14Which of the following do not lead to a runtime error?A. john + was + hereB. john + 3C. 3 + 5D. 5 + 5.5Select all correct answers.Q. 15Which of the follo

18、wing are so called short circuit logical operators?A. &B. |C. &D. |Select all correct answers.Q. 16Which of the following are acceptable?A. Object o = new Button(A);B. Boolean flag = true;C. Panel p = new Frame();D. Frame f = new Panel();E. Panel p = new Applet();Select all correct answers.Q. 17Java

19、 Certification Mock Exam 7/36What is the result of compiling and running 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.print

20、ln(temp);A. The class will not compileB. The compiler reports and error at line 2C. The compiler reports an error at line 9D. The value 10 is one of the elements printed to the standard outputE. The class compiles but generates a runtime errorSelect all correct answers.Q 18Java Certification Mock Ex

21、am 8/36Which of the following is correct:A. String temp = new String j a z;B. String temp = j b c;C. String temp = a, b, c;D. 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:A. public abstract void add(

22、);B. public abstract void add() C. public abstract add();D. public virtual add();Select the most appropriate answer.Q. 20Under what situations do you obtain a default constructor?A. When you define any classB. When the class has no other constructorsC. When you define at least one constructorSelect

23、the most appropriate answer.Q. 21Given the following code:public class Test Java Certification Mock Exam 9/36Which of the following can be used to define a constructor for this class:A. public void Test() B. public Test() C. public static Test() D. public static void Test() Select the most appropria

24、te answer.Q. 22Which of the following are acceptable to the Java compiler:A. if (2 = 3) System.out.println(Hi);B. if (2 = 3) System.out.println(Hi);C. if (true) System.out.println(Hi);D. if (2 != 3) System.out.println(Hi);E. if (aString.equals(hello) System.out.println(Hi);Select all correct answers

25、.Q. 23Assuming a method contains code which may raise an Exception (but not aRuntimeException), what is the correct way for a method to indicate that it expects thecaller to handle that exception:A. throw ExceptionB. throws ExceptionC. new ExceptionD. Dont need to specify anythingSelect the most app

26、ropriate answer.Q. 24What is the result of executing the following code, using the parameters 4 and 0:Java Certification Mock Exam 10/36public void divide(int a, int b) try int c = a / b; catch (Exception e) System.out.print(Exception ); finally System.out.println(Finally);A. Prints out: Exception F

27、inallyB. Prints out: FinallyC. Prints out: ExceptionD. No outputSelect the most appropriate answer.Q.25Which of the following is a legal return type of a method overloading the followingmethod:public void add(int a) A. voidB. intC. Can be anythingSelect the most appropriate answer.Q.26Java Certifica

28、tion Mock Exam 11/36Which of the following statements is correct for a method which is overriding thefollowing method:public void add(int a) A. the overriding method must return voidB. the overriding method must return intC. the overriding method can return whatever it likesSelect the most appropria

29、te answer.Q. 27Given 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 Java Certification Mock Exam 12/36public static void main (String a

30、rgs ) 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?A. Generates a Compiler error on the statement v= c;B. Generates runtime error on the statement v= c;C. Prints out:Vehicle: driveCar: driveCar: d

31、riveD. Prints out:Vehicle: driveCar: driveVehicle: driveSelect the most appropriate answer.Java Certification Mock Exam 13/36Q. 28Where in a constructor, can you place a call to a constructor defined in the super class?A. AnywhereB. The first statement in the constructorC. The last statement in the

32、constructorD. You cant call super in a constructorSelect the most appropriate answer.Q. 29Which variables can an inner class access from the class which encapsulates it?A. All static variablesB. All final variablesC. All instance variablesD. Only final instance variablesE. Only final static variable

33、sSelect all correct answers.Q. 30What class must an inner class extend:A. The top level classB. The Object classC. Any class or interfaceD. It must extend an interfaceSelect the most appropriate answer.Q. 31In the following code, which is the earliest statement, where the object originally heldin e,

34、 may be garbage collected:1. public class Test Java Certification Mock Exam 14/362. public static void main (String args ) 3. Employee e = new Employee(Bob, 48);4. e.calculatePay();5. System.out.println(e.printDetails();6. e = null;7. e = new Employee(Denise, 36);8. e.calculatePay();9. System.out.pr

35、intln(e.printDetails();10.11. A. Line 10B. Line 11C. Line 7D. Line 8E. NeverSelect the most appropriate answer.Q. 32What is the name of the interface that can be used to define a class that can executewithin its own thread?A. RunnableB. RunC. ThreadableD. ThreadE. ExecutableSelect the most appropria

36、te answer.Q. 33What is the name of the method used to schedule a thread for execution?A. init();B. start();C. run();D. resume();E. sleep();Java Certification Mock Exam 15/36Select the most appropriate answer.Q. 34Which methods may cause a thread to stop executing?A. sleep();B. stop();C. yield();D. w

37、ait();E. notify();F. notifyAll()G. synchronized()Select all correct answers.Q. 35Write code to create a text field able to display 10 characters (assuming a fixed sizefont) displaying the initial string hello:Q. 36Which of the following methods are defined on the Graphics class:A. drawLine(int, int,

38、 int, int)B. drawImage(Image, int, int, ImageObserver)C. drawString(String, int, int)D. add(Component);E. setVisible(boolean);F. setLayout(Object);Select all correct answers.Q. 37Which of the following layout managers honours the preferred size of a component:Java Certification Mock Exam 16/36A. Car

39、dLayoutB. FlowLayoutC. BorderLayoutD. GridLayoutSelect 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 3; i+)for (int j = 1; j 3; j+) if (a = 5) break loop;System.out.println(i * j);A. Generate a runti

40、me errorB. Throw an ArrayIndexOutOfBoundsExceptionC. Print the values: 1, 2, 2, 4D. Produces no outputSelect the most appropriate answer.Java Certification Mock Exam 17/36Q. 39What is the effect of issuing a wait() method on an objectA. If a notify() method has already been sent to that object then

41、it has no effectB. The object issuing the call to wait() will halt until another object sends a notify()or notifyAll() methodC. An exception will be raisedD. The object issuing the call to wait() will be automatically synchronized with anyother objects using the receiving object.Select the most appr

42、opriate answer.Q. 40The layout of a container can be altered using which of the following methods:A. setLayout(aLayoutManager);B. addLayout(aLayoutManager);C. layout(aLayoutManager);D. setLayoutManager(aLayoutManager);Select all correct answers.Q. 41Using a FlowLayout manager, which is the correct w

43、ay to add elements to a container:A. add(component);B. add(Center, component);C. add(x, y, component);D. set(component);Select the most appropriate answer.Q. 42Given that a Button can generate an ActionEvent which listener would you expect tohave to implement, in a class which would handle this even

44、t?Java Certification Mock Exam 18/36A. FocusListenerB. ComponentListenerC. WindowListenerD. ActionListenerE. ItemListenerSelect the most appropriate answer.Q. 43Which of the following, are valid return types, for listener methods:A. booleanB. the type of event handledC. voidD. ComponentSelect the mo

45、st appropriate answer.Q. 44Assuming we have a class which implements the ActionListener interface, whichmethod should be used to register this with a Button?A. addListener(*);B. addActionListener(*);C. addButtonListener(*);D. setListener(*);Select the most appropriate answer.Q. 45In order to cause t

46、he paint(Graphics) method to execute, which of the following is themost appropriate method to call:A. paint()B. repaint()C. paint(Graphics)D. update(Graphics)E. None you should never cause paint(Graphics) to executeJava Certification Mock Exam 19/36Select the most appropriate answer.Q. 46Which of th

47、e following illustrates the correct way to pass a parameter into an applet:A. B. C. D. Select the most appropriate answer.Q. 47Which of the following correctly illustrate how an InputStreamReader can becreated:A. new InputStreamReader(new FileInputStream(data);B. new InputStreamReader(new FileReader

48、(data);C. new InputStreamReader(new BufferedReader(data);D. new InputStreamReader(data);E. new InputStreamReader(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?A. The data is

49、 appended to the fileB. The file is replaced with a new fileC. An exception is raised as the file already existsD. The data is written to random locations within the fileSelect the most appropriate answer.Q. 49Java Certification Mock Exam 20/36What is the effect of adding the sixth element to a vect

50、or created in the followingmanner:new Vector(5, 10);A. An IndexOutOfBounds exception is raised.B. The vector grows in size to a capacity of 10 elementsC. The vector grows in size to a capacity of 15 elementsD. Nothing, the vector will have grown when the fifth element was addedSelect the most approp

51、riate 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:System.out.println(3);case 4:System.out.println(4);A. Nothing is printed outB. The value 3 is printed outC. The values 3 and 4 are printed outD. The val

52、ues 1, 3 and 4 are printed outJava Certification Mock Exam 21/36Select the most appropriate answer.Q. 51Consider the following example:class First public First (String s) System.out.println(s);public class Second extends First public static void main(String args ) new Second();What is the result of

53、compiling and running the Second class?A. Nothing happensB. A string is printed to the standard outC. An instance of the class First is generatedD. An instance of the class Second is createdE. An exception is raised at runtime stating that there is no null parameterconstructor in class First.F. The

54、class second will not compile as there is no null parameter constructor in theclass FirstSelect the most appropriate answer.Q. 52 What is the result of executing the following fragment of code:Java Certification Mock Exam 22/36boolean flag = false;if (flag = true) System.out.println(true); else System.out.println(false);A. true is printed to standard outB. false is printed to standard outC. An exception is raisedD. Nothing happensSelect the most appropriate answer.Q. 53Consider the following classes:publ

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論