Posts

Showing posts from January, 2020

Dependency Injection based Android interview questions and answers

WHAT IS DEPENDENCY INJECTION? DO YOU USE ANY DI LIBRARY IN YOUR PROJECT? CAN YOU NAME A FEW OF THEM, AND WHY ONE IS BETTER THAN OTHERS? Dependency Injection is a design pattern to implement inversion of control, and to resolve dependencies. Dependency Injection (DI) eliminates boilerplate code (for example, by removing listener) and provides a much cleaner and effective code. There are a few DI libraries used in Android development: -Dagger -ButterKnife -RoboGuice ButterKnife and Dagger do not use reflection, but rather compile time annotations. They are therefore faster to develop with. What is dependency injection? Is a pattern for resolving dependency. It is an implementation of dependency inversion principle (DIP). Some of the libraries to enable dependency injection for are, AndroidAnnotations Butter Knife Dagger Dagger2 RoboGuice Dagger Component Vs Subcomponent Component dependencies — Use this when you want to keep two components independent. Subcomponents — Use this when y...

Ranges based Kotlin interview questions and answers

Integer type range Kotlin Working Ranges What is Ranges operator in Kotlin? Ranges operator helps to iterate through a range. Its operator form is (..)  For Example for (i in 1..15) print(i) It will print from 1 to 15 in output. Kotlin Utility Function What is Ranges operator in Kotlin? Ranges operator helps to iterate through a range. Its operator forms are (..)). Example for ( i in 1 .. 4 ) print ( i ) Aaaaas

Thirty party libraries based Android interview questions and answers

Social media library: How many data can we get from Facebook API? Ans: Using graph library and Profile class, we can get all the information of a user. ex Name, first name, last name, profile image, middle name Image library: Difference between Picasso and glide Library in Android? Ans: Picasso library can only load an image, where glide can also load gif format. Which 3rd party library you have used in Android? Ans: Retrofit, Picasso, Glide, volly.

TextView and EditText based Android interview questions and answers

How to make a TextView to be editable? A) Either set its attribute editable =’true’ or Use EditText class instead of TextView class

Sensor based Android interview questions and answers

What can sensors measure? A) Relative humidity Pressure Magnetic field Steps taken Proximity The rate of ratation of the device on x,y,z axes What is a Physical Sensor? A) Sensors that pieces of hardware that are physically present on the device. Know as Hardware Sensors. What are Synthetic sensors? A) Sensors that are not physicall present on the device. They are derived from one or more sensors What is Raw? A) Values directly given by the sensor without any correction logic. Accelerometers, proximity sensors, light sensors, 133) What is Calibrated? A) Values from sensors that are corrected by the operating system 134) What is Fused? A) Sensors that gets values from two or more sensors. These values are combined to one value 135) What is SensorManager? A) Provides access for your app to the sensors. 136) What is Continuous? A) That report mode when sensor events are generated at a constant rate defined by the sampling peroid 137) What is On change? A) That report mode when sensor even...

NDK based Android interview questions and answers

What is Android NDK? A) A toolset that allows you to implement parts of your app using native-code languages What is the NDK and why is it useful?   -   Learn from here   and   here   and   here What is renderscript?   -   Learn from here

Testing based Android interview questions and answers

What is Test Module? A) Module that contains the source code to test application projects and is built into test application that run on a device What is JUnit? A) A unit testing framework for the Java programming language What is TDD (Test-driven development)? A) A software development process that relies on the repetition of a very short development cycle: first an automated test case is written that defines a desired improvement of new function What is Test case? A) Set of conditions under which a tester will determine whether an application, software system or one of features is working as was originally established for it to do What is the difference between unit testing and instrumentation testing? Unit testing: All unit tests bypass the Android system and run straight on the developer machine. Unit tests cannot use much of the Android SDK Unit tests run quickly Unit tests are placed inside the “test” folder Instrumentation testing: Test code and production code combined is runni...

Logcat based Android interview questions and answers

What is logging (Logcat)? A) The logging (Logcat) system provides a mechanism for collecting and viewing system debug output. How many different  logcat  types are there? A) 5 What are the names of the specific  logcats ? A) Verbose, Debug, Info, Warn and Error Logging methods require two strings, what does each string represent? A) The first string (Tag) identifies where the log is coming from and the second is the specific log message.

Array based Kotlin interview questions and answers

Image
What is the data type of Array?  val arr = arrayOf(1, 2, 3); The type is Array<Int>. How to Create Arrays of Different Types in Kotlin Kotlin allows programmers to easily create different types of arrays using the  arrayOf()  method. Below, we’ll take a look at how to create arrays containing integer, floats, and strings using this simple but robust procedure. val arr1 = arrayOf(1, 2, 3) val arr2 = arrayOf(1.2, 2.3, 3.4) val arr3 = arrayOf("Hello", "String", "Array) How to initialize an array in Kotlin with values?  How to initialize an array in Kotlin with values? Junior Details In Java an array can be initialized such as: int numbers [ ] = new int [ ] { 10 , 20 , 30 , 40 , 50 } How does Kotlin's array initialization look like? Solution val numbers : IntArray = intArrayOf ( 10 , 20 , 30 , 40 , 50 ) May you use IntArray and an Array<Int> is in Kotlin interchangeably?  May you use IntArray and an Array<Int> is in Kotlin int...

Functions based Kotlin interview questions and answers

Image
Function Kotlin Function  What is the difference between a function and a method in Kotlin? A function is a named code block invoked from other locations within the source code. A method is a function associated with an object and can be invoked from other code with the dot notation. Explain Functions In Kotlin? Kotlin functions are first-class functions that are easily stored in variables and data structures and can be pass as arguments and returned from other higher-order functions. Sample function declaration and usage in Kotlin fun double(x: Int): Int { return 2 * x } val result = double(2) How many types are used in kotlin?   there are to type function used in kotlin: 1. Standard library function 2. User-defined function   What is the Standard library function and User-defined function?   1. A  standard library function  is built-in library functions that are implicitly present in the library and available for use. 2. A  user-defined func...