Test 2 2024 Practical
Test 2 2024 Practical
INSTRUCTIONS TO CANDIDATES
1. Answer any number of questions that will give you a total of 50 marks
2. You only need to submit your apk files
3. To make grading convenient, hAave your apk files as ID _Q# e.g 2010200_ Q5 in a
compressed zipped file saved with your name
NOTE: You will not be graded on the way in which you implement the UI, or how the UI
looks, as long as the UI demonstrates the functionality. And make sure you cleanly separate data
from the user interface.
QUESTION 1 [10]
Shared preferences allow you to store small amounts of primitive data as key/value pairs in a file on
the device. Develop an app that demonstrates how you can create, read and write shared preferences
data using the SharedPreferences class
QUESTION 2 [15]
Write a program to create an activity having a Text box, and also Save, Open and Create buttons.
The user has to write some text in the Text box. On pressing the Create button the text should be
saved as a text file in MkSD card. On subsequent changes to the text, the Save button should be
pressed to store the latest content to the same file. On pressing the Open button, it should display
the contents from the previously stored files in the Text box. If the user tries to save the contents
in the Textbox to a file without creating it, then a toast message has to be displayed saying “First
Create a File”.
QUESTION 3 [15]
Develop an app that can work in both smartphone and tablet. This app should have two views, one (list
view) displaying the list of movies, and the other (detail view) displaying the details of the selected
movie. On smartphones, when a movie is selected from the list view, the detail view will come up to
cover the list view. On tablets, the detail view will be displayed alongside of the list view. You have to
achieve these two different behaviours with the same code
Page 1 of 4
QUESTION 4 [10]
A menu is a set of options the user can select from to perform a function, for example searching for
information, saving information, editing information, or navigating to a screen. develop a floating context
menu app to show three menu options: Edit, Share, and Delete, as shown in the figure below. The menu appears
when the user performs a long click on the Text View. Toast the content of the selected menu item.
QUESTION 5 [5]
Write a program to create the login form with necessary validations like length of username and
password, empty text fields, count of unsuccessful login attempts. Display the login
successful/unsuccessful toast message.
QUESTION 6 [15]
Radio Buttons are generally used with the Radio Group. The Radio Group is a set of radio buttons,
marking one radio button as checked makes all other radio buttons as unchecked. A radio button consists
of two states – checked and unchecked. Clicking an unchecked button changes its state to “checked” state
and “unchecked” for the previously selected radio button. To toggle a checked state to unchecked state,
we need to choose another item. Develop a simple quiz application with 5 questions from any subject of
your choice and should be implemented using radio buttons
Page 2 of 4
QUESTION 7 [25]
Create an app called TODO with a SQLite database where the user can create and edit to-do list
items that are stored in the database.
1. Extend the SQLiteOpenHelper class with query() , insert() , and update()
methods implemented to support the required functionality
2. Include the app features described below
Features:
• The user can add new items to the list.
• Each item in the database includes a task to do, creation and completion dates, and whether
or not the task has been completed.
• When the app starts, the screen shows a list of incomplete to-do items sorted by creation
date. The UI includes an Options menu item to start an activity that shows the completed
tasks.
• The user can change an item's completion status. When the user marks a task as completed, it
is marked complete and the creation date is replaced with the completion date.
• When the user taps an incomplete item, edit mode is triggered, and the user can edit the item.
• When the app is restarted, the latest state of items is visible, which demonstrates that the data
was saved and reloaded.
When the apps starts, the screen shows a list of to-do items sorted by creation date. When the user
interacts with an item, edit mode is triggered, and the user can edit the item. The user can change an
item's completion status.
Include an Options menu item that lets the user see completed items. When an item is changed, the
UI reflects the change.
When the app is restarted, the latest state of the items is visible, which demonstrates that the data
was saved and reloaded.
Page 3 of 4
Page 4 of 4