Hacks for 3.1 Part 1
You want to store the number of apples in a shop. What is the best variable name and data type?
- numApples, integer
- apples, text
- numApples, string
- isApples, boolean
You are storing true or false in a variable that asks if the classroom is cold. What is the best variable name and data type?
- weather, integer
- weather, boolean
- isCold, boolean
- cold, string
How do you store the ID numbers for the students in the classroom? Choose the best variable name and data type:
- IDnumber, string
- whatID, integer
- IDnumberofthestudentsintheclassroom, boolean
- IDnumberofthestudentsintheclassroom, integer
Is itisRainingtodayinsandiego a better option than isRaining?
- Yes
- No
Which of the following types of data is best for a true or false question?
- Boolean
- String
- Float
- All of the above
What is the difference between an integer and string of numbers?
- An integer is just a set data type while a string of numbers can be changed with addition and subtraction
- An integer can be letters and numbers while a string is just numbers
- An integer is just numbers while a string is just words
- An integer can be changed with addition and subtraction and a string is a set number or string of letters.
Now, make at least 3 of your own practice questions making a scenario and then adding the variable name and data type. Add this to you blog!
You are storing player numbers. Choose the best variable name and data type:
Answer: Playernum, string
You are deciding if it is raining. Choose the best variable name and data type:
Answer: isRaining, boolean
You want to track how much money is in your bank account. Choose the best variable name and data type:
Answer: numMoney, integer
Hacks for 3.1 Part 2
Answer the practice problems and blog about which one's you got wrong. After, create at least 6 problems that are alike to what you learned in this portion of the lesson.
Consider the following code segment:
- currentScore ⟵ 10
- highScore ⟵ currentscore
- currentScore ⟵ 7
DISPLAY (currentScore)
What will the currentScore be after running this code segment?
- 17
- 10
- 7
- none of the above
What will the highScore be?
- 17
- 10
- 7
- none of the above
Consider the following code segment:
- num1 ⟵ 4
- num2 ⟵ 6
- num1 ⟵ num 2
DISPLAY(num1)
DISPLAY(num2)
What is displayed after running this code segment?
- 4 6
- 6 4
- 4 4
- 6 6
Consider the following code segment:
- num1 ⟵ 25
- num2 ⟵ 15
- num3 ⟵ 30
- num2 ⟵ num3
- num3 ⟵ num1
- num1 ⟵ num2
DISPLAY(num1)
DISPLAY(num2)
DISPLAY(num3)
What is displayed after running this code segment?
- 25 15 30
- 30 30 25
- 30 15 30
- 15 30 25
Consider the following code segment:
- p ⟵ 10
- q ⟵ 20
- r ⟵ 30
- s ⟵ 40
- p ⟵ q
- q ⟵ r
- s ⟵ q
- r ⟵ p
What is the value of r as a result of running this code segment
- 10
- 20
- 30
- 40
Consider the following code segment:
- first ⟵ true
- second ⟵ false
- second ⟵ first
- first ⟵ second
Insert Question
- The value of first is true, and the value of second is false.
- The value of first is false, and the value of second is true.
- The value of first is true, and the value of second is true.
- The value of first is false, and the value of second is false.
Consider the following code segment:
- a ⟵ 10
- b ⟵ 20
- c ⟵ 30
- d ⟵ 40
- x ⟵ 20
- b ⟵ x + b
- a ⟵ x + 1
- d ⟵ c / d + 2
DISPLAY(a)
DISPLAY(b)
DISPLAY(c)
DISPLAY(d)
What is displayed as a result of executing the code segment?
- 21 40 30 50
- 10 20 30 40
- 21 40 30 40
- 21 30 40 50
Binary Hacks 3.2 Part 1
Convert these binary notation to decimal notation. (the way we normally count)
- The binary number 111 is 7
- The binary number 1011 is 11
- The binary number 1101011 is 107
Convert the decimal notation to binary notation. (You can use the Binary Math from Mr. Yeung or the one you have)
- 12 in binary is 1100
- 44 in binary is 101100
- 254 in binary is 11111110
Extra Binary Hacks if you changed your bits to 24
Convert decimal notation to binary notation.
- 57345 in binary is 1110000000000001
- 16777215 in binary is 111111111111111111111111
- 11184810 in binary is 101010101010101010101010
Convert the binary notation to decimal notation
- 101011101010 in decimal notation is 2794
- 10011100000 in decimal notation is 1248
- 1101001000101000 in decimal notation is 53800
Hacks for 3.2 Part 2
Consider the following code segment:
- scores1 <- [89, 78, 92, 63, 95, 88]
- scores2 <- [92, 79, 97, 63]
- scores1 <- scores2
What are the contents of scores1 after the code segment is executed?:
- [89, 78, 92, 63, 95, 88]
- [89, 78, 92, 63, 95, 88, 92, 79, 97, 63]
- [92, 79, 97, 63, 89, 78, 92, 63, 95, 88]
- [92, 79, 97, 63]
Consider the following code segment:
- listA <- ["Sam", "Ann"]
- listB <- ["Jamal", "Tamara"]
- listB <- listA
- listA <- listB
What are the contents of listA after the code segment is executed?
- ["Sam", "Ann"]
- ["Jamal", "Tamara"]
- ["Sam", "Ann", "Jamal", "Tamara"]
- ["Jamal", "Tamara", "Sam", "Ann"]
What is the length of this list? ["Red", "Orange", "Yellow", "Green", "Blue", "Purple"]
- 5
- 7
- 6
- 4
What is the index number of "Purple" in this list? ["Red", "Orange", "Yellow", "Green", "Blue", "Purple"]
- 7
- 0
- 6
- 5
Which of the following types of data can be stored in a list?
- Boolean
- String
- Float
- All of the above
Which of the following variables is a float?
- Apples
- -106.2
- 34
- True
If a list has a length of 24 items, what is the index number of the 17th item?
- 21
- 17
- 16
- 69
A variable is permanent and cannot be changed later on.
- True
- False
Which of the following is true about the list? ["Apples", 42.0, "Bananas", 0.5, "Avocado", -902.2, "Lychee", 6.9, "Orange", 7.2]
- The list has floats and string variable types.
- The ratio of float variables to string variables is 2:1.
- The length is 9.
- The index of "Avocado" is 4.
- All of the above
- 1 and 4
- 1, 3, and 4