MCQs / Computer Science / Lab: Registration Form UI
Lab: Registration Form UI MCQs — Computer Science 15 multiple-choice questions on Lab: Registration Form UI from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
1. Why is the form wrapped in a ScrollView? So all fields remain reachable in landscape or when the keyboard is open To validate input To lock orientation To make text bold Answer: A) So all fields remain reachable in landscape or when the keyboard is open
Explanation: ScrollView lets long content scroll.
Discuss this question
2. Which code reads the text typed in an EditText named etName (Kotlin)? etName.input() etName.hint etName.text.toString() etName.getValue() Answer: C) etName.text.toString()
Explanation: text returns an Editable; toString() converts it to a String.
Discuss this question
3. The summary TextView text survived rotation in the lab because it was saved in: The manifest strings.xml A Toast onSaveInstanceState() Answer: D) onSaveInstanceState()
Explanation: The value was put in the Bundle and restored in onCreate.
Discuss this question
4. Which property tells whether a CheckBox is ticked? isSelected value checkedId isChecked Answer: D) isChecked
Explanation: isChecked returns true when ticked.
Discuss this question
5. Radio buttons are made mutually exclusive by placing them inside a: LinearLayout only RadioGroup Spinner CheckBox Answer: B) RadioGroup
Explanation: A RadioGroup allows only one checked RadioButton.
Discuss this question
6. The attribute that shows grey example text inside an empty EditText is: android:label android:text android:placeholderText only android:hint Answer: D) android:hint
Explanation: hint displays guidance text until the user types.
Discuss this question
7. Which inputType hides the characters typed in a password field? phone textMultiLine textPersonName textPassword Answer: D) textPassword
Explanation: textPassword masks the characters.
Discuss this question
8. rgGender.clearCheck() will: Validate the form Unselect all radio buttons in the group Delete the group Select Male Answer: B) Unselect all radio buttons in the group
Explanation: clearCheck() removes the selection.
Discuss this question
9. Which Android class provides a ready-made pattern to validate email addresses? Regex.EMAIL EmailValidator.java InputType.EMAIL android.util.Patterns.EMAILADDRESS Answer: D) android.util.Patterns.EMAILADDRESS
Explanation: Patterns.EMAILADDRESS.matcher(email).matches() checks the format.
Discuss this question
10. A two-column landscape version of the form should be placed in: res/values-land/strings.xml res/layout-land/activitymain.xml res/layout-port res/drawable-land Answer: B) res/layout-land/activitymain.xml
Explanation: The -land qualifier selects the landscape layout.
Discuss this question
11. Which widget lets the user type text? TextView RadioButton ImageView EditText Answer: D) EditText
Explanation: EditText is the editable text field.
Discuss this question
12. etEmail.error = "Invalid email" is used to: Close the keyboard Send an email Show an error message and icon on the field Clear the field Answer: C) Show an error message and icon on the field
Explanation: setError marks the field as invalid.
Discuss this question
13. rgGender.checkedRadioButtonId returns -1 when: The first button is checked No radio button in the group is selected The group is invisible Both buttons are checked Answer: B) No radio button in the group is selected
Explanation: -1 means nothing is checked.
Discuss this question
14. Which Material component provides a floating label and inline error for text fields? TextInputLayout MaterialCardView Chip Snackbar Answer: A) TextInputLayout
Explanation: TextInputLayout wraps a TextInputEditText with label and error.
Discuss this question
15. After rotation, the text typed into EditTexts with IDs is: Restored automatically by the framework Sent to the server Always lost Moved to SharedPreferences Answer: A) Restored automatically by the framework
Explanation: Views with IDs save and restore their own state.
Discuss this question
Practise Lab: Registration Form UI MCQs
More Computer Science chapters