C1S170 Week 5 Sample Quiz in C# – 35/35 marks
share the same data type
are all integers
have different names
are not indexed
2. Question : (TCO 11) An array that stores five days of closing stock prices can be declared as _____.
decimal price1, price2, price3, price4, price5;
decimal [] price = new decimal[5];
decimal price[] = new decimal[5];
decimal [] price = new price[5];
3. Question : (TCO 11) Which statement is not true about this array declaration?
int [] myArray = {1,4,3,5,6};
It declares a one-dimensional array.
Its elements are indexed 0 thru 4.
It sets the element myArray[1] to 1.
It will compile.
4. Question : (TCO 11) Given the following declaration, what is/are the value(s) of initial[1,0]?
char[,] initial = { {‘C’, ‘D’, ‘E’, ‘F’},
{‘G’, ‘H’, ‘I’, ‘J’} };
‘C’
‘G’
‘G’ ‘C’
‘C’ ‘G’
5. Question : (TCO 11) In the following code, the “foreach” statement _____.
int[] size = {2,3,5,6,4,5};
foreach (int
val in size)
Console.Write(“{0} “,val);
reads each element of the array
converts each array element to an integer
returns the memory address of each array element
prints the index of each array element
6. Question : (TCO 11) What will be the output of this code?
int[] size = {2,3,5,6,4,5};
Array.Sort(size);
foreach (int
val in size)
Console.Write(“{0} “, val);
2 3 5 6 4 5
5 4 6 5 3 2
6 5 5 4 3 2
2 3 4 5 5 6
7. Question : (TCO 11) When the name of an array, such as myArray, is passed to a method, the method receives _____.
a copy of the value the first element stores
the starting address of the array
the address of each array element
a copy of the array
8. Question : (TCO 11) To pass the entire myData array to the DisplayItems method, replace the commented line below with _____.
static void
Main()
{
int[] myData = new int[4]{1,2,3,4};
//call DisplayItems
}
public static void DisplayItems(params
int[] item)
{
for (int i=0; i
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.