java exam 0 votes, 0 avg 350 123456789101112131415 Java Questions 1 / 15 1. Which of these keywords are used for the block to be examined for exceptions? A. check B. throw C. catch D. try 2 / 15 2. Which of these method of Object class can clone an object? A. Objectcopy() B. copy() C. Object clone() D. clone() 3 / 15 3. Which variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed? A. Local variables B. Instance variables C. Class Variables D. Static variables 4 / 15 4. What is the syntax for java main method? A. public void main(String[] args) B. public static void main() C. public static void main(String[] args) D. none of the above 5 / 15 5. What is the process of defining a method in terms of itself, that is a method that calls itself? A. Polymorphism B. Abstraction C. Encapsulation D. Recursion 6 / 15 6. Which mechanism is used when a thread is paused running in its critical section and another thread is allowed to enter (or lock) in the same critical section to be executed? A. Inter-thread communication B. Initial-thread communication C. Mutual Exclusive D. none of the above 7 / 15 7. Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B? A. super(void); B. Superclass.(); C. super.A(); D. super(); 8 / 15 8. What is not the use of “this” keyword in Java? A. Passing itself to the method of the same class B. Referring to the instance variable when a local variable has the same name C. Passing itself to another method D. Calling another constructor in constructor chaining 9 / 15 9. Find the output of the following code. class output { public static void main(String args[]) { StringBuffer s1 = new StringBuffer("Quiz"); StringBuffer s2 = s1.reverse(); System.out.println(s2); } } A. QuizziuQ B. ziuQQuiz C. Quiz D. ziuQ 10 / 15 10. How is Date stored in database? A. java.sql.Date B. java.util.Date C. java.sql.DateTime D. java.util.DateTime 11 / 15 11. What will be the output of the following Java code? class test { int a; int b; void meth(int i , int j) { i *= 2; j /= 2; } } class Output { public static void main(String args[]) { test obj = new test(); int a = 10; int b = 20; obj.meth(a , b); System.out.println(a + " " + b); } } A. 10 20 B. 20 10 C. 20 40 D. 40 20 12 / 15 12. What will be the output of the following Java code snippet? class abc { public static void main(String args[]) { if(args.length>0) System.out.println(args.length); } } A. The snippet compiles and runs but does not print anything B. The snippet compiles, runs and prints 0 C. The snippet compiles, runs and prints 1 D. The snippet does not compile 13 / 15 13. Which of these can be used to differentiate two or more methods having the same name? A. Parameters data type B. Number of parameters C. Return type of method D. All of the mentioned 14 / 15 14. Find the output of the following program. public class Solution{ public static void main(String[] args){ byte x = 127; x++; x++; System.out.print(x); } } A. -127 B. 2 C. 129 D. 127 15 / 15 15. What is Recursion in Java? A. Recursion is a class B. Recursion is a process of defining a method that calls other methods repeatedly C. Recursion is a process of defining a method that calls itself repeatedly D. Recursion is a process of defining a method that calls other methods which in turn call again this method Your score isThe average score is 36% LinkedIn Facebook VKontakte 0% Restart quiz By Wordpress Quiz plugin