В результате выполнения какого фрагмента кода в браузере будет выведена таблица, содержащая 5 строк и 3 столбца?
(Отметьте один правильный вариант ответа.)
Варианты ответа
System.Web.UI.WebControls.Table table = new System.Web.UI.WebControls.Table();form1.Controls.Add(table);table.BorderWidth = 1;for (int row = 1; row <= 5; row++){ TableRow tr = new TableRow(); table.Rows.Add(tr); for (int col = 1; col <= 3; col++) { TableCell tc = new TableCell(); tr.Cells.Add(tc); tc.Text = string.Format("{{{0},{1}}}",row + 1, col + 1); tc.BorderWidth = 1; if (row % 2 == 0) tc.BackColor = System.Drawing.Color.Moccasin; else tc.BackColor = System.Drawing.Color.PowderBlue; }}(Верный ответ)
System.Web.UI.WebControls.Table table = new System.Web.UI.WebControls.Table();form1.Controls.Add(table);table.BorderWidth = 1;for (int row = 0; row < 3; row++){ TableRow tr = new TableRow(); table.Rows.Add(tr); for (int col = 0; col < 5; col++) { TableCell tc = new TableCell(); tr.Cells.Add(tc); tc.Text = string.Format("{{{0},{1}}}",row + 1, col + 1); tc.BorderWidth = 1; if (row % 2 == 0) tc.BackColor = System.Drawing.Color.Moccasin; else tc.BackColor = System.Drawing.Color.PowderBlue; }}
System.Web.UI.WebControls.Table table = new System.Web.UI.WebControls.Table();table.BorderWidth = 1;for (int row = 0; row < 5; row++){ TableRow tr = new TableRow(); table.Rows.Add(tr); for (int col = 0; col < 3; col++) { TableCell tc = new TableCell(); tr.Cells.Add(tc); tc.Text = string.Format("{{{0},{1}}}",row + 1, col + 1); tc.BorderWidth = 1; if (row % 2 == 0) tc.BackColor = System.Drawing.Color.Moccasin; else tc.BackColor = System.Drawing.Color.PowderBlue; }}