Instructions: For each question, choose one single best answer. There is no time limit, so you can change your answers at any time. When you click Done button, the assessment report will appear in the next screen.
1. Which of the following modifiers is used to declare a class variable?;
2. Which of the following is a legal Java keyword?
3. The returning of memory (to the operating system) occupied by objects that are no longer needed is automatically accomplished in Java by a feature commonly known as:
4. Given code below. When you attempt to run it, what is the output?
1. class Test { 2. public static void main(String[] ok){ 3. System.out.println(ok[0]); 4. } 5. } >java Test ok or not;
5. What will happen when you attempt to compile and run the following code segment?
1. int output = 10; 2. boolean b1 = false; 3. 4. if((b1) && ((output += 10) == 20)){ 5. System.out.println(output); 6. } 7. else { 8. System.out.println(output); 9. }
6. Given the code below, what happens when you attempt to compile it?
1. class Base { 2. void test() { 3. System.out.println("Base"); 4. } 5. } 6. class Child extends Base { 7. void test( ){ 8. System.out.println("Child"); 9. super.test(); 10. } 11. static public void main(String[] args) { 12. new Child().test(); 13. } 14. }
7. Given the code below, what happens when you attempt to run it?
1. public class MyThread implements Runnable { 2. public void start () { 3. Thread myT = new Thread(this); 4. } 5. public void run() { 6. while(true) { 7. System.out.print(1); 8. } 9. } 10. public static void main(String[] args) { 11. MyThread myT = new MyThread(); 12. myT.start(); 13. } 14. }
8. Which of the following code calculates intersection?
Bug Report