C#语言和SQL Server数据库技术_前四章错题

 

1。在C#中,如果让某个方法只能被它所在的程序集内的其他方法访问,可使用(C)修饰这个方法。

(选择一项)

A:private

B:protected

C:internal

D:以上都不对

2.下列关于String.Format()用法不正确的是(B)

(选择一项)

A:String.Format(“今天是周{0}”,1)

B:String.Format(“今天是周{1}”,1)

C:String a= "a"; String.Format(“我的姓名是{0}”,a)

D:String.Format(“今天是周{0}”,"a")

3.在C#中,如下代码的输出结果是()

string str=",(9,8),(aa,bb),";

string array=str.Substring(str.IndexOf(',')+1,str.LastIndexOf(','));

ine(array);

(选择一项)

A:(9,8),(aa,bb)

B:(9,8),(aa,bb),

C:9,8),(aa,bb),

D:9,8),(aa,bb)

4.多数编程语言都提供数组这种数据储存结构来储存同种类型的多个数据元素。在C#中定义了如下数组。选项中有关该数组的说法中错误的是(B)。

int [] array;

array=new int[10];

(选择一项)

A:该数组最多包含10个元素

B:该数组的第一个数组元素索引值为1

C:该数组各元素已被赋了默认值0

D:该数组定义与int [] array=new int [10];等价

5.C#循环语句中break的作用是(B,D)。

(选择两项)

A:break后面的语句继续执行

B:break后面的语句不执行

C:用于退出当次循环

D:用于终止本循环语句的执行

6.下面选项中对C#注释使用错误的是(C,D)。

(选择两项)

A://这是单行注释

B:/*这是多行注释*/

C://*这是文档注释*/

D:///这才是文档注释\\\

7.运行如下C#代码,输出(D)。

int num1=7;

int num2=9;

double avg=num1+num2/2.0;

Console,WriteLine(avg);

(选这一项)

A:8

B:8.0

C:11.0

D:11.5

8.使用C#语言开发控制台应用程序时,如果程序将用户输入的数据(可能是字符串或整型数字)赋值给一个字符串变量,则可以使用以下(A,B)代码片段实现。

(选择两项)

A:string s=Console.ReadLine().ToString();

B:string s=Console.ReadLine(0;

C:string s=Console.WriteLine().ToString();

D:string s=Console.WriteLine();

9.在C#中,已定义Student类,下面代码能编译通过的是(A,B)。

public class Student

{

  public void Show()

  {

    Console.WriteLine("大家好");

  }

}

(选择两项)

A:

class Program

{

  static void Main(string[] args)

 {

    Student stu=null;

    stu.Show();

    Console.ReadLine();

  }

}

B:

class Program

{

  static void Main(string[] args)

 {

    Student stu=new Student();

    stu.Show();

    Console.ReadLine();

  }

}

C:

class Program

{

  static void Main(string[] args)

 {

    Student stu;

    stu.Show();

    Console.ReadLine();

  }

}

D:

class Program

{

  static void Main(string[] args)

 {

    Student stu=new Student;

    stu.Show();

    Console.ReadLine();

  }

}

10.用Visual Studio调试C#程序,以下说法正确的是(A,C)

(选择两项)

A:将光标停在需要设置断点的行,按F9键,可以设置断点

B:Ctrl+F2键转到所调用过程过程或变量的定义

C:F5键开始调试

D:Ctrl+F10键取消断点

11.执行下面的C#代码,输出的结果是(B)。

static void Mian(string[] args)

{

  int[] nums={1,2,3,4};

  TrunCate(nums);

  Console.WriteLine(nums[1]);

}

static void TrunCate(int[] nums)

{

  nums[1]=99;

}

(选择一项)

A:2

B:99

C:1

D:编译出现语法错误,不能运行

1。在C#中,如果让某个方法只能被它所在的程序集内的其他方法访问,可使用(C)修饰这个方法。

(选择一项)

A:private

B:protected

C:internal

D:以上都不对

2.下列关于String.Format()用法不正确的是(B)

(选择一项)

A:String.Format(“今天是周{0}”,1)

B:String.Format(“今天是周{1}”,1)

C:String a= "a"; String.Format(“我的姓名是{0}”,a)

D:String.Format(“今天是周{0}”,"a")

3.在C#中,如下代码的输出结果是()

string str=",(9,8),(aa,bb),";

string array=str.Substring(str.IndexOf(',')+1,str.LastIndexOf(','));

ine(array);

(选择一项)

A:(9,8),(aa,bb)

B:(9,8),(aa,bb),

C:9,8),(aa,bb),

D:9,8),(aa,bb)

4.多数编程语言都提供数组这种数据储存结构来储存同种类型的多个数据元素。在C#中定义了如下数组。选项中有关该数组的说法中错误的是(B)。

int [] array;

array=new int[10];

(选择一项)

A:该数组最多包含10个元素

B:该数组的第一个数组元素索引值为1

C:该数组各元素已被赋了默认值0

D:该数组定义与int [] array=new int [10];等价

5.C#循环语句中break的作用是(B,D)。

(选择两项)

A:break后面的语句继续执行

B:break后面的语句不执行

C:用于退出当次循环

D:用于终止本循环语句的执行

6.下面选项中对C#注释使用错误的是(C,D)。

(选择两项)

A://这是单行注释

B:/*这是多行注释*/

C://*这是文档注释*/

D:///这才是文档注释\\\

7.运行如下C#代码,输出(D)。

int num1=7;

int num2=9;

double avg=num1+num2/2.0;

Console,WriteLine(avg);

(选这一项)

A:8

B:8.0

C:11.0

D:11.5

8.使用C#语言开发控制台应用程序时,如果程序将用户输入的数据(可能是字符串或整型数字)赋值给一个字符串变量,则可以使用以下(A,B)代码片段实现。

(选择两项)

A:string s=Console.ReadLine().ToString();

B:string s=Console.ReadLine(0;

C:string s=Console.WriteLine().ToString();

D:string s=Console.WriteLine();

9.在C#中,已定义Student类,下面代码能编译通过的是(A,B)。

public class Student

{

  public void Show()

  {

    Console.WriteLine("大家好");

  }

}

(选择两项)

A:

class Program

{

  static void Main(string[] args)

 {

    Student stu=null;

    stu.Show();

    Console.ReadLine();

  }

}

B:

class Program

{

  static void Main(string[] args)

 {

    Student stu=new Student();

    stu.Show();

    Console.ReadLine();

  }

}

C:

class Program

{

  static void Main(string[] args)

 {

    Student stu;

    stu.Show();

    Console.ReadLine();

  }

}

D:

class Program

{

  static void Main(string[] args)

 {

    Student stu=new Student;

    stu.Show();

    Console.ReadLine();

  }

}

10.用Visual Studio调试C#程序,以下说法正确的是(A,C)

(选择两项)

A:将光标停在需要设置断点的行,按F9键,可以设置断点

B:Ctrl+F2键转到所调用过程过程或变量的定义

C:F5键开始调试

D:Ctrl+F10键取消断点

11.执行下面的C#代码,输出的结果是(B)。

static void Mian(string[] args)

{

  int[] nums={1,2,3,4};

  TrunCate(nums);

  Console.WriteLine(nums[1]);

}

static void TrunCate(int[] nums)

{

  nums[1]=99;

}

(选择一项)

A:2

B:99

C:1

D:编译出现语法错误,不能运行

猜你喜欢

转载自www.cnblogs.com/wnwn/p/10082514.html