-
-
Is it possible to have different access modifiers on the get/set methods of a property?
No. The access modifier on a property applies to both its get and set accessors. What you need to do if you want them to be different is make the property read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.
-
-
Class Design
. Below is a set of birds and movements they can perform. Birds:Penguin:• hopping: moves 2 ft• flying: can't flyHawk:• hopping: can't hop• flying: moves 100 ft; won't fly if World.windSpeed > 40Robin:• hopping: moves 1 ft; won't hop if World.temperature < 0• flying: moves 20 ft; won't fly if World.windSpeed > 20Crow:• hopping: moves 1 ft; won't hop if World.temperature < 0• flying: moves 30 ft; won't...
-
.NET run time relies on the object reference counts to manage memory
A) TrueB) FalseExplanation: .Net run time relies on Garbage Collection to manage memory
-
Which of the following is not a subclass of Value Type class
A) EnumerationsB) User defined value typesC) Boxed value typesExplanation: Boxed value types are of reference types
-
-
-
Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.
-
Which is not cls compliant built in value type?
Intushortdecimalenum
-
What does the volatile modifier do
A) The value of the object is written immediately on assignmentB) The value is lost after the system reads it.C) The system stored the value until the end of all current threadsD) The system always reads the current value of a volatile object at the point it is requested
-
What is the C# equivalent of System.Single
A) Float (16-bit)B) Float (32-bit)C) Float(64-bit)
-
The following is a correct call to the Main() function
Skill/Topic: BeginnerA) static void Main()B) static Main(void)C) Main()
-
What is the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.
-
C# Indexer
1. What is an indexer?2. Why we are using indexer?
-
-
-
1. Are there some features of C# language not supported by .NET?
Skill/Topic: AdvancedA) YesB) NoExplanation: For example some instances of operator overloading!
-
What is the difference between shadow and override
Override id used for variables and methods but override only used for methods.
-
C# Interview Questions
Ans