Test your web services knowledge

  1. Jax – RPC vs Jax-WS
  2. Explain about cannonical model
  3. How do you call multiple webservices?
  4. “SOAP vs REST
  5. Tell me one scenario where you will use REST not SOAP based web service?”
  6. How do you identify / register services? How do you invoke web service?
  7. “Essential Factors of web services/ What
  8. are the important need to be considered as web service?”
  9. How to build Asynchronous SOAP and REST Webservices
  10. REST Principles
  11. REST Webservice End to End flow
  12. How to authenticate REST?
  13. REST Basic authentication
  14. Steps to implement Oauth in REST
  15. REST representation json vs xml
  16. Is web services call sync or async? Have you implemented web services in Spring?
  17. “When you do estimation for distributed/SOA integration,
  18. what are the main factors you consider for estimation?”
  19. “On integration only another question is,
  20. what are the key design concerns you have to consider, when designing SOA service?”
  21. How many SOA design patterns you have used?
  22. What approaches you use when build a SOA client?
  23. “What is canonical data model?
  24. How many canonical data model you have worked so far?”
  25. How you secure a web service?
  26. How many things you document in in web service interface as part of technical design document?

Refresh your Hibernate Knowledge

  1. How do you connect more than one DB using Hibernate?
  2. How do you handle Hibernate Inheritence with Hibernate?
  3. Diff between primary and secondary cache? –
  4. hibernate detached object vs transient, session flush, merge
  5. hibernate advantage

Refresh your Spring Framework knowledge

  1. Scopes of Spring Bean
  2. spring DI IOC
  3. Various options to write inject cross cutting concerns in an application using Spring?
  1. What are the various Spring libraries you have used in your applications so far?
  1. Do you know Spring global transaction?
  2. How many different way you have done transaction management in Spring?
  1. How to inject a bean at runtime in spring?
  2. How did you do validation in spring?
  3. Have you used spring security?
  4. Have you used spring transaction?
  5. If you have to choose between JEE v/s Spring, what you will choose?
  6. Why you are using Spring in your project?
  7. If you have to migrate from Spring to JEE what all are changes you expect and vice versa?
  8. What all the features of Spring you have used and what you know about latest release?


  1. How do you build scalable application using AEM?

caching, modulaity, layers, data vs content., rendering, (cluster pending, common store)

Scalability Handle in AEM/ Web Application


1)Good Capacity Planning –

2)Chossing correct architecture patterns

Service pattern

static vs dynamic

2)Chosing correct deploymnet strategy

For AEM 6/6.1,

Single Tar MK

Tar MK with Cold Standby

Tar MK Farms

Oak Cluster with MongoMK Failover for High Availability in a Single Datacenter

Oak Cluster with MongoMK Failover Across Multiple Datacenters

AEM Community store

Data store separation

3)Integration Types / Design Appraches

Read Scalability

Multi level caching

Type of FEED Integration

  1. a) High Processiong Feed .. Ex- DAM assets renditions processing Solun. Offloading , data store sharing including publish
  2. b) High Volume – Ex .. PIM data sync, soln offloading processing instance, import throttling, batch saves, separate replication queues, Use nt:unstructured, no NAS

High Frequency Input Field – ex.. news feed

  1. c) High Volume and Processing –
  2. cc) High Volume and High Performance Delivery
  3. d) Geographically Distributed Editors – apache mod deflate, dispatcher
  4. e) Many DAM assets – datastore common set up , ex..Amazon S3 for data store

choosing Mk

Tar MK – Performance – Segment Store

Mongo MK – Scalability – Documenet Store

Separate Data store – TAR, FileSys, S3, Mongo,RDB

  1. Various way of achieving Application Deployment For AEM 6/6.1,
    1. Single Tar MK
    2. Tar MK with Cold Standby
    3. Tar MK Farms
    4. Oak Cluster with MongoMK Failover for High Availability in a Single Datacenter
    5. Oak Cluster with MongoMK Failover Across Multiple Datacenters
    6. AEM Community store
    7. Data store separation
  2. Integration with REST, SOAP API
  3. Sling Flow
  4. How OSGI works?
  5. How Sling works?
  6. Servlets in CQ

SlingSafeMethodsServlet, SlingAllMethodsServlet

