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

android_6

The document contains a series of questions and answers related to Android development, covering topics such as native libraries, activity lifecycle, intents, and UI components. It addresses various concepts like Kotlin lambdas, Gradle, fragments, and user input controls. The information is structured in a quiz format, providing correct answers to each question posed.

Uploaded by

Ha Cao Thu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

android_6

The document contains a series of questions and answers related to Android development, covering topics such as native libraries, activity lifecycle, intents, and UI components. It addresses various concepts like Kotlin lambdas, Gradle, fragments, and user input controls. The information is structured in a quiz format, providing correct answers to each question posed.

Uploaded by

Ha Cao Thu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Which of following components belong to android native library?

1) Webkit

2) OpenGL

3) SQLite

4) Dalvik

5) OpenUI

A: 3, 4 ,5

The RadioGroup class is directly inherited from which class?

A: LinearLayout

Which widget view could be used to make a clickable object with image content?

A: ImageButton, ImageView

An activity contains the following code in onCreate() . What will happen when this code is
executed, if the intent property is null?

val message = intent.extras?.getString("message").toString()

A: The app will not crash because the extras property is accessed safely using ?.

What is the intent action to open a web page?


A: Intent.ACTION_VIEW

What is the language to program Android natively (select all correct answers)?
A: Java, Kotlin, C/C++

Where to configure the home activity - the first activity to be run in your application?

A: in the AndroidManifest.xml
What are lambdas in Kotlin?
A: A lambda is an expression that describes a function. But instead of declaring a named
function, you declare a function that has no name

Both Toast and Logcat can be used to debug the program, which expression bellow is
wrong?
A: Logcat only display information that developer logs out

A: store data into SD card to permanently use latter

Which of the following are true about abstract classes?


A: They can be extended by subclasses and implementations can be provided for abstract
members of the class. They may have abstract properties or abstract functions. They are not
fully implemented and cannot be instantiated. They need to be marked with the open
keyword to be extended.

If you activity has the name: SampleActivity, what is the name of the binding class which is
generated automatically by Android when you configure your application as data binding
enable
A: SampleActivityBinding

Which of the following tasks can be performed in onCreate()?


A: Getting extras from the intent that launched the activity.

Inflate the activity's layout: The setContentView() method is called to inflate the activity's layout
into the activity's view hierarchy. This means that the UI elements that are defined in the layout file are
created and added to the activity's view hierarchy.

Initialize the activity's data: If the activity needs to load any data from the user or from the network, it
can do so in the onCreate() method. This is because the activity has not yet been started, so it is
safe to perform any necessary data loading without worrying about the user's interaction with the
activity.

Bind the activity's data


to the UI: Once the activity's data has been loaded, it can be bound to
the UI elements in the layout. This means that the data will be displayed to
the user in a way that is relevant to the activity's functionality.

Start any background


tasks: If the activity needs to perform any background tasks, such as
loading data from the network or updating the user's location, it can start
them in the onCreate() method. This is because
the activity is already running, so it can start the background tasks without
waiting for the user to interact with the activity.

Handle any data that was


passed to the activity from the previous activity: If the
activity was started with an intent, the onCreate() method can access the
data that was passed to the activity using the intent
property. This data can be used to personalize the activity for the user or to
perform any other necessary tasks.

Given following code, select the correct :


val address = URL .parse("https://soict.hust.edu.vn")

val intent:Intent = Intent(Intent.ACTION_VIEW, address ) startActivity(intent)

Which of the following is true about Gradle?

A: Gradle is an automated build system used by Android Studio to build your apps. You can
configure Android-specific options for your project in your app’s build.gradle file.

What is the function to open new activity from the current activity?

A: startActivity

The OBJECT is called when you create an instance of a class.

What is the purpose of using RadioGroup?


A: to group RadioButton objects. to identify which RadioButton is selected

A: to open an activity in other application

Why use the Material Components for Android library?


A: It provides widgets that follow the Material Design guidelines such as text fields and
switches. It provides default Material themes that you can use directly or extend and then
customize. It helps you more quickly build beautiful user experiences.

Which is the direct parent class of the Button class?

A: android.view.TextView

ONSUPPORTNAVIGATEUP() method needs to be overridden in the host activity to ensure


your app’s fragment-based navigation responds to the app’s "Up" button?

A: onCreate(), onStart(), onResume(), onPause(), onStop(), onRestart(), onDestroy()

Which value of the property scaleType of the ImageView allows us to keep remaining the
aspect ratio (the image will not be croped)?

A: centerInside

Select all answers that are true for this XML layout when displayed on the screen
A: TextView A appears vertically stacked on top of TextView B.

The starting edge of TextView A is aligned to the starting edge of the parent view.

TextView B is horizontally and vertically centered within the parent view.

How to handle the event that user press the button and hold for a while?
A: setOnLongClickListener

If we have some buttons in one Activity, and all the buttons set the event onClickListener to
the Activity by calling setOnClickListener(this) . So, in the callback function onClick of the
Activity, how do you know which button is clicked

A: based on the id of each button


Which activity lifecycle method would be called if a dialog appears onscreen, partially
obscuring an activity?

A: onPause() because the activity is still displayed, but no longer has focus.

True or False: onCreateView() is only called once for a fragment’s entire lifecycle
A: True

How to shutdown/finish an activity?

A: finish()

Which of following is wrong about implicit intent?

A: To call implicit, you have to know the class name of the destination activity

The 'when' statement in Kotlin is similar to which statement in other programming


languages?
A: switch

Which of the following is a benefit of using fragments?

A: Navigation between fragments allows for more sophisticated user interface patterns, such
as tab bars.. Using multiple fragments within an activity allows for an adaptive layout across
multiple screen sizes. The same fragments can be reused across multiple activities.

Given following code:

val intent = Intent([ ], Uri.parse("123456789"))

intent.putExtra("sms_body", "hello")

startActivity(intent)

what could be filled in the [ ]

A: Intent.ACTION_SENDTO

Which is a possible way/language to develop Android application?


A: Native approach: Java/Kotlin. Object C. Flutter

When is the current Activity reset, i.e., the onCreate callback is called again?
A: user rotates the phone. user changes the language of the phone. user presses the home
button and opens another app

Which of the following is not a challange for Android application development?

A: Which of the following is not a challange for Android application development?

In the fragment lifecycle, which of the following tasks should be performed in


onViewCreated() ?

A: Initialize UI elements: Load data. Set up adapters. Perform UI updates

Suppose we write an application to survey the hobby of people (there are 5 hobbies to be
surveyed), one person may have several hobbies. Which input controls is suitable for this
purpose?

A: Checkbox

What is the advantage of Android development environment compare to iOS development


environment?

A: Open Source and Cross-Platform. Large Developer Community. Java and Kotlin Support.
Cost-Effectiveness

You might also like