Monday, September 11, 2023

How do you find length of a Singly Linked list using Loop and Recursion? Example

Hello guys, here is one of the classical programming questions how do you find the length of a linked list using recursion and without recursion. This is not about the LinkedList class of Java API but the linked list data structure, which is made of nodes that contain both data and the address of the next node. In order to calculate the length, you need to count all nodes in the linked list. Since it's a singly linked list you can only move in one direction from the head to tail.  This coding problem was asked to me on my first interview with a multinational Investment bank. After that, this question has been asked to me on several occasions in other Programming Job Interviews as well.

Difference between WeakReference vs SoftReference vs PhantomReference in Java? Example

WeakReference and SoftReference were added into Java API for a long time but not every Java programmer is familiar with it. This means there is a gap between where and how to use WeakReference and SoftReference in Java. Reference classes are particularly important in the context of How Garbage collection works. As we all know that Garbage Collector reclaims memory from objects which are eligible for garbage collection, but not many programmers know that this eligibility is decided based upon which kind of references are pointing to that object. This is also the main difference between WeakReference and SoftReference in Java.

Difference between include directive and include action in JSP Servlet? Example

Difference between include directive and include action is one of the most popular JSP interview questions and also asked as What is the difference between page include and file include in JSP.  Similar to the difference between forward and send redirect and URL encoding vs URL rewriting, this is also asked at a beginner level. Here we will see page include vs file include in detail. Both include directive and include action is used to include the output of a static page e.g. HTML or a dynamic page like jsp inside another jsp file.

Sunday, September 10, 2023

Top 30 Scala and Functional Programming Interview Questions and Answers

Hello guys, if you are preparing for Scala Developer interview and looking for frequently asked Scala questions for practice then you have come to the right place. Earlier, I have shared best Scala courses, Scala books, and best Scala Frameworks and in this article, I am going to share 30 Scala Questions from past interviews. Scala is a programming language which aims to provide best of both object-oriented programming and functional programming world. It not only allows you to  construct elegant class hierarchies for maximum code reuse and extensibility but also allows you to implement their behavior using higher-order functions and other functional programming technique. It is touted as one of the languages which can probably take over Java, though it didn't happen especially after Java 8 release which also provides some functional programming tools to Java e.g. lambda expression and stream

Top 20 JUnit Testing Interview Questions with Answers for Java Programmers

Hello guys, if you are preparing for a Java programming interview and looking for some JUnit and testing interview questions then you have come to the right place. Earlier, I have shared the best JUnit and TDD courses and books, and, today, I am going to share some JUnit interview questions for Java developers. There is no doubt that JUnit is the defacto standard framework for writing unit tests in Java and every professional developer must be familiar with JUnit. Not long ago, you can clear Java interviews without writing a single line of code, forget about tests but not many more. More and more companies are including coding tests and take-home tests where you need to build solutions and write code with tests on their hiring process. 

Top 10 Puzzles, Riddles, Logical, and Lateral Thinking Questions for Programming Job Interviews

Puzzles, riddles, logical questions, and lateral thinking questions are an integral part of any programming job interviews. I missed to include some puzzles when I shared my list of top 30 programming interview questions earlier, and a couple of my friends requested to share some puzzles as well. These puzzles and lateral thinking questions are mostly collected from various Java programming interviews on Investment banks, but they are equally useful for any programming job interviews. I have seen more puzzles and logical questions at the junior level i.e. 2 to 4 years.

Saturday, September 9, 2023

10 Differences between Java and Groovy Programming - Examples

If you are working in Java, you might have heard about Scala, Groovy, and Closure. Out of these three Groovy seems to be gaining a place in Java projects more rapidly than others. Groovy is a Scripting language but runs on Java virtual machine. Every Java program can run on the Groovy platform. As per the official Groovy website, "Apache Groovy is a powerful, optionally typed and dynamic language, with static typing and static compilation capabilities, for the Java platform aimed at improving developer productivity thanks to a concise, familiar and easy to learn syntax". I think they have highlighted the key capabilities of Groovy very well in that sentence.

Top 20 Tibco Rendezvous and EMS Interview Questions Answers

Hi Guys, in this part of my Tibco Rendezvous tutorial series I am sharing some Tibco RV interview questions and answers most often asked in any TIBCO messaging interview. These are based on fundamental TIBCO concepts and also offer some new ways of learning TIBCO RV or TIBCO Rendezvous technology. Some of the TIBCO Interview questions I have already discussed in my TIBCO command series. Here is the list of TIBCO interview question, I am not putting answer for these interview questions right now but will put together in some other post but these questions are really great in terms of any Tibco messaging interview. 

