Câu 8: 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[] = {1, 2 ,3 ,4 ,5};vector v1(t, t+5);list l1;l1.assign(v1.end(), v1.begin());for(int i=0; i<l1.size(); i++){cout<<l1.at(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 (){int t[] = {1, 2 ,3 ,4 ,5};vector v1(t, t+5);list l1;l1.assign(v1.end(), v1.begin());for(int i=0; i<l1.size(); i++){cout<<l1.at(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 5 4 3 2 1
- B. program displays 1 2 3 4 5
- C. compilation error — đáp án hiện tại
- D. segmentation fault runtime exception
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.
Chưa có bình luận. Mở giao diện tương tác để bắt đầu thảo luận.