WorksheetsJAVA Round 3
Total questions: 20
Worksheet time: 10mins
What will be the output? int[] arr = {1,2,3}; System.out.println(arr.length);
2
3
4
Error
Which interface supports sorting?
Comparable
Runnable
Cloneable
Serializable
Which keyword prevents serialization?
volatile
static
transient
final
Which keyword prevents inheritance?
static
final
private
abstract
Which exception is checked?
ArithmeticException
IOException
NullPointerException
ArrayIndexOutOfBoundsException
What will be the output? int a = 5; System.out.println(a++ + ++a);
11
12
13
14
Which Java feature supports lambda?
Class
Functional Interface
Package
Thread
What will be the output? Integer a = 100; Integer b = 100; System.out.println(a==b);
true
false
Error
None
Which keyword is used to throw exception manually?
throws
throw
try
catch
Which operator checks object type?
instanceof
typeof
equals
compare
What will be the output? int x = 10; System.out.println(x==10 ? "Yes" : "No");
Yes
No
Error
None
Which collection is synchronized by default?
ArrayList
Vector
HashMap
HashSet
Which method compares string content?
==
equals()
compare()
match()
What will be the output? try{ int x = 10/0; } catch(Exception e){ System.out.print("Error"); }
Compile Error
Runtime Error
Error
No output
Which collection stores key-value pairs?
List
Set
Map
Queue
Which access modifier allows access within package and subclasses?
private
default
protected
public
What will be the output? for(int i=0;i<3;i++){ System.out.print(i); }
012
123
0123
01
What will be the output? String s = "Java"; s.concat("World"); System.out.println(s);
JavaWorld
World
Java
Error
Which memory stores local variables?
Heap
Stack
Method Area
Cache
What will be the output? System.out.println(10/3);
3
3.33
3.0
Error
