1. In the System.Media.SoundPlayer class what method is used to load a sound usi
ID: 3860466 • Letter: 1
Question
1. In the System.Media.SoundPlayer class what method is used to load a sound using a new thread?
2. What is used to implement event in C#?
3. You can update a GUI from any thread of execution.
4. In C# all non-static methods are by default virtual functions.
5. The class SmithKarenCreature inherits from the class Creature . An instance of SmithKarenCreature is created and referenced in the variable kCreature using the following code: SmithKarenCreature kCreature = new SmithKarenCreature();
A variable called creature of type Creature is declared and kCreature is cast as type Creature and assigned to creature using the following line of code:
Creature creature = (Creature)kCreature;
Which of the following is an alternative syntax to the above line of code?
6. Which of the following is true regarding a sealed class?
7. Find correct statement about the code?
class sample
{
int i = 10;
int j = 20;
public void display()
{
Console.WriteLine("base method ");
}
}
class sample1 : sample
{
public int s = 30;
}
class Program
{
static void Main(string[] args)
{
sample1 obj = new sample1();
Console.WriteLine("{0}, {1}, {2}", obj.i, obj.j, obj.s);
obj.display();
Console.ReadLine();
}
}
10, 20, 30
Base method
10, 20, 0
Compile time error
8. An interface member that is explicitly implemented can be accessed only through an instance of the interface, not from a class instance
9. Abstract class can include :
10. An abstract method can only be declared in a class that is declared as abstract.
LoadExplanation / Answer
1) LoadAsync method is used to loads sound from a stream or a Web resource using new thread.
2) Delegates as used to implement system events in C#
3) you can update a GUI from any thread of execution - Yes
4) In C# all non-static methods are by default virtual functions - False
virtual methods have performance implications.
5) Creature creature = kCreature as Creature;
as keyword is used to aliyas.
6) A sealed class cannot be inherited, it restricts inheritance for security reasons.
7) compile error
The default access for everything in C# is most restricted there i,j are not accessible which results in compilation error
8) An interface member that is explicitly implemented can be accessed only through an instance of the interface, not from a class instance - True
9) Abstract class can include Properties,Abstract methods and Non-abstract methods
10) An abstract method can only be declared in a class that is declared as abstract - True
because the abstract method does not contain body, it has to be implemented which is only ensured only in abstract class.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.