To Exam Info

Review Questions

Multiple Choice Questions

Choose the best answer for each question. When answering the final exam questions you may provide a reason to justify your answer for partial credit. Your reason will not be considered if you choose the correct answer.

  1. Which of these is not a language that you can use to write Android apps using Android Studio.
    a. C++           b. Java           c. Kotlin           d. Python
  2. Who founded the Android company?
    a. Cox and Love                            b. Gates and Simonyi  
    c. Graduate students at Stanford    d. Rubin and Minor      
  3. What is the file extension of a an Android executable file?
    a. .apk          b. .class          c. .dex          d. .exe
  4. In Android Studio, the startup activity for application must be declared in an
    a. <intent>
    b. <intent-filter>
    c. <intent-layout>
    d. <intent-activity>
    
  5. An Android component that manages appearance and format on screen is called a(n):
    a. fragment        b. intent        c. view        d. layout
  6. In an XML file, how is the XML namespacee tools defined?
    a. namespace:tools=http://schemas.android.com/tools
    b. namespace:tools="http://schemas.android.com/tools"
    c. xmlns:tools=http://schemas.android.com/tools
    d. xmlns:tools="http://schemas.android.com/tools"
    
  7. In the Android Studio app folders, where is the colors.xml file located?
    a. app/main/src/main/res/values
    b. app/src/main/res/colors
    c. app/src/main/res/values
    d. app/src/res/values
    
  8. 2. What is the hex color code for purple?
    a. #ff00ff      b. #800080      c. #808000      d. #808080
  9. The layout for an activity is specified in what kind of file?
    a. .dex          b .text          c. .java          d. .xml
  10. A class that creates a temporary message to be displayed for the user is
    a. Log      b. MessageDialog      c. ToolTip      d. Toast
  11. Which attribute of a LinearLayout determines whether its items are stacked horizontally or vertically?
    a angle   b. orientation   c. mode    d. position
  12. Consider this linear layout:
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="50dp"
        android:orientation="vertical"
        tools:context=".MainActivity">
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello"
            android:padding="50dp"
            android:textSize="30sp"/>
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hi"
            android:textSize="30sp" />
    
    </LinearLayout>
    
    Which of these emulator screen does it produce?
    a. b. c. d.
  13. In the onCreate event handler for an activity, which method is called to set the layout for the activity?
    a. startUp      b. setContentView      c. setLayout      d. setStartup
  14. Which choice obtains the string defined as
    <string name="fname">Alice</string>
    
    in the strings.xml file and assigns it to n?
    a. String n = (String) R.string.fname;
    b. String n = getResources( ).getString(R.string.fname);
    c. String n = getResources(R.string.fname);
    d. String n = getResources(R.strings.fname);
    
  15. CharSequence is a(n)
    a. class        b. interface        c. method        d. primitive datatype
  16. Which choice creates and starts an intent for the ReceiveMessage activity?
    a. new Intent(this, ReceiveMessageActivity.class).startActivity( );
    b. new Intent(this, ReceiveMessageActivity.class, startActivity( ));
    c. startActivity(new Intent(ReceiveMessageActivity.class));
    d. startActivity(new Intent(this, ReceiveMessageActivity.class));
    
  17. If txt is a TextView object, which choice adds an onClick event handler to the Button object btn? The event handler should change the text in txt to upper case.
    a.  btn.setOnClickListener(new OnClickListener( ) {
            public void onClick(View view) {
                txt.setText(txt.getText( ).toUpperCase( ));
            }
        );
    b.  btn.setOnClickListener(new OnClickListener( ) {
            public void onClick(View view) {
                txt.setText(txt.getText( ).toString( ).toUpperCase( ));
            }
        });
    c.  btn.setOnClickListener(new View.OnClickListener( ) {
            public void onClick(View view) {
                txt.setText(txt.getText( ).toUpperCase( ));
            }
        });
    d.  btn.setOnClickListener(new View.OnClickListener( ) {
            public void onClick(View view) {
                txt.setText(txt.getText( ).toString( ).toUpperCase( ));
            }
        });