SlingAllMethodsServlet Helper base class for data modifying Servlets used in Sling.

SlingSafeMethodsServlet Helper base class for read-only Servlets used in Sling.

  1. AEM stalk
  2. OSGI – activate method what it does?

activation, deactivation methods uses component needs to be notified, when it is activated and deactivated. For this, the component may implement an activate method and a deactivate method.

  1. servlet global variable
  2. strutured vs unstruterd content

CRX allows you to store both structured and unstructured data. If you use a strict, pre-defined repository structure, CRX acts like a database. If you use an unstructured repository, you can use it like a file system, and put information of any type at any place in the repository.

The JCR node type nt:unstructured is designed to accept any properties, so you can dump at will strings, dates or even binaries into such a node. This node type is very useful to get started with coding an application when you do not know what the end result should look like. It allows for a development approach coined “data first, structure later” where structure emerges from data, rather than be defined a priori.

On the other end of the spectrum you can have rigidly defined node types. JCR can enforce constraints on data structures according to schema.JCR allows you to specify e.g. mandatory properties, default values or the allowed child node types in a node hierarchy. The Apache Jackrabbit site has a good overview of the Compact Namespace and Node Type Definition which is a notation used to define such structure.

  1. jcr single property node vs multiple property node

In some cases, a property may have more than one value. A property that may have more than one value is referred to as a multi-valued property (regardless of whether it currently has one or more than one value).

Whether a particular property is a multi-valued property is governed by the property definition applicable to it, which is determined by the node type of the property’s parent node.

The values within a multi-valued property are ordered.

Accessing the values of such a property is done with the method Property.getValues, which returns an array of Value objects that contains the values in their prescribed order.

Accessing a multi-valued property with Property.getValue, or a single-value property with Property.getValues will throw a ValueFormatException.

The values stored within a multi-valued property are all of the same type.

  • SEO Techniques
  • Create unique accurate Page Title
  • Metatag
  • 3.Headings
  • 4.Domain Nmae
  • 5.Site Structure
  • 6.Site Map
  • URL Structure
  • Indexable content – Img should have alt, applet, flash with text desc in html
  • Keyword usage and target
  • 10.404 page
  • 11.Effectoieve use robots.txt
  • 12.Image optimization – alt, separate directory, JPEG or supported type in extn, noscript for resposnive image,
  • video optimization – crawlable
  1. Integrate Component with Webservices
  2. Tag api handling – how it is used pages
  3. faceted search in CQ
  4. servlets mapping in cq, same servlet for many other work
  5. UGC
  6. localization using cq
  7. Dynamic data integration with CQ component
  8. Heading Label globalization
  9. MSM – how it works
  10. AEM with Spring Services Integration
  11. complete tech flow ecomm with CQ
  12. dynamic web service integration with AEM component various options
  13. workflow set up – customized set up
  14. dynamic web service data integration with component
  15. salesforce integration
  16. SAML, SSO, Oauth in CQ
  17. AEM 6 vs 6.1 Features

31.AEM Project challenges and risks

1) Monolithic
2) Licesne cost
3) Integration with Non Java tech
4) ecommerce full fledged appl
5) Maintaining cost – migration
32. Why AEM
1) Full Fledged Products for entire marketing business
2) Marketing Cloud Tech
3) Built on top of open source tech
4) Business Agility –
5, OOB, Marketing cloud
33. Learning
1) Careful evaluation & Suitable Architecture
2) Monolithic architecture – This one need careful scalable and perform, householding activity
3) Continuos version chnage need proper plan
4) Stability issue – some fea, session management
5) Need Product knowledge – Sync up

Refresh your core Java knowledge

  1. Explain about strategy pattern with code.
  2. write interface for strategy

2.implement strategy for two different strategies

3.write a context class to use strategy

  1. pass strategy into context class and call it
  2. Concurrent HashMap vs synchronized

Concurrent HashMap

1.You should use ConcurrentHashMap when you need very high concurrency in your project.

2.It is thread safe without synchronizing the whole map.

3.Reads can happen very fast while write is done with a lock.

4.There is no locking at the object level.

5.The locking is at a much finer granularity at a hashmap bucket level.

6.ConcurrentHashMap doesn’t throw a ConcurrentModificationException if one thread tries to modify it while another is iterating over it.

