Android Interview Questions - Live Discussion with Arnav Gupta (Ex Android Lead @ Zomato)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
start uh suppose area audio is fine video is fine no lag right you guys can hear everything so any questions that you have so this is a live session so any questions that you have uh specifically related to you know android interview questions anybody who is going to give android interviews uh in the next few days or you know planning for preparing for android interviews if you have any questions in your mind feel free to write them down in the chat i would love to take them up i have some uh of you know the content that i want to obviously share with you initially and then i would pick up the uh the message on the chat and i will cover those topics as well right uh so uh i think i'm already getting uh some you know uh questions uh coming on the chat but uh let's just start with discussing something uh you know uh is that how do android interviews uh get conducted so uh you know for for people who don't know just uh for some background uh you know after uh you know uh running coding blocks full time for three years i had then spent a year at zomato where i led uh for six months what was called the android platform team so the platform team works on stability reliability speed of the app reducing the size of the app uh you know reducing the crash rate of the app so uh the app was used by you know uh two three million people every day and again downloads 100 million total downloads uh zomato app if you see on the play store so uh making sure that 99.99 of the people don't have clashes and also that's something that i worked on hired people in the team as well and then uh for the next half of the year i uh was actually leading the what was called the consumer acting so basically the main somato app that everybody uses to order food and all uh so the android uh team i was leading uh in charge of making the app releases and uh you know we revamped the entire app during that time uh you know you might have seen android zomato is very famous for revamping their entire app almost every year so i did that now i work at target so target is uh also has another very big android app and uh it is uh it is one of the biggest retailers in the us it's uh like amazon walmart like that there's target and target has very big big supermarket kind of stores kind of like you know you have big bazaar and something in india and their android app is also again used by uh almost as many people as tomato their uh you know uh the the volume of people using their similar it's a bigger team here actually because it has even more features uh the app here and there is one part of the team which is based out of india and i am the lead engineer in that team um so uh this has given me obviously the chance to interview a lot of android developers in uh the past few years i think uh like just screening uh at a resume level i have done probably 500 interviews probably 200 plus i have done so uh there is uh obviously the difference in uh i just uh start with the content is that you know when we are hiring generally there is you know you are hiring for sd one level people or sd two level people uh or sd three level people uh you know uh so this is basically kind of you know uh zero to two years kind of experience out of college uh that kind of people so it's called either associate developer junior developer or just developer or engineer that's the kind of role that sd uh one uh engineers have okay uh so in terms of like at zomatos there was roles like sd123 and then staff engineer and principal engineer like that at target we have got engineer and then senior engineer and then lead engineer and so on and you know many companies like you know uh of the bigger fan kind of companies you have n4 l5 l6 those kind of levels right so uh just to give you your perspective of you know what level of interview you are giving uh based on that what level of interview questions would be coming up uh so to just uh lay down that expectation so it's kind of like you know uh two two uh i guess uh what would be somewhere around two to five years kind of experience uh generally like hd2 kind of level uh people are joining in at sd3 level could be like there's a bit of overlap obviously so uh you know uh four to eight years kind of people they are generally joining into sd3 kind of level so uh beyond that i myself am not so experienced so i haven't obviously taken interviews of people uh joining i i am a lead engineer but i haven't taken interviews of people who are joining in at a level higher than that uh but then obviously i think we don't have that kind of an audience here as well and there are very few people actually in the industry who have more than eight years of experience on android nobody would have they would have experienced something else plus android android itself is just 10 years old i have been working on android for ever since it came out almost 10 years so anyway uh so you know uh setting the baseline here uh what are the things that you know people would be expecting from you for these different different levels so uh one of the base parameters for example was not there a little while back but it is now there is you know some you need to know quarterly okay so i think two years back people who knew java they would play child will join will learn kotlin on the job if our project uses scotland that kind of an approach these days kotlin uh kind of become uh very important uh you know the uh basic uh stuff like you know jetpack libraries like you know uh most of the android support library uh android navigation those kind of libraries that uh google has created their jetpack family of libraries so these are the kind of hygienic things so whatever sd one two whatever level these kind of things obviously are expected okay um when you uh talk about hd2 kind of level uh so here what things start becoming more important is understanding you know the architecture so mvvm uh versus mvp uh what are the differences in that which one should you use uh how testing is done uh right uh these things become a little more important and then uh for sd3 kind of level of people obviously that's all these things included and then for sd3 there is even more in-depth questions on uh you know uh dependency injection which is uh dagger coin there are some libraries around that using rx java or uh using core routines uh right and uh there are other topics we will uh go and discuss about that and uh the depth of the other things as well like understanding of architecture testing those kind of things also increase as uh we go ahead so this is the kind of basic layout so what kind of uh topics people are going to be asking questions on that is how the framework is laid out okay now so to start with um good uh so i'll just start with how the process works okay so let's start with the process and this is very important so so process obviously starts with from the company and we prepare a jd and we you know put it out now the jd would very clearly uh mention what level of skills that we are looking for uh do we want somebody who has just the basic level of idea to create an app and put on the play store or we are looking for somebody who has worked in a production app for at least two three years so that gives you a basic differentiation between if it's an sd1 opening or sd2 kind of opening okay so sd one and two these are generic terms different companies would have different kind of terms but you know mentally keep a model that you know whether it's a junior engineer or it's a senior engineer role like that okay so uh that getting the jd you would get to know that and then uh you know from there there would be the uh the resume shortlisting that happens at that point now i i'll just uh tell you what kind of things i want to look inside the resume uh when i see a resume for an android development role uh but before uh you know uh going ahead uh so uh i will tell about that after assuming what usually comes is so if your resume is selected then you mostly uh for companies where it's an android specific role you would get a take home assignment okay ah after the take home assignment uh the process would generally be there would be you know usually there would be round one uh of the interview so in the round one of the interview mostly you know discussion about this happens uh plus concepts and then if there is a round two so round two would contain you know concepts plus programming so that's the general format i have seen i have uh helped hire android engineers for other companies as well uh you know uh some of uh you know startups for my friends uh and as a hiring consultant i work so that's generally the process you you look at the jd you submit your resume your resume get shortlisted uh based on resume getting shortlisted you get a take-home assignment submit your take-home assignment and uh if the assignment is well done then you get the first round in the first round uh you would be sitting together with some android engineer and they would be discussing the take-home assignment that you have done and they would discuss why you have done certain things like you know why are you using mbvm here why are you not using mvp here something like that or why have you not written tests because you did not have time to write the test or because you did not think that this particular part of the app needed tests to be written uh questions like that so mostly it will be uh you would be challenged upon your choices that you have made while making that app that is generally what your first round is in most companies okay uh and then uh some conceptual questions will also come uh based on what they're you know asking so for example uh if you know uh you have used rx java just for example to do uh network calls inside the and then they might ask okay why have you used rx java and you know why have you not used uh you know uh something like core routines or the other way around maybe you have used core routines and they're asking why have you used core routines and why are you not using rx java okay so that level of discussion is what happens in the uh first round and uh they if you clear that then there's a second round second round usually uh there is less discussion about the project that you've already submitted because that has already happened in the first round the second round again there's gonna be android specific questions and some uh you know language in-depth questions will also start appearing in the second round uh so people would ask you about in-depth about kotlin uh you know uh how to find out memory leaks inside an app uh you know if your activity is opening slowly how would you investigate that these kind of questions start coming and uh deep conceptual questions about android so by you know uh deep conceptual questions it means you know uh core android there are you know a lot of stuff like you know activity the life cycle of activity uh how to prevent uh you know uh data getting destroyed when the phone screen is rotating these these are more on the basic level and last level there are uh more stuff so these kind of things start getting asked so that is what happens in the you know second round uh third round it depends on company to company some companies do have a third round where then you usually uh have an interview with uh somebody like you know your uh in the director of engineering or principal engineer if there is somebody like that you know the team lead of android or something like that in smaller companies it's called cto round okay so there is a tech culture kind of round that happens in some places some place it might not happen depending on how urgent the hiring is so for example sometimes when we have a lot of openings and we're not getting a lot of candidates we don't do round three we do round one round two it's good uh people are getting hired after that okay you might have an hr round or something like that that's kind of general i'm not going to spend time based on that because this video is about android interviews so what hr on people ask you can see there are a bunch of other videos on youtube you can find out about that right um let me quickly look at the uh messages in the chat once and then i will come back and talk to you about what levels what kind of questions i generally ask okay so right a lot of people asking about whether freshers are hired or not so uh listen to me uh now let me just uh kind of tell you about the kind of companies also right so so there are some companies obviously like the uh very well known big size companies like you know there is you know uh google and you know amazon uh and uh microsoft uh then uh you know um not even microsoft i would not say microsoft has kind of role specific hiring but but you know say there is samsung adobe uh right so uh these kind of companies who have a very big head count the number of people who are employed is very large uh they're the fresher hiring sd one level hiring so these kind of companies at sd one level hiring uh they don't check whether you know you know uh you know android or you know node.js whatever these kind of things don't matter to them they are hiring for general hd1 they they will hire you based on your you know programming fundamentals uh they might ask you a little bit of system design to get an understanding of whether you understand how the web works how how apis work these kind of things they might ask but they will mostly ask about uh your basic data structures algorithms some companies have google asks a lot about graphs and all uh right uh other companies like you know facebook asks about array and string manipulation more and again data such as algorithms what which company asks you will again find a bunch of uh videos uh and you will find articles on gigs for geeks and also i'm not going to waste time on that but there are companies for example you know if you look at uh the product-based startups that exist in india so for example let's say zomato okay something that i can tell you about but then similarly zomatos competitors so sugi is there right urbanclap is there flipkart is there or you know paytm is there or phone pay is there right uh dream 11 uh an academy uh you know uh doubt nut the doughnut is a company where i've helped hire people so these kind of companies they they hire for specific roles they hire for they will hire for back-end engineer they will hire for front-end engineer they will have for android engineer they will hire for specific roles so here even at the you know basic level also they do have role specific hiring when they come to campus placements sometimes they do higher you know generic sd kind of roles they hire but mostly these companies they are hiring for specific roles so here if you go to their websites and you know you see that you know what kind of openings and all they have you will see that okay there is a specific you know node.js developer django developer android developer react developer this kind of specific technology based roles are there so these companies are going to be role specific hiring and uh at target also we do role specific we have android engineer opening so senior android engineer we are in fact hiring at target right now if you uh go up at carriers.rt.com you'll find new india team we are hiring uh right so uh these uh companies where it is role specific where the where the job description says not software engineer but it says android engineer so i'm talking about these companies if it's just basic software engineer role then hardly they will ask about android related things uh in those uh interviews right so different companies have a different approach not everybody uh hires just specifically for android so company name people are saying dunzo and all of that so you got an idea right you know like dunzo will fall into this kind of a bracket it will not fall into this bracket it's very easy for you to understand right what which kind of company falls into which bracket and you can look at the careers page you will see whether they have technology specific roles or they do not have technology specific rules okay so let me uh show you what a scope of take-home assignment generally is given to you okay couple of take-home assignments i recently did uh so i will talk uh to you about that as well so [Music] um let me just uh should remove the ipad screen and bring my screen here yeah so uh this is an app that i did you know recently where you know we were making a blogging app so this contains basically you know the and a mobile app version of this site basically where you have got your articles and you can write articles and global feed is there and you can go inside an article and you can write some comments uh we have a you know youtube playlist already i think so there's this real world android medium clone i have made a video series on uh this project actually how i made it so you find it out there right so that is typically the kind of projects that are given so another example i'll give you so this is something like you know uh there is an api called github trending now uh dot sh so here if you go this is the latest trending uh languages and repositories on github so it was basically an app that shows uh the uh you know the trending list uh the ui has two activities a trending list and uh you know it fetches uh the data i think what i had done here was so it fetches the top languages the top repositories in the top developers from github shows them in a screen okay very simple scope this was there then uh this is something that uh you know i gave for another company and uh they asked me to create this app where i fetched the data from i i in fact this one i would make a youtube series on this actually so this company does not use this project for hiring anymore i confirmed with them so i i can make a video series about how to make an app it's a nice project idea so taking data from imgor uh basically you know you know this is a site called imgor where you get photos so making an instagram clone using the imgur api so take photos from imgur and make an instagram so explore page will contain all these photos here and then in the top the stories basically you can use hashtag so there are hashtags on instagram so top hashtags and you put them in stories something like that uh okay so that's the kind of scope of the project i think uh you're able to understand what is the scope of the project that people are gonna give you so it's gonna be three to four api calls right max three to four api calls okay so finding all the photos finding all the hashtags finding the maybe in the photos you're getting an area of photos and inside each photo comments three api calls right the github one trending languages trending repository standing developers three api calls uh this uh medium clone one so there are com articles comments users three api calls it will be usually like three to four api calls right three to four screens on your app corresponding to those api calls show the articles then click on one articles expanded view of that article show that okay uh that would basically be your and it would be a very simple ui to make they won't ask you to make some you know very cred app kind of animation or something like that it would be like just simple get that data down and show it in nice way on your screen uh sometimes you might be given mockups in the document that tells you how to make that project uh that's what your take-home assignment is uh gonna be like that's the scope of the take home assignment uh what are they gonna look at inside the take home assignment so let's talk about that okay so let's let's get there uh any any questions if anybody has uh feel free to ask about take home assignment part and i will be explaining to take home assignment part what they're going to be expecting uh so so for example uh this is the app that i have made uh now uh one thing that you know is very important is like for example here in the app you would be seeing i have made a separate library module where the api calls are there okay so this is a little more advanced level you can say i have made it using dependency injection so it contains you know dagger is getting used here so if you guys know about dagger then that's great if somebody does not know dagger don't worry it's not necessary that you have to use dagger in your project to get selected for lander enter your road uh there are other dependencies injection as well if you don't know dependency injection at all then you're probably not uh qualified enough to apply for hd2 level kind of role uh right sd1 you can apply for without di knowledge sd2 you would not be able to apply for right uh so this uh you know in both these projects though so this is the github trending one as well so as you can see i've made two separate uh modules one is the app where the ui part is working and this is basically my uh you know the uh lib part where i'm doing the api calls so here there is the you know api calls are written here the models for that api calls uh those things are written here you're using something like moshi or json or jackson or something like that and then there are tests as well so there are tests now uh this is where i'm testing that you know it can fetch the repository data and all everything so this is the real test and i think there is a mock test so that's the real test which actually makes the api calls and test this is the mock test which fetches data from assets so i have created some you know sample json file so because your tests uh if it's running on the ci maybe the ci is running an environment where internet access is not there it might not be able to connect and actually make the real api so you can keep a fake app because testing the api is not uh testing your app your app should the test for your app should not fail if the internet is somehow not working or something like that so you can keep like a fake copy of your api responses inside your app and run the test for that so your test and everything for the app would be working so i can make my api and that my data fetching and all things work so the test for that i can write here so but this uh project does not use as you can see uh dagger or coin or dependency injection it's a more simpler scope project that i had done this one uses that so it has got you know in in for example if i look at my view model so not in the view model i think it will be there inside at least my activities and all so here uh i'm you know getting the api via inject so injectors dependence injection i'll talk about that so uh this is more of a kind of project that you would build if you are applying for sd2 kind of level uh this is more of a kind of project that you would build if you are applying for a sd one kind of level by the way i will open source these projects whether these are private let me do that actually right now uh so i will send the links on the chat as well so i made them off a while back i would make this public and i'll just drop the links in the chat and i'll drop it in the you know the comments of the uh video as well okay so so this is the github trending repository one okay uh then let me do the other one this is the imgur app right so uh i'll make this public as well so you can see like the scope of uh the project that uh usually make for uh sd so the imgur one is more sd2 kind of level you should make projects like this for sd1 kind of level the github trending one and the conduit one is perfectly fine so this project that i'm showing that i made the video series on right uh there is this entire video series i was just uh telling you guys about so uh if you look real world uh android uh coding blogs if you just search you know you will find uh these so and a lot of parts were there in 12 parts or something so we just find out part one actually uh it should be there in a playlist as well on our channel i think it's part of this uh course playlist as well so you will find it there uh you can just search on our channel and find this so that's also kind of sd one kind of level the kind of project that i have built there in that series uh it does not use dependency injection it does not use uh rx java or something it uses very basic core routine based uh network calls uh not a very deep dive into concurrency and all that stuff okay let me open source this and then i will continue speaking about the questions that people ask after submitting of the projects oh it was supposed to be public yep so there you go uh i have you know uh made both of these public can go and check that out as well okay cool cool uh now uh [Music] any questions that you have i would love to take them up on the chat for uh two three minutes and then i will resume uh two what kind of questions people are asking come back there okay so there's one question about whether live android coding is done during an interview or not that is during the interview 99.99 actually quote things uh right um when physical interviews zoom well interviews are very exhausting and nobody was gonna make you live code things or uh internet connection and laptop resources nobody takes that risk okay and it's just too much hassle so don't worry about that nobody will ask you to live code uh an android project during the interview itself uh but they might ask you to just open the project up and you know show things and all of that stuff that can uh happen okay so that's answering that question any other questions that you have okay ah let me just cover the question that i had in my mind itself and and and we will move ahead so uh so just uh coming back to my ipad uh just a moment let me get here yeah so yeah uh okay uh what kind of questions uh we'll get asked so the very first thing obviously is uh the activity life cycle and it's it's extremely basic it's like mentioned connecting activity life cycle but still you know uh most of my experience on asking people is many people answer very wrong things in the activity life cycle itself okay so what is the activity life cycle uh and what kind of questions uh you know uh i get asked in the activity life cycle so let's talk about that so let me just go to my display again both famous topically you take android activity life cycle and there is also the fragment life cycle okay so these two things are extremely important to understand and uh more than anything else you should have a practical understanding of it not just you know your diagram attack s [Music] if you look at this diagram what it says is that obviously uh where which kind of code is supposed to be written uh that is something people ask questions on they might ask you model initialize your own create mechanics right let's say there is some observer which is observing the text that somebody has written so let's say there is a text field okay coming back enough as a letter every letter is typed if i start typing g here automatically will appear here okay so there's a live text watcher here now where would you set up the text watcher so these kind of questions will get us so generally you write a lot of your code inside oncreate but for something like the text watcher you would ideally do it inside on resume and you would remove the text watcher inside onpause because your activity is uh not in the foreground when uh somebody is working on some other app so they go to the other app then they come back to your app during this time your watchers should not be enabled because if your watcher is enabled then first of all it can lead to memory leaks so secondly what's the point of that watcher being enabled okay let's say you have another watcher is like you know uh depending on the uh accelerometer of your phone uh some color changes happen or depending on the uh let's say uh the light sensor of your phone how much light is there some color change happening so there is say some true tone shifting that's happening you know true tone these kind of things happen in laptops and mobile these days is if the light is yellowish then your phone screen becomes a little yellow if the light is bluish then your phone screen becomes bluish so that it appears perfectly white to your eyes right if you have written a code like that so where would you initialize that you would initialize that instead on resume and you would de-initialize that inside onpause you would not keep it running across create and destroy you would keep it running only between resume and pause so these kind of things get asked about the activity lifecycle okay and what kind of uh things that you need to clean up at on pause what kind of things you need to clean up at on stop what kind of things you need to clean up and on destroy again these kind of things you know you can go to the net you can uh look up a lot of things theoretically but i would honestly say the best way to understand this is going to be making some apps and then play with the activity lifecycle so uh there is something called you know uh don't kill activities uh so don't keep activity sorry so just search for don't give activities android you would find a lot of articles which explain to you that what this developer option allows you to do what it generally does is that when you go from one activity to another it makes sure that the previous activity gets destroyed so then you go back the previous activity thing it's not in the memory anymore so it has gone through the entire life cycle so making sure that your activity works fine even if you have don't keep activities enabled on your phone right so these kind of things you should uh do and when you do that you would automatically learn the things you will learn the things which are needed to answer the activity lifecycle related questions then there are uh other things like you know uh questions that get asked is you know does on destroy uh get called all the time again people who redirected theoretically might or might not have a correct understanding of it but uh on destroy does not get always called sometimes the app process can get killed uh without on destroy getting called so if there is some code written inside on destroy there is no guarantee that it will run when the activity is stopping okay when does on restart get called a question that i ask and i feel a lot of people get it wrong is that when does on restart get called okay so when there is a stop to start cycle happening then on restart gets caught now uh what happens is that a lot of times uh the app uh might have gotten killed without getting this the on destroyer getting run how would you get to know that so that's what if it has gone through the restart cycle then you know that it was not destroyed but if it has not gone through the restart cycle then you know it has been destroyed and it's a new instance of the activity that has opened up right now so that is something about the activity lifecycle that gets uh asked a lot okay uh then obviously there's the fragment life cycle so fragment lifecycle is again a little more complex so there is actually uh uh the fragment has on create function uh okay uh i don't know if seeing so there is a create function there is a oncreate view inside which you are supposed to create the view of the fragment you have to do the you know in uh and use the inflator and inflate the layout uh after that there is one view created uh then there is on view state restored is also there so which happens when uh the fragment is detached and re-attached to your screen okay then there is a start and then there's a resume so these are uh the view life cycle is the fragment callbacks uh understanding which things map to which things so if a fragment is inside an activity uh when the activity is destroyed will the fragment also be destroyed or will it not be destroyed uh understanding these things so they get more important the activity lifecycle for sd one level is very very important uh the fragment life cycle couple of mistakes if you do that is fine at an sd one level as d2 level it's important that you understand the fragment life cycle also very well because when you're dealing with complex apps you have a fragment you have multiple fragments inside one activity they keep getting recycled understanding the backstack manager of the fragment okay so backstack manager means when you have one fragment inside the activity then you put another fragment on top of it then you put another track on top of it you press the back button what happens uh sometimes if you don't set a background for your fragment if the fragment has a transparent background then if you don't do add so this is something that a lot of people you know uh kind of uh up in their code is that uh they do add one fragment on top of another fragment what happens is through the top fragment you are able to see through the lower fragment that's happening because you have not put a background color you you have not set a background to the fragment okay now instead of setting the background to the fragment what they do is uh they change the add method to a replace method now if you change the items into the replace method then your back button will stop working your back button will not go back to the previous fragment okay so these kind of things whether people understand really the backstack navigation how that works the fragment add fragment replace fragment transactions how they work uh these things are also very important about the life cycle so that's kind of very basic stuff that gets asked uh that is one thing the the next thing that gets asked obviously is about uh the architecture so architecture is again you know mvp mvvm mvc uh these kind of things now essentially what that means is i'll uh talk about i don't know if i can share the screen or something maybe so so do something uh like this i will um okay let's just talk about the mv star architecture and then i will give you this example okay um uh single app architecture or did you mean single activity architecture i think you meant single activity architecture uh so whether or not using single activity architecture that depends uh multi-module app obviously i think it has answered that uh part for you already i know if so pratham you have asked whether somebody will go deep in dagger for sd 1 if you have used inside the project so if you have used they will ask questions but not really really deep uh so you know there is uh like some seriously deep stuff on dagger like how a singleton thread management inside dagger works or you know how to use uh private scoping for uh modules inside dagger so those things obviously will not get asked but it will they will ask you at least you know why are you using dagger what's the purpose of di uh you know theoretical understanding of di whether you have or not that will get asked at an sd one level if you are using dagger okay uh if you know how to use dagger definitely use it it's not like don't you if the project is too simple then don't use it right so i don't use it like when i also give a lot of android interviews just to stay sharp just to stay aware of the industry trends not necessarily just to get a new job but i keep giving interviews the thing is that if the scope of the project is too small then don't over engineer it what happens when you over engineer it you make some mistakes and then people are able to use the you know extra code that you've written to you know tighten your screws don't do that if the project scope is simple keep it simple obviously don't write your code in such a way that modifying it later is not going to be a problem right so keep it adaptable keep it modifiable right uh but but don't over engineer it don't write it in such a way that you know it is written like the code is written like something of 10x the scope of the problem statement that you have been given okay uh by the way android interview questions there is one repo uh it's a good repo by a very good friend of mine amit shekhar so he runs my docs and he has made a repo called android interview questions there should be one the mind docs one so this is also good good you know place to go and look at android interview questions this is uh very well maintained uh as well uh in fact if you want even contribute questions to it as well so questions related to core android questions related to libraries architecture design problem those kind of things are there so like i was saying uh so here you can actually find a good list of places from where you can uh learn what is mvp what is mba vm what is mvc uh you know uh understand mvi these kind of things so architecture is something that gets asked just after the activity life cycle and the fragmented lifecycle part next thing uh the the architecture gets asked so i'll uh talk about aggregation oh by the way my screen is not getting shared i'm sorry um yep so this is the repository uh if you just search for you know uh android interview questions you will find mind docs open source android interview questions and this is the repository it's a very famous repository has 6000 stars you should go and bookmark this repository as well uh like i was saying and there is core android questions and then questions on android libraries question on android architecture design problem uh those kind of things are there cool so this is a this is a definitely good place to uh check out what kind of android interview questions come they have answers also along with that and if possible you can contribute your own questions and answers to it would be great it will be it's a nice open source repository everybody should contribute and maintain it i believe uh people who ask android interview questions they often go and look at this repository and find out questions to ask as well like it happens right you know with dslr questions people go to gfg not just to look at answers but interview people who are taking interviews they they go to gfg to uh find out questions as well so right uh it's kind of like that um now talking about what this mv star stuff is right so you know so as architecture goes so there is obviously you would find most architectures are written in form of m v and something okay so this something can be controller it can be presenter it can be interactor it can be view model okay but tomorrow somebody can come up with something else as well now what it essentially means is that your app would generally uh be something like this that what you see on your screen right what you see on your screen is that it's a twitter kind of app so you know people's tweets their photo their title and then the content of the tweet and then there is the like button and then there is the whatever you know something something button like that and there are multiple tweets like this so every tweet has a username and then the text of the tweet and then there are some buttons below it like that okay this would be coming from an api right so there will be some api uh you make a get request to slash tweets and in response what you will get is you will get an array this array will contain objects each object will contain these these things the title body description after all that stuff so this has to be shown on the screen here this has to be shown on the screen here that's essentially what you're doing when you're making an app right so where is the architecture that comes into the picture in this case right so let's talk about that so what you generally do is you will write uh some code uh which is to fetch this data you will create something like you know twitter api kind of a class okay now twitter api class is actually going to make these api calls and fetch that data okay uh the data that would be fetched uh these maybe you have a tweet dot java class or tweet.kt class which is a data class which represents each tweet okay this array is basically an array of tweets okay so this is the response class and all that so these things are basically called your model okay so these things are called your model so model represents the uh data structures and the code which deals with the data of your project okay and you would have obviously something like you know home dot home activity dot kt inside that you might have a feed fragment dot kt so these things are going to be your view okay so the layer of business logic is called which will deal with what so as soon as we click on the like button some api call needs to go you know there would be some api called post request will be made to slash tweet slash some tweet id and uh slash like so there's how a like request is made okay so when you uh you know try to reply to a particular tweet in that case another post request is made to slash tweet slash tweet id slash replies okay so whenever this button is clicked this api call is supposed to be done when this api call is supposed to be done the response is supposed to be updated and added here right so uh this logic would be driven by something here okay this something here is gonna be one of these things it can be controller it can be presenter it can be interactor it can be view model now there are different ways we can deal with uh how these interactions happen so [Music] so i will update the model accordingly then model uh data will come and you know refresh the entire view so this is a one-way data flow okay there could be another way is that okay uh we have got the model uh right we have got the view so we keep this i know array of uh entities here right so in a view if i update something the action will take place but the view will get immediately updated whenever the model gets updated it will replenish the data inside my you know the repository wherever my tweets are stored or my local tv wherever it is stored so step one this happens step two immediately the information is updated in the view step three the actual api call happens and when step three fulfills then step four this happens in this case it was like step one this then step two then step three now thing is that if this api call somehow fails because internet problem okay but here in the view the data has already been updated you can see that twitter actually uses this kind of a model how can you see that go to your twitter app if you use twitter and go to anybody's to it okay and then in the heart button double click it instead of clicking it once you will see that the count increases by two okay so that's not supposed to happen right white increases by 2 is that every time you click on the heart button it immediately does plus 1 and it changes the color from blue to red okay it immediately does that and it does this part of the job later on in the background if this part of the job is fulfilled okay then it will update the number again properly later on so what you can do is you say some to it has 10 likes you go and double click it it will become 12 you will see that immediately today right now you open your twitter app you can see it happen okay if you know anybody you can check it out and tell me on the chat do you see it happening or not okay now uh what will happen if you just it will go from 10 to 12 right you just crawl up the tweet and then scroll down come back to that same tweet you will see that now the state is liked it is blue to red it has happened because you have liked it already but the number would be back to 11 because by now twitter has actually synchronized the data with the backend and they know that the number is 11 it's not 12 anymore okay so this is two-way data flow they are doing they're immediately changing the data on the view but they are synchronizing it from the back end later on one way data flow is means that you know uh some apps you will see uh that if you try to make a post or something like that uh so with facebook twitter what kind of these apps it happens if you even make a new to it it will show it will appear as if the tweet has already been posted but in the background they're still trying to post it even if you don't have internet you can still make a tweet later on when you have the internet the tweet will be posted okay there are other apps like a banking transaction you would not want to do something like this you can't you know double minus the amount from somebody's bank account just because they are pressed on the pay now button twice okay so in those cases you want to make the api call the api call will succeed then only the fresh data that it comes you will update on the view that's one way data flow so in one way data flow there is more data integrity but the speed is slow this two-way data flow data integrity is low sometimes you see wrong data on the screen compared to what actually in the db is there but the speed is faster okay so it depends on what kind of data flow you want you can create observables inside your view model or you can use a presenter pattern and you can do an interactive pattern inside that presenter so there are these architectures that's why they are used okay now uh so you know tested on my tweet itself okay so people have already tested and you can see it increasing by two right so uh i'm not going to go deep into you know the architectures right now here i mean at coding blocks we have a course where we do it in depth i can make a small series of videos on youtube as well on this because it will take more than five minutes ten minutes inside this one video it will take more time than that to explain uh what different architectures are you can go to the you know the mind box page that i showed and you can learn about architecture there as well but that this is what architecture related questions are going to be like so somebody might ask you why you're using mvvm and then the advantages are not just one-way data flow versus two-way data flow how you test the view model or how you test a controller or how you test a presenter how you test an interactor they are all very different so writing tests for them are also going to be very very different now as a sd1 i would just expect somebody to be able to know the architectures if they have used one particular architecture they should know the advantages of it as uh an sg2 kind of person i would want them to be able to uh you know tell me proper pros and cons of the architecture versus some other architecture why they have not used the other architecture why they use the current architecture and the answer should not be like a lot of people answer the trend that's the worst answer you're not gonna get selected if you answer something like that if you do anything right if you do anything because uh it's in trend or up in a block but i have challenge without actually applying rational thought behind it it's you're not going to get selected by giving such kind of an answer so you should be able to explain why a particular architecture you are using what benefit does that architecture have and why not some other architecture and if you are at sd2 level then you should be able to un explain why how your architecture whatever you are using now mvb use curve mvc use core and vpn the particular architecture that you have used as a testing okay uh a three three party has a question can i apply an android fresher for jd which wants two to four years experience but i did android with several for two years in college do those years count very good question [Music] when i was in my college i uh had worked with some big companies already micromax phones operating system i had worked on that sony phones operating system had work not just apps that actually opened operating systems so i used to think that whether i can apply for jobs where they ask for uh you know already uh some number of years of experience so i applied to some startups uh some remote jobs i got through a few of them as well when i was in my college uh so uh it yes today the situation is even better my background two thousand uh fourteen fifteen sixteen cases uh my time when i was in college now it's been four five years more situation is even better uh people are not gonna be like you know there are very rare companies which have a hard bound on actual graduation at 2020 so 2022 those companies are trash don't apply to those companies those companies okay the companies which think uh in these kind of terms who are doing mathematics like this them don't go and work for them your life will anyway be held okay most other companies uh if you are able to actually show experience of really working on production grade projects okay this is very important just by saying two to four years i have worked does not mean your side projects your major hackathons you have gone actually internship you have done in some startup which has production level app on the play store already that kind of experience if you have two years you can apply to a job which has two to four years experience written inside the jd that you can definitely do there's not gonna be any problem related to that okay uh okay cool uh so anything else let me come back to other questions um what other questions do we have okay um will activity lifecycle stuff be replaced with jetpack compose no jetpack compose does not remove activity lifecycle jetpack compose removes the way views are created but does not remove the way fragments and activities are created so activity lifecycle will still be important even if you work with jetpack compose okay [Music] flutter or react native somebody is asking so uh flutter react native uh if you know react already uh so this is not related to the kind of video i'm making right now yeah native android interview questions but still somebody asking that i'd like to quickly answer that question uh flutter or react native is a very simple answer of letters uh it is a better framework than react native uh and performance better at the authority react native say code better you know uh you want to quickly learn how to build an app then react native could be a better choice in that case and you want to start then i would say flutter is a better option okay that's uh my opinion i am not very experienced in either react native or flutter flutter i've made some apps react native i have just tried it out once not very experienced so take my advice with a pinch of salt uh ask somebody who is an expert in one of these two things okay so i prefer to talk about things only that i know about right so uh then obviously yeah uh coming to what other kind of questions that get asked so concurrency is something that is a very important topic that uh you know questions get asked about uh concurrency okay so activity life cycle okay architecture okay uh if uh you are at an sda2 level then uh dependency injection keeper questions uh like why dependency injection is supposed to be used what is the purpose of it uh you might have used coin in your project they might ask why coin and why not dagger if you might have used dagger in your project they might if you use white dagger why not something else these days there is hilt hilt is used with dagger to write write even less code okay so dagger is a bigger topic to learn i made uh you know so what what does di really do is the code to initialize classes is separated from where it is getting used so that is what di essentially is let me um bring that my screen up uh so i think i think so you would see something like this i have written inject imgur api so injecting good api so i need this api object okay and i why do i need that object uh uh um so why do i need the am good api class because uh you have a share many unique yeah uh somewhere else i might have used let's see um i think view model middle english as use case or maybe this code is not yet uh updated uh probably uh i've used that to put it inside the view model uh repository i'm not sure if there is um oh yeah so actually i used to have done good dot api like this directly actually the di1 i had not completed writing that code actually uh so if i needed that imgur api in multiple places so here manuka i have created a static object which is not a good thing because i have done in good.api this is a static object that exists inside this place in my class here so i've created this api object in one place and i'm using it a thing is that this is a static object that's globally available across the app but if i needed separate instances of it at different different places then i would have to write this part of the code retrofit is created using this and then the client is cleared using this so this entire code i have written it one place and made it static and global across the app which is not a good pattern for a bigger app it's better that this code gets run at the runtime so dependency injection what it does is that you create a function which tells how to generate the api okay and then wherever you need the api you essentially write this kind of a code you write inject imgur api the api is generated here automatically how this actually happens is when your code is getting built there is a transformation that happened during the compile time so extra classes are created for you during compile time you don't write those classes they are created by dagger so dagger will create some extra classes and functions that will make sure that this api object is uh initialized inside activity okay so again dependence injection you should study about it properly it's a big topic it takes weeks and months to learn it first time when you're learning it it's not something easy to go so i don't want to you know just give you an overview here it will give you a fake kind of knowledge it's better if you understand it properly rather than like this ah but yeah so di based questions would be there is you know there is something called scope as well so a scope tells at what level the item is supposed to be injected can it be injected at an activity level can it be injected as a single object across the entire app whether it be a global singleton whether uh you know at every activity i need a separate copy of it so these kind of things are set using scopes so understanding scopes inside di understanding modules and components models are components are used to you know create the basically dependency graph so to uh want object a i might need object b because object b is part of object a so where will i get object b from so that is created using modules and components so understanding that is important and at sd2 level its dagger is actually kind of important to know because most companies at a bigger scale apps they're working on they would be using daggers in their projects so uh dagger is kind of uh you know important in those cases okay um okay coming back to what other topic uh you know so then there is concurrency okay so what does concurrency mean uh multi threading basically now concurrency is a big topic and there's going to be a lot of questions about it so it's going to be about you know how to do some task in the background thread how to make sure that your ui thread is not blocked how to make sure that when you're doing concurrency then memory leak does not happen how to make sure that race conditions don't happen how to make sure that if your code is getting run in parallel it does not interfere with the code that is running inside your ui these kind of things start happening i can give you a short example about it by the way is you know let me come to the screen let me look at accordingly right so this is some existing code right if i tell somebody if i want to make like this that you know there is my activity activity activity where is it right so let's say i want to create a button clicking on that button after 10 seconds i want to show something on my screen i want to change the background color of the screen or something like that okay so let's just say uh we have this activity main right uh we have the background of the app this is the drawer layout is the background of the app or something like that so let's just say that you know we we have let's say article fragment is there okay let's say we are going to create here okay or inside main activity itself let's just say so we have let's say a button let me create inside this thing wow so let's just say i've created a button which big in size or something like that we'll figure that those things out but what happens is in that case i can have this you know now on clicking this button i want after 10 seconds the background of the activity to change okay so after 10 seconds i want this thing to happen ah this drawer layout is there right so let me i want that you know binding dot drawer layout dot set background color uh color dot red okay but i want this to happen after 10 seconds okay if i ask that generally most of the people would write this code they would make you know they would create a handler and then they will do dot post delayed right and inside post delayed after 10 seconds they will write this okay now what can go wrong in this kind of a code uh these kind of things do get asked so first of all if after so this will wait for 10 seconds before running it and after 10 seconds okay so uh somebody can write like this that's fine so after 10 seconds if when this code is getting executed what happens if i the people will ask them further questions like i click on that button but before 10 seconds is complete i close the app what will happen okay you can close apps also in multiple ways but what will happen if i click on this button and after 10 seconds i go to a different activity what happens if i click on this button and before 10 seconds i swipe away the app from my recent screen okay then what will happen okay uh will this cause a memory leak right so these kind of questions can be uh there if somebody says okay don't do it using a handler do it using a new thread so uh you know uh run the delay or something like that let's say there is some function which takes 10 seconds to operate okay so i do that using a separate thread so i do you know ah like this while t equal to uh create a new thread okay then i do dot t dot uh run and inside this run i call some you know ah some function that takes a lot of time and after that if i have to do this change here right now this will fail because uh changing the background color does not work inside the uh on a thread which is separate from the ui thread now this is a different thread so inside this thread if i'm trying to run this uh then uh you know the changing of the background color will not work so i'll have to put it inside something like you know run on ui thread so it'll be a function called around ui thread and this has to be done inside it here again here the question will come is that you know uh before this function call has ended before the thread has started ended my activity has been shut down so in that case run on ui thread will fail actually you will find the network error inside there as well or concurrency errors can happen there so people will you know make complex situations like this they will give you a thread they will give you a handler they will put the you know ui changing code on a different thread tell you to come back to this main thread and do it and then ask you whether there is a memory leak here or not so that's how considered questions are asked and again this is something that you will have to spend time on uh yourself manually uh to try out these things and tinker with them try to run like you know let's say there is an app where you are trying to find out the first 1000 prime numbers so that is an operation that takes time right so first one thousand time numbers if you have to find out probably less time so first ten thousand prime numbers so first ten thousand times if you have to do it will actually take a significant amount of time on a phone right it will take that amount of time so you do it in a background there now after doing it to the background side you print all these numbers on your screen okay just try and make this app and you will understand how to work on concurrency better so take an input from the user n and then for print the first n prime numbers very simple app so the operation of doing those in prime numbers you should do it in a background thread okay you should print out the final result and all you should print out back in the ui thread okay now between these two operations if the app has gotten closed how to handle that so those kind of things uh they will come to the picture in the uh concurrency side of things cool [Music] so a three has another question i will take that up so will knowing the newer dagger hilt in place of dagger android and flow state as a replacement for rx java be acceptable in my interviews uh it's a good question i would like to answer it by saying one thing uh things that have been introduced into the android world in the last one year at any point of time i'm not saying specifically 20 20 while a year i'm saying if we are talking about 2018 then things that were introduced in 2017 if we are talking in 2019 then things that were interesting right so things that have been introduced to the android world in just the one year previous last year those things if you don't know but whatever problems they are supposed to solve for example hilt is new but before hilt dagger android was there before that plane dagger 2 people were using right so when i make projects i don't use dagger android i use plane dagger these days i use hilt in in projects at target also we are using hilt in our project okay uh at zomato dagger was not used there was no dependency injection it was a very big app but on dependence is not used it's not necessary that everywhere dependence injection is getting used okay so in an interview you are not going to be judged in a bad way or a good way either way for knowing the new things or for not knowing the new things as long as you understand what problem that thing solves and you understand how that problem can be solved using something else as well so that is fine okay dependency injection kick or any other those kind of people can often use service locator pattern they might have a function which is like you know create api function written somewhere inside their app they call create api pages created it's called service locator pattern so let's look at the pattern queue for heat dependence injection brow dependence injection makes it ah easier to do the service locator pattern right so those things are fine similarly like if you're using uh state flow uh instead of live data now if you're using it by the way latest stuff you're using it i will definitely ask why have you used state flow why have you not used live data and what benefit have you got in it and you should be able to give me a convincing answer more than your shiny new thing so merry christmas right that is a very bad answer if somebody gives such answers i generally do not you know take them to the next round uh they should be able to tell me okay i was trying it out because i saw that with live data you know memory leaks can happen view mode tying into the view model is important state flow i can use with mvp as well with mvvm as well so i use that good explanation if you can give that's fine okay that's the important part cool um so so so uh rx java versus co routine somebody is asking again if you are starting today if you're using kotlin already the new score routines are java's thing of the past today some of the biggest apps in the world they are already using alex java by saying thing of the past it does not mean we use the utah it just means that new projects don't use it anymore at target we use rx java in the entire app but we are changing to core routines we are we are going to be wiping away complete ourselves from the project and i think this year it will take hours the whole year because so we will remove our example slowly slowly across the entire app and turn it into core routines uh when i was at tomato that was one year back i was leaving so already co routines were starting to getting used in some places inside the app so rx java was not used at zomato uh you know uh threads and they were manual executors and uh you know thread pool executors and dispatchers were used rf java as a framework was not even used there so as the amount of people moved directly to core routines itself alexa was never there so yeah uh if you are already using rx java you should start seeing how core routine plus flow can work core rooting plus float together gives you a replacement for rx java okay uh but if you don't want to focus on core routines right now if you already know rx java you can give android interviews without knowing core routines uh very well that is fine there is not gonna be any issue on that okay so not having prior intern experience in android what type of projects i have to make to work with the startup uh i i would heavily suggest heavily suggest okay very big way i would suggest here uh at least internship experience okay otherwise yes you can make personal projects as well so uh if you have done an internship at a company where the app is at least out on the play store but it is out on the play store that is a very big point if not then make a personal project end-to-end ideas put it up on the play store spend that fifteen dollars that you have to spend student could disconnect therefore making an account these days and put that app on the play store so the knowledge that you can make an android app end to end not just matlab uh you know write the code for an android app right looking at a tutorial mirror course be accounting but you don't have only that knowledge you can actually make the app publish it deploy it to the play store your knowledge here showing that is very important so i would heavily suggest an internship if possible two three months do somewhere on android project even if it is not very highly paying of the project is not exciting but you will get an idea how to work on a production project if not then definitely make one project of yourself and put it on the play store okay that is gonna be a very uh big deal okay scope of the project again the like the ones i showed github trending repositories key listings these kind of things those are perfectly fine uh right to uh to create a small project that is gonna be fine okay uh so if you're starting android now which architecture should you start with um so it is a subjective thing i would say mvp mvi or mv vmt you know both architectures hey i would suggest you start with mv vm because learning materials absolutely available here because google is pushing for mvvm and as a result more learning multiple nvme is available so start with mvvm as an architecture when you're starting android development today okay so that would be about the architecture question um so it has been a while as well i think one hour 15 minutes over here i would end this video as well because you know uh long sessions when we are live is great but then later on when somebody sees the video then it is too long uh i would end saying it if anybody wants to in the comments write down the timestamps uh you know i would be very very thankful next video i would give you a shout out if anybody wants to write down the timestamps and then i would not have to go and manually find out my own timestamps if somebody can do that please do that write down in the comments i will add it in the video description because uh 1 hour 15 minutes having timestamps is going to be very uh useful uh so if somebody can somebody has watched the entire video and if they are seeing this part of the video then please help me with that you can do that um so so uh other questions uh you know guys uh so do two things one uh please join uh cb dot lk slash discord okay so we have a discord channel on cbs live discord there is a uh android uh there is a android channel inside that feel free to ask any questions there uh you can write down questions uh in comments under this video as well i would uh be happy to answer to all those questions we can do another part two of this same session android interview questions i think a lot of topics are still left i know but i don't want to make this one video too long i i can make another one sd two volume questions or depth may or we can do some mock interviews and one more thing if anybody is interested let me know on discord you can tell me if anybody is interested to do a mock interview of android and if you are okay with your interview being uh put up on youtube uh you know so i don't know when i asked about the resume host i did not think a lot of people would want to submit their resumes to get roasted but a lot of people did more than thousand people did manage uh resume episodes but i would probably make more uh but if anybody is interested to you know sit for a mock android interview with me and if you are okay with that interview being put up on youtube uh you know so ping me let me know uh we can do a mock android interview i will give you a take home assignment give you uh you know two to three days time you come with that uh project uh and submit that and we will sit that round one like i was saying you know round one is we'll discuss the project with you so we'll do that round one interview uh anybody who's interested in doing that uh on the discord channel on the android group android channel let me know in the discord server that you want to do a mock interview with me uh right so we can actually set that up that would be pretty interesting for full stack dev live interview question uh interview questions rohit we have another session like today's one day after tomorrow right uh so on uh saturday is thursday right so saturday uh uh no not sorry it will be uh like uh wednesday actually it has become saturday now so friday night basically so friday night uh there is uh another uh you know uh session uh that will be on node.js similar things i will be covering uh interview questions that i asked not just people again sd one kill level pick up push numbers on javascript questions and all of that stuff so we're gonna be doing that uh on friday night and like i said if anybody is interested for mock interviews so i will go and do that uh you guys go and you know if those who are gonna sleep go sleep uh otherwise go and you know uh study uh android related uh stuff if anything else you want to learn uh feel free to ping us on the discord channel any questions that you have me pulkit project maintainer would be happy to answer your questions right so thank you for turning up uh hope this helped any other questions feel free to ask us meet you again day after tomorrow night okay have a nice day series for di we can do that definitely we can do a series for di uh that's a that's a good uh you know suggestion so discord link i'll just put it once again it's cb dot lk slash discord i'm just putting it down in the chat okay uh discard link i have put in the chat once again you can just go through that cool okay guys good night uh have a nice day meet you again
Info
Channel: Coding Blocks
Views: 43,197
Rating: undefined out of 5
Keywords: how to learn code for beginners, programming, coding, learn code online, learn code, programming courses, coding for beginners, how to learn to code, coding courses, coding programs, how to learn coding, how to start coding programming for beginners, coding blocks
Id: uXYqLh7nikw
Channel Id: undefined
Length: 79min 43sec (4783 seconds)
Published: Wed Feb 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.