ASP NET动态网站开发基础教程习题答案

2019-01-19 13:20

Chap01参考答案 一、填空题

1、Web XML Web services

2、公共语言运行库、.NET Framework类库 3、属性 方法 事件 4、aspx 5、cs

二、选择题

1、ABCD 2、ABCD 3、AB 4、A 5、B 三、上机操作题 1、参考1.3.1。 2、参考1.4.2。

3、在ex1_1.aspx文件中的代码如下所示:

在ex1_1.aspx.cs中的代码如下所示:

public partial class _Default : System.Web.UI.Page {

private static int i;

protected void Page_Load(object sender, EventArgs e) {

if(!Page.IsPostBack) i = 0; }

protected void Button1_Click(object sender, EventArgs e) { i=i+1;

Label1.Text = \您单击了\次按钮\} }

Chap02参考答案 一、填空题 1、引用类型 2、object 3、显式 4、多态性

5、初始化语句右侧 二、选择题

钮\1、AC 2、A 3、B 4、B 5、AC 三、上机操作题

1、本习题的源代码如下: namespace ex2_1 {

struct student {

public string name; public string address; public string tel; };

class Program {

static void Main(string[] args) {

student[] stu = new student[5]; for (int i = 0; i < 5; i++) {

stu[i].name = Console.ReadLine(); stu[i].address = Console.ReadLine(); stu[i].tel = Console.ReadLine(); }

for (int i = 0; i < 5; i++) {

Console.WriteLine(i.ToString()); Console.WriteLine(stu[i].name); Console.WriteLine(stu[i].address); Console.WriteLine(stu[i].tel); }

Console.ReadLine(); } } }

2、本习题的源代码如下: namespace ex2_2 {

class Program {

static void sort(int[] a, int n) {

int temp;

for (int i = 1; i < n; i++) for (int j = 0; j < n - i; j++) if (a[j] > a[j + 1])

{

temp = a[j]; a[j] = a[j + 1]; a[j + 1] = temp; } }

static void Main(string[] args) {

int n = 5;

int[] a = new int[5]; for (int i = 0; i < 5; i++) {

a[i] = Convert.ToInt32(Console.ReadLine()); }

sort(a, n);

for (int i = 0; i < 5; i++) {

Console.WriteLine(a[i].ToString()); }

Console.ReadLine(); } } }

3、本习题的源代码如下: namespace ex2_3 {

class student {

protected string m_name; protected string m_sex; protected float m_tuition;

public student(string strname, string strsex, float ftuition) {

m_name = strname; m_sex = strsex;

m_tuition = ftuition; }

virtual public void printfInfo() {

Console.WriteLine(m_name + \} }

class graduate : student {

protected string m_tutor; public graduate(string strname, strtutor):base(strname,strsex,ftuition) {

m_tutor = strtutor; }

override public void printfInfo() {

base.printfInfo();

Console.WriteLine(\导师是\} }

class Program {

static void Main(string[] args) {

string strsex, float ftuition,string

student s = new student(\张三\男\

graduate g = new graduate(\李四\女\王五\s.printfInfo(); g.printfInfo();

Console.ReadLine(); } } }

Chap03参考答案 一、填空题

1、HttpResponse 2、客户端 3、服务器 4、状态变量 5、用户会话 二、选择题

1、C 2、ABCD 3、ABCD 4、AD 三、上机操作题

1、在ex_1_1.aspx文件中的代码如下所示:

在ex_1_1.aspx.cs文件中的代码如下所示: public partial class _Default : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) { }

protected void Button1_Click(object sender, EventArgs e) {

Response.Redirect(\张三\} }

在ex_1_2.aspx.cs文件中的代码如下所示: public partial class ex_1_2 : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) {

Response.Write(Request.QueryString[\} }

2、在ex2_1.aspx文件中的代码如下所示:

在ex_2_1.aspx.cs文件中的代码如下所示:

public partial class __ex_2_1 : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e) { }

protected void Button1_Click(object sender, EventArgs e) {

Session[\李四\

Response.Redirect(\} }

在ex_2_2.aspx文件中的代码如下所示:

在ex_2_2.aspx.cs文件中的代码如下所示: public partial class _ex_2_2 : System.Web.UI.Page


ASP NET动态网站开发基础教程习题答案.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2010年下半年中国银行业从业人员资格认证考试--真题&答案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: