Interview Preparation

OOP Concepts - Object Orientated Programming
Duplicate Code is bad. Code will always Changed.
OOP is Providing Code Reuse ability with reduce duplication of code and you have to change every where which leads to performance
code can be changed any time so when you want to change it in any application, OOP make it easy
Four main Concepts.

  • Polymorphism
    • Overloading / Static Binding /Compile Time / Early Binding : Same Methods with Different Properties, methods contain same name but having different Parameters which is compile on run time and shows error while compile time. It is also known as Static Binding or Early Binding.
      • Example :
        public void result(){}
        public void result(int numbers){}
        public void result(String names){}
    • Overriding / Dynamic Binding /Run Time / Late Binding : child class can implement a parent class method based on its requirement. Overriding means to override the functionality of an existing method.
      • Example :
        class Animal {
        public void move() {
              System.out.println("Animals can move");
        class Dog extends Animal {
           public void move() {
              System.out.println("Dogs can walk and run");
        public class TestDog {
           public static void main(String args[]) {
              Animal a = new Animal();   // Animal reference and object
              Animal b = new Dog();   // Animal reference but Dog object
              a.move();   // runs the method in Animal class
              b.move();   // runs the method in Dog class
  • Encapsulation
  • Abstraction
  • Inheritance


OOP Basics - Object Orientated Programming


  • A class is a Body for any functional entity which defines its properties and its functions. Like Human Being, having body parts, and performing various actions.


Data Types


Basic Programming


MVC - Model View Controller


Rest full Services





Repository management framework




Collections & Generics


Data Structure


Web Services




Connectivity With DataBase


GIT Overview


Agile Overview


Database Concepts


Hashing vs Encryption


Generalization & specialization


Access / non access Modifiers


Multi Threading


Synchronized and Asynchronize


For each loop


Static & Dynamic Bindings


Generics vs Object Class


Aggregation / Composition / Association 


Dependency Injector


Design Patterns


Modulus Sign


List / Array list / Array / Collections


Data Base Self Join


Programming Small Problems
About Struts 2 :

it is an MVC Framework.

Give us PreBuilt classes for MVC that we can use / extend.

Structs Main Components :

interceptors = request parameters
Action Class = Business services classes
Structs XML : work like controller, it controls the execution flow of request. it need to map Actions Classes and JSP.
JSP = Tag libraries

Structs TAGs :
<Package name = "default" namespace = "/anyNameForURL" extends = "struts-default">
<action name= "URL name" class = "Class complete path with package name" method = "someOtherMethod"> 
<result name = "SucessjSP">/JSPPageCallHere.JSP</result>
<result name = "ErrorJSP">/AnotherJSPPageCallHere.JSP</result>

<method> : calls when one class have many methods.
Example :
Struts Wild Cards:

use to search action classes when service is hit:

<action name= "URL*" class = "Class complete path with package name"> 
<result name = "SucessjSP">/JSPPageCallHere.JSP</result>

it Hit the action class which is start with URL.
pattern :

to architect the application

framework :

provides you classes and libraries to build an application

spring framework :

spring framework is a enterprise java framework which let you write enterprise java application.

spring boot :

Spring boot is a spring + bootstrap and a quickly startup a spring application which includes its own web server , we can build a complex and end to end applications in spring.
its a huge frame work have a lot of stuff.
spring boot make it easy to create stand alone, production-grade spring based applications that you can “just run”.

end to end :

includes controller,data layer,service layer

Zuul Library :

Zuul is a JVM based router and server side load balance.

rmi :(Remote Method invocation)

works through stub and skeleton.
rmi is an API which allows an object to invoke a method on an object that exists in another address space

mybatis :

MyBatis is a Java persistence framework that couples objects with stored procedures or SQL statements using an XML descriptor or annotations.

JPA : (Java Persistence API)

Java Persistence API is a collection of classes and methods to persistently store the vast amounts of data into a database.

EJB : (Enterprise JavaBeans)

Enterprise Java Beans (EJB) is one of several Java APIs for modular construction of enterprise software. EJB is a server-side software component that encapsulates business logic of an application.


Ajax Types:

have two types.


Is GET Method recieves huge data through request parameter

No, Only POST Method recieves huge data through request parameter

Differentiate between return a Value and a Reference

Differentiate between String and String Buffer ?

String-Buffer is a peer class of String that provides much of the functionality of strings. String represents fixed-length, immutable character sequences while String-Buffer represents grow able and writable character sequences.

Access Modifiers :
















no modifier










SQL | DDL, DML, DCL and TCL Commands

Structured Query Language(SQL) as we all know is the database language by the use of which we can perform certain operations on the existing database and also we can use this language to create a database. SQL uses certain commands like Create, Drop, Insert etc. to carry out the required tasks.

These SQL commands are mainly categorized into four categories as discussed below:

  1. DDL(Data Definition Language) : DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in database.

    Examples of DDL commands:

    • CREATE – is used to create the database or its objects (like table, index, function, views, store procedure and triggers).
    • DROP – is used to delete objects from the database.
    • ALTER-is used to alter the structure of the database.
    • TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records are removed.
    • COMMENT –is used to add comments to the data dictionary.
    • RENAME –is used to rename an object existing in the database.
  2. DML(Data Manipulation Language) : The SQL commands that deals with the manipulation of data present in database belong to DML or Data Manipulation Language and this includes most of the SQL statements.

    Examples of DML:

    • SELECT – is used to retrieve data from the a database.
    • INSERT – is used to insert data into a table.
    • UPDATE – is used to update existing data within a table.
    • DELETE – is used to delete records from a database table.
  3. DCL(Data Control Language) : DCL includes commands such as GRANT and REVOKE which mainly deals with the rights, permissions and other controls of the database system.

    Examples of DCL commands:

    • GRANT-gives user’s access privileges to database.
    • REVOKE-withdraw user’s access privileges given by using the GRANT command.
  4. TCL(transaction Control Language) : TCL commands deals with the transaction within the database.

    Examples of TCL commands:

    • COMMIT– commits a Transaction.
    • ROLLBACK– rollbacks a transaction in case of any error occurs.
    • SAVEPOINT–sets a savepoint within a transaction.
    • SET TRANSACTION–specify characteristics for the transaction.

Stateless vs Statefull Services

Statefull Web Services

stateful web service looks like? Let’s say you log into a resource, and in doing so, you pass your password and username. If the web server stores this data in a backend manner and uses it to identify you as a constantly connected client,

Stateless Web Services

you use a variety of stateless services and applications. When you read the news, you are using HTTP to connect in a stateless manner, utilizing messages that can be parsed and worked with in isolation of each other and your state.

If you have Twitter on your phone, you are constantly utilizing a stateless service. When the service requests a list of recent direct messages using the Twitter REST API, it issues the following request:

Soap VS Rest

Soap is statefull

Rest is stateless

Difference between ArrayList and Vector

ArrayList and Vector both implements List interface and maintains insertion order.

However, there are many differences between ArrayList and Vector classes that are given below.

ArrayList Vector
1) ArrayList is not synchronized. Vector is synchronized.
2) 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.
3) ArrayList is not a legacy class. It is introduced in JDK 1.2. Vector is a legacy class.
4) 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.
5) ArrayList uses the Iterator interface to traverse the elements. A Vector can use the Iterator interface or Enumeration interface to traverse the elements.


How to SUM Numeric value from String
 * @author Usman Mughal
public class calculateIntFromString {
    public static void main(String[] args){
        try {
    String calculateInt = "A1B2C3";
    int num1 = Integer.parseInt(calculateInt.substring(1,2));
    int num2 = Integer.parseInt(calculateInt.substring(3,4));
    int num3 = Integer.parseInt(calculateInt.substring(5,6));
    int sum = num1 + num2 + num3;
        System.out.println("num1 = " + sum);

        } catch (NumberFormatException e) {



How to SUM Numeric value from Dynamic String
 * @author Usman Mughal
public class calculateIntFromString {
    public static void main(String[] args){

String calculateInt = "A124B2C355CF85GT5";
int total = 0;
char[] data = calculateInt.toCharArray();
for(int i = 0; i < data.length; i++){
String number = "";
number = number + calculateInt.charAt(i);
total = total + Integer.parseInt(number);
System.out.println("Total number = " + total);
} }

Defference between Constructor and Destructor :-

Constructor called when object is created and Destructor called when object is ereased.

Angular Architect/Pillars :-

Angular have three pillars
1- component – communicate with front end – create HTML
2- service – business logic
3- routing – navigation with in pages/components

Spring @Webservice (annotation)

If we don’t define any service (REST,SOAP),through annotations in spring we use @webservice which is builtin library of java found in jax-ws