IT 372 - Quizzes * = correct answer Quiz questions and answers will be posted after each quiz closes. ----------------------------------------------------- Quiz 1 -- Closed Apr 13. 1. What is the version of Android Studio that we are using? a. Electric Eel b. Iguana c. Hedgehog *d. Meerkat 2. Which tool in Android Studio is used to download, install, and manage emulator device drivers? The ____________ Manager. a. Activity *b. Device c. SDK d. Resource 3. What is the location of the strings.xml resource file in the project folder? a. app/main/src/res/values/layout *b. app/src/main/res/layout c. app/src/main/res/values/layout d. app/src/main/java/layout 4. Which Android version launched the Material Design standard, which is still present today? a. Cupcake b. Froyo *c. Lollipop d. Pie 5. Which Android version introduced the on-screen keyboard? *a. Cupcake b. Froyo *c. Lollipop d. Pie ----------------------------------------------------- Quiz 2 -- Closed Apr 20. 1. Which Android MainActivity method is roughly equivalent to the main method of a traditional Java class? a. MainActivity b. onCreate *c. onStart d. Start 2. Which statement in MainActivity.java sets the layout as activity_main.xml for the app? *a. setContentView(R.layout.activity_main); b. setContentView(R.layout.main); c. setLayout(R.layout.activity_main); d. setLayout(R.layout.main); 3. Which attribute correctly defines the id of a TextView widget as txt_age? a. android:id="+id/txt_age" b. android:id="@id/txt_age" *c. android:id="@+id/txt_age" d. android:id="age" 4. Which statement defines the XML namespace prefix android? a. android="https://schemas.android.com/apk/res/android" b. android:xmlns="https://schemas.android.com/apk/res/android" c. namespace:android="https://schemas.android.com/apk/res/android" *d. xmlns:android="https://schemas.android.com/apk/res/android" 5. In the strings.xml resource file, how do you define a string with the name "pred1" and the value "It is certain."? a. "It is certain." *b. It is certain. c. d. ----------------------------------------------------- Quiz 3 -- Closed Apr 27. 1. A widget of which class allows the user to enter text into the widget? *a. EditText b. EditView c. TextField d. TextView 2. Which widget contains radio buttons so that at most one can be checked at a time? a. ButtonGroup b. RadioButtonGroup *c. RadioGroup d. Panel 3. The Elvis operator (also known as the tertiary conditional operator) consists of which two symbols? a. ? = b. ? > *c. ? : d. < ? 4. From the ArrayList collection named dice, which statement obtains the value with index 1? a. dice[1] *b. dice.get(1) c. dice.get[1] d. dice.getItem(1) 5. Which method is required in an Android Activity class? *a. onCreate b. onDestroy c. onStart d. main ----------------------------------------------------- Quiz 4 -- Closed May 4. 1. What is the first event that occurs in the Activity life cycle when an app is first launched? *a. ON_CREATE b. ON_PAUSE c. ON_RESUME d. ON_START 2. Which event occurs when the app is moved into the background and a different app is moved into the foreground and resumes running? a. ON_CREATE *b. ON_PAUSE c. ON_RESUME d. ON_MOVE_TO_BACKGROUND 3. Which View method can be used to attach a View.OnLongClickListener object or a lambda method to a widget? a. addEventListener b. attachClickListener c. onLongClick *d. setOnLongClickListener 4. An object from which class is used to save data from an activity before it is destroyed so that it can be restored when the activity is recreated, for example, when the device is rotated? a. Adapter *b. Bundle c. HashMap d. Intent 5. An object from which class can store data that is passed to a new activity. a. Adapter b. Bundle c. HashMap *d. Intent ----------------------------------------------------- Quiz 5 -- Closed May 11. 1. Which of these code fragments creates and displays a toast with the message "Hello, World!"? a. Toast.create(getApplicationContext( ), "Hello, World!", Toast.LENGTH_LONG).show( ); *b. Toast.makeText(getApplicationContext( ), "Hello, World!", Toast.LENGTH_LONG).display( ); c. Toast.makeText(getApplicationContext( ), "Hello, World!", ).show( ); d. Toast.makeText(getApplicationContext( ), Toast.LENGTH_LONG, "Hello, World!").show( ); 2. Which Java class has an append method? a. ArrayList b. Integer c. String *d. StringBuilder 3. The Design Editor is used with a ConstraintLayout to position a Button widget below a TextView widget with id txt_name. What does this constraint look like in the XML layout file? a. android.layout_constraint="@+id/txt_name" b. android.layout_margin="@+id/txt_name" c. android.layout_constraintTop_toBottomOf="@+id/txt_name" *d. app.layout_constraintTop_toBottomOf="@+id/txt_name" 4. How do you add the arraylist col defined by ArrayList col = new ArrayList( ) to a Bundle object b? a. b.putArrayList(col); b. b.putArrayList("arrlist", col); c. b.putSerializable(col); *d. b.putSerializable("arrlist", col); 5. Which of the following displays the character ℞, which has the Unicode code 211E, in a TextView widget defined by TextView tv = findViewById(R.id.txt_display); *a. tv.setText("\u211E"); b. tv.setText("\x211E"); c. tv.setText("ÓE"); d. tv.setText("℞"); ----------------------------------------------------- Quiz 6 -- Closed May 18. 1. What is the UTF-code of the character ñ (n tilde)? Its hex Unicode code is 00F1. a. 00F1 b. 0BF1 *c. C3B1 d. C3F1 2. What is the UTF-8 code of the Unicode character ⌫, hex Unicode code 232B? a. 00232B b. E2232B c. E28211 *d. E28CAB 3. What is the file extension of an Android executable file? a. .class *b. .dex c. .exe d. .kt 4. Suppose that the MyView class is a derived class of the Android View class. Which method of the View class is overridden in the MyView class for drawing in that class? a. draw *b. onDraw c. onPaint d. paint 5. For drawing in an Android MyView class, an object of which class is used to specify the color and stroke width for drawing an item? a. Color b. Graphics *c. Paint d. StrokeWidth ----------------------------------------------------- Quiz 7 -- Closed May 25. 1. An object of which class is used to call drawing methods in a View onDraw method? *a. Canvas b. Graphics c. Panel d. View 2. An object of which class contains information about a touch event that occurred, which was detected by a touch event handler? For example, this object contains the x and y location of the touch and whether the touch was touch down, touch up, or touch move. a. ClickEvent *b. MotionEvent c. MouseMoveEvent d. TouchEvent 3. To read from a text file named points.txt in the folder app/src/main/res/raw, an object from which class is used? a. File b. FileStream *c. InputStream d. String 4. Which Kotlin statement creates the variable n, which value cannot be changed. a. const n = 123; b. final n = 123; *c. val n = 123; d. var n = 123; 5. Which keyword is used to create a Kotlin function? a. def *b. fun c. function d. No keyword. Kotlin functions are defined using arrow notation. ----------------------------------------------------- Quiz 8 -- Closed Jun 1. 1. Which keyword or token denotes that a Kotlin class is inheriting from a base class? *a. : b. -> c. extends d. inherits 2. Which keyword or token is used in a Kotlin method to indicate that the method overrides a method from the base class. a. : b. @Override c. override d. overrides 3. Which keyword or token indicates that a Kotlin class is available to be used as a base class. a. : b. :: c. inheritable *d. open 4. What is the Kotlin translation of this Java statement? System.out.println(String.format("(%d, %d)", x, y)); a. println("({x}, {y}"); *b. println("($x, $y)"); c. writeln("({x}, {y}"); d. writeln("($x, $y)"); 5. What are the two required methods for a class that inherits from the SQLiteOpenHelper base class? a. onCreate and onPopulate *b. onCreate and onUpgrade c. onDraw and onCreate d. onUpgrade and onPopulate -----------------------------------------------------