下面代码实现一个站点访问量计数器,空白处的代码为()。 void ____________(object sender, EventArgs e) { Application.Lock(); Application["AccessCount"] = (int)Application["AccessCount"] + 1; Application.UnLock(); }A.Application_StartB.Application_ErrorC.Session_StartD.Session_End

下面代码实现一个站点访问量计数器,空白处的代码为()。 void ____________(object sender, EventArgs e) { Application.Lock(); Application["AccessCount"] = (int)Application["AccessCount"] + 1; Application.UnLock(); }

A.Application_Start

B.Application_Error

C.Session_Start

D.Session_End


参考答案和解析
C

相关考题:

试题五(共 15分)阅读以下说明和C++代码,将应填入 (n) 处的字句写在答题纸的对应栏内。【说明】已知类 LinkedList 表示列表类,该类具有四个方法:addElement()、lastElement()、umberOfElement()以及removeLastElement()。四个方法的含义分别为:void addElement(Object): 在列表尾部添加一个对象;Object lastElement(): 返回列表尾部对象;int numberOfElement(): 返回列表中对象个数;void removeLastElement(): 删除列表尾部的对象。现需要借助LinkedList来实现一个Stack栈类,C++代码1和C++代码2分别采用继承和组合的方式实现。【C++代码 1】class Stack :public LinkedList{public:void push(Object o){ addElement(o); }; //压栈Object peek(){ return (1) ; }; //获取栈顶元素bool isEmpty(){ //判断栈是否为空return numberOfElement() == 0;};Object pop(){ //弹栈Object o = lastElement();(2) ;return o;};};【C++代码 2】class Stack {private:(3) ;public:void push(Object o){ //压栈list.addElement(o);};Object peek(){ //获取栈顶元素return list. (4) ;};bool isEmpty(){ //判断栈是否为空return list.numberOfElement() == 0;};Object pop(){//弹栈Object o = list.lastElement();list.removeLastElement();return o;};};【问题】若类LinkedList新增加了一个公有的方法removeElement(int index),用于删除列表中第index个元素,则在用继承和组合两种实现栈类Stack的方式中,哪种方式下Stack对象可访问方法removeElement(int index)? (5) (A. 继承 B. 组合)

下面代码段的输出结果为( )。 public class Test { public static void main(String sss[]) { int i=0xFFFFFFFl; int j=~i; } }A.0B.1C.14D.-15

你有被问到配置文件,可以使用事件日志 API 可以访问的业务应用程序。您已通过添加以下代码,以创建一个自定义事件日志:if (EventLog.SourceExists (Application1))EventLog.DeleteEventSource (Application1);//Create new event logEventLog.CreateEventSource (Application1, Profile);You need to write an event to the Application1 event log.What code must you use?您需要应用 1 的事件日志中写入事件。您必须使用哪些代码?()A.B.C.D.

您需要写一个接收日期参数的多播委托,您应该使用哪一个代码片段() //委托就是一个方法,题目没有返回值。 A.public delegate int PowerDeviceOn(bool result, DateTime autoPowerOff);B.public delegate bool PowerDeviceOn(object sender, EventArgs autoPowerOff);C.public delegate void PowerDeviceOn(DateTime autoPowerOff);D.public delegate bool PowerDeviceOn(DateTime autoPowerOff);

您写了下面这段代码 public delegate void FaxDocs(object sender, FaxArgs args); 您需要创建一个事件去调用FaxDocs,您应该使用哪个代码片段?() A.B.C.D.

您需要编写可接受日期时间参数并返回一个布尔值,多路广播的委托。您应该使用哪个代码段?() A.public delegate int PowerDeviceOn(bool, DateTime);B.public delegate bool PowerDeviceOn(Object, EventArgs);C.public delegate void PowerDeviceOn(DateTime);D.public delegate bool PowerDeviceOn(DateTime);

请编写实现void * malloc(int)内存分配函数功能一样的代码。

读下列说明和Java代码,将应填入(n)处的字句写在对应栏内。【说明】已知某类库开发商捉供了一套类库,类库中定义了Application类和Document类,它们之间的关系如下图所示,其中,Application类表示应用程序自身,而Document类则表示应用程序打开的文档。Application类负责打开一个已有的以外部形式存储的文档,如一个文件,一旦从该文件中读出信息后,它就由一个Document对象表示。当开发一个具体的应用程序时,开发者需要分别创建自己的Application和Document子类,例如上图中的类MyApplication和类MyDocument,并分别实现Application和 Document类中的某些方法。已知Application类中的openDocument方法采用了模板方法(Template Method)设计模式,该方法定义了打开文档的每一个主要步骤,如下所示:1.首先检查文档是否能够被打开,若不能打开,则给出出错信息并返回;2.创建文档对象;3.通过文档对象打开文档;4.通过文档对象读取文档信息;5.将文档对象加入到Application的文档对象集合中。【Java代码】abstract class Document{public void save(){/*存储文档数据,此处代码省略*/ )public void open(String docName){ /*打开文档,此处代码省略*/)public void close(){ /*关闭文档,此处代码省略*/)public abstract void read(String docName);};abstract class Appplication{private Vector<(1)> docs; /*文档对象集合*/public boolean canOpenDocument(String docName){/*判断是否可以打开指定文档,返回真值时表示可以打开,返回假值表示不可打开,此处代码省略*/}public void addDocument(Document aDocument){/*将文档对象添加到文档对象集合中*/docs.add((2));}public abstract Document doCreateDocument();/*创建一个文档对象*/public void openDocument(String docName){/*打开文档*/if ((3)) {System.out.println(“文档无法打开!”);return;}(4) adoc=(5);(6);(7);(8);}};

某JSP中有如下代码:pageContext.setAttribute( “a” , ” page ” );request.setAttribute( “a” , ” request ” );session.setAttribute( “a” , ” session ” );application.setAttribute( “a” , ” application ” );% >有:${a}则显示结果为:A.pageB.requestC.sessionD.application

下面代码有何错误void func1(){int *pa = NULL;func2(pa);delete pa;}void func2(int *pb){pb = new int(5);}

下面代码有何错误void func2(int *value){*value = 2;}void func1(){int *p = 0;func2(p);}

下面这段代码输出什么?为什么?int i=5;int j=5;if (Object.ReferenceEquals(i,j))Console.WriteLine("Equal");elseConsole.WriteLine("Not Equal");

Java Application应用程序的编写和执行分3步进行:编写源代码、编译源代码、()

请写出程序中的部分语句的意思: A:<%@ Language=”vbscript” %>的意思 B:application.unlock

已知Strings=“Java”,则下面哪些代码是正确的()A、s=s+1;B、char c=s[3];C、int i=s.length;D、String t=s+new Object();

You create a Web page named TestPage.aspx and a user control named contained in a file named TestUserControl.ascx.You need to dynamically add TestUserControl.ascx to TestPage.aspx. Which code segment should you use?()A、protected void Page_Load(object sender, EventArgs e) { Control userControl=Page.LoadControl("TestUserControl.ascx"); Page.Form.Controls.Add(userControl); }B、protected void Page_Load(object sender, EventArgs e) { Control userControl = Page.FindControl("TestUserControl.ascx"); Page.Form.Controls.Load(userControl); }C、protected void Page_PreInit(object sender, EventArgs e) { Control userControl =Page.LoadControl("TestUserControl.ascx");Page.Form.Controls.Add(userControl); }D、protected void Page_PreInit(object sender, EventArgs e) { Control userControl = Page.FindControl("TestUserControl.ascx"); Page.Form.Controls.Load(userControl); }

You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component. You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested. Which code segment should you use? ()A、void Application_Start(object sender, EventArgs e) { SiteHelper.Configure(); }B、void Application_Init(object sender, EventArgs e) { SiteHelper.Configure(); }C、void Application_BeginRequest(object sender, EventArgs e) { SiteHelper.Configure(); }D、Object lockObject = new Object(); void Application_BeginRequest(object sender, EventArgs e) { lock(lockObject()) { SiteHelper.Configure(); } }

You need to write a multicast delegate that accepts a DateTime argument.Which code segment should you use?()A、public delegate int PowerDeviceOn(bool result,DateTime autoPowerOff);B、public delegate bool PowerDeviceOn(object sender,EventArgs autoPowerOff);C、public delegate void PowerDeviceOn(DateTime autoPowerOff);D、public delegate bool PowerDeviceOn(DateTime autoPowerOff);

You are working on an existing Web site. You need to secure the Web site by redirecting all users to the logon page, Login.aspx. After logging on, users must be sent back to the page that they originally requested. Which code segment should you use? ()A、 In the Web.config file: authorization deny users=”?”//authorization On each page in the Web site: void Page_Load(Object sender, EventArgs E){ FormsAuthentication.Initialize(); //Rest of the Page_Load code goes here}B、On each page in the Web site: void Page_Load(Object sender, EventArgs E){ FormsAuthentication.RedirectToLoginPage(“login.aspx”); //Rest of the Page_Load code goes here}C、On each page in the Web site: void Page_Load(Object sender, EventArgs E){ Response.Redirect(“login.aspx”);//Rest of the Page_Load code goes here}D、In the Web.config file: authentication mode=”Forms” forms name=”.ASPXUSERDEMO” loginUrl=”login.aspx” protection=”All”timeout=”60” / /authentication

你在创建一个 Web 窗体。这个 Web 窗体允许用户计算值并在名为 lblResults 的 Label 控件中显示结果。你需要在 Web 窗体通过 Error 事件截获所有未处理的异常并显示异常在 Web 窗体上。你可以使用下面那个代码段实现?()A、protected void Page_Error(object sender, EventArgs e) { lblResults.Text = e.ToString();e=null;}B、protected void Page_Error(object sender, EventArgs e) { lblResults.Text =Server.GetLastError().ToStri();Server.ClearError();}C、protected void Page_Error(object sender, EventArgs e) Response.Write(e.ToString());e=null;}D、protected void Page_Error(object sender, EventArgs e) Response.Write(Server.GetLastError().ToString()); Server.ClearError();}

