Unit 3 Sections 1-2 Hacks
Unit 3 Sections 1-2
3.1 Hacks
File 1(3.1 Video 1)
- Answer: #1 numApples, integer
- Answer: #3 isCold, boolean
- Answer: #1 IDNumber, string
- Answer: #2, No
- Answer: #1, Boolean
- Answer: #4, An integer can be changed with addition and subtraction and a string is a set number or string of letters.
Additional Questions
-
Which of the following data types is best for storing a word? A. String B. Boolean C. Integer D. List
-
How would you store the result of a presidential vote in a program? A. presVotes, string B. votesforpresident, integer C. presVotes, integer D. presVotes, boolean
Answer: C.
- How would store a value that contains whether a user has a premium subscription? A. usersubscription, boolean B. proSub, boolean C. doyouhavesubscription, string D. subbed, integer
Answer: D.
File 2(3.1 Video 2)
- Answer: #3, 7
- Answer: #2, 10
- Answer: #4, 6 6
- Answer: #2, 30 30 25
- Answer: #2, 20
- Answer: #3, The value of first is true, and the value of second is true.
- Answer: #1, 21 40 30 50
Additional Questions
- What is displayed by the code? string <– “hello” string <– “bye” string <– greeting DISPLAY (greeting)
A. "bye" B. “hello” C. greeting D. string
- What is displayed by the code? a <– 2 b <– a b <– 10 a <– b DISPLAY (a)
A. 10 B. 2 C. a D. b
- What boolean value will be stored in the variable enoughMoney? enoughMoney <– true value <– false enoughMoney <– value coupon <– true enoughMoney <– coupon
A. false B. enoughMoney C. true D. coupon
- What will be the result of the code? x <– 40 y <– 2 z <– 18 z <– x/y y <– x + z
DISPLAY (x + y + z)
A. 20 B. 40 C. 60 D. 120
- What will be displayed by the code segment? account <– 100 account <– account * 1.1 expenses <– 20 account <– account - expenses DISPLAY (account)
A. 20 B. 100 C. 90 D. 110
- What will the code segment display? studentA <– ‘A’ studentB <– studentA studentF <– ‘A+’ studentA <– studentF DISPLAY (studentA)
A. 'A+' B. ‘A’ C. studentF D. ‘C-‘
Blog
3.1 Focused on variables and assigning values to those variables. Variables will hold value throughout the program. When naming a variable, it is important to make it simple and not too long, for ease of use and calling in a program. We can store different types of values in the variable, like an integer, string, boolean, or float. When calling variable, the value stored in the variable will be the same as the most recent definition of the variable above the call. I think it is important to practice questions with lots of reassignment because theses questions can become very confusing quickly if you do not pay attention while going through the pseudocode.
3.2 Hacks
Video 2
Binary Hacks
Binary to Decimal
- 7
- 11
- 107 Decimal to Binary
- 1100
- 101100
- 11111110
Decimal to Binary
- 1110000000000001
- 111111111111111111111111
- 101010101010101010101010 Binary to Decimal
- 2794
- 1248
- 53800
Hacks
- Answer: #4 [92, 79, 97, 63]
- Answer: #1 [“Sam”, “Ann”]
- Answer: #3 6
- Answer: #4 5
- Answer: #4 All of the above.(Boolean, String, Float)
- Answer: #2 -106.2
- Answer: #3 16
- Answer: #2 False
- Answer: #6 1 and 4
Blog
Lists are very important to programs and algorithms. They allow for any data set to be stored together. Lists can take in any data type. Lists store these elements at specific indices. When counting the indices of a list, the first one starts at 0, the second one is 1, the third one is 2, etc. It is important to know what a list can store for AP questions.