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 .

Tuesday, April 23, 2019

Node js interview questions


This blog is just for revision .


  • Explain the version of a package in node js 
  1. major
  2. minor
  3. patch
  4. pre major
  5. pre minor
  6. pre patch
  7. pre release
  • What is the use of ~ and ^
  1. ~ matches the most recent patch version for the minor version
  2.  ^ matches the most recent minor version of the major version     

  • What are modules

Modules are way of organising reusable components


  1. Core
  2. Local
  3. Third party



  • What is the use of require()


It is used to import core modules.It is a function that can be used to import symbols from another module to the current scope



  • What is commonjs

Commonjs defines standards for modules, packages and unit testing.



  • What is AMD ?

Asynchronous


  • Explain the parts of package.json
  1. name
  2. version
  3. license
  4. description

  • Explain async functions
  • Explain await

Friday, April 19, 2019

mat-form-field must contain a MatFormFieldControl.


Hi Guys ,



Today I have faced this error :

ERROR Error: mat-form-field must contain a MatFormFieldControl.

Later I have found out that I have missed to add the attribute matInput .

<mat-form-field>
<input type="text" name="name" ngModel #refName="ngModel" name="name" required >
</mat-form-field>

Once I added the attribute to the input field matInput , the error was resolved .

<mat-form-field>
<input matInput type="text" name="name" ngModel #refName="ngModel" name="name" required >
</mat-form-field>


Video Link :

Full stack trace is as below .

CustDetailComponent.html:4 ERROR Error: mat-form-field must contain a MatFormFieldControl.
    at getMatFormFieldMissingControlError (form-field.es5.js:119)
    at MatFormField.push../node_modules/@angular/material/esm5/form-field.es5.js.MatFormField._validateControlChild (form-field.es5.js:771)
    at MatFormField.push../node_modules/@angular/material/esm5/form-field.es5.js.MatFormField.ngAfterContentInit (form-field.es5.js:453)
    at callProviderLifecycles (core.js:9553)
    at callElementProvidersLifecycles (core.js:9534)
    at callLifecycleHooksChildrenFirst (core.js:9524)
    at checkAndUpdateView (core.js:10455)
    at callViewAction (core.js:10692)
    at execComponentViewsAction (core.js:10634)
    at checkAndUpdateView (core.js:10457)

ec2-user@ec2 Permission denied