Any concepts on this page might be on the quiz. The quiz will be in late November.
Scratch and Programming
The Scratch stage measures 480 pixels wide by 360 pixels tall. Locations on the Scratch stage are referred to by their x and y coordinates. x indicates where it is on the horizontal axis, and y to the position on the vertical axis. The center is x=0 and y=0. X values range from -240 to 240 and Y ranges from -180 to 180.
To move a sprite you can either point it in a specific direction and issue the Move (10) Steps instruction, or you can directly change the x and y position of the sprite, usually within a Repeat loop.
Two methods of orchestrating the actions in a Scratch project across multiple sprites are through timing, using the “Wait (0) secs” block, and through broadcast/receive blocks. Broadcast and Receive are covered in the Donut Calculator assignment.
Using the Wait block:
Using message broadcasting:
In Scratch, when you use the Ask block to ask a question, the answer typed in by your program’s user is temporarily stored in the special Answer variable. When asking more than one question, you must save each answer into its own variable. Otherwise it will be overwritten by the answer to the next question.
A Boolean expression is a logical statement that is either TRUE or FALSE . Boolean expressions can compare data as long as both parts of the expression have the same basic data type, for example both are numbers or both are letters or words. You can test data to see if it is equal to, greater than, or less than other data.
Boolean expressions are used by programmers to make certain instructions happen only some of the time, when the expression is TRUE. Whenever you see an “IF” statement in a program, it is using Boolean expressions to determine what happens next.
If/else blocks also have an “else” section for the script instruction blocks you want to run when the boolean expression is FALSE.
Boolean expressions may be modified by the NOT operator, which makes the Boolean expression the opposite of what it would otherwise be. For example, NOT TRUE is FALSE and NOT FALSE is TRUE.
They can also be combined with the use of the AND and OR operators. With the AND operator, the expressions on both sides of the AND must be true for the overall expression to be true. With the OR operator, if either expression is True then the overall expression is true. For example: (2 < 1) OR (3 > 2) is True because at least one of the expressions, in this case (3 > 2), is true.
There will be several questions where you are shown a fragment of Scratch code and asked a question about what will happen when it runs. When solving these problems, it is often useful to make notes with a row for every iteration or pass through a loop and notes of variable values as of each iteration.
Some of the code samples on the quiz will have bugs or defects you will have to identify. Most of the bugs are cases where instructions in the code will fail to ever run, or where they are out of order such that the program will not behave as intended.
Any time you have the ability to name something in your program, you should give it a name that describes its purpose. Your projects should not have a name of “Untitled”, your sprites should not be “Sprite1″ Sprite2” etc, and your variables should not be named “my variable”. The reason for this is to help you and other programmers make sense of your program. The computer is only one audience for reading your programs: when things go wrong, other humans and you yourself need some clues as to what the progammer’s intention was when writing the progam.
Students will be able to define and apply the following terms:
Iterate, iteration, iterative: To repeat a process, In Scratch, this is achieved through the following blocks: “repeat”, “repeat until”, and “forever.”
Boolean Expression: a comparison which evaluates to True or False. Discussed above in more detail.
Concatenate: To join things together. In Scratch we use the Join block to join some text which does not change together with the current value of a variable. For example: “The answer is 42” where 42 is the value of a variable
String Concatenation: When programming, the word string refers to a sequence of letters or characters. A string could be a word or sentence, or any non-numeric information of more than one letter. String concatenation is the operation where words or sentences are connected to form new and longer longer strings.
Conditional Processing: When your program has instructions that only happen some of the time. The primary example in Scratch is the IF block, and its companion, the If/Else block. These contain a Boolean expression. When the Boolean expression is evaluated and is true, the instructions inside the IF block run.
Design Time vs. Run Time: Design time is when you are designing and writing a program. You must consider all possibilities such as whether an answer to a question is correct or not. Run Time is when someone is using your program and refers to the specific or unique conditions they experience under specific values of variables or other varying conditions such as the use of random numbers.
Practice Quiz, Quiz Schedule, and Retakes
To aid you in your preparation, a practice quiz and answer key will be posted before the end of October. The quiz will be in late November on a date to be determined. Grades will be posted to PowerSchool by the end of day Friday, the day after the quiz.
Mr. James is available for questions and content review after school on Wednesdays in the Makerspace (during Robotics) and by appointment.
Students must submit the Request to Retake form if they wish to retake the quiz, and they must show up on time when their retake is scheduled.