Question 1 of 25
Hints left: 3
Q1
Which of the following is a method having same name as that of it's class?
Q2
Which of the below is not a memory leak solution?
Q3
Abstract class cannot have a constructor.
Q4
What is the return type of Constructors?
Q5
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); } }
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 is the stored in the object obj in following lines of Java code? box obj;
Q8
Which concept of Java is a way of converting real world objects in terms of class?
Q9
Garbage Collection can be controlled by a program?
Q10
Which component is responsible for converting bytecode into machine specific code?
Q11
Where is a new object allocated memory?
Q12
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) { } }
Q13
Which of the below is invalid identifier with the main method?
Q14
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)); } }
Q15
Which of the following is a valid declaration of an object of class Box?
Q16
Which component is responsible to optimize bytecode to machine code?
Q17
Which of these packages contains the exception Stack Overflow in Java?
Q18
Which of these keywords is used to make a class?
Q19
What is it called where child object gets killed if parent object is killed?
Q20
Which of the following has the highest memory requirement?
Q21
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()); } }
Q22
What is false about constructor?
Q23
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); } }
Q24
Which of the following is not OOPS concept in Java?
Q25
What is it called where object has its own lifecycle and child object cannot belong to another parent object?