Small Basic: Link to PDF Lessons
Small Basic: Important Concepts
1. What is the term for the part of the small basic environment where you write your programs or enter your code? The editor
2. As you type your programs, you will often see a popup appear with a list of items. You may choose selections from this list as part of your programming. What is this popup called? intellisense
3. A typical Small Basic program consists of a bunch of statements. Every line of the program represents a statement and every statement is an instruction for the computer.
4. A line of program can often be broken into smaller segments. It is fairly easy to tell when a segment ends and a new segment starts, because the writing will usually change colors.
5. If you wanted to change the color of the text from white to yellow in your text window, what programming segment/property would you use to accomplish this? ForegroundColor
6. What type of code segment would typically follow the operation Write or WriteLine? - A string, such as ("Enter Your Name") or ("Hello World.")
7. What is the difference between the operation Write and WriteLine?
- Write allows the next piece of text to be on the same line as the current text. WriteLine places the next piece of text on the next line.
8. TextWindow.Write("Enter your Name: ")
name = TextWindow.Read()
TextWindow.WriteLine("Hello " + name)
- In the three lines of code above, what programming term would we give to the word name? a variable
9. What are three good rules for naming variables?
- The name should start with a letter and should not collide with any of the keywords like if, for, then, etc.
- A name can contain any combination of letters, digits and underscores.
- It is useful to name variables meaningfully – since variables can be as long as you want, use variable names to describe their intent.
10. number1 = 10
number2 = 20
number3 = number1 * number2
TextWindow.WriteLine(number3)
- In the four lines of code above, why do the numbers 10 and 20 not have quotation marks around them? Because they are integers, not strings.
11. A block of code that starts with If, must end with what? EndIf
12. A block of code that starts with For, must end with what? EndFor
13. A block of code that starts with While, must end with what? EndWhile
14. A block of code that starts with For or While is usually used to create what? Loops
15. If you want to program with text, you use what operation? TextWindow.
16. If you want to program with graphics, you use what operation? GraphicsWindow.
17. What was the name of the powerful programming language from the 1970s & 1980s that added turtle graphics to give programming a visual component it had not had before? Logo
18. Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move (100)
Turtle.Turn(-45)
- What movement will the turtle perform based on the four lines of code above?
It will move 200 pixels
turn right 90 degrees
move 100 pixels
turn left -45 degrees
19. An array is a special kind of variable which can hold more than one value at a time.
20. These are like signals that are raised, for example, in response to user actions, like moving the mouse or clicking it. Events
21. Python used the Pound sign (#) to create comments in the code. What punctuation does Small Basic use to make comments?
- a single apostrophe (')
22. (True or False) In programming, whether it be Python or Small Basic, there is usually only one correct way to write a program. False
23. How would you write code for the four lines below using Small Basic?
- Give a value to the first number.
- Give a value to the second number.
- Add the first number to the second number, resulting in the sum, a third number.
- Tell me the sum.
number1 = 10
number2 = 20
number3 = number1 + number2
TextWindow.WriteLine(number3)
2. As you type your programs, you will often see a popup appear with a list of items. You may choose selections from this list as part of your programming. What is this popup called? intellisense
3. A typical Small Basic program consists of a bunch of statements. Every line of the program represents a statement and every statement is an instruction for the computer.
4. A line of program can often be broken into smaller segments. It is fairly easy to tell when a segment ends and a new segment starts, because the writing will usually change colors.
5. If you wanted to change the color of the text from white to yellow in your text window, what programming segment/property would you use to accomplish this? ForegroundColor
6. What type of code segment would typically follow the operation Write or WriteLine? - A string, such as ("Enter Your Name") or ("Hello World.")
7. What is the difference between the operation Write and WriteLine?
- Write allows the next piece of text to be on the same line as the current text. WriteLine places the next piece of text on the next line.
8. TextWindow.Write("Enter your Name: ")
name = TextWindow.Read()
TextWindow.WriteLine("Hello " + name)
- In the three lines of code above, what programming term would we give to the word name? a variable
9. What are three good rules for naming variables?
- The name should start with a letter and should not collide with any of the keywords like if, for, then, etc.
- A name can contain any combination of letters, digits and underscores.
- It is useful to name variables meaningfully – since variables can be as long as you want, use variable names to describe their intent.
10. number1 = 10
number2 = 20
number3 = number1 * number2
TextWindow.WriteLine(number3)
- In the four lines of code above, why do the numbers 10 and 20 not have quotation marks around them? Because they are integers, not strings.
11. A block of code that starts with If, must end with what? EndIf
12. A block of code that starts with For, must end with what? EndFor
13. A block of code that starts with While, must end with what? EndWhile
14. A block of code that starts with For or While is usually used to create what? Loops
15. If you want to program with text, you use what operation? TextWindow.
16. If you want to program with graphics, you use what operation? GraphicsWindow.
17. What was the name of the powerful programming language from the 1970s & 1980s that added turtle graphics to give programming a visual component it had not had before? Logo
18. Turtle.Move(200)
Turtle.TurnRight()
Turtle.Move (100)
Turtle.Turn(-45)
- What movement will the turtle perform based on the four lines of code above?
It will move 200 pixels
turn right 90 degrees
move 100 pixels
turn left -45 degrees
19. An array is a special kind of variable which can hold more than one value at a time.
20. These are like signals that are raised, for example, in response to user actions, like moving the mouse or clicking it. Events
21. Python used the Pound sign (#) to create comments in the code. What punctuation does Small Basic use to make comments?
- a single apostrophe (')
22. (True or False) In programming, whether it be Python or Small Basic, there is usually only one correct way to write a program. False
23. How would you write code for the four lines below using Small Basic?
- Give a value to the first number.
- Give a value to the second number.
- Add the first number to the second number, resulting in the sum, a third number.
- Tell me the sum.
number1 = 10
number2 = 20
number3 = number1 + number2
TextWindow.WriteLine(number3)