What will the value of score be at the end of the program?
Note: <- is used to represent a left facing arrow
Explain in your own words the process of creating and updating a variable. How does the Counter Pattern with Event work?
The process of creating and updating a variable is using the var tag to create it. Then you use the event tag to update the variable with the user interaction you have chosen. For example in the code above the variable is 0 but when you click on it you add one which then updates the variable. The counter pattern with the event works because it updates the variable with every user interaction.
What will be displayed after this code segment is run?
The program below is run. Which of the following COULD NOT possibly be the output from that program?
An expression that produces a true of false when evaluated
A symbol or word used to connect 2 or more expressions
And
Or
Not
Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" answer?
A computer cannot evaluate something between true and false because if the boolean expression is false then it is false and the same goes for true. You cannot write an expression to deal with a maybe answer.
What does it mean to put the most specific case first?
Why is it important to put the most specific case first? What types of errors does it help avoid?
Putting the most specific case first means putting the code that will help determine the rest of the other cases and is not general. In the temperature example in bubble 6 the most specific case is 100 because if the temperature is less then 100 then it will see if the temperature is less then 90 or greater and onward. If the temperature is greater then 100 there is no need to go through all the other cases because the first case is already true and will run correctly. It is important to put the most specific case first because it prevents bugs and makes your code run most smoothly. The types of errors you can avoid is the wrong text popping up for the value of your variables, your code not running smoothly or at all because the if-else-if statement is not correct, etc.
What will be displayed after this code segment is run?
The program below asks a user to type in a number and then will output a message. What number will a user need to input for the message "COLD" to be displayed?
In your own words describe the benefits of creating functions in your code?
The benefits of creating functions in your own code is that it makes the code easier to read and gives your code a cleaner look. Having functions are make it easier to program because instead of writing the same code multiple times for different things you can just make the function and then write the function name and the code will go.
What will be displayed after this code segment is run?