问答题请写出程序中的部分语句的意思: A:<%@ Language=”vbscript” %>的意思 B:application.unlock

单选题You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component. You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested. Which code segment should you use? ()Avoid Application_Start(object sender, EventArgs e) { SiteHelper.Configure(); }Bvoid Application_Init(object sender, EventArgs e) { SiteHelper.Configure(); }Cvoid Application_BeginRequest(object sender, EventArgs e) { SiteHelper.Configure(); }DObject lockObject = new Object(); void Application_BeginRequest(object sender, EventArgs e) { lock(lockObject()) { SiteHelper.Configure(); } }

单选题You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form in the application by using the following code fragment:   01     02 protected void Button_Handler(object sender, EventArgs e)   03 {   04   // some long-processing operation.  05 }   06    07  A AB BC CD D

单选题You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web form in the application by using the following code fragment:   01     02 protected void Button_Handler(object sender, EventArgs e)   03 {   04   // some long-processing operation.  05 }   06    07  AABBCCDD

单选题You create a Web Form. The Web Form allows users to calculate values and display the results in a label named lblResults. You need to capture all unhandled exceptions on the Web Form through the Error event. The Error event must capture each unhandled exception and display it on the Web Form. Which code segment should you use?()Aprotected void Page_Error(object sender, EventArgs e) { lblResults.Text = e.ToString(); e=null;}Bprotected void Page_Error(object sender, EventArgs e) { lblResults.Text = Server.GetLastError().ToString(); Server.ClearError();}Cprotected void Page_Error(object sender, EventArgs e) Response.Write(e.ToString()); e=null;}Dprotected void Page_Error(object sender, EventArgs e) Response.Write(Server.GetLastError().ToString()); Server.ClearError();}

