Frequently Asked Interview Questions And Answers For Android Freshers

50,000+ Students Trained, 19+ Our Offices, 18+ Courses Offered,

Job Guarantee + Job Satisfaction, 2000+ Company Tie Ups For Placements

Android Interview Questions For Freshers

Most Important Question:-

 
  1. 1. How to move from one Activity to another Another Activity in android?
Ans: In Android we can use  Intent’s object with its initialization using current Activity’s context and another Activity’s class name.  
  1. 2. How Activity LifeCycle Works in android ?
Ans: When Activity starts,first OnCreate() method will be called where activity enters in the created state than OnStart() method will be called where activity gets visible to user and  than OnResume method will be called where app interacts with the user.When Activity exits first OnPause() will be called as a indication that user is leaving this activity than OnStop() will be called where activity is no longer visible and than as a final call OnDestroy() will be called where activity gets completely destroyed.    
  1. 3. How many types of parsing in Android and which one is most popular?
Ans.  In Android there are five types of parsing –
  • Soap parsing
  • XML Parsing
  • XML pull parsing
  • DOM Parsing
  • SAX parsing
Most popular Parsing in android is JSON Parsing.  
  1. 4. How to call apis in Android Application ?
Ans : Api calls can be done using external libraries like Retrofit,Volley and OKHttp or we can also use AsyncTask as a helper class.  
  1. 5. How to Attach Fragment to Activity in android Application ?
Ans: We can perform it in two ways,
  1. By declaring in XML and give the path of class in it.
  2. By declaring a frame layout and using LayoutInflater class inflate the layout in it.
    MySql Questions :  
  1. 1. Write sql query to update employee name in table with where cust_id is 3. ?
Ans : UPDATE customer set c_name=”JOHN” where cust_id = 3;
  1. 2. How to modify Column name of table?
Ans : If table name is customer in which we want to modify column name salary to c_sal, ALTER TABLE customer CHANGE salary c_sal int(9);
  1. 3. What is the Difference between truncate and drop command in sql ?
Ans : Truncate will remove record of the table with  structure and it will recreate the table structure  where Drop will remove Record and Structure both.
  1. 4. How to retrieve top 3 records from table ?
Ans : Select * from customer LIMIT  3;
  1. 5. How to get average of rating column from table ?
Ans : Select AVG(ratings) from table_name .  
  1. 6. Write a sql query to set primary key on id with auto increment.
Ans : ALTER table customer MODIFY c_id int PRIMARY KEY AUTO_INCREMENT;    
Core Java Questions :  
  1. 1. What is Object Oriented Programming Concepts .
Ans :  OOP’s provide the below concepts –  
  • Encapsulation
  • Inheritance
  • Polymorphism
  • Abstraction
  • Data binding
  • Message Passing
  1. 2. What is Encapsulation? What is class and Object?
Ans. Wrapping up of data members like variables and functions or methods into single entity is Encapsulation. Class is example of Encapsulation because it is single unit or entity in which Variables and functions both can define and declare. Also class is user define data type. Object is instance or member of class through which we can access other members of class like variables or functions.
  1. 3. How we can use multiple inheritance in java ?
Ans: In java we can use Interface to implement multiple inheritance.
  1. 4. What are the Access Modifiers in java ?
Ans. java provide restriction on sharing of data between two classes for safety and security purpose. There are 4 access modifier in java like –      Public : Any class can access other class ‘s public members without inheriting that class. Protected: Only subclass can access protected members of its super class even if they both are in different package. Default: Subclass can access protected members of its superclass but both class file should be inside same package. Private:  If any class have private members then it is only accessible by its own object. Even Subclass of that class cannot access those members.
  1. 5. What is Abstraction? Explain abstract class and method in Java.
Ans: Data hiding in Java is achieved by Abstraction, it shows only necessary data to user while it will hide the background process. In Object Oriented Programming, Object will executes the logical information. Abstraction will let you know what object does without showing how it does. Abstract class: To implement abstraction feature we need to use Abstract class and Methods. If any class contains any abstract method then that class must be declare with abstract keyword. Abstract Method: method which does not have implementation at time of declaration, it means abstract method does not contains any body part and declared with abstract keyword. Implementation of this kind of method will be inside of subclass when we inherit abstract method’s class.
  1. 6. What is Heap in memory ?
Ans: Heap is memory space which virtually allocated to objects at runtime.
  1. 7. If there is class mom and dad and son want to use their property so, he can use the property of mom and dad class ?
