Sunday, June 9, 2019

Groovy Interview Questions

Important Interview Question in Groovy .


  • Compare Java with Apache Groovy 


  1. Groovy is a scripting language 
  2. Less syntax
  3. default access modifier is public 
  4. automatic getters and setters
  5. does not support ARM introduced in java 7
  6. allows variable substitution inside double quotes 
  7. does not support anonymous inner class , lambda , use closure instead .
  8. groovy supports operator overloading 

  • What is AST transformations.
 the ability to customize the Abstract Syntax Tree representing your programs before the compiler walks this tree to generate Java bytecode .
  • Explain closure in groovy
A closure in Groovy is an open, anonymous, block of code that can take arguments, return a value and be assigned to a variable

{ [closureParameters -> ] statements }

  • Explain GRAPE 
Grape stands for the Groovy Adaptable (Advanced) Packaging Engine
Grape helps you download and cache external dependencies from within your script with a set of simple annotations.

@Grab('org.apache.httpcomponents:httpclient:4.2.1')

  • What is the use of @GrabResolver 
By default GRAPE uses Maven Central Repository , if we need to add our own repository we can use  @GrabResolver  .





Friday, May 17, 2019

Java Architect interview questions


  • What are the 4 architecture domain TOGAF deal with ?
  1. business
  2. data
  3. application 
  4. technology


  • What is TOGAF ADM ?
Architecture Development Method .
It provides a tested and repeatable process for developing architectures .


  • What are the phases within the ADM .
  1. preliminary
  2. architecture vision
  3. business architecture
  4. information system architecture
  5. technology architecture
  6. opportunities and solution
  7. migration planning
  8. implementation governance
  9. architecture change management
  10. requirement management 
  • What are the SOLID principles?


  • Explain encryption in Java

Create key object using secret key spec passing key and algorithm
Cipher.getinstance blowfish
Set mode encrypt / decrypt
Cipher.dofinal//encrypted
Base64.encode // encoded



  • A method is defined with return type string , I do not want to return anything but still want the method to compile , how can I achieve that ?
instead of return string we can throw an Exception


  • How to access private variables of a class ?
through Reflection API Field.setAccessible(true);





Saturday, April 27, 2019

Design Patterns Interview Questions


  • Explain GoF Design patterns .
  1. Creational : defines  how the objects are created 
  2. Structural : defines relationship between the classes
  3. Behavioral : defines how objects communicate with each other 
  • Explain Creational Design Patterns .
  1. Factory
  2. Abstract Factory
  3. Builder
  4. Singleton
  5. Prototype
  • Explain Structural Design Pattern .
  1. Adapter : implementing class can work with incompatible interface.
  2. Bridge : enables to implementing class and the interface to vary independently.
  3. Composite : Composite lets client treat individual objects and compositions of objects uniformly.
  4. Decorator
  5. Facade
  6. Flywheel
  7. Proxy : a new object created to handle the operation.
  • Explain Behavioral Design Pattern .
  1. Chain of Responsibility
  2. Command
  3. Interpretor : how to include language  elements
  4. Iterator
  5. Mediator : simplify communication between objects
  6. Observer : multiple objects notification
  7. State : modify the behavior on state change
  8. Template : abstract definition of algorithm
  9. Visitor : add polymorphic functions to class noninvasively .
  • Explain J2EE Patterns 

  • Explain association in Java .
Association : has a relationship 
  1. Composition : sub objects cannot exist without the parent object .
  2. Aggregation : sub objects can exist without the parent object .

  • Explain UML class diagram .

ec2-user@ec2 Permission denied