C#期末考试模拟试题及答案(5)

2019-08-30 20:59

{ string Name {get {return \ }

则下列语句的编译,运行结果如何?(C) MyInterface x=new MyClass(); Console.writeLine(x.Name);

A 运行正常,输出字符串”only a test!” B 可以编译通过,但运行出现异常 C 编译出错 121、

public interface BaseInterface

public class MyClass2:BaseInterface { }

public void Test() {

Console.Write(\

{ { }

void Test();} public void Test() {

Console.Write(\

public class MyClass1:BaseInterface

则下列输出是什么?(B)(原来答案为C) BaseInterface x=new Myclass2(); x.Test();

A in Myclass1; B in Myclass2; C 无输出

D in Myclass1;in Myclass2; 122、下列语句的输出是(A). double MyDouble=0.2;

Console.writeLine(“{0:#%}”,MyDouble); A 20% B 0.2% C #% D {0:#%}

123、下列语句的输出是(D) double MyDouble=9999.94;

Console.writerLine(“{0:#.#}”,MyDouble); A 9.9 B 10000.0 C 9,999.99 D 9999.9

124、在ADO.NET中,DataAdapter对象下列哪个Command属性用于将DataSet 中的新增记录保到数据源?(C) A Delete Command B Update Command C Insert Command D Select Command

125、在ADO.NET中,使用DataAdapter将数据源填充到DataSet,应使用下列哪个方法?(D)

第21页共33页

A DataAdapter对象的Update方法 B DataSet对象的Fill方法 C DataSet对象的Update方法 D DataAdapter对象的Fill方法

126、C#中执行下列语句后,n的值为多少?(A) Int n=oxofo; n &=oxofoo; A o

B oxoffo C false D true

127、下列语句是类Myclass的一部分,obj是Myclass的一个对象. Void change(string str) {

Str=“new string”; }

Public void test() {

String s=“old string” Change(s);

Console.writeLine(s); }

则调用obj.test()后,控制台输出(B) A new string B old string

128、C#中,下列Myclass的定义是否合法?(不合法) Public class Base1{} Public class Base2{}

Public Myclass:Base1,Base2{} (只能单继承)

129、在Visual Studio.NET窗口中,(D )窗口显示了当前Visual Studio.NET解决方案的树形结构. A 资源视图 B 类视图 C 属性

D 解决方案资源管理器

130、在类Myclass中定义下列域和方法: Private int data:

Void ShowInformation()

{ string data=“this is a JOKE!”;

}现在需要编写代码在ShowInformation中将MyClass当前对的data域赋值为100. (D)

A self.data = 100; B data = 100; C me.,data = 100; D this.data = 100;

第22页共33页

131、面向对象编程中的”继承”的概念是指(B). A 对象之间通过消息进行交互

B 派生自同一个基类的不同类的对象具有一些共同特征 C 对象的内部斤细节被隐藏

D 派生类对象可以不受限制地访问所有的基类对象

132、在DataSet对象中,可通过(A)集合遍历DataSet对象中所有的数据表对象.

A Tables B Relations C Constraints D DataReader

133、在ComboBox控件的SelectedChangeConmited事件处理方法中,应使用ConboBox对象的(C)属性获取用户新选项的值.

A SelectedIndex B Newvalue C SelectedItem D Text

134、某Windows Form的工具条为ToolBarl,则代表该工具条的第2个按钮的对象为(B). A ToolBarl.Buttons[2] B ToolBarl.Buttons[1] C ToolBarl.Buttons[3] D ToolBarl.Buttons[0]

135、在C#中,将路径名”C:\\Documents\\”存入字符串变量path中的正确语句是( A) A path = ?C: \\\\Docments\\\\“; B path = “C: //Document//”; C path = “C:\\Document\\”; D path = “C:\\/Document\\/”; 136、UDDI的作用是(C D).

A 提供可下载的客户端代理程序文件 B 提供XML Web service

C 发现其他企业的XML Web Service业务 D 定义企业的XML Web Service业务

137、在公司的网上办公Web站点中,Web站点对某些页面进行特别保护,只有具有某些特殊权限的用户才可以访问这些信息.这种类型的安全型称为(B).

A 身份验证 B 授权 C 角色扮演 D 用户管理

138、C#中执行下列语句整形变量x和y的值是多少?(D ) int x=100; int y=++x;

A x=100 y=100 B x=101 y=100 C x=100 y=101 D x=101 y=101

139、分析下列Main函数中的if语句.

Class Class1

第23页共33页

{

Bool printInfo() {

System.Console.writeLine(“printInfo”); Return true }

[STAThread]

Static void Main(string[] args) {

Class1 x = new Class1();

If(false && x.printInfo()) //若为If(false & x.printInfo()) 短路的与运算 System.console..writeline(“Main”) // System.console..writeline(“Main”)答案为 C }

}

请问该程序在控制台的输出是什么?(A) A 无输出 B Main C PrintInto D PrintInfo Main

140、在C#设计类时,如何将一个可读可写的公有属性Name修改为只读属性?( B)

A 将Name的get块删除 B 将Name的set块删除

C 在Namei的set块前加修饰符private D 在Name添加readonly修饰符 141、数组pins的定义如下:

int[ ] pins = new int[4] {9,2,3,1} ; 则 pins[1] = ( B )

A. 1 B. 2 C.3 D.9

142、类Myclass的定义如下: Class myclass {

int count; string msg; }

则该类的缺省构造函数为:(B) A internal myclass() B public myclass(){}

C public myclass(){count=0; msg=null} D 不存在

143.C#类myclass定义如下: Public class myclass {

int count;

private myclass(int I){count=I;}

第24页共33页

}

现在需要为该类添加一个公有的构造函数,则下列函数定义正确的有(D) A Public myclass(){myclass(100);} B public myclass();myclass(100){} C public myclass();base(100){} D Public myclass():this(100){} 144. 类MyClass定义如下:

namespace ClassLibrary1

{ public class MyClass

{ internal class subclass { int i ; } } }

则类MyClass. Subclass的可访问间域为: ( B )

A在所有引用ClassLibrary1的程序集中可用, 但限于MyClass的内部 B定义MyClass时所在的程序集

C在所有引用ClassLibrary1的程序集中可用, 但限于MyClass的派生类中 D访问不受限制

145、列程序的输出是什么?(C) .public class Base {

private readonly string msg = “Base!”;

private Base(){Console.Write(msg);}//私有的 protected Base(string str):this(){this.msg = str; }

Public class myclass:Base { Public myclass():base(\ { console.write(“myclass”); } }

Static void main()//控制台主程序入口 {

Myclass x = new myclass(); }

A Base! B myclass

C Base! Myclass! D Myclass! Base!

146.下列类的定义中哪些是合法的抽象类?(D) A abstract class c1{

Abstract sealed public void test(); B abstract class c1{ Abstract void test(); C sealed abstract class c1{ Abstract public void test(){}; D abstract class c1{

abstract public void test();

第25页共33页


C#期末考试模拟试题及答案(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:上下五千年历史知识电子小报手抄报模板古代历史板报中国近代史画

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

马上注册会员

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