7.ConcurrentHashMap uses multitude of locks.

Synchronized HashMap

1.Synchronization at Object level.

2.Every read/write operation needs to acquire lock.

3.Locking the entire collection is a performance overhead.

4.This essentially gives access to only one thread to the entire map & blocks all the other threads.

5.It may cause contention.

6.SynchronizedHashMap returns Iterator, which fails-fast on concurrent modification.

  1. what does mean by Threadsafe.

Ensures that particular task object would complete without interruption by other Thread. It helps to complete the Task.

  1. How do you start a Thread?

by start method(), run method()

  1. How do you handle concurrency?





1.Executor framework

2.Synchronizer framework

3.Concurrent collections


5.Atomic variables




2.Thread Factory





7.Concurrent Collections

8.Atomic Variables


  1. Threadsafty

“A class is threadsafe if it behaves correctly when accessed from multiple threads, regardless of the scheduling or

interleaving of the execution of those threads by the runtime environment,and with noadditional synchronization or

other coordination on the part of the calling code.”

  1. Explain Singleton Pattern.

“allows only a single object to ever be created

Private constructor

1.double checking synchronized way: Lazy Loading

  1. statis final – Eager Loading
  2. enum

Realtime Example

Java.lang.Runtime with getRuntime() method

Java.awt.Toolkit with getDefaultToolkit()

Java.awt.Desktop with getDesktop()

How to break singleton pattern?

  1. use different class loader
  2. use clone interface
  3. serialization – use readResolve to avoid

4.concurrent thread – use double locking  ”




  1. Explain about collection in Java. How do you handle dublicates?

Set – TreeSet – No dublicate

List- ArrayList, LinkedList – Ordered way

Map – HashMap, TreeMap, HashTable, Dictionary, ZKey value pair

Collection Interface

Collection c = new ArrayList() is better than List interface


HashMap – fast algorithem to retieve, no order

TreeMap – Keys sorted by ascending comparision order

LinkedHashMap- keeps the key in insertion order

ArrayList – excels randon access, slower insert or removing elements

LinkedList – good at insertion and deletions from the middle of a List


The concept of an Iterator (another design pattern) can be used to achieve this abstraction. An iterator is an object whose job is to move through a sequence and select each object in that sequence without the client programmer knowing or caring about the underlying structure of that sequence. works only on forward direction

ListIterator – works on both direction

LinkedList supports both queue and stack

  1. why concurrency?

Improve resource utilization/ Time Efficiency

Parallel Task

Handle Blocking I/O easily

  1. hierachcal DB handle in core hava – write a program to handle in Memory
  2. flight schedule – Write Java program
  3. static vs instance

static – class level

–  static method cannot be overridden

– executes only once

intance – object level

Hiding: Parent class methods that are static are not part of a child class (although they are accessible), so there is no question of overriding it.

Even if you add another static method in a subclass, identical to the one in its parent class, this subclass static method is unique and distinct from the static method in its parent class.

  1. annotation – how it works?

Annotation is code about the code, that is metadata about the program itself. In other words, organized data about the code, embedded within the code itself. It can be parsed by the compiler, annotation processing tools and can also be made available at run-time too.

  1. add @Marker in interface where you wanted to make it as annotation 2. Add annototed interface at required places

Retention Policy to decide compile or runtime 3. write annotation processor ( uses reflection)

4.Build Jar

  1. What is mean by String is immutable?

StringPool- Special Storage area in heap, if the string created and if it already has variable, it will be returned.

Allow string to cache its hashcode – This helps in hashmap for storage object, string play as better key.

Security – many db, networking connections uses string as name. Changing would lead to security issues.The same case for Reflection.

Synchronization and concurrency: making String immutable automatically makes them thread safe thereby solving the synchronization issues

Class loading: String is used as arguments for class loading. If mutable, it could result in wrong class being loaded (because mutable objects change their state).



  1. How can you make class as immutable?



  1. Why String is immutable?
  2. how to pass object from m/c to m/c? RMI, serialization
  3. Can we override static method?

No. we cannot.No, you cannot override static method in Java because method overriding is based upon dynamic binding at runtime and static methods are bonded using static binding at compile time. Though you can declare a method with same name and method signature in sub class which does look like you can override static method in Java but in reality that is method hiding.


