Midterm (2) Flashcards
How many bits are there in a “byte” of data?
8 bits
What is a popular convention set that associates 8 bit binary bit patterns to different characters?
ASCII
Is it reasonable to store an ASCII character value in a byte?
Yes
What does the CPU do?
Runs programs and makes sure the computer runs smoothly.
What size of memory is the least amount that has an address/name that machine code can refer to?
8 bits
What size of memory does a computer typically use to store an integer for floating point value?
A “word” of memory, either 4 bits (float) or 8 bits (double)
True or False: Two common word sizes are 32 and 64 bits, and larger word size allows for greater precision and greater range for values stored.
True
What is a string in Python?
One or more characters placed in a sequence to be an “ASCII text” string, or just “string” for short.
What is the process of converting a float in string form to a binary floating point number used by the CPU to do math?
Casting
What is the one type of language a CPU can perform?
Machine Code
True or False: A variable can be thought of as a name which points to a value.
True
Given that the 8 bit pattern 00110100 is the ASCII representation for the character “4”, and assuming we have a computer with only 8 bit words, what would the memory X points at look like if we executed the statement X = input(“type in an int”) and the user entered a 4 and then pressed enter?
00110100
(because they’re entering the string for the character 4, not the integer 4)
What would the machine code representation of the number 4 look like if it were entered as a string, then cast as an in int?
00000100
(The integer value of 4 expressed in binary machine code)
What happens to a value in memory if things change and there is no variable pointing to it anymore?
It gets garbage collected and allocated to free/unused memory by Python