Wednesday 2 August 2023

mobtexting company Java Technical Lead interview questions

  Below are the list of java technical lead interview questions asked in mobtexting company.


List<String> list = new ArrayList<String>();
List<String> linkedList = new LinkedList<String>();


In the above code, which one is faster, whether list.get or linkedList.get ?

Answer :- list.get is faster than linkedList. more details refer Time Complexity of Collection API

HashMap<String, String> map = new HashMap<String, String>();
map.put("a", "abc");
TreeMap<String, String> treeMap = new TreeMap<String, String>();
treeMap.put("a", "abc");


Which one is faster HashMap or TreeMap retrieval ? (Answer)
and also explain the internal working of HashMap and TreeMap ?

public class Key{
   private String name,
   private String id;
   //constructir and Setters and getters

public class Main {
    public static void main(String[] args) {
         Map<Key, String> map = new HahsMap<Key, String>();
         Key a = new Key("XYZ", "123");
         Key b = new Key("XYZ", "234");
         map.put(a, "Value");

What is the output for map.get code ?

4) What is dependency injection ? (Answer) What is diffrence between Spring MVC and Spring boot?(Spring)

5) What is difference between setter injection and constructor injection.(Answer)

6) What are the different ways to create bean ? (Answer)

7) Explain Spring bean scopes and Spring bean singleton is thread safe or not ?(Answer)

8) What are IOC containers in spring ?(Answer)

9) What is difference between Hibernate and JPA? can we use hibernate without JPA?

10) Explain JPA entity lifecycle/status.(Answer)

11) What is eager and lazy loading ? whats N+1 problem and solution(Answer)

12) Explain first level and second level caching in hibernate(Answer)

13) Explain ACID properties of transaction  (Answer)

14) SQL
create table person(
  id integer,
  name varchar,
  primary key(id)
create car_owner(
   person_id integer(it's primary key of person table),
   car_id integer (it's primary key of car table)

create table car(
  id integer,
  car_brand varchar,
  car_color varchar,
 Write a query to return car brand and car owner name for all the owners
 Answer :- 
SELECT, c.brand FROM person p, car_owner co, car c 
 WHERE = co.person_id AND 
       co.car_id =
 Write a query to count the total cars for each color greater than 10.
SELECT count(*), color FROM car 
group by color HAVING count(*) > 10;

Thank you for visiting the blog.

No comments:

Post a Comment