Problem 1. What are the arguments for and against representing Boolean values as
ID: 3843052 • Letter: P
Question
Problem 1. 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.)
Problem 2. Describe the functions performed by a garbage collector. What are the advantages and disadvantages of using a programming language with garbage collection services?
Problem 3. 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?
Problem 4: Describe how the following programming languages deal with the dangling else issue: C++, Java, Ruby, and Python.
Problem 5: Discuss the differences between name type and structure type equivalence. Explain some potential challenges with implementing structure type equivalence.
Explanation / Answer
Below are your answers.Please do rate this answer positive, If i was able to help you. Let me know if you have any issues in comments
1.
Representing boolean as single bits is very much memory efficient as only 1 bit is used in place of 8 bits. But If we use only 1 bit for boolean, then searching or accessing the boolean variable will be very much inefficient as these can be stored anywhere and will take more time to access it.
2.Main function of garbage collector is to make memory allocation more efficient by gathering and deleting the unused allocated memory automatically. in Java gc() is the method which is used for garbage collection. Because of this automatic memory management, the programmer need not to do extra programming to this task and can code the requirement without any extra duration or cost.
Another advantage of this memory management is that application is more efficient in this persistent data structure.
Disadvantage of this function is that it effects the performance of the application sometimes for eg. manipulation of garbage collection is non deterministic like games. One of the other disadvantage is that sometimes, this explicit management produces faults in memory management.
As per chegg policy solving first 2 questions. Please post rest of the questions saperatly
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.