0
0
Intro to Computingfundamentals~10 mins

Why computers use binary in Intro to Computing - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to show the two states used in binary.

Intro to Computing
binary_states = [[1], 1]
Drag options to blanks, or click blank then click option'
ANone
B0
CTrue
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using numbers other than 0 or 1.
Using boolean values like True instead of 0.
2fill in blank
medium

Complete the code to convert a decimal number to binary using built-in function.

Intro to Computing
binary_value = bin([1])
Drag options to blanks, or click blank then click option'
A10
B2
C'1010'
D0b10
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a string instead of an integer.
Passing a binary string instead of decimal number.
3fill in blank
hard

Fix the error in the code to correctly check if a bit is 1.

Intro to Computing
if bit == [1]:
    print('Bit is ON')
Drag options to blanks, or click blank then click option'
A1
B"1"
CTrue
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Comparing bit to string "1" instead of number 1.
Using boolean True which may cause unexpected results.
4fill in blank
hard

Fill both blanks to create a simple binary AND operation.

Intro to Computing
result = [1] & [2]
Drag options to blanks, or click blank then click option'
A0b1010
B0b1100
C0b1000
D0b1111
Attempts:
3 left
💡 Hint
Common Mistakes
Using decimal numbers instead of binary literals.
Using the wrong operator like | instead of &.
5fill in blank
hard

Fill all three blanks to create a dictionary mapping decimal to binary strings for numbers 1 to 4.

Intro to Computing
binary_map = [1]((x, bin(x)) for x in [2](1, [3]))
Drag options to blanks, or click blank then click option'
Adict
Brange
C5
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using list instead of dict.
Using wrong range end value causing missing numbers.