O'Reilly logo

App Inventor by Ellen Spertus, Liz Looney, Hal Abelson, David Wolber

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Presidents Quiz

image with no caption

The Presidents Quiz is a trivia game about former leaders of the United States. Though this quiz is about presidents, you can use it as a template to build quizzes on any topic.

In the previous chapters, you’ve been introduced to some fundamental programming concepts. Now you’re ready for something more challenging. You’ll find that this chapter requires a conceptual leap in terms of programming skills and abstract thinking. In particular, you’ll use two list variables to store the data—in this case, the quiz questions and answers—and you’ll use an index variable to track where the user is in the quiz. When you finish, you’ll be armed with the knowledge to create quiz apps and many other apps that require list processing.

This chapter assumes you’re familiar with the basics of App Inventor: using the Component Designer to build the user interface, and using the Blocks Editor to specify event handlers and program the component behavior. If you are not familiar with these fundamentals, be sure to review the previous chapters before continuing.

You’ll design the quiz so that the user proceeds from question to question by clicking a Next button and receives feedback on whether each answer he inputs is correct or incorrect.

What You’ll Learn

This app, shown in Figure 8-1, covers:

  • Defining list variables for storing the questions and answers in lists.

  • Sequencing through ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required