Android Interview Questions and Answers

In this tutorial, you’ll learn Android-specific interview questions and answers. By Evana Margain Puig.

Leave a rating/review
Save for later
Share
You are currently viewing page 4 of 4 of this article. Click here to view the first page.

What Is the Difference Between a Class and an Object?

A class is a blueprint or template for creating objects. An object is an instance of a class.

Classes don't contain actual data. Classes can have sub-classes, but once you create an object, it remains an instance of the class or sub-class you created it from.

Seal with Kotlin logo

What Are Data Classes?

A data class in Kotlin is a special type of class that exists only to contain data. You declare a data class by providing the name of the class and its attributes, as in this example:

data class Cat(val name: String, val age: Int, val furColor: Color)

This special construct in Kotlin provides standard functionality with minimal coding. Behind the scenes, Kotlin generates getters and setters and an initializer for you. Then you can get on with creating and modifying instances of the object!

For a deeper dive into data classes, see the Data Classes article in the Kotlin Language website.

What Is Encapsulation?

Encapsulation is a primary concept of Object-Oriented Programming. It refers to the bundling of an object with its attributes, state and operations. This simplifies code and protects data integrity.

What Are Visibility Modifiers?

Data encapsulation allows you to control how objects and their behaviors are exposed outside the object. This is called visibility. In Kotlin, there are four levels of visibility, called visibility modifiers: public, internal, protected, and private. The default is public.

For more information about Kotlin's visibility modifiers, review the Visibility modifiers article in the Kotlin website.

Where to Go From Here?

In this Android Interviewing tutorial, you reviewed the most important topics you'll encounter in an interview, regardless of your level. There are many other topics you may want to review. See the suggestions below for some other resources.

Design patterns are a very broad topic on Android. Most interviewers will ask you which ones you have used, and they'll ask you to describe a couple of them. Visit our Common Design Patterns for Android with Kotlin tutorial to learn about them.

It is common in interviews to have whiteboard questions related to data structures and algorithms. This is a huge topic by itself. We cover all the associated topics in our book Data Structures and Algorithms in Kotlin. If you have a coding interview, make sure you review these topics!

And if you are interviewing for a more advanced role, you may get architecture questions. For acing those interviews, take a look at our Advanced Android App Architecture Book.

If you have any suggestions, questions, or if you want to show off the new job you just got, join the discussion below.