Question: C# Multiple Choice Questions: Attempting to invoke a derived-class-only method through a base-class variable is an error. True False Which of the following property specify
C# Multiple Choice Questions:
Attempting to invoke a derived-class-only method through a base-class variable is an error.
| True |
| False |
Which of the following property specify the duration of a Timer in System.Timers.Timer
| Events |
| Interval |
| Duration |
| Enabled |
The .NET languages have which of the following in common?
| Syntax |
| Keywords |
| Base Class Library |
Which of the following is an appropriate declaration of an abstract method?
| public abstract int GetScore() { } |
| public abstract int GetScore(); |
| public int GetScore() as abstract; |
| none of the above |
What type of methods can be called without instantiating an object first?
| static |
| dynamic |
| primary |
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 |
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 |
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 |
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 |
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 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
