0% found this document useful (0 votes)
25 views

Android MCQ

The document contains questions and answers related to Android development. It covers topics like access modifiers, getting references to views, layout parameters, method overloading, activities, classes, return types, intents, arrays, Room, RecyclerView, fragments, and more.

Uploaded by

kumar k
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Android MCQ

The document contains questions and answers related to Android development. It covers topics like access modifiers, getting references to views, layout parameters, method overloading, activities, classes, return types, intents, arrays, Room, RecyclerView, fragments, and more.

Uploaded by

kumar k
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Android Answers :

Which access modifier only lets the class it was declared in use the variable?
a. public
b. protected
c. default
d. private

How would you get a reference to a button with the id myButton?


a. buttonVar = (Button) findViewByld(R.id.myButton);
b. buttonVar = (View) findViewByld(R.id.myButton);
c. buttonVar = getButtonByld(R.id.myButton);
d. buttonVar = findButton(R.id. myButton);

Which of the following will cause the view to be as big as it needs to be to contain
its content?
a. match_parent
b. responsive_sizing
c. container
d. Wrap_content

What is method overloading?


a. Having more than one method with the same name but different parameters
b. Having more than one method with the same name and the same parameters
c. Creating a new method with similar code to an existing method
d. Creating a method that returns multiple variables

If an activity is not registered in AndroidManifest.xmI your application may crash


a. True
b. False

How would you create an instance of a Soldier class?


a. mySoldier = new Soldier();
b. Soldier mySoldier = new Soldier():
c. Class mySoldier = Soldier
d. Class Soldier = Soldier():
Which of the following can be a return type for a method?
a. A primitive type
b. A reference type
c. A user defined type
d. All the answers are correct

What does APK stand for?


a. Android Programming Kit
b. Android Programming Package
c. Android Application Package
d. None of these answers are correct

Which attribute can you use to increase the "3d effect of a CardView?
a. cardElevation
b. You cannot make a CardView 3d
c. card3dHeight
d. cardCornerRadius

Which Intent method will let you send data from one activity to another?
a. putExtra
b. sendData
c. activityData
d. putData

You can put objects of a different type in the same ArrayList


a. True
b. False

What is a singleton?
a. A class with just one variable
b. A class with just one method
c. A class that can never be instantiated
d. A class where there can only be one instance

How would you set the value of the first item in an integer array?
a. intArray[0] = 100;
b. intArray[1] = 100;
c. intArray{0} = 100;
d. intArray{1} = 100;
How do you declare and initialize a new ArrayList containing Strings?
a. myList = new ArrayList.String();
b. String ArrayList[] myList;
c. ArrayList<String> myList = new ArrayList<String> ();
d. myList = new ArrayList[][]:

The RecyclerView class handles the data from an array directly to display it
a. True
b. False

What is the use of the DAO object in the Room library?


a. To modify our main object and turn it into a data entity
b. To provide the methods for database interaction
c. To inherit from when we use a RecyclerView.
d. Adapter To create a special widget in the XML for the database

What does the condition of a Java enhanced for loop look like?
a. foreach (int i in myArray)
b. for (int i = 0; 1 < myArray.length; it +)
c. for (int i : myArray)
d. enhancedfor (int i in myArray);

If we declare a 2-dimensional array stringArray = new String[5](2] how many


elements will it contain?
a. 10;
b. 100;
c. 7:
d. 1;

Which of the following is true about Java arrays?


a. They are reference variables;
b. They hold up to predetermined
c. Each element is a variable with the same type;
d. All of the above;

If we are writing code inside a "Fragment" class, how can we access a Context
object?
a. Use the 'this' operator
b. getContext()
c. getActivityContext()
d. All answers are correct

The ViewPager2 can only be used to display fragments


a. True
b. False
c.
What is a Room Entity?
a. The object that we want to use in our database
b. The methods needed for database interaction
c. Our new Recycler View
d. All answers are correct

What is the purpose of the RecyclerAdapter class?


a. To add a RecyclerView widget to the XML automatically
b. Managing the data from the array to show it to the user
c. Allowing the user to easily add or remove elements from an array
d. Determining whether the RecyclerView will be a grid or a column Which Room

Annotation do we use to perform a SQL "select" statement


a. @SELECT
b. @SQL
c. @Query
d. @Update

What is the purpose of the LayoutManager class?


a. To add a new DialogLayout to your application
b. To modify settings for the RecyclerView such as linear or grid
c. To allow you to create a custom layout for your XML
d. To modify the ConstraintLayout settings

You might also like