Read more: http://java67.blogspot.com/2012/08/can-we-override-static-method-in-java.html#ixzz3kxdkRXwI

  1. factory vs builder

both are creational pattern

Factory – provide single or family of related objects

builder – crafts complex different types of objects step by step, construction process helps to create different forms of objects.

  1. depth questions on multithreading code
  2. counter in core java
  3. Class Path issue –

Parent First, Parent Last, Depends on App Server

how do you solve class path issue?



  1. Explain about JVM and GC


Abstract computing m/c to run java program

HotSpot – ClassLoader with JRE

– Just In Compilation –  dynamic translation, is

compilation done during execution of a program – at run time –

rather than prior to execution.

– Adaptieve Optimization – Dynamic compilation

Class Loader

JVM Memory

Method Area(Shared among all threads(global), shared

class structures like field,method data,code for methods and


Permannent Generation

Runtime Constant Pool

Field & Method Area



Heap(Shared among all threads(global), stores all

created objects and arrays)

Younger Generation


Eden – New/short-term objects are instantiated

in the eden space

From Survivor 0 -Survived/mid-term objects are

copied from the eden space to the survivor space.

From Survivor 1

Old Generation – Tenured/long-term objects are

copied from the survivor to the old generation space.



JVM Language Stacks

PC Registers

Native Method Stacks


Execution Enginge

Native Method Interface

Native Method Libraries

Code Cache

Thread 1..N( Private stack(local), Holds reference

to object in heap, stores local variables of primitive types)



Native Stack




***“In each thread stack the program is executed

referring to the Java logic in the method area and the object

data in the heap space”.****


How GC works?




– collection is performed frequently

– collection is focused more on speed efficiency.


— collection is performed less or in-frequently

– collection is focused more on time efficiency.

– very large


Most objects live for a short period.

Only few old objects have references to young objects.


GC algorithems

  1. Serial – works by holding all application thread(freeze all


– designed for single threaded environtmnet

– doesn’t suitable for server, and suitable for

commandline programs

  1. Parallel – default GC

– halts application thread, but uses multiple thread

  1. CMS
  2. mark live objects by start with root(thread stack, global

references and static variables)

2.In the sweep phase of the Mark-and-Sweep algorithm all

unreachable objects are declared as free memory.


  1. Uses more memory compared with Parallel.Better GC incase

of more CPU.

  1. CMC – avoids fragmentation by moving objects
  2. G1 – used for large heap memory areas

separate Heaps into region


  1. What are new feature and JDK 7 and are you aware about JDK 8 enhancements?

Java 5 Tiger

Generics – Provids compile type safety for collections



Enumerations – Typesafe


Enhanced for loops

improved memory model

concurrent utils

Java 6 Mustang

JavaScript integration in platform

Java compiler API

Java 7 Dolphin

Strings in switch

automatic resource managemnet in try-statement

Java 8


date and time api

parallel operations

pipeline and streams

  1. “Have to build your own implementation of thread pool?

ExecutorService executor = Executors.newThreadPool(5);

Runnable worker = new WorkerThread(i);


  1. Did you sometime try to build your own web server in Java?”
  2. Give few examples where you wrote Abstract Base classes?

Abstact vs Interface

Abstract – provide IS A, this can be used when sub classes need

default functionality .If the base class is changed often abstarct class is the best approach.

Framework is the best place where we can use it for Abstarct class.

Interface – 1.Can do like this- used for common functionality need to be shared with unrelated classes. but different implementation.

Contains variable static final. Design By Contract.

Supports Runtime polymorphism.

Avoid hierarchical type framework frequent changes in interface break the implementation.Everything should be done at first

Composition vs Inheritence

Inheritance – compile time – IS A

Composition – Runtime

runtime – HAS A

  1. write own arraylist

two approaches. Simple class having most of them static methods and second java inheritance and polymorphism based.

  1. Draw process flow of JVM and explain each component?
  2. Draw and explain each functions of GC
  3. Explain thread locking

Intrinisic Lock: Every object in Java has Monitor, when synchronized key word applied, it locks the object. For static method, it applies on Class


Drawbacks of Intrinisic Locks:

  1. not possible to interrupt a thread waiting to acquire a lock(lock interruptly)
  2. not possible to attempt to acquire a lock without being willing to wait for it forever(try lock)

3.Cannot implement non-block-structured locking disciplines.

  1. DeadLock situations can occur.


Reentrant Lock – allows the thread to re-aquire the same lock multiple times.1)Polled and Timed Lock aquisitions, 2)Interruptable Lock aquisitions, 3)Non-block structure locking, 4)Fairness.



  1. What are the main steps you do when using JAXB?



