30、引用ListBox(列表框)当前被选中的数据项应使用( B )语句 a) ListBox1.Items[ListBox1.Items.Count]
b)ListBox1.Items[ListBox1.SelectedIndex] c) ListBox1.Items[ListBox1.Items.Count-1] d) ListBox1.Items[ListBox1.SelectedIndex-1] 31、下面代码的输出结果是(d)。 int x = 5; int y = x++;
Console.WriteLine(y); y = ++x;
Console.WriteLine(y);
a)5 6 b) 6 7 c) 5 6 d) 5 7
34、在C#语言的main方法定义体中,下面()是错误的。 C A) static voidMain(string[] args){ } B) static int Main(string[] args){ }
C) static Main(string[] args){ } 缺少定义返回类型 D) static int Main( ){ }
35、在C#语言中,下面的关于公共类型常量定义正确的是() A A) public const int dayMax=7; B) public const dayMax=7; C) const int dayMax=7;
D) public const int day-Max=7; 变量名错误,不能有“-” 36、在C#中,关于下面代码的输出结果正确的是()。 D static void Main(string[] args) {
int[] array = new int[3] { 0, 1, 2}; foreach(int temp in array) {
temp++; forach循环只能读,不能更改 Console.WriteLine(temp); } }
A) 0 B) 1C) 2D) 编译错误
37、下面C#中,使用String类把字符串“abcd”截取成“cd”,应采用的方法是()。D A) Compare() B) IndexOf()C) Join() D) Substring()
38、在C#中,int num=2 采用Convert方法转换为单精度浮点型,应采用()方法。 B A) Convert.ToInt32() 转换为int型
B) Convert.ToSingle() 转换为单精度浮点型 C) Convert.ToDouble() 转换为双精度型 D) Convert.ToString()
39、在sql server中,下面()不属于sql server数据库的数据类型。 A A) bool B) datetime C) bitD) image
40、在SQL Server假设订单表order用来存储订单信息,cid代表客户编号现在要查询每个客户的订购次数以及客户编号,以下语句正确的是()。D A) select conut(ciD),cid from orders
B) select conut(ciD),cid form orders order by cid
C) select count(ciD),cid form orders having count(ciD>0)
D) select count(ciD),cid from orders group by cid 要查询每个客户,要进行分组查询 41、在SQL Server中,现有订单表orders,包含用户信息userid,产品信息productid,以下()语句能够返回至少被订购过两回的productid。 D
A) select productid from orders group by productid where count(productiD>1) B) select productid from orders having count(productiD>1) order by productid
C) select productid from orders where having count(productiD>1) group by productid
D) select productid from orders group by productid having count(productiD>1 先进行分组,再用having筛选 42、在表Employee中有一列为EmpName,执行删除语句: B DELETE FROM Employee WHERE EmpName LIKE ‘_[a e]%’ 下面包含EmpName 列的()值的数据行可能被删除。 A) Whyte
B) Carson 只允许第二个字母为a或e C) Annet D) Hunyer
43、在C#中,下列代码的运行结果是()。 A string appName=.NET foreach(char ch in appName){ if(ch==\'4\') break;
Console.Write(ch); }
A) ACCP 截取四个之后,ACCPB) 40 C) ASP.NETD) ACCPASP.NET
44、在C#语言的类定义体中,下面()访问修饰符可以访问该类的成员。 D A) privateB) publicC) internalD) 以上选项均可
45、下列执行数据的删除语句在运行时不会产生错误信息的是() B C (选择二项)
A) delete * from employee where sgrade=\'6\' delete与from之间不允许有任何东西 B) delete from employee where sgrade=\'6\' C) delete employee where sgrade=\'6\'
D) delete employee set sgrade=\'6\' 不符合delete语法
46、在C#中,要使用ExecuteReader()方法查询获取数据库中的数据集,需要创建()类型对象. A (选择一项)
A) SqlCommand 返回SqlDataReader B) SqlConnection C) SqlDataAdapter D) DataSet
47、在c#中,关于命名空间说法正确的是()。B C (选择二项)
A) 采用import关键字添加命名空间引用 Java中用import B) 采用using关键字添加命名空间引用
C) 添加命名空间引用必须添加在当前命名空间外部 D) 添加命名空间引用可以添加在当前命名空间内部 48、在c#中,下面关于int.Parse()方法使用正确的是()。 A A) String value=
int temp=int.Parse(value); B) int temp=int.Parse(24.5); C) int temp=int.Parse(D) int temp=int.Parse(24);
49、下面关于命名空间说法错误的是() C A) 命名空间用于组织相关的类型 B) 命名空间可以嵌套
C) 在同一个应用程序中,不同的命名空间中不允许有相同名称的类允许有 D) using关键字用于引用命名空间
50、下面关于DataSet描述正确的是() A A) 不直接和数据库打交道,与数据库类型没有关系关闭数据库,DataSet依然是可用的,DataSet在内部是用XML来描述数据的,由于XML是一种与平台无关、与语言无关的数据描述语言,而且可以描述复杂关系的数据,比如父子关系的数据,所以DataSet实际上可以容纳具有复杂关系的数据,而且不再依赖于数据库链路。 B) 用于读取只读的数据
C) DataSet中的数据存储在数据库服务器的内存中 D) 在断开数据库连接时,不可以操作数据库
51、在C#中,下面关于属性(UserName)定义正确的是() C D (选择二项)
A) string UserName{get} get少; B) string UserName{set;} C) string UserName{set;get;} D) private string userName; public string UserName {
set{userName=value;} get{return userName;} }
52、以下选项中,()符合类和对象的关系 B A) 猫和老虎同属于动物类 B) 大学和北京大学从属关系 C) 学生和中学生 D) 中国和中国人