AP CS Principles
Binary Review
The following questions are review for the midterm.
QUESTION 1 of 5
What is the binary equivalent for 12?
1011
0011
1100
Right!
Next
QUESTION 2 of 5
What is the maximum decimal number a 4 bit binary number can represent
15
16
Right!
Next
QUESTION 3 of 5
What is 1110 in decimal?
14
13
15
Right!
Next
QUESTION 4 of 5
How many bits are in a byte
Right!
Next
QUESTION 5 of 5
Consider a computer that uses 4 bits to represent nonnegative integers and uses all 4 bits to represent the value. Which of the following would result in integer overflow?
3 x 3
4 x 4
1 + 3
Right!
Results
QUESTION 5 of 5
Ernesto writes this code to calculate the final cost of a meal with a tip of 20%:meal ← 9.70 withTip ← 1.20 total ← meal * withTip They're surprised to see that total stores the value 11.639999999999999 instead of 11.64.
Integer Overflow
Roundoff error
Limited percision
Right!
Results
Summary
Bit vs Byte
Base 2
Overflow
Roundoff
This error happen when you try to store a number to big or to small for the numbers of bits you have. The number loops back aound and will appear too small or too big
Decimals cannot be fully represented in binary. 0.1 + 0.1 + 0.1 = 0.3 but in binary it is 0.300000000004
Bit - 1 digitByte - 4 bits
20 - 121 - 2 22 - 4 23 - 8
Quick Binary Review
Abby Sheridan
Created on December 14, 2023
Start designing with a free template
Discover more than 1500 professional designs like these:
View
Math quiz
View
Math quiz mobile
View
Retro Bits Quiz
View
Corporate Icebreaker
View
Christmas Spirit Test
View
Timer Quiz
View
Stopwatch Quiz
Explore all templates
Transcript
AP CS Principles
Binary Review
The following questions are review for the midterm.
QUESTION 1 of 5
What is the binary equivalent for 12?
1011
0011
1100
Right!
Next
QUESTION 2 of 5
What is the maximum decimal number a 4 bit binary number can represent
15
16
Right!
Next
QUESTION 3 of 5
What is 1110 in decimal?
14
13
15
Right!
Next
QUESTION 4 of 5
How many bits are in a byte
Right!
Next
QUESTION 5 of 5
Consider a computer that uses 4 bits to represent nonnegative integers and uses all 4 bits to represent the value. Which of the following would result in integer overflow?
3 x 3
4 x 4
1 + 3
Right!
Results
QUESTION 5 of 5
Ernesto writes this code to calculate the final cost of a meal with a tip of 20%:meal ← 9.70 withTip ← 1.20 total ← meal * withTip They're surprised to see that total stores the value 11.639999999999999 instead of 11.64.
Integer Overflow
Roundoff error
Limited percision
Right!
Results
Summary
Bit vs Byte
Base 2
Overflow
Roundoff
This error happen when you try to store a number to big or to small for the numbers of bits you have. The number loops back aound and will appear too small or too big
Decimals cannot be fully represented in binary. 0.1 + 0.1 + 0.1 = 0.3 but in binary it is 0.300000000004
Bit - 1 digitByte - 4 bits
20 - 121 - 2 22 - 4 23 - 8