Professional Documents
Culture Documents
Dotnet
Dotnet
Ans: The base class is a class whose members and functions can be inherited, and the
derived class is the class that inherits those members and may also have additional
properties.
Ans: The extension method is used to add new methods in the existing class or the
structure without modifying the source code of the original type. Special permission
from the original type or re-compiling it isn’t required.
3. What is inheritance?
Ans: Implementation inheritance is when a class inherits all members of the class from
which it is derived. Interface inheritance is when the class inherits only signatures of
the functions from another class.
Ans: Method Overriding is a process that allows using the same name, return type,
argument, and invoking the same functions from another class (base class) in the
derived class.
Ans: No, .NET supports only single inheritance due to the diamond problem. Also, it
would add complexity when used in different languages. However, multiple interfaces
can solve the purpose.
9. What is an Interface?
Ans: An interface is a declaration for a set of class members. It is a reference type that
contains only abstract members such as Events, Methods, Properties, etc.
Ans: Events notify other classes and objects when the desired action occurs in a class
or object. A delegate is a type-safe function pointer that defines a method signature in
CLI.
12. What is the difference between trace class and debug class?
Ans: The call to Debug class is included in Debug mode only and it is used at the time
of application development. While the call to Trace class will be included in Debug as
well as Release mode also and it is used at the time of application deployment.
Ans: MVC is an architectural model for building .Net applications. It stands for Model
View Controller. It is easy to use and offers full control over the HTML.
Ans: Stored Procedures are pre-compiled objects which execute the code when called
for. While a Function is compiled and executed when it is called for.
Ans: ADO stands for ActiveX Data Objects. It is an application program for writing
Windows applications. It is used to get access to a relational or non-relational database
from database providers such as Microsoft and others.
i. DataReader: connected architecture.
ii. DataSet: disconnected architecture.
Ans: The thread represents an actual OS-level thread, with its own stack and kernel
resources, and allows the highest degree of control. You can choose to Abort() or
Suspend() or Resume() a thread, and set thread-level properties, like the stack size,
apartment state, or culture. While a Task class from the Task Parallel Library is
executed by a TaskScheduler to return a result and allows you to find out when it
finishes.
Ans: JIT stands for Just In Time. It is a compiler in CLR responsible for the execution
of .NET programs of different languages by converting them into machine code. It
speeds up the code execution and supports multiple platforms.
i. Pre-JIT compiler: It compiles all the source code into the machine code in a single
compilation cycle, i.e. at the application deployment time.
ii. Normal JIT Compiler: The source code methods required at run-time are compiled
into machine code and stored in the cache to be called later.
iii. Econo JIT Compiler: The methods required only at run-time are compiled using
this compiler and they are not stored for future use.
No support for exception handling using Supports the usage of try-catch blocks for
try-catch blocks exception handling
The argument consists of only one input Both input and output parameters are
parameter present
A function can be called from a stored The stored procedure cannot be called
procedure from a function
C# part2
1. How is Exception Handling implemented in C#?
You can carry out exception handling using the following four keywords in C#:
The following table enumerates the key differences between overloading and
overriding.
Constructor dependency
Property dependency
Method dependency
(INNER) JOIN – returns only those records that satisfy a defined join
condition in both (or all) tables. It's a default SQL join.
LEFT (OUTER) JOIN – returns all records from the left table and those
records from the right table that satisfy a defined join condition.
RIGHT (OUTER) JOIN – returns all records from the right table and those
records from the left table that satisfy a defined join condition.
FULL (OUTER) JOIN –
returns all records from both (or all) tables. It can be
considered as a combination of left and right joins
DOTNET INTERVIEW QUESTION WITH ANSWERS
IEnumerable interface has only single method - GetEnumerator() and it must return
an instance of an object of a class which implements the IEnumerator interface.
ICollection inherits IEnumerable apart from it contains some more method and
IsSynchronized and SyncRoot properties help to make the collection thread-safe.
ICollection supports count property too.
DOTNET INTERVIEW QUESTION WITH ANSWERS
A class from which it is not possible to create/derive a new class is known as a sealed
class. In simple words, we can say that when we define the class using the sealed modifier,
then it is known as a sealed class and a sealed class cannot be inherited by any other
classes.
What is middleware?
It is software that is injected into the application pipeline to handle requests and
responses. They are just like chained to each other and form as a pipeline. The incoming
requests are passed through this pipeline where all middleware is configured, and
middleware can perform some action on the request before passing it to the next
middleware. Same as for the responses, they are also passing through the middleware
but in reverse order.
DOTNET INTERVIEW QUESTION WITH ANSWERS
The lifecycle of an MVC application includes two execution steps and two
main phases. The two execution steps involve understanding the request and,
secondly, sending out the most appropriate response based on the type of
request. The two main phases include creating the request object and,
secondly, sending the response to the browser.
0. What are the differences between View data and View Bag?
View data can pass the data from a controller to view, while View bag
can pass data from the controller to the respective view.
View data is available for current requests only, while View bag is
available for all kinds of requests.
View data needs typecasting for complex data, while View bag does not
require any kind of typecasting.
the layout page. At one time, there can be multiple instances of RenderPage in
the RenderBody.
Constraints are used to specify the rules concerning data in the table. It can be applied
for single or multiple fields in an SQL table during the creation of the table or after
creating using the ALTER TABLE command. The constraints are:
NOT NULL - Restricts NULL value from being inserted into a column.
CHECK - Verifies that all values in a field satisfy a condition.
DEFAULT - Automatically assigns a default value if no value has been specified
for the field.
UNIQUE - Ensures unique values to be inserted into the field.
INDEX - Indexes a field providing faster retrieval of records.
PRIMARY KEY - Uniquely identifies each record in a table.
FOREIGN KEY - Ensures referential integrity for a record in another tabl
A database cursor is a control structure that allows for the traversal of records in a
database. Cursors, in addition, facilitates processing after traversal, such as retrieval,
addition, and deletion of database records. They can be viewed as a pointer to one row
in a set of rows.
01.What is Scaffolding?
Scaffolding is basically a Code Generation framework. Scaffolding Engine generates basic
controllers as well as views for the models using Microsoft’s T4 template. Scaffolding blends
with Entity Framework and creates the instance for the mapped entity model and generates
code of all CRUD Operations. Further, we can edit or customize this auto-generated code
according to our needs. As a result, we get the basic structure for a tedious and repetitive
task.
03.What is Caching?
Caching is the most important aspect of a high-performance web application. Caching
provides a way of storing frequently accessed data and reusing that data. Practically, this is
an effective way of improving the web application’s performance
Authentication is the process of identifying the user. For example, one user let’s say
James logs in with his username and password, and the server uses his username and
password to authenticate James.
Authorization is the process of deciding whether the authenticated user is allowed to
perform an action on a specific resource (Web API Resource) or not. For example, James
(who is an authenticated user) has the permission to get a resource but does not have the
permission to create a resource.
11.Types of Constructors in C#
There are five types of constructors available in C#, they are as follows
1. Default or Parameter Less Constructor
2. Parameterized Constructor
3. Copy Constructor
4. Static Constructor
5. Private Constructor