-
Does C# support properties of array types?
Yes. Here's a simple example: using System;class Class1 {private string[] MyField;public string[] MyProperty {get { return MyField; }set { MyField = value; }}}class MainClass{public static int Main(string[] args) {Class1 c = new Class1();string[] arr = new string[] {"apple", "banana;c.MyProperty = arr;Console.WriteLine(c.MyProperty[0]); // "apple"return 0;}}
-
-
Value of x
This is interview question,public void A() { int x; x = 8; x *= 4 + 8 / 2; } Given the above code, what is the value of "x"?options:- A) 3 B) 2 C)4 D) None
-
Interfaces provide implementation of methods
Skill/Topic: IntermediateA) TrueB) FalseExplanation: They only provide declaration on methods, events and properties
-
You can create the following using C#
Skill/Topic: BeginnerA) class librariesB) Stand alone GUI (Windows Forms) applicationsC) ASP.NET Web pagesD) Command Line applications
-
-
-
Which keywords can do case insensitive string comparison in c#?
string.Equals("string number 1", "String NUMBER 1", StringComparison.CurrentCultureIgnoreCase) There is also a similar override of String.Compare().
-
Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.
-
Classes Interface
Explain how many classes can an interface inherit?
-
Threading
Write a very simple multi threaded program in C#. 1. The program should create two threads that each add data to the same list at the same time. Then after they are both done, print out the entire list. 2. So each thread should loop through 100 times adding the name of the thread doing the work to the list. For example, the first thread should add the string "thread1" to the shared list and the second...
-
The base class Arrray belongs to the mamespace
Skill/Topic: IntermediateA) GlobalTypeB) ArraysC) System
-
What is the difference between // comments, /* */ comments and /// comments?
Single-line, multi-line and XML documentation comments.
-
-
What is the order of destructors called in a polymorphism hierarchy
A) Starts with derived class ends at base classB) Starts with base class ends at derived classC) The destructor of base can not becalledD) RandomlyExplanation: Uses Bottomup approach while calling Destructors from derived class
-
-
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
C# Interview Questions
Ans