Any help is appreciated, thank you! What are the arguments for and against repre
ID: 3841320 • Letter: A
Question
Any help is appreciated, thank you!
What are the arguments for and against representing Boolean values as single bits in memory. (Recall that the C++ bool type is actually one byte in size despite the fact that a logical true/false can be encoded in one bit.) Describe the functions performed by a garbage collector. What are the advantages and disadvantages of using a programming language with garbage collection services? Recall that many programming languages use short circuit evaluation when determining the result of a complex boolean expression involving add/or operations. What are the benefit of using short circuit evaluations? Are there are safety/reliability issues involved? If so, what are they? Describe how the following programming languages deal with the dangling else issue: C++, Java, Ruby, and Python. Discuss the differences between name type and structure type equivalence. Explain some potential challenges with implementing structure type equivalence.Explanation / Answer
1)Answer:
->Boolean variables stored as single bits are very space efficient, but on most computers
access to them is slower than if they were stored as bytes.
->For: Using a single bit instead of an entire byte will conserve memory.so boolean variables stored as single bits are very space efficient
->Against: Processors to have addresses for single bits. So up to 8 Booleans values can be combined into a single byte, which means bit-wise arithmetic to separate the separate values. Although this conserves memory, it takes more time (CPU time) to deal with.
->A Boolean value could be represented by a single bit, but because a single
bit of memory cannot be accessed efficiently on many machines, they are often
stored in the smallest efficiently addressable cell of memory, typically a byte.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.