Question 1 of 25
Hints left: 3
Q1
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 obj = new box(); System.out.println(obj); } }
Q2
What is -Xms and -Xmx while starting jvm?
Q3
Which concept of Java is achieved by combining methods and attribute into a class?
Q4
What will be the output of the following Java program? class box { int width; int height; int length; int volume; void volume(int height, int length, int width) { volume = width*height*length; } } class Prameterized_method { public static void main(String args[]) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(3,2,1); System.out.println(obj.volume); } }
Q5
What would be the behaviour if this() and super() used in a method?
Q6
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(6)); } }
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 obj = new box(); obj.width = 10; obj.height = 2; obj.length = 10; int y = obj.width * obj.height * obj.length; System.out.print(y); } }
Q8
What would be the behaviour if one parameterized constructor is explicitly defined?
Q9
What is the extension of compiled java classes?
Q10
Which keyword is used by the method to refer to the object that invoked it?
Q11
What would be behaviour if the constructor has a return type?
Q12
Which of the following statements is correct?
Q13
What is it called if an object has its own lifecycle and there is no owner?
Q14
What is the process of defining more than one method in a class differentiated by method signature?
Q15
What is use of interpreter?
Q16
Which of the following statements are incorrect?
Q17
What is true about protected constructor?
Q18
What is the return type of a method that does not return any value?
Q19
Which of this statement is incorrect?
Q20
Which of these will happen if recursive method does not have a base case?
Q21
In the following Java code, which call to sum() method is appropriate? class Output { public static int sum(int ...x) { return; } static void main(String args[]) { sum(10); sum(10,20); sum(10,20,30); sum(10,20,30,40); } }
Q22
How can we identify whether a compilation unit is class or interface from a .class file?
Q23
What will be the output of the following Java code? class area { int width; int length; int area; void area(int width, int length) { this.width = width; this.length = length; } } class Output { public static void main(String args[]) { area obj = new area(); obj.area(5 , 6); System.out.println(obj.length + " " + obj.width); } }
Q24
What will be the output of the following Java program? class main_class { public static void main(String args[]) { int x = 9; if (x == 9) { int x = 8; System.out.println(x); } } }
Q25
Which of the following is a type of polymorphism in Java?