Giả sử trong cơ sở dữ liệu BookShop có procedure được tạo ra bằng script: CREATE PROCEDURE InsertOrder (ID int = NULL output, BookID int, Quantity int) … Cho biết nguyên nhân sinh ra lỗi khi chạy đoạn code dưới đây? SqlConnection connection = new SqlConnection(“Data source=localhost;Initial catalog=BookShop”); SqlCommand command = new SqlCommand(“InsertOrder”, connection); command.CommandType=CommandType.StoredProcedure; command.Parameters.Add(“ID”, SqlDbType.Int); command.Parameters.Add(“BookID”, SqlDbType.Int).Value = bookID; command.Parameters.Add(“Quantity”, SqlDbType.Int) = quantity; connection.Open(); command.ExecuteReader(); connection.Close(); A) Không thể thực hiện command.ExecuteReader() để chạy một Stored Procedure Giả sử trong cơ sở dữ liệu BookShop có procedure được tạo ra bằng script: CREATE PROCEDURE InsertOrder (ID int = NULL output, BookID int, Quantity int) … Cho biết nguyên nhân sinh ra lỗi khi chạy đoạn code dưới đây? SqlConnection connection = new SqlConnection(“Data source=localhost;Initial catalog=BookShop”); SqlCommand command = new SqlCommand(“InsertOrder”, connection);
Trang 1ASP là viết tắt bởi:
A) Active Server Pages
B
Biểu thức nào sau đây là sai nếu chưa chỉ định sử dụng namespace System.Data?
C) DataTable table = (DataTable)listBox1.DataSource;
Biểu thức nào sau đây là sai nếu chưa chỉ định sử dụng namespace System.Xml?
Các bước bắt buộc để đưa một DataTable lên một đối tượng DataList gồm:
B) Gán DataList.DataSource = DataTable và gọi DataList.DataBind()
Các HTML control gồm các nhóm nào?
C) HtmlInputControl, HtmlContainerControl và HtmlImage
Các web service được xây dựng trong file có phần mở rộng nào?
Trang 2Cho control sau:
<asp:CheckBoxList ID=”CheckBoxList1” runat=”server”>
Biểu thức nào cho phép truy cập đến item đang được chọn của control?
C) CheckBoxList1.Items[CheckBoxList1.SelectedIndex]
Cho control sau:
<asp:CheckBoxList ID=”CheckBoxList1” runat=”server”>
Biểu thức nào cho phép truy cập đến danh sách các item của control?
Trang 4Hãy cho biết Tables[1].Columns.Count của một DataSet sau khi đọc Schema của file này?
C) HtmlInputText không có thuộc tính Text
Cho biết đoạn tag trong WSDL sau đây mô tả cho Web service nào?
Trang 5A) string BinToDec(string BinaryNumber)
Cho biết đoạn tag trong WSDL sau đây mô tả cho Web service nào?
<s:element name="GetWeather">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CityName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CountryName" type="s:string" />
C) string GetWeather(string CityName, string CountryName)
Cho đoạn xml sau:
Trang 6Cho đoạn thẻ sau đây:
<asp:DropDownList ID=”DropDownList1” runat=”server”>
…
< /asp:DropDownList>
Lệnh C# nào tương đương với tag <asp:ListItem Text=”Item 1” Value=”1” />
D) DropDownList1.Items.Add(new ListItem(“Item 1”, “1”))
Cho đoạn thẻ sau đây:
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
Cho đoạn thẻ sau đây:
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
Trang 7<asp:ListItem Text="Item 1" Value="5" />
<asp:ListItem Text="Item 2" Selected="True" Value="10" />
<asp:ListItem Text="Item 3" Value="20" />
Trang 9C) string DecToBin(int DecimalNumber)
Cho các file sau đây:
MyTable.ascx:
<script language="C#" runat="server">
public string Value
Trong các file này có gì sai?
B) Không thể gán giá trị cho thuộc tính Value
Cho đoạn code sau:
string xml = "<Order><KhachHangID>1</KhachHangID>";
foreach (DataRow r in this.tblGioHang.Rows)
Trang 10xml += string.Format("<Sach><SachID>{0}</SachID><SoLuong>{3}</SoLuong><DonGia>{4}</Do nGia></Sach>", r.ItemArray);
C) “4”
Cho đoạn code sau:
protected void Page_Load(object sender, EventArgs e)
Trang 11dm.Table = new DataTable();
Cho đoạn code sau:
DataTable table = new DataTable();
…
DataRow row = table.NewRow();
Cho biết trạng thái của đối tượng row?
B) RowState.Detached
Cho đoạn code sau:
DataTable table = new DataTable();
<form id="form1" runat="server">
<asp:Button Text="Tổng" runat="server" OnClick="Button1_Click"/>
Trang 12</form> </body></html>
<script language="C#" runat="server">
void Button1_Click(object sender, EventArgs e)
{
Response.Write(Button1.Text);
}
</script>
File này có lỗi nào?
D) Không có đối tượng nào có tên là Button1
Cho file aspx sau:
<%@ Page Language="C#" %>
<html><body>
<form id="form1" runat="server">
<asp:Button ID="Button1" Text="Tổng" runat="server" OnClick="Button1_Click"/>
File này có lỗi nào?
D) Không chỉ định code chạy tại server
Cho file aspx sau:
<%@ Page Language="C#" %>
<html><body>
<form id="form1" runat="server">
<asp:Button ID="Button1" Text="Tổng" runat="server" OnClick="Button1_Click"/>
</form> </body></html>
File này có lỗi nào?
Trang 13C) Không có hàm xử lý sự kiện
Cho đoạn tag sau:
<asp:RadioButton ID=”Radio1” GroupName=”Group1” runat=”server” Checked=”true” />
<asp:RadioButton ID=”Radio2” GroupName=”Group1” runat=”server” />
Vì sao hai RadioButton này không thể cùng có thuộc tính Checked bằng “true”?
Trang 14Để sử dụng một web service trong ASP.NET project, cần thêm gì vào References
A) WScủa web service
Để sử dụng các đối tượng IDbCommand, IDbConnection cần sử dụng namespace nào?
A) System.Data
Đối tượng nào được server trả về khi có yêu cầu một trang aspx?
A) string BinToDec(string BinaryNumber)
Đối tượng nào được server trả về khi có yêu cầu một trang aspx?
Trang 15Giả sử trong cơ sở dữ liệu BookShop có bảng tableOrder Cho biết nguyên nhân sinh ra lỗi khi chạy đoạn code dưới đây?
SqlConnection connection = new SqlConnection(“Data source=localhost;Initial catalog=BookShop”);
SqlCommand command = new SqlCommand();
command.CommandText = “SELECT * FROM tableOrder”
connection.Open();
command.ExecuteReader();
connection.Close();
D) Chưa thiết lập thuộc tính Connection cho command
Giả sử trong cơ sở dữ liệu BookShop có procedure được tạo ra bằng script:
CREATE PROCEDURE InsertOrder (@ID int = NULL output, @BookID int, @Quantity int)
…
Cho biết nguyên nhân sinh ra lỗi khi chạy đoạn code dưới đây?
SqlConnection connection = new SqlConnection(“Data source=localhost;Initial catalog=BookShop”);
SqlCommand command = new SqlCommand(“InsertOrder”, connection);
command.Parameters.Add(“@ID”, SqlDbType.Int);
command.Parameters.Add(“@BookID”, SqlDbType.Int).Value = bookID;
command.Parameters.Add(“@Quantity”, SqlDbType.Int) = quantity;
connection.Open();
command.ExecuteNonQuery();
connection.Close();
C) command.commandType không phù hợp
Giả sử trong cơ sở dữ liệu BookShop có procedure được tạo ra bằng script:
CREATE PROCEDURE InsertOrder (@ID int = NULL output, @BookID=NULL int,
@Quantity int, @All bit) …
Cho biết nguyên nhân sinh ra lỗi khi chạy đoạn code dưới đây?
SqlConnection connection = new SqlConnection(“Data source=localhost;Initial catalog=BookShop”);
SqlCommand command = new SqlCommand(“InsertOrder”, connection);
Trang 16B) Chưa thiết lập Value cho Parameter “@Quantity
Giả sử trong cơ sở dữ liệu BookShop có procedure được tạo ra bằng script: CREATE PROCEDURE InsertOrder (@ID int = NULL output, @BookID int,
@Quantity int) …
Cho biết nguyên nhân sinh ra lỗi khi chạy đoạn code dưới đây?
SqlConnection connection = new SqlConnection(“Data source=localhost;Initial catalog=BookShop”);
SqlCommand command = new SqlCommand(“InsertOrder”, connection);
command.CommandType=CommandType.StoredProcedure;
command.Parameters.Add(“@ID”, SqlDbType.Int);
command.Parameters.Add(“@BookID”, SqlDbType.Int).Value = bookID;
command.Parameters.Add(“@Quantity”, SqlDbType.Int) = quantity;
connection.Open();
command.ExecuteReader();
connection.Close();
A) Không thể thực hiện command.ExecuteReader() để chạy một Stored Procedure
Giả sử trong cơ sở dữ liệu BookShop có procedure được tạo ra bằng script:
Trang 17CREATE PROCEDURE InsertOrder (@ID int = NULL output, @BookID int, @Quantity int)
…
Cho biết nguyên nhân sinh ra lỗi khi chạy đoạn code dưới đây?
SqlConnection connection = new SqlConnection(“Data source=localhost;Initial catalog=BookShop”);
SqlCommand command = new SqlCommand(“InsertOrder”, connection);
command.Parameters.Add(“@ID”, SqlDbType.Int);
command.Parameters.Add(“@BookID”, SqlDbType.Int).Value = bookID;
command.Parameters.Add(“@Quantity”, SqlDbType.Int) = quantity;
InnerText là giá trị (Value) của Element nào?
B) Element không có ChildNode
Trang 18Một Stored Procedure có các tham số sau:
@ID int, @Name nvarchar(50), DOB datetime, @Male bit
Nếu checkbox1 là một tên của CheckBox Control và command là tên của một đối tượng SqlCommand thì biểu thức nào sau đây là đúng?
C) command.Parameters.Add(“@Male”, SqlDbType.Bit).Value = checkbox1.Checked
Một web service được xây dựng trên nền tảng của class nào?
C) WebService
Một XmlNode không có node con có NodeType là gì?
A) Text
Một Stored Procedure có các tham số sau:
@ID int, @Name nvarchar(50), DOB datetime, @Male bit
Trang 19Hãy chọn tham số đúng khi thêm các tham số của một đối tượng SqlCommand với tên command cho @DOB
A) command.Parameters.Add(“@DOB”, SqlDbType.DateTime)
Một đối tượng XmlTextWriter sau khi thực hiện phương thức WriteComment(“Comment Text”); sẽ ghi dòng nào vào file xml?
D) <! Comment Text >
Một đối tượng XmlTextWriter sau khi thực hiện phương thức
WriteElement(“Order”); sẽ ghi dòng nào vào file xml?
A) <Order />
Một class được xây dựng ở đâu?
A) Trong file cs
Một Web User Control được xây dựng trong file “MyTable.ascx” Directive nào cho phép
sử dụng control này trong file aspx
A) <%@ Register TagPrefix="myControl" TagName="MyTable" Src="MyTable.ascx" %>
Trang 20A) localhost.ShoppingCart sc = new localhost.ShoppingCart(); sc.InsertDatHang(xml);
Nếu một đối tượng DataRow có trạng thái là RowState.Unchanged, khi bị xóa khỏi
DataTable.Rows thì trạng thái của nó là gì?
Trang 21Phương thức nào của DataAdapter dùng để cập nhật sự thay đổi của dữ liệu từ DataTable vào cơ sở dữ liệu?
Trang 22Tag <input type=”text”> tạo ra control nào?
B) Một ô nhập một dòng ký tự
Tag <textarea> tạo ra control nào?
C) Một ô nhập nhiều dòng ký tự
Tag <a> tạo ra control nào?
A) Một dòng link đến một web page
Tập tham số của SqlCommand là?
Trang 23B) Web Control Tag
Thành phần nào của Provider dùng để chạy một câu SQL?
B) Command
Thành phần nào của Provider cho phép kết nối đến cơ sở dữ liệu?
A) Connection
Trong đoạn tag dưới đây có gì không đúng?
<asp:CheckBox ID="CheckBox1" runat="server"/>
B) Ngôn ngữ mô tả web service
Web User Control có control <asp:label ID=”Label1”> Biểu thức trong thuộc tính đặt dòng chữ hiện trên control sẽ được viết thể nào?
B) set { Label1.Text = value; }