Android interview – Telegram
Channel created
Channel photo updated
What is the name of the architectural style that separates responsibilities into models, views, and controllers?
Anonymous Quiz
1%
REST
6%
MVP (Model-View-Presenter)
12%
MVVM (Model-View-ViewModel)
81%
MVC (Model-View-Controller)
Which architectural pattern is best suited for an Android application to separate logic, UI, and data management?
Anonymous Quiz
10%
MVC
6%
MVP
80%
MVVM
4%
Singleton
Which Android component is responsible for managing the lifecycle of an activity?
Anonymous Quiz
29%
ActivityManager
35%
LifecycleOwner
32%
Activity
3%
Application
Which mechanism in Android is used for data exchange between application components?
Anonymous Quiz
58%
Intent
8%
SharedPreferences
25%
ContentProvider
8%
BroadcastReceiver
Which method is typically overridden in a ViewModel to perform cleanup operations when it is no longer needed?
Anonymous Quiz
22%
onDestroy()
21%
OnClear()
42%
onCleared()
8%
onDestroyed()
7%
OnCleared()
Which method of the android.widget.SimpleAdapter class is used to set data and layout for binding data with a view in Android applications?
Anonymous Quiz
16%
setDataSource()
26%
bindLayout()
29%
setAdapterData()
29%
setViewBinder()
What are the layers of clean architecture (Fernando Cejas)?
Anonymous Quiz
14%
View, Domain, Repository
74%
Presentation, Domain, Data
4%
View, Data
8%
Core, Domain, Data
FragmentManager.commit() method - synchronous or asynchronous?
Anonymous Quiz
49%
Synchronous
51%
Asynchronous
Which Android component is used for executing background tasks without a user interface?
Anonymous Quiz
3%
Activity
11%
BroadcastReceiver
84%
Service
2%
ContentProvider
🤩1
Question and answer

What is the difference between an abstract class and an interface in Java?

Answer: An abstract class is a class that cannot be instantiated, and it can have abstract and non-abstract methods. An interface, on the other hand, is a collection of abstract methods and constants that can be implemented by any class. One key difference between the two is that a class can implement multiple interfaces, but it can only extend one abstract class.

#question #answer #java
Question and answer

What is the difference between the “==” operator and the “.equals()” method in Java?

Answer: The “==” operator checks for object reference equality, while the “.equals()” method checks for object value equality. For example, two different String objects with the same value will return true when compared using “.equals()”, but false when compared using “==”.

#question #answer #java
👍1
Java and Kotlin

1. What is the difference between an abstract class and an interface in Java?
Answer: An abstract class is a class that cannot be instantiated, and it can have abstract and non-abstract methods. An interface, on the other hand, is a collection of abstract methods and constants that can be implemented by any class. One key difference between the two is that a class can implement multiple interfaces, but it can only extend one abstract class.

2. What is the difference between the “==” operator and the “.equals()” method in Java?

Answer: The “==” operator checks for object reference equality, while the “.equals()” method checks for object value equality. For example, two different String objects with the same value will return true when compared using “.equals()”, but false when compared using “==”.

3. What is a lambda expression in Kotlin?

Answer: A lambda expression is a way to define a function in Kotlin without creating a separate named function. It allows you to define a function inline, using a more concise syntax. For example, the following code defines a lambda expression that takes two integers and returns their sum: “(x: Int, y: Int) -> x + y”.

4. What is the difference between a lateinit property and an initialized property in Kotlin?

Answer: A lateinit property is a property that is declared without an initial value, but is guaranteed to be initialized before it is used. This is useful for properties that cannot be initialized in the constructor, but need to be initialized before they are used. An initialized property, on the other hand, is a property that is declared with an initial value and can be used immediately.

5. What is the difference between a HashSet and a TreeSet in Java?

Answer: A HashSet is an unordered set of unique elements, implemented using a hash table. A TreeSet, on the other hand, is an ordered set of unique elements, implemented using a red-black tree. The elements in a TreeSet are stored in sorted order.

6. What is a companion object in Kotlin?

Answer: A companion object is an object that is associated with a class, rather than an instance of the class. It can be used to define static methods and properties for the class. For example, the following code defines a companion object for the MyClass class, with a static method “myStaticMethod”:

class MyClass {
companion object {
fun myStaticMethod() {
/* code */ }
}
}

7. What is the difference between a class and an object in Kotlin?

Answer: A class is a blueprint for creating objects, while an object is a single instance of a class. Objects are often used to implement singletons in Kotlin.

8. What is polymorphism in Java?

Answer: Polymorphism is the ability of an object to take on multiple forms. In Java, this can be achieved through inheritance and method overriding. For example, a subclass can override a method from its superclass to provide a different implementation.

9. What is a functional interface in Java?

Answer: A functional interface is an interface that has only one abstract method. It is often used with lambda expressions and method references in Java. Java provides the @FunctionalInterface annotation to indicate that an interface is a functional interface.

10. What is the difference between a private and a protected method in Java?

Answer: A private method is a method that can only be accessed within the same class. A protected method, on the other hand, can be accessed within the same class and any subclasses.

#QuestionsAndAnswers #java #kotlin #JavaKotlin