Câu 36: 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 (){list l1;deque d1;for(int i=0; i<5; i++){l1.push_back(i);l1.push_front(i);d1.push_back(i);d1.push_front(i);}for(int i=0; i<d1.size(); i++){cout<<d1[i]<<" "<<l1[i]<<" ";}cout<<endl;return 0;}
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 (){list l1;deque d1;for(int i=0; i<5; i++){l1.push_back(i);l1.push_front(i);d1.push_back(i);d1.push_front(i);}for(int i=0; i<d1.size(); i++){cout<<d1[i]<<" "<<l1[i]<<" ";}cout<<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 displays 4 4 3 3 2 2 1 1 0 0 0 0 1 1 2 2 3 3 4 4
- B. runtime exception
- C. compilation error due to line 11
- D. compilation error due to line 12
- E. compilation error due to line 16 — đá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.