Which type(s) of bug exist? Check all that apply. If the code crashes, fill in t
ID: 3902213 • Letter: W
Question
Which type(s) of bug exist? Check all that apply.
If the code crashes, fill in the values of the data members right before the crash.
If the code doesn't crash, fill in the values of the data members right before the overloaded = operator exits.
If a value is not yet instantiated, or if the code exits or crashes when a variable is not in scope, write "unknown".
Assume values start at 0 at the top of the seven segment image and 0 at the left of the seven segment image.
this -> topRow ___________
this-> midRow ___________
this-> bottomRow ___________
this-> leftCol ___________
this->rightCol ___________
width ___________
height ___________
row ___________
i ___________
j ___________
>bad access or segmentation fault or malloc errorExplanation / Answer
In the overloaded operator function:
rhs's data has not been checked for null condition:
1. segmentation fault
2. rhs members have not been checked for negative data.
3. allocateCleanArray(); has been called after updating the value
so prvious values will be lost.Deallocate will not happen
properly. Memory leak
Crash is certain
If crash happens:
this -> topRow = rhs.topRow
this-> midRow = rhs.midRow
this-> bottomRow = rhs.bottomRow
this-> leftCol = rhs.leftCol
this->rightCol = rhs.rightCol
width = Unkown (program will not reach here)
height = Unkown (program will not reach here)
row = Unkown (program will not reach here)
i = Unkown (program will not reach here)
j = Unkown (program will not reach here)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.