Why do computers require precise instructions?
Computers cannot handle vague, ambiguous directions. They need exact instructions to perform tasks correctly.
What command is used to change from one screen to another in App Lab?
setScreen("screenName");
What is an event in App Lab?
An action that occurs as a result of a button click, which causes separate code to run
What is debugging?
What is the primary purpose of a user interface (UI)?
it allows the user to interact with the application
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.
What identifies a button, label, screen, etc so the program can interact with it?
element ID
Which of the following is an event?
A. variable
B. button click
C. screen
D. label
B - a button click
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
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
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
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!");
What will happen here?
onEvent("homeBtn", "click", function() {
setScreen("homeScreen");
});
When a user clicks the homeBtn the screen changes to the homeScreen
Find the error
onEvent("nextBtn", "click", function() {
setScreen("screen2");
The closing brace, parathesis, and semicolon are missing
});
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
A team writes the following algorithm:
Identify two problems with this algorithm
- out of order
- no password mentioned
- which button for #2?
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
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");
});
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
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
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.
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");
});
A student claims that "all of the code runs as soon as the app starts." Is the student correct? Explain
onEvent("submitBtn", "click", function() {
setScreen("formScreen");
});
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"
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