Who is a protected class-level variable available to?

1 Answer

Answer :

It is available to any sub-class (a class inheriting this class).

Related questions

Description : Who is a protected class-level variable available to?

Last Answer : It is available to any sub-class (a class inheriting this class). 

Description : When you inherit a protected class-level variable, who is it available to? 

Last Answer : Classes in the same namespace. 

Description : Describe the accessibility modifier “protected internal”. 

Last Answer : It is available to classes that are within the same assembly and derived from the specified base class.

Description : What is protected internal accessibility?

Last Answer : Access is restricted to types derived from the containing class or from files within the same assembly.

Description : What is protected accessibility? 

Last Answer : Access is restricted to types derived from the containing class. 

Description : Describe the accessibility modifier “protected internal”. 

Last Answer : It is available to classes that are within the same assembly and derived from the specified base class.

Description : Describe the accessibility modifier protected internal. 

Last Answer : It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in). 

Description : Are private class-level variables inherited? 

Last Answer : Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.

Description : Are private class-level variables inherited? 

Last Answer : Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.

Description : Are private class-level variables inherited? 

Last Answer : Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.

Description : What si the difference between interface and abstractclass Select Answer:  1. interface contain only methods  2. we can't declare a variable for interface  3. interface contain only events  4. None  5. All

Last Answer : Ans : 2 The only Difference between Interface and Abstract class is we can declare a variable in abstract class but we can't declare in variable interface

Description : Can you change the value of a variable while debugging a C# application? 

Last Answer : Yes. If you are debugging via Visual Studio.NET, just go to Immediate window. 

Description : Can you change the value of a variable while debugging a C# application? 

Last Answer : Yes. If you are debugging via Visual Studio.NET, just go to Immediate window. 

Description : Does C# support a variable number of arguments?

Last Answer : Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type, e.g., int. For ultimate flexibility, the type can object. The standard example of a method which uses this approach is System.console.writeLine().

Description : Does C# support a variable number of arguments?

Last Answer : Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type.

Description : State true of false. i) Public can only be assigned to class ii) Protected protects a statement iii) Protected method is never accessible outside the package iv) Friendly variable may be accessible outside class A) i- ... -false, ii-true, iii-false, iv-false D) i-true, ii-false, iii-false, iv-true

Last Answer : C) i-false, ii-true, iii-false, iv-false

Description : Describe Break mode and some of the available methods for navigating in Break mode.

Last Answer : Break mode allows you to observe program execution on a line-by-line basis. You can navigate program execution in Break mode by using Step Into, Step Over, Step Out, Run To Cursor, and Set Next Statement.

Description : Define what are the two data types available in C#?

Last Answer : Value type Reference type

Description : Describe an abstract class and explain when one might be useful.

Last Answer : An abstract class is a class that cannot be instantiated but must be inherited. It can contain both implemented methods and abstract methods, which must be implemented in an inheriting class. ... common interface for other methods, and leave more detailed implementation up to the inheriting class.

Description : Briefly describe how a class is similar to a structure. How are they different?

Last Answer : Both classes and structures can have members such as methods, properties, and fields, both use a constructor for initialization, and both inherit from System.Object. Both classes and structures can be ... are value types, and the memory that holds structure instances is allocated on the stack. 

Description : Do you need to instantiate a class before accessing a Shared (static) member? Why or why not?

Last Answer : Because a Shared (static) member belongs to the type rather than to any instance of the type, you can access the member without first creating an instance of the type.

Description : How do you enable your application to use .NET base class library members without referencing their fully qualified names?

