Question 1 of 25
Hints left: 3
Q1
What is the process of defining more than one method in a class differentiated by method signature?
Q2
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); } }
Q3
What is true about protected constructor?
Q4
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); } }
Q5
Which keyword is used by the method to refer to the object that invoked it?
Q6
Which of the following is a type of polymorphism in Java?
Q7
What would be the behaviour if this() and super() used in a method?
Q8
What is the return type of a method that does not return any value?
Q9
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)); } }
Q10
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); } }
Q11
How can we identify whether a compilation unit is class or interface from a .class file?
Q12
What is use of interpreter?
Q13
What would be behaviour if the constructor has a return type?
Q14
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); } } }
Q15
What would be the behaviour if one parameterized constructor is explicitly defined?
Q16
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); } }
Q17
Which of the following statements are incorrect?
Q18
Which concept of Java is achieved by combining methods and attribute into a class?
Q19
Which of this statement is incorrect?
Q20
Which of these will happen if recursive method does not have a base case?
Q21
What is the extension of compiled java classes?
Q22
What is it called if an object has its own lifecycle and there is no owner?
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
Which of the following statements is correct?
Q25
What is -Xms and -Xmx while starting jvm?