5.5. Quiz App

Time Estimate: 45 minutes

5.5.1. 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
  • navigate a list using an index variable
  • perform operations on a list, such as selecting items and checking for the end
  • use parallel lists to organize data
Language Objectives: I will be able to
  • explain how items in parallel lists are related to each other
  • use target vocabulary, such as index and parallel list , while describing app features and User Interface with the support of concept definitions and vocabulary notes from this lesson

5.5.2. Learning Activities

Tutorial

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.

Quiz Questions

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:
  1. Which computer science pioneer broke the German Enigma Code during the World War II?
  2. Which recent movie showcases the first African-American women who worked as human “computers” for NASA?
  3. Which Navy admiral led the creation of COBOL, one of the first high level programming languages?
The corresponding answers are:
  1. Alan Turing
  2. Hidden Figures
  3. Grace Hopper
The corresponding images are:
  1. AlanTuring.jpg
  2. MaryJackson.jpg
  3. GraceHopper.jpg

Enhancements and Extensions

Here are some programming problems that will let you enhance and extend the Quiz App.

  1. 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.)
  2. 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.”
  3. 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.)
  4. 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.)

5.5.3. Summary

In this lesson, you learned how to:

5.5.4. Still Curious?

More information about these computer science pioneers can be found below:

5.5.5. Self-Check

Vocabulary

Here is a table of the technical terms we've introduced in this lesson. Hover over the terms to review the definitions.

index
parallel lists

Check Your Understanding


5.5.6. 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.

You have attempted of activities on this page