Last Answer : Use the Imports keyword (Visual Basic .NET) or the using keyword (Visual C#) to make a .NET Framework namespace visible to your application. 

Description : what is Class ?

Last Answer : Answer:A group of objects that share a common definition and that therefore share common properties, operations, and behavior. A user-defined type that is defined with the class-key 'class,' 'struct, ... one class to be an expansion of another, and classes can restrict access to their members. 

Description : How do you specify a custom attribute for the entire assembly (rather than for a class) ?

Last Answer : Answer: Global attributes must appear after any top-level using clauses and before the first type or namespace declarations. An example of this is as follows: using System; [assembly : ... that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs.

Description : What is the role of the DataReader class in ADO.NET connections?

Last Answer : It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed.

Description : What’s the difference between the Debug class and Trace class? 

Last Answer : Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.

Description : If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?

Last Answer : Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Description : What’s the implicit name of the parameter that gets passed into the set method/property of a class?

Last Answer : Value. The data type of the value parameter is defined by whatever data type the property is declared as.

Description : What is the difference between a Struct and a Class? 

Last Answer : Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that structs cannot inherit.

Description : What’s the difference between an interface and abstract class?

Last Answer : Answer: An abstract class and Interface both have method only but not have body of method.The difference between Abstract class and An Interface is that if u call Ablstract class then u have to call ... type, Parameter type, Parameter Number all must be same . Only body of method can change. 

Description : What is an interface class?

Last Answer : Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. 

Description : When do you absolutely have to declare a class as abstract?

Last Answer : 1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden. 2. When at least one of the methods in the class is abstract.

Description : What’s an abstract class?

Last Answer : Answer:Classes that cannot be instantiated. We cannot create an object from such a class for use in our program. We can use an abstract class as a base class, creating new classes that will inherit from ... can inherit from a non-abstract class. In C++, this concept is known as pure virtual method.

Description : Can you allow a class to be inherited, but prevent the method from being over-ridden?

Last Answer : Yes. Just leave the class public and make the method sealed. 

Description : Can you prevent your class from being inherited by another class?

Last Answer : Yes. The keyword “sealed” will prevent the class from being inherited. 

Description : What is the syntax to inherit from a class in C#? 

Last Answer : Place a colon and then the name of the base class. Example: class MyNewClass : MyBaseClass

Description : What class is underneath the SortedList class?

Last Answer : A sorted HashTable. 

Description : What’s the .NET collection class that allows an element to be accessed using a unique key? 

Last Answer : HashTable. 

Description : What’s the top .NET class that everything is derived from?

Last Answer : System.Object.

Description : In terms of constructors, what is the difference between: public MyDerived() : base() an public MyDerived() in a child class?

Last Answer : Nothing

Description : How do you refer to a member in the base class?

Last Answer : To refer to a member in the base class use:return base.NameOfMethod(). 

Description : What is a nested class?

Last Answer : A class declare within a class. 

Description : Can properties hide base class members of the same name?

Last Answer : Yes

Description : Write some code for a custom collection class.

Last Answer : using System; using System.Collections; public class Items : IEnumerable { private string[] contents; public Items(string[] contents) { this.contents = contents; } public IEnumerator GetEnumerator() { ... (string item in items) { Console.WriteLine(item); } Console.ReadLine(); } }

Description : A class can have many mains, how does this work? 

Last Answer : Only one of them is run, that is the one marked (public) static, e.g: public static void Main(string[] args) { // // TODO: Add code to start application here // } private void Main(string[] args, int i) { }

Description : Write some code using interfaces, virtual methods, and an abstract class.

Last Answer : using System; public interface Iexample1 { int MyMethod1(); } public interface Iexample2 { int MyMethod2(); } public abstract class ABSExample : Iexample1, Iexample2 { public ABSExample( ... override void VIRTMethod2() { System.Console.WriteLine("VIRTMethod2 has been overridden"); } }

Description : Class methods to should be marked with what keyword?

Last Answer : static

Description : What is the default accessibility for a class?

Last Answer : internal for a top level class, private for a nested one. 

Description : What is the role of the DataReader class in ADO.NET connections?

Last Answer : It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed. 

Description : What’s the difference between the Debug class and Trace class? 

Last Answer : Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.