Showing posts with label Interview Questions. Show all posts
Showing posts with label Interview Questions. Show all posts

December 28, 2023

#WebSockets: Part 3 Key components of the Java WebSocket API



In Part 1, we discussed some basic Socket programming interview questions. In Part 2 we discussed some basics of WebSockets. In Part 3 we will learn about the Java API for WebSocket (JSR 356), the key components of the Java WebSocket API, and how to handle WebSocket events in Java.
    
The Java API for WebSocket, specified by JSR 356, supports creating WebSocket applications in Java and is defined in the javax.websocket package. It provides a set of classes and interfaces that allow us to create WebSocket-based applications in Java. The WebSocket API was introduced in Java EE 7 and is designed to simplify the development of real-time, bidirectional communication between clients and servers.

December 27, 2023

#WebSockets: Part 2 WebSockets Interview Questions in Java

 

In Part 1, we discussed some basic Socket programming interview questions. In part 2 we will discuss WebSockets.

What is WebSocket?
  • WebSocket is a thin, lightweight layer above TCP, which is used to create a communication channel between a client and a server.
  • It provides efficient communication between the server and the web browser by providing bi-directional, full-duplex, real-time client and server communications. The server and client can send data to each other at any time.
  • Since the WebSocket runs over TCP, it also provides a low-latency, low-level communication, and reduces the overhead of each message.
  • WebSockets are typically designed to be implemented in web browsers and web servers, however, they can be used in any application where real-time communication is needed.

December 26, 2023

#WebSockets: Part 1 Socket Programming Interview Questions in Java




Recently in one of my freelance projects, I was asked to replace existing Java Sockets with the websockets. In this series of tutorials, I will explain some basic details of Java Sockets and Websockets. I will also provide a working code in which 2 servers communicate via WebSockets.

During the migration from Java Sockets to WebSockets I faced a couple of issues, I will also explain how I resolved those issues.

April 01, 2020

Part 1: Node JS Tutorial-var vs let vs const in JavaScript

While declaring any variable we can use either var, let or const. In JavaScript, variables are initialized with the value of undefined when they are created. What that means is if we try to log the declaration variable, we’ll get undefined. e.g:

var name;
console.log(name); // this will print 'undefined'

Part 2: Node JS Tutorial- Understanding npm

Write your own module
Open visual studio code, create a new file with the name my-module.js. Let's create another file module-demo.js. We will declare a variable inside my-module.js and try to access it from module-demo.js.

In my-module.js, we have declared variable mytext.

August 03, 2019

Oracle Interview Questions

  1. What is abstraction and encapsulation in java? (solution)
  2. If we didn't declare any exception in super class then in subclass can we declare any checked/custom exception.(solution)
  3. Can I have only try block in code? (solution)
  4. Why wait(), notify() and notifyAll() are defined in Object class? (solution)
  5. Can we override wait() or notify() methods? (solution)
  6. Difference between wait(), sleep() and yield()? (solution)
  7. What is the purpose of join()? (solution)
  8. Explain Singleton design pattern.
  9. Write a program to swap two numbers with out using third variable?

Deloitte India Interview Questions

Database
  1. What is the difference between a function and a stored procedure. (solution)
  2. What is the difference between a Unique and a primary key. 
  3. Difference between truncate and delete command. (solution)
  4. Can I use use a function in where clause?
Hibernate
  1. How many types of cache is available in Hibernate?
  2. What is the difference between get and load in Hibernate? (solution)
  3. How many tables will be created in @ManyToMany mapping? (solution)
  4. What is HQL?
  5. What is Nativel SQL?
Spring
  1. What is the default scope of Spring?
  2. How can I change the scope of bean in Spring?
  3. What is the advantage of Spring Boot?

July 23, 2019

SugerBox interview questions for Senior Java Software Engineer

  1. What is the difference between Spring Singleton and Java Singleton?(solution)
  2. Explain JWT.(solution)
  3. Explain Circuit Breaker Pattern.(solution)
  4. What is the purpose of Bulkhead Pattern?(solution)
  5. Suppose we have two web-services E and D. E is calling D. At a time D can accept only 30 requests, but E is getting more than 50 requests. How can you handle this?
  6. Have you ever used Actuator?(solution)
  7. What is the purpose of Consumer groups in Kafka?(solution)
  8. What is the difference between SSL and SSH?(solution)
  9. Explain TLS.(solution)
  10. How can we migrate data from one schema to another?(solution)

Wissen Technology Interview Questions For Senior Java Developer/ Lead Position

  1. What is the difference between Composition and Aggregation? How can we implement them in Java?
  2. How can we implement Least Recently Used (LRU) Cache using LinkedHashMap? (solution)
  3. What is the use of Builder Design Pattern. (solution)
  4. Explain Observer Design pattern. (solution)
  5. Assume we have an Employee class, which contains employeeName, employeeId (both are Strings) and employeeDateOfJoining(which is date). How can I make employee class Immutable? (solution)
  6. What is the advantage of making a String class Immutable? (solution)
  7. Design your own custom Threadpool executor with minimal functionality?(solution) (GIT:Custom Threadpool executor)
  8. An Employee table has four columns, emp_id, emp_name, salary and mngr_id. Find all the employees, who have a bigger salary than their manager. Answer: SELECT e.emp_name FROM Employee e JOIN Employee m ON e.mngr_id = m.emp_id WHERE e.salary > m.salary;
  9. Find the employee who is getting third higest salary? Answer: SELECT top 1 salary FROM (SELECT top 3 salary FROM Employee ORDER BY salary DESC) Result ORDER BY salary;

July 22, 2019

UBS interview questions

  1. Explain concurrency utils i.e. Atomic package? (Answer)
  2. How AtomicInteger works internally? (Answer)
  3. What is a volatile keyword? (Answer)
  4. Why is AtomicInteger class better than a synchronized counter class? (Answer)
  5. What is CAS?(Answer)

May 25, 2014