Question 1 of 25
Hints left: 3
Q1
Which of these statement is incorrect?
Q2
What will be the output of the following Java program? class recursion { int func (int n) { int result; result = func (n - 1); return result; } } class Output { public static void main(String args[]) { recursion obj = new recursion() ; System.out.print(obj.func(12)); } }
Q3
Which function is used to perform some action when the object is to be destroyed?
Q4
Which of these operators is used to allocate memory for an object?
Q5
What is Recursion in Java?
Q6
Which exception is thrown when java is out of memory?
Q7
Method overriding is combination of inheritance and polymorphism?
Q8
class A{ A(String s){} A(){} } class B extends A{ B(){} B(String s){ super(s); } void test(){ // insert code here } } Which of the below code can be insert at line 7 to make clean compilation ?
Q9
Which of the below is not a Java Profiler?
Q10
Which component is responsible to run java program?
Q11
Which statement is true about java?
Q12
What is the output for the below code? class A{ public A(){ System.out.println("A"); } public A(int i){ this(); System.out.println(i); } } class B extends A{ public B(){ System.out.println("B"); } public B(int i){ this(); System.out.println(i+3); } } public class Test{ public static void main (String[] args){ new B(5); } }
Q13
When does method overloading is determined?
Q14
What is true about Class.getInstance()?
Q15
Which of these is a legal definition of a method named examveda assuming it throws IOException, and returns void. Also assume that the method does not take any arguments. Select the one correct answer.
Q16
What is true about constructor?
Q17
Which of the following is a garbage collection technique?
Q18
What is the output for the below code? public class Test{ public static void printValue(int i, int j, int k){ System.out.println("int"); } public static void printValue(byte...b){ System.out.println("long"); } public static void main(String... args){ byte b = 9; printValue(b,b,b); } }
Q19
What is the output for the below code? public class A{ int add(int i, int j){ return i+j; } } public class B extends A{ public static void main(String argv[]){ short s = 9; System.out.println(add(s,6)); } }
Q20
What will be the output? public class Test{ public static void main(String[] args){ String value = "abc"; changeValue(value); System.out.println(value); } public static void changeValue(String a){ a = "xyz"; } }
Q21
What will be the output of the following Java program? class recursion { int func (int n) { int result; if (n == 1) return 1; result = func (n - 1); return result; } } class Output { public static void main(String args[]) { recursion obj = new recursion() ; System.out.print(obj.func(5)); } }
Q22
What will be the result of compiling and running the given code? class A{ int b=10; private A(){ this.b=7; } int f(){ return b; } } class B extends A{ int b; } public class Test{ public static void main(String[] args){ A a = new B(); System.out.println(a.f()); } }
Q23
What will be the output of the following Java code? class box { int width; int height; int length; int volume; void finalize() { volume = width*height*length; System.out.println(volume); } protected void volume() { volume = width*height*length; System.out.println(volume); } } class Output { public static void main(String args[]) { box obj = new box(); obj.width=5; obj.height=5; obj.length=6; obj.volume(); } }
Q24
What is not the use of "this" keyword in Java?
Q25
What is true about private constructor?