wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Android UI Elements Quiz

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

In Android, every user interface element is considered a:

a)

Activity

b)

View

c)

Layout

d)

Fragment

2.

Which of the following is NOT an example of a View?

a)

TextView

b)

Button

c)

LinearLayout

d)

ImageView

3.

Views can have the following properties EXCEPT:

a)

Color and dimensions

b)

Can have focus

c)

Can be visible or invisible

d)

Can run background services

4.

Which XML attribute sets the width of a View to fill the parent container?

a)

wrap_content

b)

fill_parent

c)

match_parent

d)

expand_parent

5.

In Android, a ViewGroup is best described as:

a)

A collection of Activities

b)

A type of View that contains other Views

c)

A storage container for Java classes

d)

A tool for debugging

6.

Which layout arranges Views in either a row or column?

a)

ConstraintLayout

b)

RelativeLayout

c)

LinearLayout

d)

FrameLayout

7.

Which layout is best for arranging child Views in rows and columns?

a)

TableLayout

b)

FrameLayout

c)

GridView

d)

RelativeLayout

8.

The correct Java code to create a new TextView in an Activity is:

a)

TextView myText = new TextView(this);

b)

TextView myText = new TextView(context);

c)

TextView myText = new TextView(new View());

d)

TextView myText = new TextView();

9.

Which measurement unit is recommended for text size in Android?

a)

px

b)

sp

c)

dp

d)

pt

10.

The method used to capture a button click in Java is:

a)

setOnClickHandler()

b)

setOnAction()

c)

setOnClickListener()

d)

onTouchEvent()

11.

In Android XML, how is a string resource referenced?

a)

@res/string/title

b)

@string/title

c)

@text/title

d)

R.string.title

12.

Which layout shows only one child at a time in a stack?

a)

FrameLayout

b)

LinearLayout

c)

GridView

d)

RelativeLayout

13.

The Toast class in Android is used for:

a)

Logging messages

b)

Showing popup notifications

c)

Debugging applications

d)

Running background services

14.

Which class is the base class for all layouts in Android?

a)

ViewGroup

b)

ConstraintLayout

c)

Activity

d)

FrameLayout

15.

In Java code, which class is used to set width and height for a View?

a)

View.LayoutManager

b)

LayoutInflater

c)

LinearLayout.LayoutParams

d)

ViewSettings

16.

Which hierarchy is based on inheritance (e.g., Button → TextView → View)?

a)

Layout hierarchy

b)

View class hierarchy

c)

Activity hierarchy

d)

Resource hierarchy

17.

Which hierarchy defines how Views are visually arranged?

a)

Layout hierarchy

b)

View class hierarchy

c)

Context hierarchy

d)

Resource hierarchy

18.

What is the purpose of findViewById() in Android development?

a)

To locate Activities

b)

To create a new layout

c)

To find a View by its XML ID

d)

To log messages

19.

Which log method in Android is used for error messages?

a)

Log.w()

b)

Log.d()

c)

Log.e()

d)

Log.i()

20.

Which of the following should NOT be used for screen measurements in Android?

a)

dp

b)

sp

c)

px

d)

in