-
Does Console.WriteLine() stop printing when it reaches a NULL character within a string?
Strings are not null terminated in the runtime, so embedded nulls are allowed. Console.WriteLine() and all similar methods continue until the end of the string.
-
Why do I get a syntax error when trying to declare a variable called checked?
The word checked is a keyword in C#.
-
How do destructors and garbage collection work in C#?
C# has finalizers (similar to destructors except that the runtime doesn't guarantee they'll be called), and they are specified as follows: class C{~C(){// your code}public static void Main() {}}Currently, they override object.Finalize(), which is called during the GC process.
-
How do I convert a string to an int in C#?
Here's an example: using System;class StringToInt{public static void Main(){String s = "105";int x = Convert.ToInt32(s);Console.WriteLine(x);}}
-
ByteArray Class
Write a class called ByteArray that implement allocating, reading and writing to an array of bytes. The runtime environment has a limitation. The maximum continuous memory size that it can allocated is 64k bytes. It can allocate many 64K ( or less) chunks. The ByteArray class should hide this limitation and support allocating arrays larger than 64K as in the following example :ByteArray ba = new ByteArray...
-
Whitespace in XML Parser
When whitespace is encountered by an XML parser within the element content, how is it handled by the XML parser?
-
-
-
Singleton Class
Give an example of inbuilt Singleton Class in .NET.
-
Value Types are stored on the heap ..? Is it true/False ?
Skill/Topic: AdvancedA) TrueB) False
-
-
-
C# Program to test efficient coding
You have several instances of the following class (User). Provide a class with three methods:"AddUser" accepts a User instance as a parameter and add it to a collection."GetUser" accepts a UserID as a parameter and returns the corresponding User instance. It is important that this executes quickly as it will be used often."GetOrderedUserArray" returns an array of User instances ordered by UserID....
-
What does the keyword virtual mean in the method definition?
The method can be over-ridden.
-
Variable Declaration and Assignment
What is difference between these two statement? if variable is declared and assign value in following two waysString sValue = (String)GridView1.DataKeys[GridView1.SelectedIndex].Value;String sValue = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString();
-
YIELD Keyword
What is the purpose of YIELD Keyword in C#?
-
What is the difference between const and static read-only?
The difference is that static read-only can be modified by the containing class, but const can never be modified and must be initialized to a compile time constant. To expand on the static read-only case a bit, the containing class can only modify it:-- in the variable declaration (through a variable initializer).-- in the static constructor (instance constructors if it's not static).
-
What is managed code?
Skill/Topic: IntermediateA) Code managed ouside the ILB) Code which can't be managed by the ILC) Code written in VB.NETD) Code to be compiled by IL
-
Is there a way to force garbage collection?
Yes. Set all references to null and then call System.GC.Collect().If you need to have some objects destructed, and System.GC.Collect() doesn't seem to be doing it for you, you can force finalizers to be run by setting all the references to the object to null and then calling System.GC.RunFinalizers().
-
Where does the version dependencies recorded
A) Inside an assembly’s manifestB) Along with the project propertiesC) Both
C# Interview Questions
Ans