Question: Question 41 What type of methods can be called without instantiating an object first? static dynamic primary No answer text provided. Question 42 Assume an
Question 41
What type of methods can be called without instantiating an object first?
| static |
| dynamic |
| primary |
| No answer text provided. |
Question 42
Assume an extension method is defined as:
static class Util
{ public static int Negate(this int i)
{
return -i;
}
}
Which of the following is correct?
| int x = 591; Console.WriteLine($"x.Negate {x.Negate()}"); |
| int x = 591; Console.WriteLine($"x.Negate {Util.Negate(x)}"); |
| both A and B |
| None of the above |
Question 43
To define an extension method for a type:
| The extension method can be an instance method |
| The first parameter must be of the type being extended |
| The first parameter must be proceeded by this keyword |
| Both A, B and C |
| Both B and C |
| Both A and C |
Question 44
var addresses = new[] {
new { CompanyName = "Alpine Ski House", City = "Berne", Country = "Switzerland"},
new { CompanyName = "Coho Winery", City = "San Francisco", Country = "United States"},
new { CompanyName = "Wingtip Toys", City = "London", Country = "United Kingdom"},
new { CompanyName = "Wide World Importers", City = "Tetbury", Country = "United Kingdom"}
};
var usCompanies =
addresses.Where(addr => String.Equals(addr.Country, "United States"))
.Select(usComp => usComp.CompanyName)
What type is variable usCompanies?
| int |
| string |
| IEnumerable |
| anonymous type |
Question 45
In the variable declaration Func
| Methods that take no parameters and return an Order object. |
| Methods that take an Order object as a parameter and return void. |
| Methods that take an Order object as a parameter and return an Order object. |
| Methods provided by the Action class that take no parameters and return void. |
| None of the choices are correct |
Question 46
Assume Horse class is defined as:
class Horse : ILandBound, IJourney
{
int ILandBound.NumberOfLegs() { return 4; }
int IJourney.NumberOfLegs() { return 3; }
}
Which of the following is correct if:
Horse horse = new Horse(); int legs = horse.NumberOfLegs();
| legs variable has a value of 4 |
| legs variable has a value of 3 |
| Code will not compile |
| None of the choices are correct |
Question 47
Suppose the variable result is declared by the statement Func
| result = (float x) => x * x; |
| result = (x) => return x * x; |
| result = x => x * x; |
| Both a and c are correct. |
Question 48
Which method can you use to find the minimum value in a sequence?
| (from i in myArray select i).Min() |
| from Min(i) in myArray select i |
| from i in myArray select Min(i) |
| from i in Min(myArray) select i |
Question 49
Which object does the variable mySet inherit from?
Int[] mySet = new int[5];
| System.Collection |
| System.Collection.List |
| System.Array |
| None, this is a value type. |
Question 50
If Employee inherits from Person and Manager inherits from Employee, which of the following statements is valid?
| Person alice = new Employee(); |
| Employee bob = new Person(); |
| Manager cindy = new Employee(); |
| Manager dan = (Manager)(new Employee()); |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
