WorksheetsC#数组基础复习
Total questions: 3
Worksheet time: 2mins
Name
Class
Date
1.
以下哪种是C#中正确的数组声明方式?
a)
int [] numbers = new int [5];
b)
int number = new int [5];
c)
数组数=新数组(5);
d)
列表<int> numbers =新列表<int>();
2.
以下哪种代码能正确遍历数组int[] scores = {80, 90, 70};?
a)
对于(int i = 0; i <scores.length; i ++){console.writeline(得分[i]); }
b)
foreach(分数为int得分){console.writeline(score); }
c)
(((consexte)(Console.Writeline。分数(流动); }
d)
分数(得分=> console.Writeline(score));
3.
以下哪种方式可以初始化一个包含3个元素的字符串数组?
a)
string[] names = {"Alice", "Bob", "Charlie"};
b)
string[] names = new string[3];
c)
string[] names = new string[];
d)
string names = new string[3];
100 %
