Question: An enum is defined in a program as follows:
[Flags]
public enum Permissions
{
None = 0,
Read = 1,
Write = 2,
Delete = 4
}
What will be the output of the following Main program (which has access to the enum defined above) in this C# console application (Assume required namespaces are included) :
static void Main(string[] args)
{
var permissions = Permissions.Read | Permissions.Write;
if ((permissions & Permissions.Write) == Permissions.Write)
{
Console.WriteLine("Write");
}
if ((permissions & Permissions.Delete) == Permissions.Delete)
{
Console.WriteLine("Delete");
}
if ((permissions & Permissions.Read) == Permissions.Read)
{
Console.WriteLine("Read");
}
Console.ReadLine();
}
Question: Suppose a class is declared as a protected internal:
protected internal class A
{
}
Which statement is correct with regards to its accessibility?
A
This class can be accessed by code in the same assembly, or by any derived class in another assembly.
B
This class can only be accessed by code which is in the same assembly.
C
This class can only be accessed by code which is in the derived class (i.e. classes derived from Class A) and which are in the same assembly.
D
This class can be accessed by any code whether in the same assembly or not.