Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Test Information  Description This is Part #4 of the final test

Test Information  Description This is Part #4 of the final test

Computer Science

Test Information 
Description This is Part #4 of the final test. This part is worth 20% of the final test mark. 
In this part you must identify syntactic errors (that are caught by a compiler, generate memory leaks or crashes/undefined behaviour at runtime) in the provided C++ code, ac-cording to the C++17 standard. 
The test contains one (1) question with five errors. You must identify all five errors. Instructions The Debugging questions are presented as C++ code that has errors in it: errors caught by a compiler, generate memory leaks or crashes/undefined behaviour at runtime. Your task is to identify each error by file name and line number and to explain why the error appears, what C++ standard rule is broken or C++ feature is misused and how to fix the error. Your answer will be evaluated based on clarity of the text and the show of un-derstanding of the concepts involved. 
Each identified error can receive 4 points: 
Look carefully at every line in the code snippet you are provided. Ask yourself "For this line to work, what conditions must be met?", and then check that those conditions are met. Example of conditions (the list below is general and not complete, just gives you some examples): 
• identifiers are declared/defined • necessary headers are included • types match in the expression • keywords are used with the correct semantic • operators and language features are used following the C++ standard • correct namespaces are used • null terminator for strings is used appropriately • privacy rules are not violated • variables are not used before being initialized • dynamic memory is correctly handled 
The code below contains five (5) syntactic errors under C++17 standard (errors that are caught by a compiler or generate crashes/memory leaks/undefined behaviour at runtime). Make use of the listed hints when locating errors: 
• Error #1 - In student.cpp related to the use of function qualifiers • Error #2 - In main.cpp related to definition/ re-definition • Error #3 - In student.cpp related to variable scoping/ access • Error #4 - In student.cpp related use of variable modification • Error #5 - In main.cpp related to use of dynamic memory 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Error # 2- In main.cpp related to definition/ re-definition
	line 23, we can not initialise the object like that.

Error 3:

In student.cpp line 12 SIZE is not defined but still trying to access which is error.

Error 4:

In student.cpp line 13 cnames is trying to be modified but have not been defined or passed in that function.

Error #5- In main.cpp related to use of dynamic memory
	line 26 in main.cpp, because the *c is a pointer to the student but the st[0] is not.