Pages

Wednesday 21 June 2023

Interview preparation

Java Backend:
  • Oops
    • Object
    • Class
    • Inheritance
    • Polymorphism
    • Abstraction
    • Encapsulation
  • Java keywords
  • Java Basics
  • Java 8 Features
    • Lambda
    • Functional Interface
    • Completable Feature
  • Java Collection Framework
  • Java Spring Boot Framework
    • Annotations
      • @Bean
      • @Restcontroller
      • @Service
      • @Repository
      • @Component
      • @Configuration
      • @Autowired
      • @ControllerAdvice
      • @PathVariable
      • @RequestParameter
      • @RequestBody
      • @Value
      • @Entity
      • @Column
      • @Valid
      • @Pattern
      • @Async
    • Beans
      • Scope
    • Dependency Injection
      • Types
  • Java Repository/JPA/Hibernate
  • Java Spring Security
  • JUnit
Design/Architecture:
  • Microservice Architecture
    • Saga
    • Rules to consider
  • Design Patterns
    • Singleton
    • Factory
  • UML/HLD/LLD
    • Tools
    • Diagrams
Database - Oracle/Mongo:
  • Oracle DB
    • Tables
    • Synonyms
    • Constrains
    • Primary Key
    • Foreign Key
  • Oracle SQL functions
    • COALESCE
    • NVL, NVL2
    • DECODE
    • TO_DATE, TO_CHAR
  • Oracle SQL queries
    • group by
    • having
  • Oracle PLSQL
    • packages
    • procedures
    • functions
    • triggers
    • views
Angular UI:
  • Decorators
  • Lifecycle hooks
  • UI level security - authgarud/filters/interceptors
  • Karma Jasmine
Messaging/ Event based:
  • Kafka
  • IBM MQ
  • Tibo MQ
Caching:
  • In-memory caching - ehcache/memcache
  • Couchbase
Unit Tests:
  • JUnit
  • Karma Jasmine
Performance testing:
  • JMeter
API Testing:
  • Swagger
  • SOAP UI
  • Postman
Deployment - CICD:
  • Jenkins/TeamCity
  • Maven
  • Artifactory - JFrog
  • Docker - docker image
  • urban code deploy - ucd
  • OpenShift/Kubernetes/PCF
    • Deployment configs (template.yml/.params/.sh/docker/jenkins)
    • Containers
    • Pods & instances
    • Memory - CPU
    • ConfigMaps
    • Volume mount
Code analysis:
  • SonarQube - Static code analysis, code coverage
  • Blackduck - Vulnerable jars
  • CheckMarx
Monitoring:
  • ITRS/OSE monitoring - AppDynamics
Tracing:
  • ELK stack - Kibana
Version control:
  • BitBucket/Git
Lead:
  • Code Review
    • coding principles
    • Tools used for coverage/analysis
  • Work assignment
  • Design
Program:
  • Java8 based (filter, map, reduce, max, grouping)
  • String based (prohibited substring, no repeating char substring)
  • Array based (No of duplicate numbers)
  • Regex based (IP validation)
  • Brackets based (Parentheses matching, parentheses match score)
  • Custom LinkedList
  • Reverse LinkedList
  • Custom ArrayList
System design:
  • Parking slot
  • TicTacToe game

Tuesday 20 June 2023

@input and @output properties in angular









COALESCE() Function

 Return the first non-null value in a list.

Example:

SELECT COALESCE(NULL, NULL, NULL, 'value 1', NULL, 'value 2') FROM dual;

Output: value 1

OOPs - Object-Oriented Programming System

Object means a real-world entity such as a pen, chair, table, computer, watch, etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies software development and maintenance by providing below concepts:

  1. Object
  2. Class 
  3. Inheritance
  4. Polymorphism
  5. Abstraction
  6. Encapsulation


Object :
  • Any entity that has state and behavior 
  • instance of a class
  • object contains an address & takes up some space in memory.


Class :
  • Collection of objects
  • logical entity 
  • blueprint from which you can create an individual object
  • doesn't consume any space.


Inheritance :
  • One object acquires all the properties and behaviors of a parent object
  • provides code reusability
  • used to achieve runtime polymorphism.

  • Multiple inheritance is not supported in Java through class
    • ambiguity
    • diamond problem/deadly diamond problem/deadly diamond of death
    • Java renders compile-time error.

Polymorphism:
  • one task is performed in different ways
  • method overloading and method overriding to achieve polymorphism.
  1. compile-time polymorphism : method overloading - overload a static method in Java
  2. runtime polymorphism/Dynamic Method Dispatch : method overriding
upcasting



Example


Abstraction:
  • Hiding internal details and showing functionality
  • abstract class and interface.    

Abstract class (0 to 100%)

Interface (100%)

Java compiler adds public static final for elements & public abstract for methods
Multiple inheritance through interface


Encapsulation:
  • Binding (or wrapping) code and data together into a single unit
  • java class, Java bean is the fully encapsulated class because all the data members are private here.


Apart from these concepts, there are some other terms which are used in Object-Oriented design:
  1. Coupling
  2. Cohesion
  3. Association
  4. Aggregation
  5. Composition

Reverse a LinkedList

Input: Head of following linked list 
1->2->3->4->NULL 
Output: Linked list should be changed to, 
4->3->2->1->NULL

Input: Head of following linked list 
1->2->3->4->5->NULL 
Output: Linked list should be changed to, 

5->4->3->2->1->NULL

Code:[Java]

package com.learning.learn.linkedlist;

public class LinkedList {

static Node head;

static class Node {
int data;
Node next;
Node(int d) {
this.data = d;
next = null;
}
}

Node reverse(Node node) {
Node prev = null;
Node curr = node;
Node next = null;
while(curr != null) {
next = curr.next;
curr.next = prev;
prev = curr;
curr = next;
}
node = prev;
return node;
}

void printList(Node node) {
while(node != null) {
System.out.print(node.data+" ");
node = node.next;
}
}

public static void main(String[] args) {
LinkedList list = new LinkedList();
list.head = new Node(1);
list.head.next = new Node(2);
list.head.next.next = new Node(3);
list.head.next.next.next = new Node(4);

System.out.println("Given :");
list.printList(head);
head = list.reverse(head);
System.out.println();
System.out.println("Reversed :");
list.printList(head);
}

}

 

Wednesday 7 June 2023

Find second max value in the table (nth max value)

--Second maximum column value

SELECT *

FROM customers

ORDER BY age DESC, first_name ASC

LIMIT 1,1; -- 1 - number of row to omit, 1 - no of records to show


Code Review

 SOLID Principles S – Single Responsibility Principle There should never be more than one reason for a class to change. O – Open-Closed Prin...