Question 1 of 25
Hints left: 3
Q1
In Java, which keyword is used to implement inheritance between classes?
Q2
In Java, can a subclass access private members (fields and methods) of its superclass?
Q3
What is the difference between "extends" and "implements" in Java?
Q4
What is the result of the following code snippet? class Parent { void display() { System.out.println("Parent"); } } class Child extends Parent { void display() { System.out.println("Child"); } } public class Main { public static void main(String[] args) { Parent obj = new Child(); obj.display(); } }
Q5
Which of these is a method can generate a boolean output?
Q6
What will be the output of the following Java program? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.toDegrees(x); System.out.print(y); } }
Q7
What is method overriding in Java?
Q8
What will be the output of the following Java program? import java.util.*; class LOCALE_CLASS { public static void main(String args[]) { Locale obj = new Locale("INDIA") ; System.out.print(obj.getCountry()); } }
Q9
What is a superclass in Java?
Q10
Which of these method(s) is/are used for writing bytes to an outputstream?
Q11
What will be the output of the following Java program? class X { int a; double b; } class Y extends X { int c; } class Output { public static void main(String args[]) { X a = new X(); Y b = new Y(); Class obj; obj = b.getClass(); System.out.print(obj.isInstance(a)); } }
Q12
Which of these keywords is used to define packages in Java?
Q13
What is the "super" keyword used for in Java?
Q14
What will be the output of the following Java program? class Output { public static void main(String args[]) { char a[] = {'a', '5', 'A', ' '}; System.out.print(Character.isDigit(a[0]) + " "); System.out.print(Character.isWhitespace(a[3]) + " "); System.out.print(Character.isUpperCase(a[2])); } }
Q15
Which of these classes is not included in java.lang?
Q16
Which of these exceptions will be thrown if we use null reference for an arithmetic operation?
Q17
Which of the following reference types cannot be generic?
Q18
What is inheritance in Java?
Q19
Which of these class can be used to implement the input stream that uses a character array as the source?
Q20
Which of these is a super class of wrappers Long, Character & Integer?
Q21
Which of these is a process of converting a simple data type into a class?
Q22
What will be the output of the following Java program? class Output { public static void main(String args[]) { String x = Boolean.toString(false); } }
Q23
In Java, can a subclass override a private method from its superclass?
Q24
In Java, can a subclass inherit constructors from its superclass?
Q25
What will be the output of the following Java code snippet? int a = random.nextInt(7) + 4;