Marshalling – POJO to XML

UnMarshalling- XML to POJO


  1. What is WeakHashmap and why do we use it?

A weak reference, simply put, is a reference that isn’t strong enough to force an object to remain in memory. Weak references allow you to leverage the garbage collector’s ability to determine reachability for you, so you don’t have to do it yourself.

Reference Queue – Keep track of Weak References.

Soft References – Same as weak, but it will stay in memory for sometime.

Phantom References – A phantom reference is one of the strengths or levels of ‘non strong’ reference defined in the Java programming language; the others being weak and soft.[1] Phantom reference are the weakest level of reference in Java; in order from strongest to weakest, they are: strong, soft, weak, phantom.

An object is phantomly referenced after it has been finalized, but before its allocated memory has been reclaimed.s



  1. How do you decide Thread Pool Size?
  2. Number of processors
  3. Extra overhead for thread swicth

Formula 1 for simpler Tasks

Thread Pool Size = Number of processors +1

int poolSize  = Runtime.getRuntime().availableProcessors() + 1;

Formula 2: Consider I/O or other blocking operations

N = Number of processor available in system.

U = Target utilization of CUP; 0 >= U <= 1.

W/C = Ration of wait and computation time.

Number of threads for thread pool can evaluate by this formula:

Number of Threads = N * U * (1 + W/C)

Formula 3: Amadhals Law


P – proportion of task excuted on parallel.N – number of processors



  1. “Threaddumb structure
  2. Why we need threaddump?”

healthy vs non-healthy(stuck)

JVM Threads

Application Thread

Thread Status

Thread Life status


Why Threaddumb analysis?

appln and java concurrency problems

root cause of performamce problems

respose time contributors / performamce bottlenecks

impact of JVM pause on appln threads

  1. Diff b/w User Thread and Daemon Thread

Daemon thread exit when main thread exits.

User Thread continues after Main thread exits



  1. Explicit vs Intrinisc Lock


  1. What is volatile?

Declaring a volatile Java variable means: The value of this variable will never be cached thread-locally: all reads and writes will go straight to “main memory”; Access to the variable acts as though it is enclosed in a synchronized block, synchronized on itself.

  1. Mutax vs Synchronizer block

it is called Mutex if only one person allow to watch the play

it is called Semaphore if N number of people allow to watch the play.If anybody leave the Theater during the play then other person can be allowed to watch play.

