What si the difference between interface and

abstractclass

Select Answer:

 1. interface contain only methods

 2. we can't declare a variable for interface

 3. interface contain only events

 4. None

 5. All

1 Answer

Answer :

Ans : 2 The only Difference between Interface and Abstract class is we can declare a variable in abstract class but we can't declare in variable interface

Related questions

Description : Why can’t you specify the accessibility modifier for methods inside the interface?

Last Answer : They all must be public, and are therefore public by default. 

Description : Why can’t you specify the accessibility modifier for methods inside the interface?

Last Answer : They all must be public, and are therefore public by default.

Description : Why can’t you specify the accessibility modifier for methods inside the interface? 

Last Answer : They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it’s public by default.

Description : Methods must declare a return type, what is the keyword used when nothing is returned from the method?

Last Answer : void 

Description : Can an Interface contain fields?

Last Answer : No, an Interface cannot contain fields.

Description : Which one of the following tools is used to view the metadata information contained in a .NET assembly? Select Answer:  1. al.exe  2. ilasm.exe  3. vbx.exe  4. csc.exe  5. ildasm.exe

Last Answer :  5. ildasm.exe

Description : What is the lifespan for items stored in ViewState? Select Answer:  1. Item stored in ViewState exist for the life of the current page  2. Item stored in ViewState exist for the life ... of the current Applicaiton  4. Item stored in ViewState exist for the life of the current configuration

Last Answer : 1. Item stored in ViewState exist for the life of the current page AS any web application works on request and response basis ,so on every post backs, The data in control gets lost. To retain page ... control with data. The life cycle of the view state exist for life of current running page only. 

Description : Can we declare a method as sealed?

Last Answer : In C# a method can’t be declared as sealed. However, when we override a method in a derived class, we can declare the overridden method as sealed. By declaring it as sealed, we can avoid further overriding of this method.

Description : Can we declare a block as static in c#?

Last Answer : No, because c# does not support static block, but it supports static method.

Description : Can you declare an override method to be static if the original method is not static? 

Last Answer : No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override)

Description : What does the keyword “virtual” declare for a method or property? 

Last Answer : The method or property can be overridden. 

Description : When do you absolutely have to declare a class as abstract?

Last Answer : 1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden. 2. When at least one of the methods in the class is abstract.

Description : Write some code to declare and use properties.

Last Answer : // instance public string InstancePr { get { return a; } set { a = value; } } //read-only static public static int ClassPr { get { return b; } }

Description : How do you declare a constant? 

Last Answer : public const int c1 = 5; 

Description : Can you declare an override method to be static if the original method is not static? 

Last Answer : No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override)

Description : What does the keyword “virtual” declare for a method or property? 

Last Answer : The method or property can be overridden.

Description : When do you absolutely have to declare a class as abstract?

Last Answer : 1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden. 2. When at least one of the methods in the class is abstract.

Description : When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?

Last Answer : 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 overridden.

Description : Can you declare the override method static while the original method is nonstatic?

Last Answer : No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override. 

Description : What’s the difference between an interface and abstract class?

Last Answer : Answer: An abstract class and Interface both have method only but not have body of method.The difference between Abstract class and An Interface is that if u call Ablstract class then u have to call ... type, Parameter type, Parameter Number all must be same . Only body of method can change. 

Description : Define what is the difference between a class and an Interface?

Last Answer : 1. Abstract classes can have implementations for some of its members, but the interface can't have implementation for any of its members. 2. Interfaces cannot have fields whereas an ... 5. Abstract class members can have access modifiers whereas interface members cannot have access modifiers.

Description : Define what is the difference between Class And Interface?

Last Answer : Class is a logical representation of an object. It is a collection of data and related sub procedures with a definition. The interface is also a class containing methods which are not having any definitions. Class does not support multiple inheritances. But interface can support.

Description : What is an interface class?

Last Answer : Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. 

Description : Can an interface have properties?

Last Answer : Yes

Description : Can the members of an interface be private?

Last Answer : No. 

Description : What is the default accessibility for members of an interface?

Last Answer : public

Description : What is an interface class? 

Last Answer : Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.

Description : What’s an interface class? 

Last Answer : It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.

Description : Can you create an instance of an interface?

Last Answer : No, you cannot create an instance of an interface.

Description : Define what is an interface class?

Last Answer : It is an abstract class with public abstract methods all of which must be implemented in the inherited classes.

Description : Define what is the difference between static and instance methods?

Last Answer : A method declared with a static modifier is a static method. A static method does not operate on a specific instance and can only access static members. A method declared without a static modifier is an ... can be explicitly accessed as this. It is an error to refer to this in a static method.

Description : Define what is the difference between “throw ex” and “throw” methods in C#?

Last Answer : “throw ex” will replace the stack trace of the exception with stack trace info of rethrowing point. “throw” will preserve the original stack trace info.

Description : Define what is the difference between “finalize” and “finally” methods in C#?

Last Answer : Finalize – This method is used for garbage collection. So before destroying an object, this method is called as part of the cleanup activity. Finally – This method is used for executing the code irrespective of exception occurred or not.

Description : Events use a publisher/subscriber model. What is that?

Last Answer : Objects publish events to which other applications subscribe. When the publisher raises an event all subscribers to that event are notified.

Description : Are events synchronous of asynchronous? 

Last Answer : Asynchronous

Description : Can events have access to modifiers?

Last Answer : Yes, you can have access to modifiers in events. You can have events with the protected keyword, which will be accessible only to inherited classes. You can have private events only for objects in that class.

Description : Do events have return type?

Last Answer : No, events do not have a return type.

Description : Define what is events?

Last Answer : An event is a member that enables a class or object to provide notifications. An event is declared like a field except that the declaration includes an event keyword and the type must be a delegate type.

Description : Which of the following factor needs to be addressed while working with mobile applications in the cloud? A. Slow transmission over the connection B. Different methods of navigation through the interface C. Variable screen sizes and resolutions D. All of the above

Last Answer : All of the above

Description : Can you change the value of a variable while debugging a C# application? 

Last Answer : Yes. If you are debugging via Visual Studio.NET, just go to Immediate window. 

Description : Who is a protected class-level variable available to?

Last Answer : It is available to any sub-class (a class inheriting this class). 

Description : Can you change the value of a variable while debugging a C# application? 

Last Answer : Yes. If you are debugging via Visual Studio.NET, just go to Immediate window. 

Description : Who is a protected class-level variable available to?

Last Answer : It is available to any sub-class (a class inheriting this class).

Description : When you inherit a protected class-level variable, who is it available to? 

Last Answer : Classes in the same namespace. 

Description : Does C# support a variable number of arguments?

Last Answer : Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type, e.g., int. For ultimate flexibility, the type can object. The standard example of a method which uses this approach is System.console.writeLine().

Description : Does C# support a variable number of arguments?

Last Answer : Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type.

Description : What does the assembly manifest contain? 

Last Answer : Assembly manifest lists all names of public types and resources and their locations in the assembly.

Description : Explain how to use the Begin and End methods on a Web Service to make an asynchronous method call.

Last Answer : Every public Web method on a Web Service can be called either synchronously or asynchronously. To make an asynchronous call to a Web method, you call the method named Begin, where is the name of ... returned by Begin. This will allow you to retrieve the actual data returned by the Web method.

Description : Describe Break mode and some of the available methods for navigating in Break mode.

Last Answer : Break mode allows you to observe program execution on a line-by-line basis. You can navigate program execution in Break mode by using Step Into, Step Over, Step Out, Run To Cursor, and Set Next Statement.

Description : Can abstract methods override virtual methods? 

Last Answer : Yes