NEW
Font size
WorksheetsC# .Net Arrays and Split String Method
Total questions: 25
Worksheet time: 25mins
Which of the following items is an example of Camel Case Naming Convention?
lastName
FirstName
middle_name
Firstnumber
Which of the following is considered as a correct format in declaring an Array?
string[ ] myStrings;
string[4] myStrings;
string myStrings[ ];
string( ) myStrings;
Which of the following is considered as a correct format in declaring the SIZE of an Array?
lotteryNumbers = new int[4];
lotteryNumbers[4] = new int[ ];
lotteryNumbers[4] = new int[4];
lotteryNumbers = new[4] int;
Which of the following is considered as a correct format in declaring and setting the size of an Array in a single line?
float[] myFloatValues = new float[10];
float[10] myFloatValues = new float[ ];
float myFloatValues[10] = new float[ ];
float myFloatValues = new[10] float;
int[] lotteryNumbers = new int[4];
lotteryNumbers[0] = 1;
lotteryNumbers[1] = 2;
lotteryNumbers[2] = 3;
lotteryNumbers[3] = 4;
From the above Array example, what is the index of the third integer?
2
0
1
3
Given the example:
int[] lotteryNumbers = new int[8];
What would be the index of the last integer?
7
6
5
8
Given the example:
int[] lotteryNumbers = new int[4] {1, 2, 3, 4};
Which part declares the Array?
int[] lotteryNumbers
lotteryNumbers
new int[4]
{1, 2, 3, 4};
Given the example:
int[] lotteryNumbers = new int[4] {1, 2, 3, 4};
Which part sets the size the Array?
int[] lotteryNumbers
lotteryNumbers
new int[4]
{1, 2, 3, 4};
Given the example:
int[] lotteryNumbers = new int[4] {1, 2, 3, 4};
Which part assigns the values to be saved in the Array?
int[] lotteryNumbers
lotteryNumbers
new int[4]
{1, 2, 3, 4};
Which of the following items identifies the size of an Array?
Length - 1
Size - 1
Array - 1
Int - 1
Which of the following items is an example of Pascal Case Naming Convention?
lastName
FirstName
middle_name
Firstnumber
Using the simplest Split method, how many values will our Array have after splitting the example string below?
string data = "there is a cat";
3
4
5
None
Which of the following split method is can be used to separate a string based on multiple characters?
Regex.Split
File.ReadAllLines
StringSplitOptions.None
StringSplitOptions.RemoveEmptyEntries
Which of the following split method is can be used to split lines in files?
Regex.Split
File.ReadAllLines
StringSplitOptions.None
StringSplitOptions.RemoveEmptyEntries
string value1 = "man,woman,child,,,bird";
char[] delimiter1 = new char[] { ',' };
Which of the following method will result to:
man
woman
child
bird
Regex.Split
File.ReadAllLines
StringSplitOptions.None
StringSplitOptions.RemoveEmptyEntries
string value1 = "man,woman,child,,,bird";
char[] delimiter1 = new char[] { ',' };
Which of the following method will result to:
man
woman
child
bird
Regex.Split
File.ReadAllLines
StringSplitOptions.None
StringSplitOptions.RemoveEmptyEntries
Which of the following iteration statement is can be used to display values from a string Array?
while loop
for loop
foreach loop
both for loop and foreach loop
True or False.
Without the use of an Array, a single variable can only hold one value at a time.
True
False
Which of the following does not belong to the group?
Single Dimensional Array
Multidimensional Array
Jagged Array
Multiple Array
Which of the following is a multidimensional Array?
array anarray[20][20];
int anarray[20][20];
int array[20, 20];
char array[20];
Which of the following correctly accesses the seventh element stored in foo, an array with 100 elements?
foo[6];
foo[7];
foo(7);
foo;
What are the legal indexes for the array ar, given the following declaration:
int[] ar = {2, 4, 6, 8 }
0, 1, 2, 3
1, 2, 3, 4
2, 4, 6, 8
0, 2, 4. 6
What is the output of the following code fragment:
int[] ar = {2, 4, 6, 8 };
ar[0] = 23;
ar[3] = ar[1];
Console.ReadLine( ar[0] + " " + ar[3] );
23 2
2 8
3 1
23 4
What is the output of the following code fragment:
int[] z = new int[9];
z[0] = 7;
z[1] = 3;
z[2] = 4;
Console.ReadLine( z[0] + z[1] + " " + z[5] );
10 0
7 3 0
The program is defective and will not compile
7 3 4
What is the output of the following code fragment:
int[] zip = new int[5];
zip[0] = 7;
zip[1] = 3;
zip[2] = 4;
zip[3] = 1;
zip[4] = 9;
Console.ReadLine( zip[ 2 + 1 ] );
4 3
3 7
4
1
