Programming Languages
App Lab Basics
Events & Interactivity
Debugging
App Design
100

Why do computers require precise instructions?

Computers cannot handle vague, ambiguous directions. They need exact instructions to perform tasks correctly.

100

What command is used to change from one screen to another in App Lab?

setScreen("screenName");

100

What is an event in App Lab?

An action that occurs as a result of a button click, which causes separate code to run

100

What is debugging?

The process of finding and fixing errors (bugs) in a program
100

What is the primary purpose of a user interface (UI)?

it allows the user to interact with the application

200

A student writes these instructions:

Draw a circle near the top of the page

Why might these instructions produce different results when followed by different people?

They are not specific. Different people will interpret "near the top" differently and place the circle in varying places.

200

What identifies a button, label, screen, etc so the program can interact with it?

element ID

200

Which of the following is an event?

A. variable
B. button click
C. screen
D. label

B - a button click

200

If a screen has ID of homeScreen and the below code exists, what is the bug?

onEvent("submitBtn", "click", function() {
    setScreen("homScreen");
});

The screen ID is misspelled in the onEvent

200

What would be more appropriate for an app for middle school students?

A. Tiny text and complex menus
B. Large buttons and clear navigation
C. Technical language
D. Multiple screens with no labels

B. Large buttons and clear navigation

300

Which set of instructions is better for a computer?

A. Put a square somewhere in the middle.

B. Draw a square with sides 2cm long. Place its center 5cm from the left edge and 5cm from the top edge.

B. more specific and leave less room for interpretation

300

A student wants to display "Welcome!" inside a label called messageLabel. Which command should they use?

A. setScreen()
B. setText()
C. onEvent()
D. console.log()

B. setText()

setText("messageLabel", "Welcome!");

300

What will happen here?

onEvent("homeBtn", "click", function() {

    setScreen("homeScreen");

});

When a user clicks the homeBtn the screen changes to the homeScreen

300

Find the error

onEvent("nextBtn", "click", function() {
    setScreen("screen2");

The closing brace, parathesis, and semicolon are missing

});

300

An app has a Home screen, Settings screen, Profile screen. What should be included on each screen/page?

A way to go back to the home screen

400

A team writes the following algorithm:

  1. open the app
  2. click the button
  3. log in
  4. enter your username

Identify two problems with this algorithm

 - out of order
 - no password mentioned
 - which button for #2?

400
In Design Mode there is a label with the ID:

messageLabel

In Code View there is the below line:
setText("welcomeLabel", "Hello!");

What happens?

Nothing, the ID in the code does NOT match the ID in the Design

400

The student wants the screen to change only when the user clicks the button. Why won't the below code work as intended?

onEvent("gameBtn", "mouseOver", function() {
    setScreen("gameScreen");
});

The wrong event handler is used - the student had used mouseOver instead of click
400

Design Mode contains: homeScreen, gameScreen


Code View contains:

onEvent("playBtn", "click", function() {
   setScreen("gameScreen");
});

onEvent("homeBtn", "click", function() {
  setScren("homescreen");
});


What happens when someone clicks the homeBtn?

Nothing happens as the ID does not match in terms of case

400

Student A: the app should include as many features as possible

Student B: the app should focus on features that the user will need

Who is correct and why?

Student B

Adding unnecessary features can make the app difficult to use

500

Two students are discussing programming languages

Student A
Computers should just understand normal human language

Student B
Programming languages are necessary because human language is often ambiguous.

Who is more correct and why?

B - Human language can have multiple meanings and interpretations. Programming languages are designed to follow strict rules and syntax to execute instructions consistently and accurately.

500

An app has 2 screens (homeScreen & settingsScreen) and on the home screen there is a button with ID settingsBtn.

In Code View the student puts only the below:
setScreen("settingsScreen");

When the app starts the Setting screen appears. What did the student forget?

To add an onEvent for the button

onEvent("settingsBtn", "click", function() {

 setScreen("settingsScreen");

});

500

A student claims that "all of the code runs as soon as the app starts." Is the student correct? Explain

No, any code with an onEvent() block waits until the specified event occurs.


onEvent("submitBtn", "click", function() {
    setScreen("formScreen");
});

500

Design Mode contents:
homeScreen, menuScreen, gamesScreen

Code:
onEvent("startBtn", "click", function() {
    setScreen("menuScren");
});

onEvent("playBtn", "click", function() {
   setScreen("gameScreen");
});

onEvent("homeBtn", "click", function() {
   setScreen(homescreen);
});

Bug 1

menuScreen


Bug 2

"homeScreen"

500

Why are comments and testing essential to App Design?

Comments make it easy to trace what is happening and testing help make sure the app works as it is intended to