单选题You are creating a Windows Forms application by using the .NET Framework 3.5. The application requires a thread that accepts a single integer parameter.    You write the following code segment (Line numbers are included for reference only.) Thread myThread = new Thread(new ParameterizedThreadStart(DoWork)) ;  myThread.Start(100); You need to declare the method signature of the DoWork method.   Which method signature should you use?()Apublic void DoWork();Bpublic void DoWork(int nCounter);Cpublic void DoWork(object oCounter);Dpublic void DoWork(Delegate oCounter);

单选题您需要编写可接受日期时间参数并返回一个布尔值,多路广播的委托。您应该使用哪个代码段?()Apublic delegate int PowerDeviceOn(bool, DateTime);Bpublic delegate bool PowerDeviceOn(Object, EventArgs);Cpublic delegate void PowerDeviceOn(DateTime);Dpublic delegate bool PowerDeviceOn(DateTime);

单选题您需要写一个接收日期参数的多播委托,您应该使用哪一个代码片段() //委托就是一个方法,题目没有返回值。Apublic delegate int PowerDeviceOn(bool result, DateTime autoPowerOff);Bpublic delegate bool PowerDeviceOn(object sender, EventArgs autoPowerOff);Cpublic delegate void PowerDeviceOn(DateTime autoPowerOff);Dpublic delegate bool PowerDeviceOn(DateTime autoPowerOff);