程序设计模拟题Word格式文档下载.docx
《程序设计模拟题Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《程序设计模拟题Word格式文档下载.docx(10页珍藏版)》请在冰豆网上搜索。
D.aspx
2、VisualStudio没有内置的编程语言是。
A.VisualC#.NET
B.PB.NET
C.VisualBasic.NET
D.VisualJ#.NET
3、Visualstudio2008不可用于开发_____程序()
A.Web应用程序
B.3D动画
C.XMLWebSerivce
D.Windows应用程序
4、Replace()实现字符串的_____功能。
A.替换字符串的内容
B.截取子字符串
C.计算字符串的长度
D.去掉字符串中的空格
5、通过数据视图的RowFilter属性可以实现_____功能。
A.数据排序
B.数据删除
C.数据过滤
D.数据更新
6、C#每个语句行以_____结束。
A.#
B.句号
C.逗号
D.分号
7、如果希望使用TreeView控件显示时默认全部展开应设置_____属性。
A.ExpandDepth
B.ExpandImageToolTip
C.ExpandImageUrl
D.ExpandAll
8、CheckBox是我们常用的控件,它是指。
A.列表框
B.文本框
C.复选框
D.标签
9、下面的变量名称,正确的是。
A.X*Y
B.$XY
C.12XY
D.XY_1
10、具有用户登录界面设计功能的控件是。
A.Login
B.LoginView
C.Loginname
D.LoginStatus
11、SqlDataSource不可以直接访问。
A.MicrosoftSQLServer
B.MicrosoftAccess
C.Oracle
D.Word
12、GridView控件不支持的操作是。
A.选择
B.编辑
C.删除
D.上传
13、可使用户能够方便地在网站的不同页面之间实现跳转的控件是。
A.CausesValidation
B.HyperLink
C.Checked
D.SelectedIndex
14、下列保持程序状态的方法中,那种是服务器端的管理方式。
A.input
B.ViewState
C.Session
D.Cookie
15、要将数据源绑定到控件,需要调用控件的_____方法。
A.DataBind
B.Load
C.Dispose
D.GetType
16、要使Button控件不可用,需要将控件的_____属性设置为false。
A.CausesValidation
B.EnableViewState
C.Visible
D.Enabled
17、要使文本框最多输入6个字符,需要将该控件的_____属性值设置为6。
A.Rows
B.MaxLength
C.Columns
D.TabIndex
18、以下代码,输出结果为。
()
strings="
ABCABCD"
;
Console.WriteLine(s.IndexOf("
BCD"
));
A.4
B.1
C.3
D.2
19、下面不属于导航控件。
A.Menu
B.SiteMapPath
C.View
D.TreeView
20、应用程序主题储于Web应用程序的_____文件夹中。
A.App_Themes
B.根目录
C.App_code
D.子目录
21、数组的下标是从_____开始。
A.1
B.-1
C.0
D.2
22、要使RadioButton控件被选中,需要将其_____属性设置为true。
A.Enabled
B.Checked
C.AutoPostBack
D.Visible
三、简答题
1、C#程序从编写到运行要经过哪几个步骤。
2、列举ASP.NET2.0对于Session内容的存储模式有哪些。
四、程序题
说明:
按各小题的要求,填入程序中不完整的部分。
1、写出下面程序段的输出结果。
staticvoidMain(string[]args)
{
strings="
Console.WriteLine(s.IndexOf('
A'
//输出
(1)
//输出
(2)
Console.WriteLine(s.LastIndexOf('
C'
//输出(3)
s="
ADEF"
Console.WriteLine(s.Insert(1,"
BC"
//输出(4)__
Console.WriteLine(s.Remove
(1));
//输出(5)__
Console.WriteLine(s.Remove(0,2));
//输出(6)__
}
2、以下程序是实现简单的发表留言,显示留言的功能。
Default.aspx代码:
……
<
formid="
form1"
runat="
server"
>
姓名<
asp:
TextBoxID="
tb_UserName"
/asp:
TextBox>
br/>
留言<
tb_Message"
Height="
100px"
TextMode="
MultiLine"
Width="
300px"
<
ButtonID="
btn_SendMessage"
Text="
发表留言"
OnClick="
btn_SendMessage_Click"
/>
RepeaterID="
rpt_Message"
ItemTemplate>
tablewidth="
600px"
style="
border:
solid1px#666666;
font-size:
10pt;
background-color:
#f0f0f0"
tr>
tdalign="
left"
width="
400px"
%#Eval("
Message"
)%>
/td>
right"
200px"
PostTime"
-<
UserName"
/tr>
/table>
/ItemTemplate>
Repeater>
Default.aspx.cs代码:
usingSystem;
usingSystem.Data;
using
(1);
usingSystem.Configuration;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
publicpartialclass_Default:
System.Web.UI.Page
protectedvoidPage_Load(objectsender,EventArgse)
{
if(
(2))
SetBind();
}
}
protectedvoidbtn_SendMessage_Click(objectsender,EventArgse)
SqlConnectionconn=newSqlConnection(@"
server=(local)\SQLEXPRESS;
database=GuestBook;
Trusted_Connection=True"
);
stringSql="
(3)tbGuestBook(UserName,PostTime,Message,IsReplied,Reply)VALUES('
"
+tb_UserName.Text+"
'
'
+DateTime.Now+"
+tb_Message.Text+"
0,'
)"
SqlCommandcmd=newSqlCommand((4),conn);
conn.Open();
cmd.(5);
conn.(6);
privatevoidSetBind()
SELECT*FROMtbGuestBook(7)PostTimeDESC"
SqlDataAdapterda=newSqlDataAdapter(Sql,conn);
DataSetds=newDataSet();
da.(8)(ds);
DataTabledt=ds.Tables[0];
rpt_Message.(9)