Struct Definition for SCP Objects
Struct Definition for SCP Objects
Câu hỏi 1
Đúng
Mô tả tiếng Việt:
Cho struct SCP lưu trữ thông tin các vật thể dị thường được mô tả như sau:
struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};
SCP createSCP(int id, int objClass, string speConProcedures, string description, string* addendums, int
numAddendums);
Hàm có chức năng khởi tạo instance của struct SCP với các thông tin đã truyền vào, sau đó trả về instance đó.
Ghi chú: (Các) thư viện iostream và string đã được khai báo, và namespace std đã được sử dụng.
English version:
Struct SCP used to store information about paranormal objects is declared as below:
struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};
SCP createSCP(int id, int objClass, string speConProcedures, string description, string* addendums, int
numAddendums);
The function returns a new instance of struct SCP with the passed parameters.
Note: Libraries iostream and string have been imported, and namespace std has been used.
For example:
Test Result
delete [] addendums;
[Link] 2/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);
delete [] addendums;
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);
delete [] addendums;
string* addendums = new string[2]; Object is kept within a five (5) by five
addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts (5) by two point five (2.5) meter square
forward the hypothesis that SCP-055 was never formally acquired."; room.
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);
string* addendums = new string[2]; All known information about the object
addendums[0] = "Document #055-1: An Analysis of SCP-055\nThe author puts is that it is not round.
forward the hypothesis that SCP-055 was never formally acquired.";
addendums[1] = "Document #055-2: Report of Dr. John Marachek\nSurvey team
#19-055-127BXE was successfully able to enter SCP-055's container and
ascertain the appearance.";
SCP obj = createSCP(55, 2, "Object is kept within a five (5) by five (5)
by two point five (2.5) meter square room.", "All known information about
the object is that it is not round.", addendums, 2);
delete [] addendums;
[Link] 3/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
delete [] addendums;
delete [] addendums;
delete [] addendums;
delete [] addendums;
[Link] 4/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
delete [] addendums;
Reset answer
1 ▼ SCP createSCP(int id, int objClass, string speConProcedures, string description, string* addendums, int n
2 SCP obj;
3 [Link] = id;
4 [Link] = objClass;
5 [Link] = speConProcedures;
6 [Link] = description;
7 [Link] = addendums;
8 [Link] = numAddendums;
9
10 return obj;
11 }
[Link] 5/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Câu hỏi 2
Đúng
Mô tả tiếng Việt:
Cho struct SCP lưu trữ thông tin các vật thể dị thường được mô tả như sau:
struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};
Hàm trả về một string duy nhất, với format chuẩn được quy định bởi tổ chức:
Item #: SCP-<Mã định danh, thêm 0 vào trước nếu chưa đủ 3 chữ số>
Object Class: <Safe nếu objClass là 0, Euclid nếu là 1, Keter nếu là 2>
Special Containment Procedures: <Quy trình quản thúc đặc biệt>
Description: <Mô tả vật thể>
<Phụ lục 0>
<Phụ lục 1>
...
<Phụ lục n>
Ghi chú: (Các) thư viện iostream và string đã được khai báo, và namespace std đã được sử dụng.
English version:
Struct SCP used to store information about paranormal objects is declared as below:
struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};
For example:
[Link] 6/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
SCP obj {2, 1, "SCP-002 is to remain connected to a suitable power Item #: SCP-002
supply at all times.", "SCP-002 resembles a tumorous, fleshy growth Object Class: Euclid
with a volume of roughly 60 cubed meter.", nullptr, 0}; Special Containment Procedures: SCP-002 is
cout << convertToString(obj); to remain connected to a suitable power
supply at all times.
Description: SCP-002 resembles a tumorous,
fleshy growth with a volume of roughly 60
cubed meter.
SCP obj {500, 0, "SCP-500 must be stored in a cool and dry place away Item #: SCP-500
from bright light.", "SCP-500 is a small plastic can which at the time Object Class: Safe
of writing contains forty-seven (47) red pills.", nullptr, 0}; Special Containment Procedures: SCP-500
cout << convertToString(obj); must be stored in a cool and dry place away
from bright light.
Description: SCP-500 is a small plastic can
which at the time of writing contains
forty-seven (47) red pills.
[Link] 7/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
SCP obj {2, 1, "SCP-002 is to remain connected to a suitable power Item #: SCP-002
supply at all times.", "SCP-002 resembles a tumorous, fleshy growth Object Class: Euclid
with a volume of roughly 60 cubed meter.", nullptr, 0}; Special Containment Procedures: SCP-002 is
cout << convertToString(obj); to remain connected to a suitable power
supply at all times.
Description: SCP-002 resembles a tumorous,
fleshy growth with a volume of roughly 60
cubed meter.
SCP obj {500, 0, "SCP-500 must be stored in a cool and dry place away Item #: SCP-500
from bright light.", "SCP-500 is a small plastic can which at the time Object Class: Safe
of writing contains forty-seven (47) red pills.", nullptr, 0}; Special Containment Procedures: SCP-500
cout << convertToString(obj); must be stored in a cool and dry place away
from bright light.
Description: SCP-500 is a small plastic can
which at the time of writing contains
forty-seven (47) red pills.
Reset answer
[Link] 8/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
[Link] 9/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Câu hỏi 3
Đúng
Mô tả tiếng Việt:
Cho struct SCP lưu trữ thông tin các vật thể dị thường được mô tả như sau:
struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};
Một đối tượng dị thường là SCP-038 có khả năng tạo bản sao của các vật thể dị thường khác, ví dụ như SCP-500
(thuốc vạn ứng). Khi đối tượng gốc bị tiêu thụ/phá hủy, bản sao vẫn tồn tại độc lập.
Hàm có chức năng tạo một bản sao con trỏ loại SCP chứa các thông tin như đối tượng gốc original, sau đó trả về con
trỏ đó. Lưu ý về shallow copy và deep copy.
Ghi chú: (Các) thư viện iostream và string đã được khai báo, và namespace std đã được sử dụng.
English version:
Struct SCP used to store information about paranormal objects is declared as below:
struct SCP {
int id;
int objClass;
string speConProcedures;
string description;
string* addendums;
int numAddendums;
};
The paranormal object SCP-038 has the ability to clone other objects, such as SCP-500 (panacea). The clone is
independent of the original, and the clone will remain the same whether the original is destroyed or modified.
The function returns a pointer of the new cloned instance of the original object original. Choose the appropriate
copy method.
Note: Libraries iostream and string have been imported, and namespace std has been used.
For example:
[Link] 10/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
obj->id = 1;
cout << obj->id << " " << newObj->id << "\n";
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
[Link] 11/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
}
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
obj->id = 1;
cout << obj->id << " " << newObj->id << "\n";
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
[Link] 12/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
[Link] 13/14
04:08 27/05/2024 Struct_Inlab: Xem lại lần làm thử | BK-LMS
Test Result
SCP* obj = new SCP {55, 2, "Object is kept within a five (5) by five (5) by
two point five (2.5) meter square room.", "All known information about the
object is that it is not round.", addendums, 2};
delete [] obj->addendums;
delete obj;
delete [] newObj->addendums;
delete newObj;
}
Reset answer
[Link] 14/14