Hey guys, today we have Mjunath and he is having total two year of experience in Java, Spring Boot and microservices domain and those who want to give same free mock interview, please fill out the form below in the description. So now let's get started. Hey, hello Mu. How are you? Yeah, I'm fine. How about you? Yes, I'm also good. Shall we start? Yeah, sure. Yeah, Mangu, can you please introduce yourself and your recent project in brief? Yeah, first of all, thank you so much for giving this opportunity. So my name is Mangjunat. So I'm a Java backend developer with two years of experience at Infosys. So and I did my graduation from Bangalore instead of technology from Bangalore. So and my technology stack like Java, Springboard, Microser and MySQL and my experience at Infosys was like um digital banking application the project. So and um I building the rest APIs and writing the optimized queries and like um and writing a pagination technique which is reduce the data load on the so what's your approach to optimize the queries. Yeah. So I first use the two approach first using the indexing okay so and and proper like annotations to on the repository layer. Okay. Yeah. So this is all about me myself. Yeah. Yeah. Okay. Thank you. So yeah moving ahead. Can you tell me the role of classes and objects in spring boot projects? Yeah. The classes and objects which is the major role in that any Java applications projects. So the main thing is which is using that some entity or DTO class layers. So another thing is like commun communicating between that classes. So that's the major important. So it's a ple based on object oriented. So yeah. Okay. Okay. Got it. Do you know about dependency injection in spring boot? Yes. Please go ahead. Dependency injection is like a design design pattern which is creating the object based on the injecting injecting the dependency without creating the manual um creation. Okay. Okay. Uh what are some common issues we anyone could encounter with the dependency injection and how would you resolve them? Like that common uh exceptions right? Yeah. common issues that anyone could encounter. Yeah, sometimes issues we can get that like uh duplicate DNA exceptions like okay so anotherceptions like uh we may uh encounter like circular dependencies circular dependencies like and um tracing the flow of dependencies difficulties in tracing the flow of dependencies okay yes yeah yeah And solving these problems uh typically involves careful design to minimize direct dependencies and use explicit configuration or annotation to manage these dependencies clearly. Yes. Okay. Yeah. Uh so uh can we create a non-web application in spring boot? N application. Mhm. Yes, we can create. Okay. Uh how um so without adding some like u web dependencies. Okay. Yeah. Okay. So yes uh that's true. Uh we can create a non- web application in spring boot. Uh so there is a way uh uh I mean we should we could use command line interface. We could implement the command line interface. uh if you want to uh use non if you want to create a non-web application. Yeah. Okay. Yeah. Okay. So uh can you tell me how do you configure a spring boot project like what's the initial step? Uh spring boot config like uh creating the project. Yeah. Creating the project in the initial stage. Yeah. uh so by uh we can using that uh two ways by using the command line interface and another thing is using that spring ination so like and first first adding the dependencies so require dependencies in the pom doxml the and second thing um we differentiate the layers between that like controller layer and present persistence layer and service layer like that so And uh according to the uh requirement we creating that okay yeah we can use spring initializer and there are some other ways as well that's correct so guys has our interview preparation kit and after completing that kit he is able to crack multiple interviews and have big offers in big MNC's we have also referred him in few companies so guys basically This interview preparation kit has four parts. First is complete interview preparation material. Second is two client enterprise projects with video recorded sessions. Third is lifetime chat support and fourth is referral support to the big MNC's like infosys, GCS, HCL etc. You can purchase either whole interview preparation kit or complete inter preparation material also. Uh so basically it contain a lot of material categorized by experience level means each experience level has different material with all possible interview question answers for Java, spring framework, Maven G, Spring Security, Spring Data, JPA, Kafka, Microservices, Java questions, streaming questions and many more. I have provided the link to get this in the below description as well as the interview preparation kits uh in the description. So guys, now moving to our interview. Before moving to our interview, U Manju, can you please uh give your reviews about this interview preparation kit whether this was helpful for you or not? Yeah, basically it's so helpful for me. Okay. So to taking the multiple courses or like to searching the different platforms so that is time consuming. Yeah. Yeah. So it's a one-stop solution for everything. So in your resource like that everything is in one resource all in one. So that helps to um like getting the guidance like some. Okay. Okay. Yeah. Thank you. Uh so now moving to our interview. Uh so Manu uh can you please uh mention few advantages of a spring boot application. Yeah. Uh the spring boot uh features like that auto configuration the first one and uh another one is embedded server. It's a micros service support project. Yeah. Um and it is the B plate code. Okay. So these are the main features of the spring boot. Okay. So are there advantages or limitations of using spring boot that you have encountered? The first advantage advantage. No I'm saying uh is there any disadvantages of using spring boot that you have encountered? Or do you think no? Okay. Yeah. Actually there are no major disadvantages in a spring boot application. Uh since is a facelift of a spring framework. Uh but there is a term auto configuration. That's a advantage of a spring boot. But sometimes that's also a disadvantage of a spring boot. Uh leading to difficulty debugging or managing the complex auto configuration structure dependencies on beans. Right. If not carefully managed, we need to configure configuration. Yeah. Mhm. So can you tell me what are some important annotations in spring boot? Yeah. Uh first one there is stereotype annotations like component service and repository. These are the main annotations. So after that in the we using controller rest controller annotations. So and request mapping annotation. So autoide annotations. So these are the main annotations like qualifier primary. Yes. Okay. So can you tell me some advanced annotations which you have used other than this common annotations? I used like I used like u Mhm. Uh profiler and qualifier. Okay. Yeah. Uh and u another thing is like uh logging logging logging annotations. Okay. And uh Lombok. Mhm. Yeah. Okay. Uh can you tell me the difference uh between controller and rest control annotation? Yeah. Okay. So controller is an annotation which is used at the controller layer. Controller class. So it returns in the it's an MVC architecture. which used in the main in the MVC architecture and it returns in the view or page page form. So when come to the rest controller the combination of controller and response body annotation. So it returns in the like XML or JSON format. Yeah. Okay. So this is architecture restful web service architecture. So when would you choose controller over rest controller annotation? Yeah, sometimes if you want that um view page. Okay. Yeah. So raw data like something. Okay. Okay. Yeah. Yeah. Got it. So tell me the differences between put, post and batch. Yeah. Uh put uh is annotation which is used to like um update the resource. Mhm. It update the entire resource. when come to the uh patch it just update the particular field in the resource. Okay. Yeah. And the post annotation which is used to adding the new resource to the existing database. Okay. Yeah. Table. Yeah. Uh okay. Got it. Uh have you worked with this fing actuators? Yes. Uh can you please go ahead? So spring boot actuators is like production ready feature. So it gives some like um to test the um application uh health health or like a metric. Yeah. Okay. Can you tell me the name of few endpoints that actuators provide? Like health endpoints, info end points. and another something. Okay. So, how how do you secure uh rest APIs? What's your pattern? So, the first one is like using the O framework. Mhm. So, open authorization. So, another thing using that like uh authoriz at the rate of pre-authorized like annotations. Yeah. RB role based access control. Yeah. Mechanism. Okay. Got it. What is a 404 error and 401? Yes. Sorry. Uh what is 4004 error and 4001? Yeah. 4404 that is like resource not found. So 4.1 is like unauthorized access. Mhm. Okay. And what is 500 series 50? Uh it's like server error. Server error. Okay. Uh so how do you handle these errors user friendly manner in spring boot application? Yeah. First we have to if I got the any like 44. So we using that create the some custom class in the exception handler. So we just like implement the service not found. Yeah. So if you got the 500 like that is um server error. Mhm. Yeah. Okay. Okay. Got it. Can you explain the spring data JPA? Yeah. Spring data JPA is like a specialization of ORM framework. So which is used to like um mapping the object object between and relation database. Okay. Okay. Okay. So do you know about n +1 problem? Yeah. Actually I'm not that much of confidence in that problem. Yeah. Yeah. Fine. Fine. Uh and do you know about JDBC? Yes. Uh what is the full form of JDBC? JDBC uh Java database connected. Okay. Uh okay. Uh moving ahead. Uh what are the microservices and how does it differ from monolithic architecture? Yeah, basically monotic architecture which is that entire application in the one container means like yeah so enter functionality or entire service in the one so the whole database which is depend on that one application one application so when come to the micros service so we divided the micros service into the services so each services has its own database or own functionality Okay. So like yeah so each services are communicated through the rest calls. Okay. Uh moving ahead. Have you faced any challenges while developing microser architecture? Yeah. Can you tell me few challenges? So the first issue which is I like getting that rest call between the services the first issue. So first you need to identify that where the service resource not found something or issues in the another service. So these are yeah this is I okay uh how do microser communicate with each other? I mean how do the services inside the market micros service architecture communicate with each other? Yeah. Uh there are two ways like using the synchronous communication and a synchronous communication. When come to the synchronous communication using the rest calls so using the JSON or XML format sending the data each other each service each service. So another thing one is like using the Kafka Kafka architecture which is like one service act as an producer another service act as a customer consumer. So between the sending the data using the topic in the form of top topic here. Okay. Okay. So uh how is communication secured in commun uh I mean how is communication secured in between microservices? First we implemented in the API gateway level. Mhm. So in the entry point of that um all the micros service. Okay. So then each in the each services in the controller layer we use that like uh pre-authorized annotations. Okay. Got it. Uh can you explain what is polymorphism? Yeah. Polymorphism is like mechanism to like more than one form. Okay. Yeah. So we can take the example of method overloading and method over. Okay. Can you provide a real world scenario where polymorphism could be effectively utilized? could be effectively equalized. Uh sorry the polymorphism which is like ability to take more than one form which is like there's a there's need to perform the one operation multiple multiple scenarios like if you take the addition so we can take the two variables sometimes we can use the three variables. So this is a method overloading that how it use. Yeah. Okay. Uh what is imitability in Java? So immutability is like uh which is doesn't change. We can't able to change in the future. Okay. Uh why is immutability considered beneficial property in multi-threaded application? Sorry, I don't have any. Okay. Okay. So basically immutable objects are thread safe. Uh do you know? Yeah. Yeah. So that which eliminates the need for synchronization and can significantly simplify the design and implementation of concurrent applications. Okay. Okay. They also reduce the risk of thread interference and memory consistency errors. So that's why it is considered a beneficial property in a multi-threaded application. Okay. Okay. What is lambda expression? Yeah, lambda expression is like an anonymous function which is used to uh concise the code. Mhm. Yeah. Okay. Uh have you worked with generics in Java? No. No. Mean size like Yeah. Not do you know? Yeah. Okay. Yeah. Go ahead. Yeah. Generics which is giving that like um constraints. Mhm. Means like that um so I can't can't able to recall. Okay. Okay. Yeah. It's fine. So generics uh I mean uh uh genix enable types to be parameters when defining classes, interface and methods. that provides stronger type checks at compile time and can eliminate the need for casting. Okay. Yeah. And also generic force a Java compiler to check of type compatibility reducing runtime errors by preventing the wrong types from being used at the wrong time. This type safety help prevents class cast exception at runtime. Okay. Yeah. Can you explain uh about JRE, JVM and JDK? Yeah. So JDK is a Java development kit which is the like JRE and JVM. So and come to J is a Java contain environment which is um like which is used to it consist of like JVM. Mhm. So JVM is a Java machine which is used for like convert the compile compile compiler code to the like machine level code. So like interpreter code. Okay. How does JVM handle memory management if I can't able to remember that? Exactly. Okay. Okay. So JVM manages memory through a process known as garbage collection which automatically deallocates memory that is no longer being used. I think you are aware of garbage collection right? So garbage collection uh I mean this process runs inside the JVM. Yeah. Okay. Okay. So what do you think uh Java uses pass by value or pass by reference? Pass by Yeah. means like uh passing that object. H yeah passing that object in the method method parameter. Okay. Yeah. And pass by value we can like um passing that in the method parameter values. Yeah. Okay. Got it. Have you used uh do you also write the test cases? Yes. Okay. Can you tell me the annotations before, after and before L? before all. Sorry. First using the after which is writing the it test after that like that execute function execution. Yeah. Okay. So tell me uh like so uh before annotation is used to specify a method that runs before each test method in the class before each test method in the class. So uh okay and after annotation is used for a method that runs after each test method. Okay. And before all annotation is used for a method that runs once before all tests in a class. Okay. before all means runs once before all tests in a class and only before means runs before each test method in a class. Okay. Okay. Yeah. Uh okay. So moving ahead. What are the changes that came in the interfaces in Java 8? Yeah. There's a two features like static and default keyword which is introduced in the interfaces. So for example we take there's an RBI we we can take the example of RBI is an interface so that we take the several banks as a class so like IC and Canada bank so these are the classes which extends the um RBI which implements the RBI interface. So if you want to change the something like interest or something like feature need need to be add so we just add in the um interface. If you just need to add the the interface it will directly reflect to the classes also subasses. Okay. So there is no need to write the in the subclass. Mhm. What's the difference between hashmap and tree map? So yeah, hashmap um it doesn't follow any insertion order but remap usually follows the insertion order and it okay only and map in the ascending order like follow the order. Yeah. In what scenarios would you prefer to use stream map over hashap hash? Yeah, first use that like if you want to sorting the like heterogeneous uh sorry um uh same tree map which is used like for accountable. Okay. Okay. Uh so for example when displaying sorted data to a user or when order specific computations are critical so in that case we could use tree map okay or hashmap right yeah can we add objects as a key in the tree map? Mhm. Yes, we can add. Okay. What consideration must be taken into account when using custom objects as a key in the tree map? Okay. So, as you know, we can use custom objects as a keys in the tree map, right? But there are some uh thing that need to be considered. uh for example uh like the key objects must have consistent implementation of equals and compare two. This ensures that the tree map can correctly determine both order as well as uniqueness of the key. Okay. Okay. So how can we achieve uh multi-threading in Java? Yeah. I'm not aware of multi. No. Okay. You are not aware. Yeah, it's fine. Uh moving ahead. Uh what are the exceptions in Java? Like um there are two exception like custom exception and yeah compile time exception and runtime exception. Mhm. How do you decide when to use checked exceptions versus unchecked exceptions? Yeah. Checked exceptions of the exception which is um checked at the compile time. Okay. Yeah. Uh so like runtime exception which is checked at the runtime. Mhm. It's not checked at the compile time. Okay. Uh Okay. So, uh can you tell me in your project what all tools you guys are using? Uh tool means uh tool can be your IDE, tool can be your uh git tool like GitHub or GitHub tool can be a Jira like all these stuffs. I want to know. Yeah. used like intellig idea is the ID for the developing the okay screen application. So and like uh another one is like GitHub uh which is used GitHub actions. Okay. And so Maven is the tool Maven for building your project and what about for tracking your user stories and all. So like using Jira. Yeah. Jira. Okay. And uh uh which tools you guys are using for visualizing logs? Visualizing logs which is personally which is used like um we maintain the log files. Okay. You maintain the log files uh like we have graph. Now have you used any one of this? Okay. So how do you how do you debug in your application? Let's say there is uh some issues coming in and how you how do you debug? Yeah. First uh we check the log files. Mhm. Yeah. Then uh if you got the issue like u trace out that application in the console. Okay. And which log logger you are using? Lo 4j lo 4J2 okay okay so what's the difference between get rebase and g merge g rebase and git merge g rebase and g merge so g merge which is like um it merging the two uh two repositories is. Mhm. Okay. Uh and get reus if we want if there is a main branch and there is a feature branch and we want to uh inclined a feature branch to the main branch we want to fetch few commits from the main branch to our feature branch. Uh so we could use I mean we if we want to sync up so we could use freebase. Uh okay. So Mju now I will give you few uh coding questions uh like first one would be input output based question I will share out code snippet and you have to tell me what would be the output and second is I would uh give you a coding question that you have to write in Java stream API okay are you comfortable yes yeah please share your screen okay so I have dropped one uh snippet in the chat box. Can you please copy that and paste in any of the editor? Okay. So, you have to tell me uh the outputs in true and false like S1 is equal to equal to S3 whether it will be true or false in the other following lines as well. Yeah. So just write your answer after question mark. Yeah. Okay. Okay. Yeah. Uh okay. S1 is equal to equal to S2. They are false. Uh because uh one is uh S_sub_1 dot equals S_sub_2 is true. That's true because equals checks the content also. S1 and S3 is false. So tell me the reason why it is false. uh because it's a string lit which is stored in the string constant pool uh if you the in the string constant pool is referring the same object but here it's comparing the address means like references okay can you copy this code and run in any address in the ID yeah in the ID Just run this code. So it will false true and true. Third will be true because in string pool this will check the content not the reference. Okay. Okay. Okay. Okay. That's a confusion part. People think like double equal checks reference and these are there will be two reference. No string pool. Let's say if s_sub_1 is equal to equal to test. Now if we are creating s1 is three is equal to equal to test. So there will be a one test. Now s_sub_1 and s2 referring to the same test string that is available there. That's why string is immutable. We cannot change. Okay. Yeah. Okay. Now I am just going to give you one coding question. Okay. So uh you have to write that code in the stream API. Okay. Uh you have to find the number of occurrence of each letter in the string and the string is you can write anything like I love. Yeah. Spring boot can take any string. Okay, that string is the input, right? Yes. Yes. Now you have to print the frequency of each character in the string. Okay. By using a stream API using stream. Okay. Let's see. Okay. Frequency of each character. [Music] Actually, stream AP works only for the collections. Yeah. Yeah. Okay. So, you can take a list of strings and it will work with a string as well. But yeah, if you know uh on the collections and take a list of strings and just print the frequency of each string uh like uh you could take a list of a string and then in the string you could take like four five strings and Yeah. Okay. And print the frequency of each string like put Java Python. Okay. Then C++ then again Java. The same output like output should be like Java as Java comes two times. Python 1, C++ 1. Okay. uh okay so uh uh Manchu I think I'm running out of time uh you could try this code after this interview uh okay uh uh and I'll tell you the approach If if someone ask you to write a stream API code that is related to the key and value pair right I mean here there key should be string and value would be frequencies right. So in that case try to use grouping by in by using group characters collectors or grouping by we could create a map uh like ta value uh in a stream map. Okay, try that way and after this interview please try that. Uh, okay. And uh, thank you so much. It was a wonderful interview.
Get free YouTube transcripts with timestamps, translation, and download options.
Transcript content is sourced from YouTube's auto-generated captions or AI transcription. All video content belongs to the original creators. Terms of Service · DMCA Contact