Trả lời:
Đáp án đúng: A
The code initializes an integer array `arr` with values {5, 8, 2, 10}. It then iterates through the array using a `for` loop, applying two operations to each element: first, it calculates the modulo 5 of the element (`arr[i] % 5`), and then it subtracts 1 from the result. Finally, it prints the modified element followed by a space. Let's trace the execution:
- i = 0: `arr[0] = 5 % 5 = 0`; `arr[0] = 0 - 1 = -1`. Output: -1
- i = 1: `arr[1] = 8 % 5 = 3`; `arr[1] = 3 - 1 = 2`. Output: 2
- i = 2: `arr[2] = 2 % 5 = 2`; `arr[2] = 2 - 1 = 1`. Output: 1
- i = 3: `arr[3] = 10 % 5 = 0`; `arr[3] = 0 - 1 = -1`. Output: -1
Therefore, the output of the program is -1 2 1 -1.
Câu hỏi liên quan

FORM.08: Bộ 130+ Biểu Mẫu Thống Kê Trong Doanh Nghiệp

FORM.07: Bộ 125+ Biểu Mẫu Báo Cáo Trong Doanh Nghiệp

FORM.06: Bộ 320+ Biểu Mẫu Hành Chính Thông Dụng

FORM.05: Bộ 330+ Biểu Mẫu Thuế - Kê Khai Thuế Mới Nhất

FORM.04: Bộ 240+ Biểu Mẫu Chứng Từ Kế Toán Thông Dụng
