Câu 67: CPP: C++ Certified Professional Programmer
What happens when you attempt to compile and run the following code?#include #include using namespace std;template void print(T start, T end) {while (start != end) {std::cout l1(t1, t1 + 5);int t2[] ={ 3, 2, 6, 9, 0 };list l2(t2, t2 + 5);l1.sort();list ::iterator it = l2.begin();it++; it++;l1.splice(l1.end(),l2, it, l…
Nội dung câu hỏi
What happens when you attempt to compile and run the following code?#include #include using namespace std;template void print(T start, T end) {while (start != end) {std::cout l1(t1, t1 + 5);int t2[] ={ 3, 2, 6, 9, 0 };list l2(t2, t2 + 5);l1.sort();list ::iterator it = l2.begin();it++; it++;l1.splice(l1.end(),l2, it, l2.end());print(l1.begin(), l1.end()); cout<<"Size:"<<l1.size()<<" "; print(l2.begin(), l2.end()); cout<<"Size:"<<l2.size()<<endl; return 0;}
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. program outputs: 1 4 5 7 8 6 9 0 Size:8 3 2 Size:2 — đáp án hiện tại
- B. program outputs: 1 4 5 7 8 6 9 0 Size:8 3 2 6 9 0 Size:5
- C. compilation error
- D. program outputs: 0 1 4 5 6 7 8 9 Size:8 3 2 Size:2
- E. program outputs: 0 1 4 5 6 7 8 9 Size:8 3 2 6 9 0 Size:5
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.