Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Objects and Collections Questions
Which Java class inherits its equals() and hashCode() directly from java.lang.Object (i.e., does not override them)?
Which Java collection lets you associate elements with keys while iterating in insertion (FIFO) order?
Java — Which interface does java.util.Hashtable implement?
Java — What is the numerical range of the char data type?
Java — Store elements with no duplicates and natural order. Which interface provides this capability?
Java — Which Map implementation maintains iteration order of an existing Map?
Java — Which collection class allows resizing, provides indexed access, but is not synchronized?
Java — What line of code should replace the missing statement to compile this program? public class foo { public static void main(String[]args)throws Exception { java.io.PrintWriter out = new java.io.PrintWriter(); new java.io.OutputStreamWriter(System.out,true); out.println("Hello"); } }
Java — Which interface provides capability to store objects using key-value pairs?
Java — Which of the following are Java reserved words? (run, import, default, implement)
Java — Which collection class allows key-value associations and provides synchronization?
Java — Which is a valid declaration of a float value?
Java TreeSet iteration order and duplicate handling: what sequence is printed?\n\nTreeSet map = new TreeSet();\nmap.add("one");\nmap.add("two");\nmap.add("three");\nmap.add("four");\nmap.add("one"); // duplicate\nIterator it = map.iterator();\nwhile (it.hasNext()) {\n System.out.print(it.next() + " ");\n}
Static array reference default value vs element access: what happens when printing x[0]?\n\npublic class Test {\n private static int[] x; // reference not initialized → null\n public static void main(String[] args) {\n System.out.println(x[0]);\n }\n}
Which interfaces does Vector.elements() return, and how do instanceof tests evaluate?\n\nimport java.util.*;\nclass H {\n public static void main (String[] args) {\n Object x = new Vector().elements();\n System.out.print((x instanceof Enumeration) + ",");\n System.out.print((x instanceof Iterator) + ",");\n System.out.print(x instanceof ListIterator);\n }\n}
Packages, access modifiers, and top-level classes: will this code compile?\n\npackage foo;\nimport java.util.Vector; // Line 2\nprivate class MyVector extends Vector {\n int i = 1; // Line 5\n public MyVector() {\n i = 2;\n }\n}\npublic class MyNewVector extends MyVector {\n public MyNewVector() {\n i = 4; // Line 15\n }\n public static void main (String args[]) {\n MyVector v = new MyNewVector(); // Line 19\n }\n}
Default values in a newly allocated float array: what exactly prints for f[0]?\n\npublic class Test {\n private static float[] f = new float[2];\n public static void main (String[] args) {\n System.out.println("f[0] = " + f[0]);\n }\n}
Which interfaces does ArrayList.iterator() implement? Evaluate the instanceof results.\n\nimport java.util.*;\nclass I {\n public static void main (String[] args) {\n Object i = new ArrayList().iterator();\n System.out.print((i instanceof List) + ",");\n System.out.print((i instanceof Iterator) + ",");\n System.out.print(i instanceof ListIterator);\n }\n}
Using NULL vs null in Java: what does this program do?\n\npublic class Test {\n public static void main (String args[]) {\n String str = NULL;\n System.out.println(str);\n }\n}
In Java command-line arguments, what is printed by this program when executed as shown?\n\npublic class Test \n{ \n public static void main (String[] args) \n {\n String foo = args[1]; \n String bar = args[2]; \n String baz = args[3]; \n System.out.println("baz = " + baz); // Line 8\n } \n}\n\nInvocation:\n> java Test red green blue
1
2