it is called CountDownLatch if no one allowed to enter until every person vacate the theater.Here each person has freewill to leave the theater. One or More Threads wait for other set of Threads to complete set of tasks.`

it is called Cyclicbarrier if theater will not start until every person enter in theater. Here showman can not start the show until all the person enter and grab the seat . Once the play finish same barrier will apply for next show

One or More thread in a group to complete certain set of tasks before start the next tasks.


Here , person is Thread , Play is resource.


Test your NFR knowledge

1.”How do you handle NFRs?

Availability – Loose coupled services, Data centers, cluster, CAP, BASE

Performance- Caching, choosing right technology options based dynamic vs static data, JVM GC options, following coding best practices like object creation, using object pool, avoiding thread local, releasing listeners, DB connections. Design Patterns.

Scalability- Loose coupled services, Micro Services, Layered Approach, Asynchronous Approach, Read – cache, Write – Batch Update, choosing right technology options like Cassandra, oracle coherent DB, Memcache. Token based authentication. Sharding, Read / Write scalability approach

Maintainability-Modularity, Layered Architectures.

2.”What are the necessary action to be taken to meet provided SLA?

Scenario: Accessing web service from third party.”

Caching, Integration Approach (Loose coupled approach, asynchronzed approach), measuring by monitoring

  1. “how do you increase scalability/ read scalability? What things you consider in Design to make system highly available? He was not interested in knowing vertical, horizontal or partitioning. Same

Hint : Caching, Loose coupled service, Sharding, Read Write partitioning

  1. “Tell me about few instances when you had major performance bottleneck in application?

How problem was investigated?

What are the tools used?

What were the fixes made?”

Hint : Everyone will ask about non-functional but not quality questions?  I find people mostly asking based on their clustering experience.

5.What are the various performance monitoring options you have for Java/JEE applications

6.SLA how do you maintain for performance

  1. setting GOAL, benchmark, monitoring and measuring, analyse, imple ..1. temporary soln
  2. analyse
  3. Compare with benchmark
  4. Caching

Test your knowledge with Algorithems Data structure scenario

  1. How do you sort the following array? What is the algorithm used for this?

arr ab = {8,7,9,6,3,5,2,0,4}

  1. depth DFS vs bredth BFS
  2. central blr, north blr sales man problem
  3. 1000000 records need to process and having less memory, how do you process effectively?

5.Time efficiency of quick sort algorithms

  1. Given 1000 bottles of juice, one of them contains poison and tastes bitter. Spot the spoiled bottle in minimum sips.

It s a divide and conquer problem.

Take 500 of the bottles and put one drop from each of them into an empty bottle.

Taste the juice in that bottle. If it’s bitter, we know the poison is in one of them;

if not, it’s in one of the other 500.

Now, take 250 of the bottles we’ve chosen and put one drop from each into another empty bottle and taste it.

Now, you’ve narrowed it down to 250 bottles.

Repeat, and narrow it down to 125… then 63… then 32… 16…8… 4… 2… and finally 1.

And you only had to taste the juice 10 times, instead of possibly 999.

  1. Question: There are N houses in a row. Each house can be painted in either Red, Green or Blue color.

The cost of coloring each house in each of the colors is different.

Find the color of each house such that no two adjacent house have the same color and the total cost of coloring all the houses is minimum.

Its dynamic programming problem.

We have  to maintain 3 minimums

cost(i,b)=min(cost(i-1,g),cost(i-1,r))+cost of painting i as b;

cost(i,g)=min(cost(i-1,b),cost(i-1,r))+cost of painting i as g;

cost(i,r)=min(cost(i-1,g),cost(i-1,b))+cost of painting i as r;


finally min(cost(N,b),cost(N,g),cost(N,r)) is the ans

7.Question -write a prototype and algo for a function for deleting a node in a linked list, but with following constraints:

1) You accept pointer to the start node as first parameter and item to be deleted as second parameter. start node is not global

2) You WILL NOT be returning pointer to the start node.

3) You WILL NOT be accepting a pointer to pointer to start node.


Considering the constraints, the restriction is – only single dimension indirection is allowed, something like

void deleteNode(Node *pStart, Node* pDelete);

The problem is, modifications to the list will not be retained as it is passed as Node *. We need pass “Node **” or return the modified list pointer (which is also not allowed).

The idea is simple, add one more level of abstraction.

typedef struct List_tag


Node *pHead;

Node *pEnd;

} List;

Now the delete function declaration looks like,

void deleteNode(List *pList, Node *pNode);

8.Have you used HashMap before or  What is HashMap? Why do you use it

9.Do you Know how HashMap works in Java or How does get () method of HashMap works in Java

10.What will happen if two different objects have same hashcode?

11.How will you retrieve Value object  if two Keys will have same hashcode?

12.What happens On HashMap in Java if the size of the HashMap  exceeds a given threshold defined by load factor ?

  1. Do you see any problem with resizing of HashMap in Java??
  2. Question – There are n people on a day who came to be interviewed by Joe.

Joe rates every candidate from 0 to 10. He has to output the total ratings of all the people who came in a day.But, here’s the problem: Joe gets extremely frustrated when someone ends up scoring a 0 in the interview.So in frustration he ends up removing the candidate who scored that 0, and also removes the candidate who came before him.

If there is no candidate before the one who scores a 0, he does nothing.

You’ve to find the summation of all the ratings in a day bby Joe.

Input constraints:

The first line of input will contain an integer — n. The next n lines will contain an integer, where the ith integer represents the rating of the ith person.

Output constraints:

Print the required sum.


1 ≤ n ≤5 * 10^3

0 ≤ Value of ratings ≤10

15.algorithms classification