当前位置 >> 测试练习 >> 模拟考试 >> 模拟试题一    

模拟试题一

    一、HTML代码分析(5*2=10分)
      1、根据网页截图效果补充代码。(5分)


   <html>
      <___1___>
         <___2___>
            ___3___
         </title>
      </head>
      <body>
      </___4___>
     </___5___>

   2、根据网页截图效果补充代码。(5分)


      <___1___ border="1">
         <___2___>
            <___3___ >row 1, cell 1</td>
            <td>row 1, cell 2</td>
          </tr>
          <tr>
            <td>row 2, cell 1</ 4 >
            <td>row 2, cell 2</td>
         </___5___>
   </table>
   二、数据库基础代码分析(2*5分=10分)
   1.解释代码:请解释下述代码的含义。(5分)
      INSERT INTO article ( title, writer, content )
      VALUES (‘实验’, ‘学生’, ‘插入数据’);

   2.解释代码:请解释下述代码的含义。(5分)
      DELETE *
      FROM article
      WHERE 编号=1;

    三、标准控件代码分析(2*10分=20分)
   1.解释代码:请解释下述代码的含义。(10分)
    ButtonEx.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <br />
    <asp:Button ID="Button1" runat="server" Text="确定" />
    <asp:Label ID="Label1" runat="server"></asp:Label></div>
    </form>
    </body>
    </html>
    --------
    ButtonEx.vb :

    Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Response.Write("通过按钮的Click事件触发后显示!")
    End Sub

    Protected Sub Button1_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Handles Button1.Command
    Label1.Text = Label1.Text + "1"
    End Sub
    End Class

    2.解释代码:请解释下述代码的含义。(10分)
    CalendarEx.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="White"
    BorderWidth="1px" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="190px"
    NextPrevFormat="FullMonth" Width="350px">
    <SelectedDayStyle BackColor="#333399" ForeColor="White" />
    <TodayDayStyle BackColor="#CCCCCC" />
    <OtherMonthDayStyle ForeColor="#999999" />
    <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" />
    <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
    <TitleStyle BackColor="White" BorderColor="Black" BorderWidth="4px" Font-Bold="True"
    Font-Size="12pt" ForeColor="#333399" />
    </asp:Calendar>
    <br />
    <asp:Label ID="Label1" runat="server"></asp:Label>&nbsp;</div>
    </form>
    </body>
    </html>
    --------
    CalendarEx.vb :

    Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
    Label1.Text = Calendar1.SelectedDate.ToShortDateString()
    End Sub
    End Class
   
    四、网络基础名词解释(2*5分=10分)
    1.请解释如图所示模型的含义。(5分)


    2.请给出网络工具netstat的作用。(5分)

   五、站点开发控件代码分析(3*10分=30分)
   1.解释代码:请解释下述代码的含义。(10分)
    CompareValidatorEx.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="Label1" runat="server" Text="开始时间"></asp:Label>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
    <asp:Label ID="Label2" runat="server" Text="结束时间"></asp:Label>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox1"
    ControlToValidate="TextBox2" ErrorMessage="CompareValidator" Operator="GreaterThan"
    Type="Date">结束时间必需大于开始时间</asp:CompareValidator><br />
    <asp:Button ID="Button1" runat="server" Text="确定" /></div>
    </form>
    </body>
    </html>
    --------
    CompareValidatorEx.vb :
    Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    CompareValidator1.Validate()
    If (CompareValidator1.IsValid = True) Then
    Response.Write("通过检验")
    End If
    End Sub
    End Class
    2.解释代码:请解释下述代码的含义。(10分)
    CustomValidatorEx.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="TextBox1"
    ErrorMessage="CustomValidator">不是偶数</asp:CustomValidator></div>
    </form>
    </body>
    </html>
    --------
    CustomValidatorEx.vb :
    Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate
    Dim i As Integer
    i = Integer.Parse(args.Value)
    If i Mod 2 = 0 Then
    args.IsValid = True
    Else
    args.IsValid = False
    End If
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    CustomValidator1.Validate()
    If (CustomValidator1.IsValid = True) Then
    Response.Write("通过检验")
    End If
    End Sub
    End Class
    3.解释代码:请解释下述代码的含义。(10分)
    LoginEx.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    &nbsp;</div>
    </form>
    </body>
    </html>
    --------
    LoginEx.vb :
    Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
    End Sub
    End Class

   六、内建组件对象代码分析(2*10分=20分)
   1.解释代码:请解释下述代码的含义。(10分)
    Server.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
    </body>
    </html>
    --------
    Server.vb :
    Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim str As String
    str = Server.MachineName()
    Response.Write("计算机名:" + str)
    End Sub
    End Class

    2.解释代码:请解释下述代码的含义。(10分)
    Session_Default.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    </div>
    <asp:TextBox ID="Username" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
    </body>
    </html>
    --------
    Session_Default.aspx.vb :
    Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Session("Username") = Username.Text
    Response.Redirect("show.aspx")
    End Sub
    End Class
    --------
    Session_Show.aspx :
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Show.aspx.vb" Inherits="Show" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>无标题页</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
    </body>
    </html>
    --------
    Session_Show.aspx.vb :
    Partial Class Show
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Write(Session("Username"))
    End Sub
    End Class
   
           
参考答案