-
GetEnumerator( ) of Ienumerable interface returns
A) IenumeratorB) IcollectionC) Ienumerable
-
What happens when you create an arraylist as ArrayList Arr=new ArrayList()
A) An arraylist of object Arr is created with the capacity of 16B) An arraylist of object Arr is created with the capacity of 20C) An arraylist of object Arr is created with the capacity of 26Explanation: Default capacity is 16 if size is not specified
-
In order to use stringbuilder in our class we need to refer
A) System.TextB) System.IOC) System.StringBuilder
-
For performing repeated modification on string which class is preferred
A) StringB) StringBuilderC) Both
-
How are the attributes specified in C#
A) Enclosed with in [ ]B) Enclosed with in ( )C) Enclosed with in { }
-
Which preprocessor directive are used to mark that contain block of code is to be treated as a single block
A) # define & #undefB) # Region & #EndRegionC) #Line
-
Which method is implicitly called when an object is created
A) Main MethodB) Constructor MethodC) Destructor MethodExplanation: Constructor is the method which is implicitly created when ever a class is instantiated
-
Interface members can not be declared as
A) VirtualB) StaticC) PrivateD) All of the above
-
-
What is the difference between a struct and a class in C#?
From language spec:The list of similarities between classes and structs is as follows. Longstructs can implement interfaces and can have the same kinds of members as classes. Structs differ from classes in several important ways; however, structs are value types rather than reference types, and inheritance is not supported for structs. Struct values are stored on the stack or in-line. Careful programmers...
-
Sealed class can be inherited
A) TrueB) FalseExplanation: Sealed class cannot be inherited
-
Which of the following can not be declared as virtual
A) Static functionsB) Member fieldsC) Instance functions
-
Which of the following is not a C# reserved keyword
A) IsB) AsC) InD) Of
-
Which of the member is not a member of Object
A) Equals ( )B) GetType ( )C) ToString ( )D) Parse( )
-
Which statement is invalid with regards to Constant
A) They must be initialized when they are declaredB) The value of the constant must be computable at compile timeC) Constants are not staticD) Constant is a variable whose value can be changed through out it’s life time when it is static.
-
If you need your own implementation of Equals method of object what needs to be done
A) Overload Equals methodB) Override Equals methodC) Implements Equals method
-
Is there an equivalent to the instanceof operator in Visual J++?
C# has the is operator: expr is type
-
What is similar in concept to IL?
Skill/Topic: IntermediateA) Java Byte CodeB) C++ LibrariesC) Machine Language
-
Method Overloading and Overriding are the same
Skill/Topic: IntermediateA) TrueB) FalseExplanation: Overloading is changing the behavior of a method in a derived class, whereas overriding is having multiple methods with the same name
-
Garbage Collector:
Skill/Topic: AdvancedA) Copies the IL code to the heapB) Destroys the pointersC) is responsible for automatic memory management
C# Interview Questions
Ans