Question 1 of 25
Hints left: 3
Q1
What is it called where object has its own lifecycle and child object cannot belong to another parent object?
Q2
What will be the output of the following Java code? class A { A()throws IOException { } } class B extends A { B() { } public static void main(String[]args) { } }
Q3
What will be the output of the following Java program? class recursion { int fact(int n) { int result; if (n == 1) return 1; result = fact(n - 1) * n; return result; } } class Output { public static void main(String args[]) { recursion obj = new recursion() ; System.out.print(obj.fact(5)); } }
Q4
What is it called where child object gets killed if parent object is killed?
Q5
Which of the following has the highest memory requirement?
Q6
What will be the output of the following Java program? class box { int width; int height; int length; int volume; void volume() { volume = width*height*length; } } class Output { public static void main(String args[]) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(); System.out.println(obj.volume); } }
Q7
What will be the output of the following Java program? class box { int width; int height; int length; } class mainclass { public static void main(String args[]) { box obj1 = new box(); box obj2 = new box(); obj1.height = 1; obj1.length = 2; obj1.width = 1; obj2 = obj1; System.out.println(obj2.height); } }
Q8
Which component is responsible for converting bytecode into machine specific code?
Q9
What will be the output of the following Java code? class box { int width; int height; int length; int volume; box() { width = 5; height = 5; length = 6; } void volume() { volume = width*height*length; } } class constructor_output { public static void main(String args[]) { box obj = new box(); obj.volume(); System.out.println(obj.volume); } }
Q10
Which of these packages contains the exception Stack Overflow in Java?
Q11
What is false about constructor?
Q12
Which of the following is a method having same name as that of it's class?
Q13
Which of the following is not OOPS concept in Java?
Q14
What is the return type of Constructors?
Q15
Where is a new object allocated memory?
Q16
Which of the following is a valid declaration of an object of class Box?
Q17
Which of the below is invalid identifier with the main method?
Q18
Which of these keywords is used to make a class?
Q19
Which component is responsible to optimize bytecode to machine code?
Q20
Which of the below is not a memory leak solution?
Q21
What is the stored in the object obj in following lines of Java code? box obj;
Q22
Which concept of Java is a way of converting real world objects in terms of class?
Q23
Garbage Collection can be controlled by a program?
Q24
What will be the output of the following Java program? class equality { int x; int y; boolean isequal() { return(x == y); } } class Output { public static void main(String args[]) { equality obj = new equality(); obj.x = 5; obj.y = 5; System.out.println(obj.isequal()); } }
Q25
Abstract class cannot have a constructor.