Time Estimate: 45 minutes
Introduction and Goals¶
|The Quiz App presents a quiz about pioneers in computer science. The questions, answers, and images are in parallel lists where the first question in the question list corresponds to the first answer in the answer list and the first image in the image list, and so on for each element in the lists.
Learning Objectives: I will learn to
Language Objectives: I will be able to
To get started, open App Inventor with the Quiz App template in a separate tab and follow along with the video tutorial, read the text tutorial, or for an extra challenge use just the short handout.
In the app you will construct three separate lists for the questions, answers, and the names of image files. The first question in the question list corresponds to the first answer in answer list and the first image in the image list. This is known as a parallel list construction. This parallel setup allows you to use an index variable to associate each question with its corresponding answer and image. For example, when the index variable has the value 2, it is referring to the second question, second answer, and second image.
You will be typing in the quiz questions, answers, and image names (the image jpg files are provided in the Quiz App template).The questions are:
- Which computer science pioneer broke the German Enigma Code during the World War II?
- Which recent movie showcases the first African-American women who worked as human “computers” for NASA?
- Which Navy admiral led the creation of COBOL, one of the first high level programming languages?
- Alan Turing
- Hidden Figures
- Grace Hopper
Enhancements and Extensions
Here are some programming problems that will let you enhance and extend the Quiz App.
- As you might have noticed, if the answer is “Alan Turing” and the user types in “alan turing”, the answer will be marked incorrect. That’s not very nice for the user. To remedy this problem you will want to convert both the user’s answer and the stored answer to upper case “ALAN TURING”. (HINT: use the upcase block in the Text drawer to convert both strings.)
- When the user gets an incorrect answer, instead of just reporting “incorrect”, use a join block to also display the correct answer. For example, “Sorry, that is incorrect. The correct answer is Grace Hopper.”
- Add RandomButton to the app that when clicked will display a random question from the quiz. (HINT: You could use some new blocks from the List drawer such as a pick a random item block fed into an index in list thing block to set the index randomly.)
- Add a fourth question (and answer and image) to the quiz. If you like, you can research famous computer scientists on the Web to discover a fourth person. Or, if you wish, you can create a question about Hal Abelson, the creator of our App Inventor programming language. (HINT: You should only have to modify the 3 lists and upload an image file. The code should work with any number of questions as long as you used the length of list block instead of hard coding in the number 3 for the number of questions.)
In this lesson, you learned how to:
More information about these computer science pioneers can be found below:
Here is a table of the technical terms we've introduced in this lesson. Hover over the terms to review the definitions.
Check Your Understanding
Reflection: For Your Portfolio¶
Answer the following portfolio reflection questions as directed by your instructor. Questions are also available in this Google Doc where you may use File/Make a Copy to make your own editable copy.