Test : Java_19
This test contains 10 questions based on Java.
Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers.
Each question answered correctly awards you 1 point and each incorrect answer has a penalty of -0.25 points, no points are deducted for unattempted answers.
Select Test Type
You Get +1 for each correct answer and -0.25 for each incorrect answer
Time Left - minutes :seconds
Which of these packages contains abstract keyword?
java.util | java.io |
java.system | java.lang |
A subclass of an abstract class can also be abstract if
It is instantiated | The static class is declared in the parent class |
It does not define all the abstract methods in the parent class | All of the above |
What is the name of the class that is the ancestor to every other class in Java?
Object | Class |
root | java |
Which of the following is a method having same name as that of its class?
finalize | delete |
class | constructor |
Which of these keywords is used to define interfaces in Java?
interface | Interface |
intf | Intf |
What is the output of this program?
import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdefgh"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 1, 4); int i; int j; try { while((i = input1.read()) == (j = input2.read())) { System.out.print((char)i); } } catch (IOException e) { e.printStackTrace(); } } }
abc | abcd |
abcde | None of the above |
Which of these packages contain all the collection classes?
java.lang | java.util |
java.net | java.awt |
What is the output of the following code:
abstract class Shape { void display() { } } class Circle extends Shape { void display() { System.out.println("You are using circle class"); } } class Rectangle extends Shape { void display() { System.out.println("You are using rectangle class"); } } class Triangle extends Shape { void display() { System.out.println("You are using triangle class"); } } class AbstractClassDemo { public static void main(String args[]) { Shape sObj = new Circle(); sobj.display(); sObj = new Rectangle(); sobj.display(); sObj = new Triangle(); sobj.display(); } }
You are using triangle class You are using rectangle class You are using circle class | You are using rectangle class You are using circle class You are using triangle class |
You are using circle class You are using triangle class You are using rectangle class | You are using circle class You are using rectangle class You are using triangle class |
String in Java is a?
class | object |
variable | character array |
Which of these access specifiers must be used for main() method?
private | public |
protected | None of the mentioned |
Finish Test
No comments: