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

模拟试题二

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


    <      >
       <       rows="10" cols="30">hello
       </textarea>
       <br/>
    <              ="submit"       ="Submit" />
    <input type="reset" value="Reset" /> </form>
   
   2、根据网页截图效果补充代码。(5分)


    <      >
        <      >
        </head>
    <      >
    <        face="verdana" size=5 color= red>hello world!</font>
    <font face="宋体" size=3       = blue>hello world!</font>
    </body> </html>
   二、数据库基础代码分析(2*5分=10分)
   1.解释代码:请解释下述代码的含义。(5分)
      UPDATE article SET content = ‘修改’
      VALUES (‘实验’, ‘学生’, ‘插入数据’);

   2.解释代码:请解释下述代码的含义。(5分)
      SELECT article.writter
      FROM article;

   三.标准控件代码分析(2*10分=20分)
   1.解释代码:请解释下述代码的含义。(10分)
   DropDownList.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:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
    <asp:ListItem>Item1</asp:ListItem>
    <asp:ListItem>Item2</asp:ListItem>
    <asp:ListItem>Item3</asp:ListItem>
    </asp:DropDownList>
    <asp:Label ID="Label1" runat="server"></asp:Label></div>
    </form>
    </body>
    </html>
    --------
    DropDownList.vb :
    Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
    Label1.Text = DropDownList1.SelectedItem.Value.ToString()
    End Sub
    End Class
    --------
   
    2.解释代码:请解释下述代码的含义。(10分)
   FileUpLoadEx.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:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="Button1" runat="server" Text="确定" /><br />
    <asp:Label ID="Label5" runat="server" Text="上传成功" Visible="False"></asp:Label><br />
    <asp:Label ID="Label1" runat="server" Text="文件名称:"></asp:Label><br />
    <asp:Label ID="Label2" runat="server" Text="保存路径:"></asp:Label><br />
    <asp:Label ID="Label3" runat="server" Text="文件类型:"></asp:Label><br />
    <asp:Label ID="Label4" runat="server" Height="15px" Text="文件大小:"></asp:Label></div>
    </form>
    </body>
    </html>
    ---------------
    FileUpLoadEx.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
    Dim strFileName As String
    Dim strPath As String
    If FileUpload1.PostedFile.FileName <> "" Then '判断上传文件名是否为空
    FileUpload1.Visible = True
    strFileName = FileUpload1.PostedFile.FileName '获得上传文件在本地的文件名
    strPath = Server.MapPath(".") + "\\" + strFileName '重组得到上传至服务器的路径
    Label2.Text += strPath
    FileUpload1.PostedFile.SaveAs(strPath) '上传文件
    Label5.Visible = True
    Label1.Text += FileUpload1.PostedFile.FileName '文件名信息
    Label3.Text += FileUpload1.PostedFile.ContentType '文件类型信息
    Label4.Text += FileUpload1.PostedFile.ContentLength.ToString() '文件大小信息
    End If
    End Sub
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
    End Class
         
    四、网络基础名词解释(2*5分=10分)
    1.请解释如图所示模型的含义。(5分)


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

   五、站点开发控件代码分析(3*10分=30分)
   1.解释代码:请解释下述代码的含义。(10分)
   MenuEx.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:Menu ID="Menu1" runat="server" BackColor="#F7F6F3" DynamicHorizontalOffset="2"
    Font-Names="Verdana" Font-Size="0.8em" ForeColor="#7C6F57" Orientation="Horizontal"
    StaticSubMenuIndent="10px">
    <StaticSelectedStyle BackColor="#5D7B9D" />
    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
    <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
    <DynamicMenuStyle BackColor="#F7F6F3" />
    <DynamicSelectedStyle BackColor="#5D7B9D" />
    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
    <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
    <Items>
    <asp:MenuItem NavigateUrl="~/Default.aspx" Text="主页" Value="主页"></asp:MenuItem>
    <asp:MenuItem Text="个人信息" Value="个人信息"></asp:MenuItem>
    <asp:MenuItem Text="相册" Value="相册">
    <asp:MenuItem Text="管理相册" Value="管理相册"></asp:MenuItem>
    <asp:MenuItem Text="上传文件" Value="上传文件"></asp:MenuItem>
    </asp:MenuItem>
    <asp:MenuItem Text="博客" Value="博客"></asp:MenuItem>
    <asp:MenuItem Text="链接" Value="链接"></asp:MenuItem>
    </Items>
    </asp:Menu>
   
    </div>
    </form>
    </body>
    </html>
    --------
    MenuEx.vb :
   
    Partial Class _Default
    Inherits System.Web.UI.Page
   
    End Class

    2.解释代码:请解释下述代码的含义。(10分)
   RangeValidatorEx.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="确定" />
    <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox1"
    ErrorMessage="RangeValidator" MaximumValue="90" MinimumValue="0" Type="Integer">超出数值范围</asp:RangeValidator></div>
    </form>
    </body>
    </html>
    --------
    RangeValidatorEx.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
    RangeValidator1.Validate()
   
    If (RangeValidator1.IsValid = True) Then
    Response.Write("通过检验")
    End If
    End Sub
    End Class

    3.解释代码:请解释下述代码的含义。(10分)
   RegularExpressionEx.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;
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="确定" />
    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
    ErrorMessage="RegularExpressionValidator" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">格式错误</asp:RegularExpressionValidator></div>
    </form>
    </body>
    </html>
    --------
    RegularExpressionEx.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
    RegularExpressionValidator1.Validate()
   
    If (RegularExpressionValidator1.IsValid = True) Then
    Response.Write("通过验证")
    End If
    End Sub
    End Class

   六、内建组件对象代码分析(2*10分=20分)
   1.解释代码:请解释下述代码的含义。(10分)
   Application.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>
    --------
    Application.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
    Application("times") = Now()
    Response.Write("访问时间为:" + Application("times"))
    End Sub
    End Class

    2.解释代码:请解释下述代码的含义。(10分)
      HttpBrowser.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>
    --------
    HttpBrowser.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 bc As HttpBrowserCapabilities = Request.Browser
    Response.Write("您好,您正在使用 " + bc.Browser + " v." + bc.Version + ",你的运行平台是 " + bc.Platform)
    End Sub
    End Class
           
参考答案