Which of the following statements is not true for interfaces
A) interface definitions does not have implementationb) interfaces must be declared as publicc) interfaces can be instantiatedd) interface does not have constructorsexplanation: interfaces can only be implemented by inheriting and they can not be instantiated
Can we write dotnet console program in UNIX
Can we write dotnet console program in UNIX ? If yes give one example.
If you write in Java then the application will run in a JRE on UNIX but you have to compile the application on Windows first. Then deploy it to UNIX.
You can use mono .net for this
How to handle exceptions without using try catch finally
The best way to do this would be doing the same in global.asax application_error method.
Thanks
Vijay
By using "if else" conditional statement
The following code fails. Why?
Int a = 5; int b = 5; object oa = a; object ob = b; debug.Assert(oa == ob, "oa is not equal ob");
nice answer peter
The "==" operand on the 2 int's is comparing value types. Here the content is compared. After boxing the value types into objects, i.e. reference types, the "==" operand compares the references (memo...
How can I check whether a dataset is empty or not in c#.Net
Code
if(dataset.Tables.count!=0) { do some operation } else { nothing... }
Thank you Seeker911, your answer helped me :)
Which of the following statement is invalid with regards to constructor
A) constructors should have the same name as class nameb) constructors have to be public so that class can be instantiatedc) constructors can not be overloadedexplanation: constructors can be overloaded with different parameters
all the three statements are true...
The correct answer is B: as constructors need not be public we can have private constructors also for instance a singleton object has a private constructor
If a.Equals(b) is true then a.Gethashcode & b.Gethashcode must always return same hash code
A) trueb) false
Not necessarily. Actually GetHashCode() can always return the same value... :-) Say "1". And everything will work well. Just Hashtable with such a key will not be efficient. Keys in the hashtable are ...
FALSE
Both Equals() and GetHashCode() can be overridden by the developer for user-defined classes, so there is no guaranteed behavior.
Program on 3d matrix using random function print the o/p in file.
Program on 3d matrix using random function print the o/p in file find the even,odd,prime numbers from above output file. please do needful help thank you
People, please read the question before answering, don't just answer "Why" is the question - not "how".
String is an array of bytes.
When are you ave to change it, you have to create the new one; because the string is always considered as a constant.
My switch statement works differently! Why?
C# does not support an explicit fall through for case blocks. The following code is not legal and will not compile in c#: switch(x){case 0:// do somethingcase 1:// do something in common with 0default:// do something in common with//0, 1 and everything elsebreak;}to achieve the same effect in c#, the...
Folks:
Empty cases allowed to fall through in C#.
Most of the other answers are right, but there is a caveat.
Empty cases are allowed to fall through. However, the last case statement always needs a break - empty or not.
By declaring a base class function as virtual we allow the function to be overridden in subclasses
A) trueb) falseexplanation: if a function is declared virtual it needs to be overridden in subclass
It is not mandatory for a derived class to override the virtual base method. Nevertheless, derived class can opt to override the virtual base method to redefine the functionality.
The answer is A) TRUE. If you declare a virtual method in a class , its not mandatory to override it in the sub class. However, In case of abstract class, the answer would be B) False since if you ...
I have taken a windows application and a button control in it.I want to declare a variable as a sealed and use that variable with in same class as we cannot use in other class. Class test { public sealed int x = 5; public void abc() { ...
Keyword sealed can be used with class declaration to prevent it from being sub-classed.
Keyword sealed can be used in method declaration to prevent it from being overridden.
To restrict users from inheriting the class by sealing the class using "sealed" keyword i.e. no class can be drieved from a sealed class. both Class and Method can be sealed, in that case Method cannot be overridden.
What is the necessary for "throws" and "throw" in exception handling?? even though the exception has been thrown automatically and being handled by try and catch block..
no throws in C#.
throw is used to re-throw exceptions
if we have different layers like Dataaccess layer,Business layer ,Presentation layer. The error is in DataAccess layer,that error should come to presentation layer and we can show that error in messa...
Following are the collections in c#:
Skill/topic: advanceda) structsb) enumc) dictionariesexplanation: ans. B & c. A isn’t a collection .
Answered by: LordAlex
Member Since Nov-2011 | Answered On : Nov 5th, 2011
All collections directly or indirectly should implement the ICollection interface or the ICollection(Of T) generic interface. If you check System.Array you will see ICollection interface in there. Correct answer is C, it doesn't matter that there are methods that can provide arrays of Names and Values. Because if you are reasoning like this, it means bject.ToString().ToCharArray() cause all classes are being collections.
C. Dictionary
Enum is not a collection but a distinct type like struct
All collections directly or indirectly should implement the ICollection interface or the ICollection(Of T) generic interface. If you check System.Array you will see ICollection interface in there. Co...
Object oriented and object based language
Explain what are object oriented language and object based language
Answered by: Aarthy_SP
Member Since Dec-2008 | Answered On : Dec 10th, 2008
Any langauge based on encapsulation concpet and operations with the objects are called as Object Based language. Exmaple : VB is a Object based and not an Object oriented
Any langauge based on encapsulation concept and operations with the objects and also dealing with the inheritance and polymorphism are called as Object Oriented language. Exmaple : C++,C#
Object based languages do not support inheritance & dynamic binding. Example, VB
Object Oriented - supports of using the objects.
Object Based Language - all data types are objects, based on single type object primitive.
When do you absolutely have to declare a class as abstract ?
(as opposed to free-willed educated choice or decision based on uml diagram)? when at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.
If any of the methods do not have implementation.
When you do not want to create an object of the class and want to provide some abstract implementation
ex: Class HumanBeing. No Point of creating a class human being. You can create Men or Women out of it an create an object of the derived class
In a multilevel hierarchy how are the constructors are called
A) topdownb) bottomupc) none
Order of call: From child to parent
Order of execution: From parent to child
Bottom up.
A parent class has no reference to the child class, it's the other way around. The code calls the child class, which then calls the parent class, and so on up. Then the constructors are executed top down.
All .Net code have to be cls compliant
Skill/topic: intermediatea) trueb) false
Not required. If you want your code to be CLS complaint use the annotation CLScompliant(true)
False All .Net code need not be CLS compliant if you are going to write all modules using single .Net language. However, if you are going to use different .Net language for different modules then you...
Why should we have to overload ==(equals) and !=(not equals) operators in same program? If any one is not overloaded it gives error. Same with =?
Comparison operators must be overloaded in pair
Same class name and different parameters within one class
Which one best in late binding and early binding? What is the difference between them ?
Early binding Or Compile time Or static binding: Assigning of object to type reference happens at compile time.
Late binding Or Run time Or Dynamic binding: Assigning of object to type reference happens at run time.
Early binding is efficient while late binding provides flexibility to programmers.
Early binding is best. Because any errors can be resolved at compile time. Late binding is at Run Time
C is the correct answer. Interfaces dont have constructors so they cant be instantiated.
http://msdn.microsoft.com/en-US/library/vstudio/ms173156.aspx
C) Interfaces can be instantiated