0
0
Intro to Computingfundamentals~10 mins

Why understanding hardware builds intuition 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 print the number of CPU cores available on the system.

Intro to Computing
import os
cores = os.cpu_count()
print('CPU cores:', [1])
Drag options to blanks, or click blank then click option'
Acpu_count
Bos
Ccores
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using the function name instead of the variable.
Trying to print the module name.
2fill in blank
medium

Complete the code to calculate the total memory in bytes using the given hardware info dictionary.

Intro to Computing
hardware_info = {'memory_gb': 8}
total_bytes = hardware_info['memory_gb'] * [1]
print('Total memory in bytes:', total_bytes)
Drag options to blanks, or click blank then click option'
A1024 * 1024 * 1024
B1024 * 1024
C1000 * 1000 * 1000
D1024
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1000 instead of 1024 for conversion.
Multiplying by 1024 only once or twice.
3fill in blank
hard

Fix the error in the code to correctly calculate the CPU speed in MHz from GHz.

Intro to Computing
cpu_speed_ghz = 3.5
cpu_speed_mhz = cpu_speed_ghz [1] 1000
print('CPU speed in MHz:', cpu_speed_mhz)
Drag options to blanks, or click blank then click option'
A/
B-
C+
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using division or addition instead of multiplication.
Confusing units.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each device name to its RAM size in MB.

Intro to Computing
devices = {'laptop': 8, 'tablet': 4, 'phone': 2}
ram_mb = { [1]: [2] * 1024 for [1] in devices }
Drag options to blanks, or click blank then click option'
Adevice
Bdevices[device]
Cram
Ddevice_name
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names.
Not multiplying RAM size by 1024.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that includes only devices with RAM greater than 3 GB, converting RAM to MB.

Intro to Computing
devices = {'laptop': 8, 'tablet': 4, 'phone': 2}
filtered_ram = { [1]: devices[[2]] * 1024 for [3] in devices if devices[[2]] > 3 }
Drag options to blanks, or click blank then click option'
Aname
Ddevice
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not filtering correctly.