Monday, September 4, 2023

15 Advanced Microservices Architecture Interview Questions for Experienced Developers

Hello guys, Microservices architecture has become extremely popular in today's technology-driven, quick-paced world because to its scalability, adaptability, and effectiveness. They also goes hand-in-hand with today's popular Cloud computing architecture. They are designed to make best use of Cloud Computing power and that's why more and more companies are switching from Monolithic architecture to Microservices. With increase adoption of Microservices, you will also see more and more questions related to Microservices in Java developer interviews or any other programming job interviews. In fact, Experienced developers frequently encounter difficult interview questions that test their knowledge of microservices and their practical use. To assist developers in preparing for their upcoming interview, we will examine 15 advanced microservices interview questions and provide relevant real-world examples.

Sunday, September 3, 2023

How to Enable logging of SQL statements in Spring Boot? Hibernate + JPA Example Tutorial

Hello guys, if you are a Java developer developing Spring Boot applications, you may need to have proper knowledge of various kinds of errors and also how to overcome those. For example, most of Java developers use JPA in spring boot to make our work easy when managing databases. If you get an error like an internal server error (504 error), you need to go through your backend system and find the error. In many cases, these errors are caused by running invalid SQL or due to error on database. At that time, you often need to know which SQL statements are executed by Hibernate or JPA, or any other database library you are using and if you don't know how to retrieve those SQL statement then debugging and troubleshooting becomes a painful process as you don't have enough data. That's why its important to know how to enable logging of SQL in Spring Boot application. 

How to Modify or Update Data Type of an Existing Column in SQL Server? Example Tutorial

Sometimes we put the wrong data type in a column while creating a table in SQL Server, and later we want to update that column with a different data type, how do we do that? The first things that come to my mind are ALTER TABLE statement, but again I don't remember the exact syntax. Another thing that could go wrong is one ALTER statement working in MySQL may not work in SQL Server or Oracle. To deal with this, I am writing these tutorials to not only remember exact syntax but also about alternatives and other important details.  By the way, while changing the data type of an existing column in a table, there are a couple of things consider like does your table has a huge amount of data? If yes, then it might take a long time to update the table structure, on the other hand in an empty table updating the data type of a column is instantaneous. It would hardly take a couple of milliseconds. 

Spring Boot + MySQL Database example (CRUD) in Java [Tutorial]

Hello guys, if you are a Java developer and wondering how to connect to MySQL database from Spring Boot Java application then you have come to the right place. In this series of Spring Boot tutorials, earlier, I have shared how to use Redis with Spring Boot, a NoSQL database and in this article, I Am going to share how to connect to a relational database like MySQL with Spring Boot. I have also shared tutorials like Spring Boot + MyBatis, Spring Boot + React.js, and Spring Boot +Angular app for full-stack Java developers. If you haven't checked them then you can also check them out along the way. 

How to return different HTTP status code from a Spring MVC controller? Example Tutorial

Hello guys, if you are wondering how to return different HTTP Status codes from a Spring MVC controller then you have come to the right place. You can use @ResponseCode annotation on Spring MVC to send different HTTP codes to the client as part of the HTTP response. If you are developing REST APIs then you can even @RestControler to do that job. This article will demonstrate how to return different HTTP statuses for a Spring MVC controller. Prior to implementation, all we need to understand what is with the HTTP return types and why we need them. Let's have a quick look into this.

Saturday, September 2, 2023

How to define Multiple intercept-url's in Spring Security? Does Order of URLs matter?

Hello guys, one of the frequently asked Spring Security Question is about the order of multiple intercept-urls in Spring security configuration file e.g. applicationContext-security.xml. If you have to define more than one intercept URLS, which order will you define them? Does order or URLs in configuration file even matters? The short answer of this question is, Yes, ordering of intercept URLs in Spring Security configuration file does matter and if you have to define multiple intercept-urls then you define the in a order from most specific to least specificWhy you should that? because Spring security tries to match the URL of every incoming request or outgoing response to the intercept urls in the same order they are declared. 

How to use Named Query SQL in Spring Framework? Example Tutorial

Hello guys, many Java developers don't know that Spring Framework also provides support for NamedQuery where you can pass parameters in a much readable way by using named placeholders than the default placeholder of ? (question mark) which is used with PreparedStatement in Java. If you want to learn Spring JDBC then you have come to the right place. In the past, I have shared the best Spring Framework courses, books, and tutorials to learn Spring Framework and its different features, and in this example, I will show you how to use NamedQuery in Spring Framework. You can then use this technique to write much more readable queries on the Java layer for your application.