Lab 4 Self Assessment

Lab4 Self Assessment

Q1 The following programming languages can be used to create Android app except

Answer

Java

C++

Koitlin

PHP


Answer :   PHP


Q2

There are four different types of app component in an Android app.  Which one of these app components do not require Intent to activate it?

Answer

Activity

Services

Broadcast Receivers

Content Providers

Answer :  Content Providers


Q3 

In a life cycle of an Android Activity, choose the correct order of the various callbacks

Answer

onCreate() -> onStart() ->onStop() -> onResume() -> onPause() -> onDestroy()

onCreate() -> onPause() ->onResume() -> onStart() -> onStop() -> onDestroy()

onCreate() -> onStart() ->onResume() -> onPause() -> onStop() -> onDestroy()

onCreate() -> onStart() ->onPause() -> onResume() -> onStop() -> onDestroy()


Answer :    onCreate() -> onStart() ->onResume() -> onPause() -> onStop() -> onDestroy()



Q4

At which callback in the life cycle of an Android Activity should the View layout of the Activity be loaded?

Answer

onCreate()

onStart()

onStop()

onResume()



Answer :  onCreate()


Q5

Question options:

Given the following code snippets from a activity_main.xml layout,

  <Button android:id="@+id/mybutton"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="Hello, I am a Button" />

 

What should be inserted in the blank in this onCreate( ) method of MainActivity.java file?

protected void onCreate(Bundle savedInstanceState) {

                super.onCreate(savedInstanceState);

                setContentView( ______________________ ); 

Button myButton =  (Button) findViewById ( __________________ );


Answer : 


  <Button android:id="@+id/mybutton"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="Hello, I am a Button" />

 

What should be inserted in the blank in this onCreate( ) method of MainActivity.java file?

protected void onCreate(Bundle savedInstanceState) {

                super.onCreate(savedInstanceState);

                setContentView( ______________________ ); 

Button myButton =  (Button) findViewById ( __________________ );




Q6  

In Android layout, which of the following statements describes a View object and a ViewGroup object correctly?

Answer

A ViewGroup usually draws something the user can see and interact with, whereas a View is an invisible container that defines the layout structure

A View usually draws something the user can see and interact with, whereas a ViewGroup is an invisible container that defines the layout structure for View or other ViewGroup objects

Example of a View object is LinearLayout and example of a ViewGroup object is Button.

ViewGroup objects are normally included within the View object


Answer : 

A View usually draws something the user can see and interact with, whereas a ViewGroup is an invisible container that defines the layout structure for View or other ViewGroup objects



Q7


What are some advantages of Mobile Devices? (There are more than one answer)

Answer

Mobility

Location sensitivity

Push technology

Offline Web Storage support




Answer : 

All correct except Offline Web Storage support

 

Q8What is the name of the API in Android Application Framework used to build GUI?

Answer

View System

Resource Manager

Activity Manager

Window Manager


Answer :  View System


Q9   Which of the following is responsible for the management of the lifecycle of applications?

Answer

Notification Manager

Resource Manager

Activity Manager

Package Manager

Answer : 

Activity Manager

Q10 Which of the following objects belong to the ViewGroup in Android Layout?  (Choose all that apply)

Answer

ConstraintLayout

Button

LinearLayout

ImageView

Answer : 

ConstraintLayout  and LinearLayout




Q11The Android Activity Layout XML file is normally stored in which folder of the project directory in Android Studio?

Answer

res/drawable

res/layout

res/values

res/mipmap

Answer : 

res/layout

Q12

In which Activity callback does the layout resource for the Activity is loaded?

Answer

onCreate()

onStart()

onPause()

onResume()

Answer : 

onCreate()

Q13


Which line of code will load the layout resource for the Activity?

Answer

findViewbyId

setContentView

setOnClickListener

setLayout

Answer : 

setContentView

Q14Given the following xml codes for the button in the layout file, what is the correct Java codes to access this button?



Answer

Button b = (Button) findViewbyId (R.id.my_button);

Button b = (Button) findViewbyName(R.name.my_button);

Button b = (Button) findViewbyId (R.id.my_button_text);

Button b = (Button) findViewbyName(R.name.my_button_text);

Answer : 

Button b = (Button) findViewbyId (R.id.my_button);




Q15

In the following xml layout codes, what is the root element?

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

              android:layout_width="match_parent"

              android:layout_height="match_parent"

              android:orientation="vertical" >

    <TextView android:id="@+id/text"

              android:layout_width="wrap_content"

              android:layout_height="wrap_content"

              android:text="Hello, I am a TextView" />

    <Button android:id="@+id/button"

            android:layout_width="wrap_content"

            android:layout_height="wrap_content"

            android:text="Hello, I am a Button" />

</LinearLayout>

Answer

LinearLayout

TextView

Button

xml



Answer : 

LinearLayout

Comments

Popular posts from this blog

Simple Login Example (PHP Server + Android Client)

Lab 6: Using split