Skip to content

I created this repository to answer the typical interview questions that I am asked. The Unit Test project is used to run the test cases that I am given

Notifications You must be signed in to change notification settings

ZinkNotTheMetal/TypicalInterviewQuestions

Repository files navigation

Typical Interview Questions & Answers

HTML

  • What is HTML?
  • HTML is short for HyperText Markup Language, and is the language of the World Wide Web. It is the standard text formatting language used for creating and displaying pages on the Web.
  • How do you insert a comment in html?
  • Using the
  • What are Web Workers?
  • Web workers at long last bring multi-threading to JavaScript.
    A web worker is a script that runs in the background (i.e., in another thread) without the page needing to wait for it to complete. The user can continue to interact with the page while the web worker runs in the background. Workers utilize thread-like message passing to achieve parallelism.
  • What is HTML 5 WebStorage? Explain the difference between localStorage and sessionStorage.
  • With HTML5, web pages can store data locally within the user’s browser.
    Earlier, this was done with cookies. However, Web Storage is more secure and faster. The data is not included with every server request, but used ONLY when asked for.
    The data is stored in name/value pairs, and a web page can only access data stored by itself. Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server.
    The difference between localStorage and sessionStorage involves the lifetime and scope of the storage.
    Data stored through localStorage is permanent: it does not expire and remains stored on the user’s computer until a web app deletes it or the user asks the browser to delete it. SessionStorage has the same lifetime as the top-level window or browser tab in which the script that stored it is running. When the window or tab is permanently closed, any data stored through sessionStorage is deleted.
    Both forms of storage are scoped to the document origin so that documents with different origins will never share the stored objects. But sessionStorage is also scoped on a per-window basis. If a user has two browser tabs displaying documents from the same origin, those two tabs have separate sessionStorage data: the scripts running in one tab cannot read or overwrite the data written by scripts in the other tab, even if both tabs are visiting exactly the same page and are running exactly the same scripts.

    CSS

  • What is CSS?
  • The full form of CSS is Cascading Style Sheets. It is a styling language which is simple enough for HTML elements. It is popular in web designing, and its application is common in XHTML also.
  • What are pseudo classes and what are they used for?
  • Pseudo classes are similar to classes, but are not explicitly defined in the markup, and are used to add additional effects to selected HTML elements such as link colors, hover actions, etc.
    Pseudo classes are defined by first listing the selector, followed by a colon and then pseudo-class element. E.g., a:link{ color: blue }, or a:visited { color: red }
  • What are the three main ways to apply CSS styles to a Web page?
    • Inline - although this method goes against best practices, it is easily done adding the style tag to an element
    • Internal - Done by defining the head of an HTML document by wrapping characteristics in a style tag.
    • External - Done by referencing an external style sheet in the head of an HTML document
  • What are child selectors?
  • Child selectors are another way to group and style a set of elements that descend from a parent element. A child selector is matched by calling two or more elements, separated by a ‘>’ sign to indicate inheritance.
  • What is the CSS Box Model used for? What are the elements that it includes?
  • CSS box model is made up of margins, borders, padding, and content.
    Box model provides a structured way to space elements in relationship to each other.
  • What is the purpose of the z-index and how is it used?
  • The z-index helps specify the stack order of positioned elements that may overlap one another. The z-index default value is zero, and can take on either a positive or negative number.
    An element with a higher z-index is always stacked above one with a lower index.

    JavaScript

  • What is the difference between == and === ?
  • The 3 equal signs mean "equality without type coercion". Using the triple equals, the values must be equal in type as well.
    == is equal to
    === is exactly equal to (value and type)
    0==false // true
    0===false // false, because they are of a different type
  • What is 'this' in JavaScript
  • In JavaScript, 'this' normally refers to the object which 'owns' the method, but it depends on how a function is called.

    ASP.NET

    MVC

  • How can we maintain sessions in MVC?
  • tempdata
  • viewdata
  • viewbag
  • Explain the MVC Lifecycle?
    1. Routing - Basically it is a pattern matching system that matches the request’s URL against the registered URL patterns in the Route Table
    2. MVC Handler - responsible for initiating the real processing inside ASP.NET MVC
    3. Controller - is intantiated or retreived from memory
    4. Action Executed - Controller's ActionInvoker determines which specific action to invoke on the controller. Action to be execute is chosen based on attributes
    5. View Result - The action method receives user input, prepares the appropriate response data, and then executes the result by returning a result type
    6. View Engine - retrieves the setup view engine in the application start (typically Razor)
    7. View - Action method may returns a text string,a binary file or a Json formatted data. The most important Action Result is the ViewResult, which renders and returns an HTML page to the browser by using the current view engine

    WebForms

  • List all the ways to store data?
    • View state
    • Control state
    • Hidden fields
    • Cookies
    • Query strings
    • Application state
    • Session state
    • Profile Properties
    View state, control state, hidden fields, cookies, and query strings all involve storing data on the client in various ways. However, application state, session state, and profile properties all store data in memory on the server. Each option has distinct advantages and disadvantages, depending on the scenario.
  • List all page life-cycle events.
    • PreInit
    • Init
    • InitComplete
    • LoadViewState
    • LoadPostData
    • PreLoad
    • Load
    • LoadComplete
    • PreRender
    • PreRenderComplete
    • SaveStateComplete
    • Unload

    C-Sharp

    Type

  • What kind of type is a string?
  • Reference
  • What kind of type is a double?
  • Value
  • What keyword defines a custom value type?
  • struct

    Class

  • Can a class have more than one direct base class?
  • No
  • What is a POCO
  • It stands for Plain old C (or C#) object. It is typically a class that contains multiple properties and has 0 functionality.
  • Difference between Abstract class & Interface
  • An abstract class can have shared state or functionality. An interface is only a promise to provide the state or functionality. A good abstract class will reduce the amount of code that has to be rewritten because it's functionality or state can be shared. The interface has no defined information to be shared just a contract of what the class will include.

    Method

  • What method do you call on a delegate to run it on a background thread?
  • BeginInvoke
  • Describe Overriding
  • Overriding means that a method shares the same name and signature of a base or abstract calss, but is overriden in the inhertted class
  • Describe Overloading
  • Overloading means that a method has the same name in the class but a different method signature

    Keyword

  • What keyword makes a member visible to inherited classes?
  • protected
  • What keyword makes a class visible only within its assembly?
  • internal
  • What keyword allows a method to be overridden?
  • virtual
  • What keyword requires a method to be overridden?
  • abstract
  • What keyword prevents a class from being used as a base class?
  • sealed
  • What keyword returns true if a cast will succeed?
  • is
  • What keyword returns null if a cast will not succeed?
  • as
  • What keyword ensures code execution even if an exception occurs?
  • finally
  • What keyword calls IDisposable.Dispose?
  • using
  • What keyword constrains a generic type argument to derive from a particular class?
  • where
  • What two keywords used together return IEnumerable?
  • yield return
  • What keyword would you use to define an inline variable in a LINQ query?
  • let
  • What keyword brings an extension method into scope?
  • using (these are typically at the top of the file)
  • What keyword do you add to a delegate to force subscribers to use += or –=?
  • event
  • What keyword provides thread synchronization?
  • lock
  • Protected Internal
  • (combination of these two) will be visible only to classes that derive from the class that declares that member *and* are declared in a file in the same assembly.
  • What is a static method?
  • If you apply static keyword with any method, it is known as static method. A static method belongs to the class rather than object of a class. A static method invoked without the need for creating an instance of a class.

    Generic C-Sharp

  • What are extension methods? What are some examples.
  • Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type
    LINQ, ToString, Split...
  • What is the difference between the stack and the heap?
  • The Stack is more or less responsible for keeping track of what's executing in our code (or what's been "called"). The Heap is more or less responsible for keeping track of our objects.

    Entity Framework

    ADO.NET

  • Should you use ADO.NET DataReader or Dataset? Why?
  • It depends on your needs. One of the most important differences is that a DataReader will retain an open connection to your database until you're done with it while a DataSet will be an in-memory object. If you bind a control to a DataReader then it's still open. In addition, a DataReader is a forward only approach to reading data that can't be manipulated. With a DataSet you can move back and forth and manipulate the data as you see fit.

    SQL

  • What is a left outer join? What is an example.
  • Outer is an optional keyword in sql server. That being said this would be a LEFT JOIN. A LEFT JOIN gets all data from the left (or first table) and joins it to the right (or second table) matching null where they do not line up. Customers LEFT JOIN Orders (will show all customers but they might not have any orders which will return null)
  • What are some advantages to using Stored Procedures? Disadvantages?
  • Advantages
    • Testability outisde of the application
    • Security
    • Speed / Optimization
  • Disadvantages
    • Errors are typically found in runtime
    • Stored procedure code is not as robust as application code, particularly in the area of looping (not to mention that iterative constructs, like cursors, are slow and processor intensive)
    • Lot of overhead for simple stored procedures
  • What are advantages to using indexes? Disadvantages?
  • Indexes (typically) speed up SELECT's and slow down INSERT's.
  • What are the difference between clustered and a non-clustered index?
  • A clustered index is a special type of index that reorders the way records in the table are physically stored.
  • A non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.
  • Is it possible to have temporary tables in Views?
  • No, a view consists of a single SELECT statement. You cannot create or drop tables in a view.
  • What are the different types of triggers?
  • DDL - Data Definition Language (trigger based on CREATE, ALTER, DROP)
  • DML - Data Manipulation Language (trigger based on INSERT, UPDATE, DELETE)
  • CLR - based on the CLR (Common Language Runtime) in .NET framework
  • Login - fire when LOGON event of Sql Server is raised.
  • What's the difference between a primary key and a unique key?
  • Both primary key and unique key enforces uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only.
  • What is SQL Injection
  • Refers to an attack where a malicious user is trying to execute SQL statements that control a web application's database server.
  • What is Log Shipping?
  • Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server.
  • What is a Foreign Key?
  • A FOREIGN KEY constraint prevents any actions that would destroy links between tables with the corresponding data values. A foreign key in one table points to a primary key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no primary keys with that value. The foreign key constraints are used to enforce referential integrity.
  • How to implement one-to-one, one-to-many, and many-to-many tables?
    One-to-One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships. One-to-Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships. Many-to-Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key of the junction table.
  • Should you use a GUID as a primary key? why or why not?
  • There are positives and negatives to using GUIDs. if they are not sequential you should NOT use them as primary keys. As they cannot be easily clustered and SQL Server defaults to clustering. This can cause big performace problems on the database server. It is also 4 times larger than using the traditional 4-byte index values that can also cause performance problems.

    Generic / Leftovers

  • Explain the difference between managed and unmanaged code.
  • Managed code is code that has its execution managed by the .NET Framework Common Language Runtime.
  • Inheritance vs Composition. Which one should you choose?
  • Favor composition over inheritance
  • What is SOLID?
  • S - Single Responsibility - one class does 1 thing
    O - Open / Closed - Open for extension, closed for modification
    L - Liskov Substitution Principle - classes should be able to be switched out easily
    I - Interface Segregation - many client-specific interfaces are better than one general-purpose interface.
    D - Dependency Inversion - not to be confused with Dependency Injection, entities / layers depend on abstractions not concretions.
  • What is Rest
  • ReST stands for Representational State Transfer, it is an architecture style for designing networked applications. It uses stateless HTTP calls, rather than complex systems like SOAP, RPC, or COBRA
  • What is an ORM?
  • It stands for Object relational mapper, it is a tool that converts incompatible data types to object-oriented types. There are many different ORMs. A few examples would be Entity Framework, NHibernate. A few examples of MicroOrms would be Dapper, Insight DB, Simple.Data. For more information on Object relational mappers check out my Github project [MicroOrm Comparison](https://github.com/ZinkNotTheMetal/MicroOrmComparison)

    About

    I created this repository to answer the typical interview questions that I am asked. The Unit Test project is used to run the test cases that I am given

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published