- Use radio buttons to build a multiple-choice quiz
- Load images dynamically
- Create a helper class to store data objects
Overview of Multiple Choice Quiz App
In this project, we will build a multiple choice quiz about the U.S. presidents. Click on the video below to see an overview.
Video: Overview of the President's Quiz App
- In this app, you will be uploading images from your PC into Android Studio. As a reminder, only lowercase letters, numbers and underscores are permitted when referencing resources in Android. Thus, even if the original file names contain uppercase and/or special characters, these must not be present in the corresponding Android file names. So a file name like abcDef.jpg should be converted to abcdef.jpg or abc_def.jpg when uploading.
- The students who are implementing this app in App Inventor 2 will be using parallel lists to store information for the questions in the multiple choice quiz app. (In App Inventor 2, arrays are called lists). One array will contain the images for the entire quiz. Another array will contain the text for each question. A third array will contain the choices for each question. A fourth array will contain the right answers, etc.
Parallel list structures are a beginner's programming construct. Although they are simple and can work well for small projects, these structures have trouble scaling when the amount of data becomes large. It then becomes problematic if any of the arrays fall out of sync with the others. Furthermore, if there is even one piece of missing data, not only is that question affected but all questions after that question can end up with the wrong data. For these reasons, object oriented programmers typically shy away from using parallel lists in their design. It is much preferred using the object oriented paradigm to store all information for each question in a single object. For this reason, our quiz app will make use of a helper class called Question. Objects of this class will contain all the information pertinent to each question.