Câu 37: CPP: C++ Certified Professional Programmer
What happens when you attempt to compile and run the following code?#include #include #include using namespace std;int main (){int t[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };vector v1(t, t + 10);deque d1(v1.begin(), v1.end());deque d2;d2 = d1;d2.insert(d1.rbegin(), 10);for(int i = 0; i<d1.size(); i++){cout<<d1[i]<<" ";}re…
Nội dung câu hỏi
What happens when you attempt to compile and run the following code?#include #include #include using namespace std;int main (){int t[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };vector v1(t, t + 10);deque d1(v1.begin(), v1.end());deque d2;d2 = d1;d2.insert(d1.rbegin(), 10);for(int i = 0; i<d1.size(); i++){cout<<d1[i]<<" ";}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: 0 1 2 3 4 5 6 7 8 9 10
- B. program outputs: 10 0 1 2 3 4 5 6 7 8 9
- C. program outputs: 0 1 2 3 4 5 6 7 8 9
- D. compilation error — đáp án hiện tại
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.