Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'trắc nghiệm core java', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Trắc nghiệm Core Java 1. Which of the following statements are valid given the following variable declarations boolean a boolean b int c Select a valid answer A a c C a A b c B a a D a c Answer B Mark 1.0 2. Which of the following can be applied to constructors Select a valid answer A final B static C synchronized D None of these. Answer D Mark 1.0 3. Which of the following retain their preferred size width and height when added individually to the North section of a container with a BorderLayout assume that no other components or containers are present in the North section . Select a valid answer A TextArea B Button C TextField D Checkbox Answer D Mark 1.0 4. Which of the following are legal names for variables. Select a valid answer A int B large C Integer D 2much Answer C Mark 1.0 5. Consider the following piece of code and select the correct statement from the following. String s new String abcdefgh 1 s.replace d q 2 System.out.println s 3 Select the one right answer A The code fails to compile reporting an error at line 2. Strings are immutable and therefore a replace method is meaningless. C The code compiles correctly and displays the text abcdefgh . Answer C Mark 1.0 B The code compiles correctly and displays the text abcqefgh . D The code compiles but an exception is thrown when line 2 is executed. 6. Which of the following keywords can be applied to the variables or methods of an interface. Select all valid answers A static B private C public D protected Answer A C Mark 0.5 7. Consider the following piece of code and select the correct statement s 1. class A 2. protected int method 3. 4. 5. 6. class B extends A 7. int method 8. 9. Select all valid answers A The code fails to compile because you can t override a method to be more private than its parent. C The code fails to compile. However it can be made to compile correctly by prefixing line 7 with the access qualifier protected . Answer A C D Mark 1.0 B The code fails to compile because method is .