Java - Online Test - Ebay - javasearch.buggybread.com


Share

Search Java Test Questions


 223 test questions in repository.




Java - Test Questions on 'Ebay' - 21 questions found


Which of the following collections stores its elements in insertion Order ?Core Java
HashMap
TreeMap
LinkedHashMap
LinkedMap

  linkedhashmap  collections  java  map

Which of the following is false ?Core Java
HashMap came before HashTable.
HashMap allows null values whereas Hashtable doesn’t allow null values.
HashTable and HashMap allow Key-Value pairs.
Hashtable is synchronized whereas HashMap is not.

  map  hashmap  hashtable  collection  java

Which of the collections allows null as the key ?Core Java
HashTable
HashMap
TreeMap
LinkedHashMap

  java  collections  map

Which of the following class creates mutable objects ?Core Java
Boolean
File
String
StringBuffer

  java  immutable

Which of the following is wrong for final instance variables ?Core Java
They cannot be changed after initialization
They can be initialized directly within static method
They can be declared and initialized together at the same place
They can be initialized within constructor

  java  final  final variable  java keywords

Which of the following is false for final ?Core Java
Final methods cannot be overriden
Final methods cannot be overloaded
Final classes cannot be subclassed
Final class cannot be abstract

  java  final  java keyword

Which of the following statement is not true ?Core Java
x==y means they are pointing to the same object
x==y means that they hold same information
x.equals(y) means they are pointing to the same object
x.equals(y) means that they hold same information

  

When String literals are compared using ==, they always returns true if the string values are same because .. Core Java
of overridden compareTo method
of overridden compare method
of String Pool
== means that the object contents are equal

  

Which of the following has been introduced with Java 8 ?Core Java
StringBuffer
StringBuilder
StringFilter
StringJoiner

  java  java8  java 8  String  StringJoiner

What will be the output of following ?

String str1 = new String("String1");
String str2 = new String("String1");
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2);
Core Java
falsetruetrue
truetruetrue
truetruefalse
falsetruefalse

  equals  object equality

What will be the output of following code ?

String str1 = "String1";
String str2 = "String1";
System.out.print(str1 == str2);
System.out.print(str1.equals(str2));
str1 = str2;
System.out.print(str1 == str2);
Core Java
falsetruetrue
falsefalsetrue
truetruetrue
falsefalsefalse

  equals  object equality  string pool

What will be the output of following code ?

String str1 = "String1";
String str2 = "String2";
str1.concat("String3");
System.out.print(str1);
System.out.print(str2);
Core Java
String1String2
String1String3String3
String1String3String1String3
String1String1

  

What will be the output of following code ?

String str1 = "String1";
String str2 = "String2";
str1=str1.concat("String3");
System.out.print(str1);
System.out.print(str2);
Core Java
String1String2
String1String3String2
String1String2String3
String1Stringg3String1

  

What will be the output of exceuting main method ?

public static void main(String[] args){
      List list = new ArrayList();
      list.add(1);
      list.add(2);
      list.add(3);
      System.out.println(list);
   }
Core Java
1,2,3
Order cannot be determined
compilation error
3,2,1

  collections  list  arraylist

What will be the output upon executing main method ?

public static void main(String[] args){
      Set set = new HashSet();
      set.add(1);
      set.add(2);
      set.add(3);
      System.out.println(set);
   }
Core Java
1,2,3
Order cannot be determined
Compilation error
3,2,1

  set  hashset  collections

Which of the following class creates immutable objects ?Core Java
String
StringBuffer
StringBuilder
None of these create immutable objects.

  String  StringBuffer  StringBuilder  Immutable

Which of the following class is synchronized ?Core Java
String
StringBuffer
StringBuilder
None of these

  String  StringBuffer  StringBuilder  Synchronized

Which of the following methods are used by Java Garbage Collection Mechanism ?Core Java
final
finally
finalize
All of the above

  garbage collection  finalize

Function variables are kept in ..Core Java
Stack
Heap
Both Stack and Heap
None of them

  memory management  stack  heap

In which case finally won't get executed ?Core Java
in case of exception
in case of normal execution
in case of return statement before end of try block
in case of force program termination

  finally

Which of following class types in MVC holds Business logic ?Java EE
Model
View
Controller
Accessor

  mvc







comments powered by Disqus