Java Online Quiz

Below are the instructions for this quiz:

  • Time Limit for this Quiz is 30 minutes
  • This quiz has 20 questions
  • Multiple choice questions
  • Multiple attempts are allowed
Enter your Email:
1. What happens when we try to add the same element twice to a Set?
2. Which one these is a valid keyword in Java?
3. What is the difference between Vector and ArrayList?
4. Which of the following declaration is correct?
5. What is @Override annotation?
6. In the following code. Who has access to member num?package car;
public class Audi {
   int num;
}
7. Which Java declaration will return syntax error?
8. Which of the following code snippets would compile successfully?
9. What modifier is used to provide access to a method within the class and all the extending classes?
10. Which member of an abstract class can be abstract?
11. What is correct variable type for the result?... variable = 5 + 0.11;
12. There is a class with private constructors only. How can we provide a way to create instance of this class?
13. Create a set of strings and add the string "def" three times to this set, then remove an "def" string. What will happen when size() method is called on this set?
14. What is the output for the below code?public class Test{
    public static void main(String[] args){
            Integer i = Integer.valueOf("1");
            if(i.toString()=="1")
               System.out.println("Equal");
            else
                System.out.println("Not Equal");
     }
}
15. Which Java class provides variables local to each thread?
16. Which of the following code snippets will compile?
17. What is the command to run a JAR file application?
18. When is an object's finalize method called?
19. Which of the following statements is true?
20. What is the output of the following class?public class Test{
    public Test() {
         int x = 5;
         return x;
    }
  public static void main(String[] args){
       System.out.println(new Test());
   }
}

Share

Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *