c#.net面试题及答案(2)

2019-08-30 22:16

y=-1; }

public override void PrintFields() {

Console.WriteLine(\} }

当使用new B()创建B的实例时,产生什么输出? 答:X=1,Y=0;x= 1 y = -1

10.根据委托(delegate)的知识,请完成以下用户控件中代码片段的填写: namespace test {

public delegate void OnDBOperate();

public class UserControlBase : System.Windows.Forms.UserControl {

public event OnDBOperate OnNew;

privatevoidtoolBar_ButtonClick(objectsender,System.Windows.Forms.ToolBarButtonClickEventArgs e)

{

if(e.Button.Equals(BtnNew)) {

//请在以下补齐代码用来调用OnDBOperate委托签名的OnNew事件。 } } }

答:if( OnNew != null ) OnNew( this, e );

11.分析以下代码,完成填空 string strTmp = \某某某\

int i= System.Text.Encoding.Default.GetBytes(strTmp).Length; int j= strTmp.Length; 以上代码执行完后,i= j= 答:i=13,j=10

12.SQLSERVER服务器中,给定表 table1 中有两个字段 ID、LastUpdateDate,ID表示更新的事务号, LastUpdateDate表示更新时的服务器时间,请使用一句SQL语句获得最后更新的事务号

答:Select ID FROM table1 Where LastUpdateDate = (Select MAX(LastUpdateDate) FROM table1)

13.写出一条Sql语句:取出表A中第31到第40记录(SQLServer,以自动增长的ID作为主键,注意:ID可能不是连续的。

答:解1: select top 10 * from A where id not in (select top 30 id from A) 解2: select top 10 * from A where id > (select max(id) from (select top 30 id from A )as A)

13.请编程遍历页面上所有TextBox控件并给它赋值为string.Empty? 答: foreach (System.Windows.Forms.Control control in this.Controls) {

if (control is System.Windows.Forms.TextBox) {

System.Windows.Forms.TextBox tb = (System.Windows.Forms.TextBox)control ; tb.Text = String.Empty ; } }


c#.net面试题及答案(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:深圳市市政工程综合价格2002定额规则 - 第二册 道路

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

马上注册会员

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