Study Guide for programmers

Podcasts
Click the card to flip 👆
1 / 47
Terms in this set (47)
Helps remove dependencies and helps make a system more decoupled and maintainable. When calling a function through an interface, the caller doesn't need to know how the call is implemented, just that the interface has a function by that name. When the interface is used using dependency injection, the instance of that interface is passed in/"injected".
Describe the accessibility modifier protected internalIt's available to derived classes and classes within the same Assembly (and naturally from the base class it's declared in)C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there's no implementation in it.What's the top .NET class that everything is derived from?System.Object.How's method overriding different from overloading?Overload has more than one function with the same name but different parameters. Override is having more than one function with the same name, same parameters, but one is in the base class and is overridden by the one in the derived class.What does the keyword virtual mean in the method definition?The method can be overriddenCan you declare the override method static while the original method is non-static?No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.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.What's an abstract class?A class that cannot be instantiated. A class that must be inherited and have the methods overridden. Essentially, it's a blueprint for a class without any implementation.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 overridden.What's an interface class?It's an abstract class with public abstract methods all of which must be implemented in the inherited classesWhy can't you specify the accessibility modifier for methods inside the interface?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.Can you inherit multiple interfaces?Yes, .NET supports multiple interface inheritance.And if they have conflicting method names?It's up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you're okay.What's the difference between an interface and abstract class?In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classesIf a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.What's the difference between System.String and System.StringBuilder classes?System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.What is immutable?A type of object whose data cannot be changed after its creation. An immutable type sets the property or state of the object as read only because it cannot be modified after it is assigned during initialization.What are extension methods? Can you give an example of one that you have written?The ability to add methods to an existing datatype without modifying the original datatype. An example would be various .Format()What are data annotations and how are they used?Quick and easy way to validate your business class/model by decorating them with ready made attributesWhat is "M"-"V"-"C"?Model, View, ControllerWhich are the advantages of using MVC Framework?It provides a clean separation of concerns between UI and model. UI can be unit test thus automating UI testing. Better reuse of views and model. You can have multiple views which can point to the same model and also vice versa. Code is better organized.What is Razor View Engine?Razor view engine is a new view engine created with ASP.Net MVC model using specially designed Razor parser to render the HTML out of dynamic server side code. It allows us to write Compact, Expressive, Clean and Fluid code with new syntaxes to include server side code in to HTML.What is an Action Filter and please give an example of one you have writtenAn attribute you can attach to a controller or controller action that modifies the way an action is executed. You can have custom action filters too.How would you go about implementing a global error handler and logger?Webconfig customErrorWhat is Forms Authentication and how does it work?Set in the IIS or webconfig. Deprecated after MVC 5. A way of authentication user access.What is routing?Helps map how to reach a view using routing patterns. MVC is "smart enough" to try multiple routes before throwing an error.What is the 'page lifecycle' of an ASP.NET MVC?Controller action is called and response is rendered in the browser. App Initialization > Routing > URL Routing module > MVC Handler > Controller > ViewWhat is a JQuery selector?Expressions to help find a matching DOM (Document Object Model) element.What are the different ways you can select DOM elements?$(". ") $("#") are what i use most. By class and IDWhat is the name of jQuery method used for an asynchronous HTTP request?jQuery.ajax()SQL Server: What are the difference between clustered and a non-clustered index?Clustered defines the order in which data is stored in the DB. One clustered index per table. Non Clustered does not physically sort the data, rather, stores the index in a separate place and tells the DB how to sort the data. Additional step, slower.What's the difference between a primary key and a unique key?Primary key: used to identify the row Unique key: used to prevent duplicates with the exception of nulls.What is SQL Profiler?Graphical tool to help monitor events in an instance of the SQL serverCan a stored procedure call itself or recursive stored procedure? How much level SP nesting is possible?Yes. 32 layers deepWhat are the advantages of using Stored Procedures?Stored procedure can reduced network traffic and latency, boosting application performance. Stored procedure execution plans can be reused, staying cached in SQL Server's memory, reducing server overhead. Stored procedures help promote code reuse. Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients. Stored procedures provide better security to your data.What is an execution plan? When would you use it? How would you view the execution plan?Shows the roadmap of how the data is retrievedDifference between REST and SOAP