Ans : We use multilevel inheritance where mom and dad class are connected, then Son can use both class’s properties by inherited any one. Father   Mother   Son   Op. A
  1. 8. What is GC (Garbage Collection)?
Ans: Garbage collector is used to collect unused objects of class and it will free heap memory which is allocated at time of object is created. It will systematically called, no need to define inside program.
  1. 9. What is polymorphism?
Ans: Polymorphism is concept which meaning is multiple form. Object can take multiple form and behaves differently. Ex. Person, He/she is father/mother/son/daughter at home, at workplace He/she is boss/employee,
  1. 10. Difference between OOPS and POP ?
Ans: POP Means Procedural Oriented Programming Language is procedure or function oriented where function will call another function. Where In OOPS – Object Oriented, Object is main entity. Each data members and functions will be inside of the class, and object.
  1. 11. Where we can use OOPS concept in Android Project?
Ans: In Android, every activity is Java class, every components have Listeners of Java, Adapter classes are also used in android.
  1. 12. What is Inheritance?
Ans: Inheritance is concept to use parent class’s properties and methods into child class without creating parent class object. Java supports single, multilevel and Hierarchical inheritance.   Android Questions :  
  1. 1. What is Android ?
Ans: Android is Linux based Open source Mobile operating system used in Smart phones, Tablets, TV, Automobiles, and Watch etc.
  1. 2. What is view Android application?
Ans: View is base class of widgets, Rectangular area of screen. View is responsible for drawing and event handling.
  1. 3. List of out the each method of Activity lifecycle in android ?
Ans : In Android application have the below stage of life cycle method –   
  • OnCreate()
  • OnStart()
  • OnResume()
  • OnPause()
  • OnRestart()
  • OnStop()
  • OnDestroy()
  1. 4. List out the Fragment lifecycle in Android ?
Ans: Following methods will generate on different stages of fragment lifecycle.
  • OnAttach()
  • OnCreate()
  • OnCreateView()
  • OnCreateView()
  • OnViewCreated()
  • OnStart()
  • OnResume()
  • OnPause()
  • OnStop()
  • OnDestroyView()
  • OnDestroy()
  • OnDetach()
 
  1. 5. What is Difference between linear and relative layout in Android ?
Ans: Linear Layout – it will show sub layouts in Linear form (Vertical and Horizontal) . Relative Layout: This layout will set its components by relating to each other and also by giving dependency.
  1. 6. How to set two layout which equal width and height on View in Android ?
Ans: With use of Linear Layout we have weight attribute to set equal height and width.
  1. 7. How many Components in Android which are using to build an Application?
Ans: When we create android application below components will be used –  
  • View
  • Activity
  • Service
  • Broadcast Receiver
  • Content Provider
  1. 8. What is Service in Android ?
Ans: Service is background task of any application which runs in background.
  1. Downloading task, MusicPlayer Task.
  2. 9. What is intent in android Application ?
Ans: Intent is object which defines to execute any action intentionally. Two types of intent in android. (i) Explicit Intent: this intent define when we want to call another activity from current activity in same application. (ii) Implicit Intent.
  1. 10. Which class is using to complete long task in background?
Ans: We can use below class and method to complete long background task –  
  • AsyncTask with help of its three methods,
  • onPreExecutes
  • onPostExecutes
  • doInBackground
  1. 11. Where we can store offline data in android Application?
Ans: Data will be stored in local database using SQLite.
  1. 12. What is Gradle in Android?
Ans: Gradle is script in which we define third party library dependencies, class paths and it will compile all files without project.
  1. 13. If you have to use services of any online shopping website so you have to configure in every activity or to create any class file?
Ans: We can define service handler class to establish HTTP Url connection, then in each activity where we want to show data from database we just change URL of our web service API.
  1. 14. What is view pager in android Application?
Ans: The View Pager is providing swiping gesture in android, ex. Tab Layout.
  1. 15. Difference between picaso and glide Library in Android ?
Ans: Picasso library can only load image, where glide can also load gif format.
  1. 16. What is GSON in Android ?
Ans : GSON is converter library, which convert Json array and objects when we work with retrofit.
  1. 17. What is JsonParsing ?
Ans: Json is stands for Java script object notation, format for data exchange from server. In android, when we work with online database, we need to convert table data into JSON data, and to manipulate those data Android provide different way for JSON Parsing. HTTP Url connection, Retrofit,Volly etc.    
  1. 18. Difference between activity and fragment in Android ?
