Fourth Dimension Technologies Interview Question

Fourth Dimension Technologies Interview Question

 This blog explains about  FOURTH DIMENSION TECHNOLOGIES Interview Questions and is given below :-

FOURTH DIMENSION TECHNOLOGIES

Why String is Immutable? Give Some Example.

In java, string objects are immutable. Immutable simply means unmodifiable or unchangeable.Once string object is created its data or state can’t be changed but a new string object is created. Let’s try to understand the immutability concept by the example given below:

class Testimmutablestring{

public static void main(String args[]){

String s=”Sachin”;

s.concat(” Tendulkar”);//concat() method appends the string at the end

System.out.println(s);//will print Sachin because strings are immutable objects

}

}

Difference Between HashMap and Hash Table?

 HashMap and Hash Table both are used to store data in key and value form.Both r Using Hasing technique to store Unique Keys.But there are many differences between Hashmap and Hashtable classesthat are given below.

           HASHMAP      HASHTABLE
Hashmap is Fast Hashtable is Slow
Hashmap is a new class introduced in JDK 1.2 Hashtable is legacy class
HashMap allow one null key and multiple null values. Hashtable doesn’t allow any null key or Value
HashMap is traversed by Iterator. Hashtable is traversed by Enumerator and Iterator
Iterator in HashMap is fail – fast Enumerator in Hastable in Not fail-fast.
HashMap inherits AbstractMap Class Hashtable inherits Dictionary class

 Difference Between ArrayList and Vector?
ArrayList and Vector both implements List interface and maintains insertion order.

ArrayList Vector
ArrayList increments 50% of current array size if the number of elements exceeds from its capacity. Vector increments 100% means doubles the array size if the total number of elements exceeds than its capacity.
ArrayList is not synchronized. Vector is synchronized.
 ArrayList is not a legacy class. It is introduced in JDK 1.2. Vector is a legacy class.
ArrayList is fast because it is non-synchronized. Vector is slow because it is synchronized, i.e., in a multithreading environment, it holds the other threads in runnable or non-runnable state until current thread releases the lock of the object.
ArrayList uses the Iterator interface to traverse the elements.  A Vector can use the Iterator interface or Enumeration interface to traverse the elements.

What is DBMS?
      The software which is used to manage database is called Database Management System (DBMS). For Example, MySQL, Oracle etc. are popular commercial DBMS used in different applications.

What is Synchronization?
    In general, synchronization is used to protect access to resources that are accessed concurrently. One of the benefits of using multiple threads in an application is that each thread executes asynchronously. There are many situations in which multiple threads must share access to common objects.
 
 Checked Exception & Unchecked Exception Differences.
 
Checked Exception UnChecked Exception
Checked exceptions occur at compile time. Unchecked exceptions occur at runtime.
A checked exception is checked by the compiler. The compiler does not check these type of exception.
These types of exception can be handled at the time of compilation. These types of exceptions cannot be a catch or handle at the time of compilation, because they get generated by the mistakes in the program.
They are the sub-class of the exception class. They are runtime exceptions and hence are not a part of the Exception class.
Here, the JVM needs the exception to catch and handle. Here, the JVM needs the exception to catch and handle.
Examples of Checked exceptions:

  • File Not Found Exception
  • No Such Field Exception
  • Interrupted Exception
Examples of Unchecked Exceptions:

  • Undeclared Throwable Exception
  • Empty Stack Exception
  • Arithmetic Exception