Java - Online Test - Basic interview question - javasearch.buggybread.com


Share

Search Java Test Questions


 223 test questions in repository.




Java - Test Questions on 'Basic interview question' - 22 questions found


Which access specifiers can be used with top level class ?Core Java
public or default
public or private
public or protected
protected or default

  access specifier  oops  java  class

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

What is the initial state of a thread when it is created and started ?Core Java
Wait
Running
Ready
Sleep

  java  threads  multithreading  thread states

What state does a thread enter when it terminates its processing?Core Java
Wait
Ready
Dead
Running

  java  threads  multithreading  thread states

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 Java feature promotes access protection or Hiding ?Core Java
Inheritance
Encapsulation
Abstraction
Composition

  java  java concepts  java features  oops concepts  oops features  access protection  information hiding

enums are intrinsically ..Core Java
private
public
static
final

  java  enum

Enums cannot be declared ..Core Java
private
public
static
final

  java  enum

Which of the following Java feature promotes Code Re usability ?Core Java
Abstraction
Encapsulation
Inheritance
Polymorphism

  java  java concepts  java features  code reusability

Which of the following is true ?Core Java
Composition is Tightly Bound
Inheritance is Tightly Bound
Object can only hold reference of only one other object
A Class cannot be extended by multiple classes

  

Collections is a / an ..Core Java
interface
abstract class
final class
util class

  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

Which of the following can be overridden ?Core Java
final instance methods
final static methods
non final instance methods
non final static methods

  overriding

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 can be nested into another ?Core Java
class within another class
class within interface
interface within class
All of above

  nested classes   nested interface  inner classes

Which of the following is not true ?Core Java
A Java class can extend multiple classes
A Java class can implement multiple interfaces
A Java interface can extend multiple interfaces
All of above are true

  inheritance  multiple inheritance

In Case a method is declared to throw an exception , We can only use a call to that method if ...Core Java
We use the call within try block and catch the exception
We declare that the method is expected to throw the exception using throws
Both 1 and 2
Either 1 or 2

  exception handling  throws







comments powered by Disqus