Ans Activity is direct user interaction screen in which all components and events are generated. Every application has at least one Activity. Fragment is part of an activity, which inflated on activity’s layout. We can use multiple fragments inside single activity. Fragments are faster in transaction than activity.
  1. 19. Can we use more than one fragments in single activity ?
Ans: Yes.
  1. 20. How many data we can get from facebook api ?
Ans: Using graph library and Profile class, we can get all information of user.
  1. Name, firstname,lastname,profile image, middle name
  2. 21. Which 3rd party library you have used in Android ?
Ans: Retrofit, Picasso, Glide, volly.
  1. 22. Why use Retrofit in Android ?
Ans: Retrofit will return appropriate response very faster than HTTP, Volly.   Practical Questions:  
  1. 1. In Hangout application if data is more than 5000 at that time which adapter view is the best for memory management ?
Ans: Recycler View
  1. 2. Write code for fetching json array in Android ?
Ans: JSONArray array = new JSONArray(result); for(int i=0;i<array.length;i++) { JSONObject object = array.getJSONObject(i); }
  1. 3. How to display json data in recycler view ?
Ans: RecyclerView rv; rv = findViewById(R.id.rv); rv.setLayoutManager(new LinearLayoutManager(this)); // make adapter class with layout to set data from arrayList. CustomAdapter adapter = new CustomAdapter(this,arraylist); rv.setadapter(adapter);     
  1. 4. How to Implement Clear Top Activity in Android ?
Ans:      Intent a = new Intent(this,A.class); a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(a);
  1. 5. Write code to implement for SMS Send Using SMS Manager ?
Ans:      Intent intent=new Intent(getApplicationContext(),MainActivity.class); PendingIntent pi=PendingIntent.getActivity(getApplicationContext(),0,intent,0); SmsManager sms=SmsManager.getDefault(); sms.sendTextMessage(“9898098980”, null, “Android Code”,pi,null);  
  1. 6. How to implement Broadcast receive Using Send Broadcast
Ans:   public class MyReceiver extends BroadcastReceiver { public MyReceiver() { } @Override public void onReceive(Context context, Intent intent) { // This method is called when this BroadcastReceiver receives an Intent broadcast. Toast.makeText(“Action: ” + intent.getAction(), Toast.LENGTH_SHORT).show(); } }   <receiver android:name=”com.pycitup. android:enabled=”true” android:exported=”true” > <intent-filter> <action android:name=”com.pycitup. /> </intent-filter> </receiver>   IntentFilter filter = new IntentFilter(“com.pycitup.); MyReceiver myReceiver = new MyReceiver(); registerReceiver(myReceiver, filter);  
  1. 7. Which two method will be Override from SQliteOpenHelper ?
       Ans:
  1. OnCreate()
  2. OnUpgrade()
  3. 8. How to Implement Realm Object in Android .
Ans: Class Data extents RealmObject { int id; String name,address; }  
  1. 9. How to Call Stickey intent in Android Application ?
Ans: public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); startTimer(); return START_STICKY; }

Tips & Tricks

Latest Blog

Which country is better for Indian Students for Study Abroad?17th November, 2018

Canada is among the top destinations for students who choose to study abroad. Students prefer Canada

How to migrate to Canada?17th November, 2018

If you have considered moving to Canada, either you already are on the path to apply for a PR throug

Study Abroad with Minimum finance17th November, 2018

For many Indian students aspiring for high-quality education abroad, scholarships become a great h

How to Become a Good Designer?8th October, 2018

Graphic, Web, Animation, VFX, UI, UX There are plethora of options for a designer to make an amaz

Is Digital Marketing a Right Career For You?2nd October, 2018

Digital Marketing is an industry in itself that is growing rapidly since its inception. And since th

Our Events

Gyanmanjari Institute Of Technology Industrial Visits on 30th June 2018

Gyanmanjari Institute Of Technology Industrial Visits on 30th June at TOPS Technologies TOPS Techno

Android, Laravel, Python, Java and iOS Workshop at TOPS Technology

Android, Laravel, Python, Java and iOS Workshop at TOPS Technology We are happy to share that once

Project Documentation Workshop at TOPS Technologies

Project Documentation Workshop TOPS Technologies have organized “Project documentation” worksho

Final Year Project Documentation Workshop

Final Year Project Documentation Workshop Project Documentation, Project Definition, project Submis

Industrial Visit in the month of March and April at TOPS Technologies

Industrial Visits in the month of March and April at TOPS Technologies TOPS Technologies always bel