5 NEW Android Interview Questions

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone e how are you we're finally doing this video finally I got a lot of responses on the first one I know you liked them but I've been lazy the first one what is dependency injection someone asks you this on the street what do you say you know I would be careful if you were to mention the solid principles in your resume and then you come to this question and then they ask you what is dependency injection well the answer is dependency injection is a design pattern to implement the inversion of control principle the i in the solid principles and it's used to resolve dependencies right this is the simple answer very surfacy but it shows that you know the solid principles you know what inversion of control is whatever that is but the key word right they like the keywords so the more advanced answer would be dependency injection is a subtype of inversion of control it's one way of doing it and it's implemented by Constructor injection or method injection and it deals with how components get hold of their dependencies that is what depends the injection is very good answer shows that you know shows that you're not just throwing around words never thought what they mean good answer all right follow-up question to the first one can you name a few dependency injection libraries for Android how do they differ um so first of all there's dagger Hilt butter knife coin and you could say something like this goes on and on or you could say something like there are many others I'm sure but these are ones I used throughout the years so dagger and health and butter knife are actually compile time based so before you compile it checks if you're a dependency graph which is already constructed by this Library it checks if it's all satisfied and then you can compile you don't see any runtime errors like you would with corn coin uses the DSL to describe the dependency graph you describe it yourself it's not built by using compile time annotations that's the difference between them I honestly use Hilt I like Hilt because of the power of dagger and help makes it easier to use dagger that's what I understood from it Beyond this no one will go deeper into this question that I know of I don't think anybody would go deeper why you know I'm sure there's many people who know much deeper stuff than this but I'm asking about what to ask you during an interview I don't think anybody would go deeper than this right what's the next question this is number two those were sub questions can you mention some types of testing that you know um I can there's UI tests there's unit tests and there's integration tests we all know that so what about UI tests well they involve user interaction meaning you are testing if a button does trigger this function to be called when I click it they verify this behavior is clicked is run or is displayed is not displayed this is what they deal with the interaction or the behavior of the element you're working with unit tests for example they're based on the junit framework they also verify behavior of classes actual code not the UI stuff whether it's displayed or not or whatever coming up or down or pressing going left and right they test the behavior of your classes is your method doing or outputting what it said it will output based on this new input integration tests I have no idea I have never written any integration tests I'm not sure what they are even this is what I would answer I would show myself my behavior my my level of experience I would put it out there as it is I have nothing to lose except the job of course but besides that I have nothing to lose I don't know what an integration test is I've never written an Android integration test if you have I'd love to know tell me about it during the interview I would say this who cares bro they're taking my time they're taking one and a half hour of my time I have the right to say whatever I like you know granted that within the bounds of respect right so I have no idea what an integration test in the terms of Android means I don't know and that's what I would say moving on do you have experience with lint what is it used for okay so lint scans code provides you with a report which includes issues with your code Style okay there's a linter inside Android Studio already and it runs as your writing code okay it suggests to you that this Lambda should be out of the parentheses if it's the last parameter to uh if it's the last argument to a function or something it goes like a yellow squiggly line that's the linter you can have this this is the advanced answer that you can have a linter standalone Katie lint right you can include it into continuous integration you can have this linter be run from some server and it has to run your code under these rules while it's on the server right and you use ktlint to do that so KT lent is a standalone lender can be run on the code on your code from the command line at the CI server it runs your code through the linter produces an APK and that's how continuous integration uh that's what it does right so this is your follower question what do you mean by the last sentence can be integrated into continuous integration server what do you mean exactly how like this using KT lint again deeper than this I don't think anybody will go they will just say Okay noted cool and that's what we use uh in my company in an instrumentation test case what are the two most important methods it's a cool question but it's easy so there's the setup method and there's the tear down method those are the two most important test functions right the setup method runs for initialization so it injects whatever the hell you want to inject it initializes stuff It prepares the environment to tell the test for example there's no internet so it says whenever you call my view model and you call is connected I want you to return false so the environment for your test now is that there is no internet because some of your code inside your test is going to call this method before executing some other code so you're testing some other code but you're gonna go ahead you're gonna have to go through is there internet so your test says whenever you call this return false so that other code you're testing is going to be running under the pretense that there is no internet right so this is done in the setup before you do anything the tear down resets the environment for the test back to zero now it's not false anymore right so this is the simple answer there's a follow-up question to this one in what order do these methods run the two important ones set up and tear down so setup is always called before each individual test is passed always if we were to say let's run two tests right this would be the execution you would first call The Constructor then you would call the setup then the test then the tear down in the case of the next test no Constructor is called just the setup then the actual test and then the tear down right this would give you amazing points you would be someone huge no it's normal but this is cool if you were to answer that it shows that you really know cool cool this is another cool one but I would first ask the candidate for example uh have you ever worked with core routines if not I wouldn't proceed right because I really don't want to put the person under the spot and and have them explain this uh or or I would say this huge uh question and then they go honestly I've never worked with quarantine so I can't even answer this no I just say have you worked with core routines before yes yes I would continue no no I will move on to something else this is the last question what can you say about the relationship between core routines and threads hmm quarantines are very similar to threads however quarantines are cooperatively multitasked whereas threads are typically preemptively multiple do not answer this at all this is an answer from Wikipedia do not talk like this because if you do somebody's gonna say what do you mean by typically preemptively multitasked please could you explain to me what does this word mean and this is where you will be embarrassed and you won't know what to say right so don't bring yourself into such a situation where you're parroting or you're repeating someone else's words try to understand the thing in a more simple way right this is the simpler way this is the in my opinion the first one it is from Wikipedia it could be the right answer I don't understand it I'm not gonna use it and I don't agree with this kind of talking this is the way I would prefer quarantines are not threads first of all they are not threads here it mentions quarantines are very similar to threads similar how are they threads themselves no then how are you saying they're very similar that they're another thing they're a different thing but the relationship with the threads is as follows coroutines are not threads they are a low level mechanism or way that uses thread pools to shuffle work between multiple existing threads so there's a thread pool you are allowed access to when you're using your machine core routines are a way to shuffle work between the threads in this pool so that they could do the work for you right and the proof of this is that you can create a million core routines and launch them all in your code trying to do that with threads is going to crash even the most advanced machine right now so this is the difference and that's the last question if you like this tell me I'll make more of them because these are honestly from what I ask personally when I'm doing an interview and from what I've sourced on the internet and found useful if you like them I will do more and it will take me three years to do another video like this no I'm kidding I'll make more yeah tell me if you like them see you in the next one good luck
Info
Channel: Oday
Views: 8,251
Rating: undefined out of 5
Keywords: android, programming, tutorial, how-to, software, development, engineering, help, guide, step-by-step, easy, kotlin, testing, questions, interview, android interview, interview prep
Id: aEwCOIMJtvE
Channel Id: undefined
Length: 13min 4sec (784 seconds)
Published: Mon Oct 03 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.