Question: Question 9 Select all the options which correctly call the following method: private static decimal CalculateSum(decimal[] salariesArray) { decimal salarySum = 0; for (int i
Question 9
Select all the options which correctly call the following method:
private static decimal CalculateSum(decimal[] salariesArray)
{
decimal salarySum = 0;
for (int i = 0; i < salariesArray.Length; i++) ;
{
salarySum = salarySum + salariesArray[i];
}
return salarySum;
}
Question 9 options:
| |||
| |||
| |||
|
Question 10
Select all the options which correctly calculate the average of all the grades
Question 10 options:
| |||
| |||
| |||
|
Question 11
If an application needs to save a whole number value in a variable, what data type should the variable be? Select the best answer.
Question 11 options:
| a)double | |
| b)int | |
| c)string | |
| d)decimal |
Question 12
What's wrong with the following code snippet?
string userEntry = Console.ReadLine();
string answer = Convert.ToString(userEntry);
if (String.Compare(answer,"Yes",true) == 0)
{
Console.WriteLine("User said yes");
}
Question 12 options:
a)There is a missing semi colon on this line if (answer.Equals("Yes")); | |
b)Instead of this string userEntry = Console.ReadLine(); string answer = Convert.ToString(userEntry); c)the code should do this string answer = Convert.ToString(Console.ReadLine()); | |
c)Instead of this if (answer.Equals("Yes")) the code should do this if (answer.CompareTo("Yes") > 0) | |
| d) | Instead of this string userEntry = Console.ReadLine(); string answer = Convert.ToString(userEntry); the code should do this string answer = Console.ReadLine(); because converting a string to a string is unnecessary |
Question 15
Select all the options that correctly define and initialize an array to a set of grades.
Question 15 options:
| |||
| |||
| |||
|
Question 16
Select all the options which correctly call the following method:
private static decimal CalculateSum(decimal[] salariesArray)
{
decimal salarySum = 0;
for (int i = 0; i < salariesArray.Length; i++)
{
salarySum = salarySum + salariesArray[i];
}
return salarySum;
}
Question 16 options:
| |||
| |||
| |||
|
Question 17
Which of the following code segments correctly reads in the user's age?
Question 17 options:
| |||
| |||
| |||
|
Question 19
Select the correct code to place the variable value ( decimal currentSalary ) into the following list
List
Question 19 options:
| a)salariesList[1] = currentSalary; | |
| b)salariesList.Add(currentSalary); | |
| c)salariesList[0] = currentSalary; | |
| d)salariesList[i] = currentSalary; |
Question 20
Examine this snippet of code. ListsalariesList = new List (); Select a code snippet below which correctly displays the first salary in the list.
Question 20 options:
| a)Console.WriteLine($"The first salary in the list is {salariesList[i]}"); | |
| b)Console.WriteLine($"The first salary in the list is {salariesList[1]}"); | |
| c)Console.WriteLine($"The first salary in the list is {salariesList[0]}"); | |
| d)Console.WriteLine($"The first salary is {salariesList.First}"
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
