0% found this document useful (0 votes)
66 views7 pages

Briefly Explain The Characteristics of Reference-Type Variables That Are Supported in The C# Programming Language

The variables that are based on reference types store references to the actual data. The keywords that are used to declare reference types are: Class, Interface, and Delegate. Class refers to the primary building block for programs, which is used to encapsulate variables and methods. Interface contains only method signatures. Delegate refers to a reference type that encapsulates a named or anonymous method. Constants perform the same tasks as read-only variables but are dealt with at compile-time and support value types, while read-only variables are evaluated at runtime and can hold reference types. The while and for loops are used to repeatedly execute code but differ in syntax, with the for loop setting an explicit loop variable.

Uploaded by

maanicapricon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views7 pages

Briefly Explain The Characteristics of Reference-Type Variables That Are Supported in The C# Programming Language

The variables that are based on reference types store references to the actual data. The keywords that are used to declare reference types are: Class, Interface, and Delegate. Class refers to the primary building block for programs, which is used to encapsulate variables and methods. Interface contains only method signatures. Delegate refers to a reference type that encapsulates a named or anonymous method. Constants perform the same tasks as read-only variables but are dealt with at compile-time and support value types, while read-only variables are evaluated at runtime and can hold reference types. The while and for loops are used to repeatedly execute code but differ in syntax, with the for loop setting an explicit loop variable.

Uploaded by

maanicapricon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Briefly explain the characteristics of reference-type variables that are supported in the C#

programming language.
The variables that are based on reference types store references to the actual data. The keywords that
are used to declare reference types are:
Class - Refers to the primary building block for the programs, which is used to encapsulate variables and
methods into a single unit.
Interface - Contains only the signatures of methods, properties, events, or indexers.
Delegate - Refers to a reference type that is used to encapsulate a named or anonymous method.
Explain keywords with example.

Keywords are those words that are reserved to be used for a specific task. These words cannot be used
as identifiers. You cannot use a keyword to define the name of a variable or method. Keywords are used
in programs to use the features of object-oriented programming.

For example, the abstract keyword is used to implement abstraction and the inherits keyword is used to
implement inheritance by deriving subclasses in C# and Visual Basic, respectively.

The new keyword is universally used in C# and Visual Basic to implement encapsulation by creating
objects.
What is the difference between constants and read-only variables that are used in
programs?

Constants perform the same tasks as read-only variables with some differences. The differences between
constants and read-only are

Constants:

Constants are dealt with at compile-time.


Constants supports value-type variables.
Constants should be used when it is very unlikely that the value will ever change.

Read-only:

Read-only variables are evaluated at runtime.


Read-only variables can hold reference type variables.
Read-only variables should be used when run-time calculation is required.

Differentiate between the while and for loop in C#.

The while and for loops are used to execute those units of code that need to be repeatedly executed,
unless the result of the specified condition evaluates to false. The only difference between the two is in
their syntax. The for loop is distinguished by setting an explicit loop variable.

What is the syntax to declare a namespace in .NET?

In .NET, the namespace keyword is used to declare a namespace in the code.

The syntax for declaring a namespace in C# is:


namespace UserNameSpace;

The syntax for declaring a namespace in VB is:


Namespace UserNameSpace
The responsibilities of CLR are listed as follows:

Automatic memory management


Garbage Collection
Code Access Security
Code verification
JIT compilation of .NET code

CTS is the component of CLR through which .NET Framework provides support for multiple languages
because it contains a type system that is common across all the languages. Two CTS-compliant
languages do not require type conversion when calling the code written in one language from within the
code written in another language. CTS provide a base set of data types for all the languages supported
by.NET Framework. This means that the size of integer and long variables is same across all .NET-
compliant programming languages. However, each language uses aliases for the base data types
provided by CTS. For example, CTS uses the data type system. int32 to represent a 4 byte integer value;
however, Visual Basic uses the alias integer for the same; whereas, C# uses the alias int. This is done for
the sake of clarity and simplicity.
What are tuples?

Tuple is a fixed-size collection that can have elements of either same or different data types. Similar to
arrays, a user must have to specify the size of a tuple at the time of declaration. Tuples are allowed to
hold up from 1 to 8 elements and if there are more than 8 elements, then the 8th element can be
defined as another tuple. Tuples can be specified as parameter or return type of a method.
State the differences between the Dispose() and Finalize().

CLR uses the Dispose and Finalize methods to perform garbage collection of run-time objects of .NET
applications.

The Finalize method is called automatically by the runtime. CLR has a garbage collector (GC), which
periodically checks for objects in heap that are no longer referenced by any object or program. It calls
the Finalize method to free the memory used by such objects. The Dispose method is called by the
programmer. Dispose is another method to release the memory used by an object. The Dispose method
needs to be explicitly called in code to dereference an object from the heap. The Dispose method can be
invoked only by the classes that implement the IDisposable interface.
Explain memory-mapped files.

Memory-mapped files (MMFs) allow you map the content of a file to the logical address of an application.
These files enable the multiple processes running on the same machine to share data with each Other.
The MemoryMappedFile.CreateFromFile() method is used to obtain a MemoryMappedFile object that
represents a persisted memory-mapped file from a file on disk.

These files are included in the System.IO.MemoryMappedFiles namespace. This namespace contains four
classes and three enumerations to help you access and secure your file mappings.

Name the classes that are introduced in the System.Numerics namespace.

The following two new classes are introduced in the System.Numerics namespace:

BigInteger - Refers to a non-primitive integral type, which is used to hold a value of any size. It has no
lower and upper limit, making it possible for you to perform arithmetic calculations with very large
numbers, even with the numbers which cannot hold by double or long.
Complex - Represents complex numbers and enables different arithmetic operations with complex
numbers. A number represented in the form a + bi, where a is the real part, and b is the imaginary part,
is a complex number.
What is Manifest?

Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following
things

Version of assembly.
Security identity.
Scope of the assembly.
Resolve references to resources and classes.
What is an IL?

Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common
Intermediate Language). All .NET source code is compiled to IL. IL is then converted to machine code at
the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

What is the difference between OLEDB Provider and SqlClient?

With respect to usage, there is no difference between OLEDB Provider and SqlClient. The difference lies
in their performance. SqlClient is explicitly used to connect your application to SQL server directly, OLEDB
Provider is generic for various databases, such as Oracle and Access including SQL Server.

Therefore, there will be an overhead which leads to performance degradation.


Explain the DataAdapter.Update() and DataSetAcceptChanges() methods.

The DataAdapter.Update() method calls any of the DML statements, such as the UPDATE, INSERT, or
DELETE statements, as the case may be to update, insert, or delete a row in a DataSet. The
DataSet.Acceptchanges() method reflects all the changes made to the row since the last time the
AcceptChanges() method was called.
What are the benefits of using of ADO.NET in .NET 4.0.

The following are the benefits of using ADO.NET in .NET 4.0 are as follows:

Language-Integrated Query (LINQ) - Adds native data-querying capabilities to .NET languages by using a
syntax similar to that of SQL. This means that LINQ simplifies querying by eliminating the need to use a
separate query language. LINQ is an innovative technology that was introduced in .NET Framework 3.5.
LINQ to DataSet - Allows you to implement LINQ queries for disconnected data stored in a dataset. LINQ
to DataSet enables you to query data that is cached in a DataSet object. DataSet objects allow you to use
a copy of the data stored in the tables of a database, without actually getting connected to the database.
LINQ to SQL - Allows you to create queries for data stored in SQL server database in your .NET
application. You can use the LINQ to SQL technology to translate a query into a SQL query and then use
it to retrieve or manipulate data contained in tables of an SQL Server database. LINQ to SQL supports all
the key functions that you like to perform while working with SQL, that is, you can insert, update, and
delete information from a table.
SqlClient Support for SQL Server 2008 - Specifies that with the starting of .NET Framework version 3.5
Service Pack (SP) 1, .NET Framework Data Provider for SQL Server (System.Data.SqlClient namespace)
includes all the new features that make it fully compatible with SQL Server 2008 Database Engine.
ADO.NET Data Platform - Specifies that with the release of .NET Framework 3.5 Service Pack (SP) 1, an
Entity Framework 3.5 was introduced that provides a set of Entity Data Model (EDM) functions. These
functions are supported by all the data providers; thereby, reducing the amount of coding and
maintenance in your application. In .NET Framework 4.0, many new functions, such as string, aggregate,
mathematical, and date/time functions have been added.
What are major difference between classic ADO and ADO.NET?

Following are some major differences between both

In ADO we have recordset and in ADO.NET we have dataset.


In recordset we can only have one table. If we want to accommodate more than one tables. We need to
do inner join and fill the recordset. Dataset can have multiple tables.
All data persist in XML as compared to classic ADO where data persisted in Binary format also.
Explain ADO.NET in brief.

ADO.NET is a very important feature of .NET Framework, which is used to work with data that is stored
in structured data sources, such as databases and XML files. The following are some of the important
features of ADO.NET:

Contains a number of classes that provide you with various methods and attributes to manage the
communication between your application and data source.
Enables you to access different data sources, such as Microsoft SQL Server, and XML, as per your
requirements.
Provides a rich set of features, such as connection and commands that can be used to develop robust
and highly efficient data services in .NET applications.
Provides various data providers that are specific to databases produced by various vendors. For example,
ADO.NET has a separate provider to access data from Oracle databases; whereas, another provider is
used to access data from SQL databases.
What is the full form of ADO?
The full form of ADO is ActiveX Data Object.
What is .NET Framework?

.NET Framework is a complete environment that allows developers to develop, run, and deploy the
following applications:

Console applications
Windows Forms applications
Windows Presentation Foundation (WPF) applications
Web applications (ASP.NET applications)
Web services
Windows services
Service-oriented applications using Windows Communication Foundation (WCF)
Workflow-enabled applications using Windows Workflow Foundation (WF)

What are the main components of .NET Framework?

.NET Framework provides enormous advantages to software developers in comparison to the advantages
provided by other platforms. Microsoft has united various modern as well as existing technologies of
software development in .NET Framework. These technologies are used by developers to develop highly
efficient applications for modern as well as future business needs. The following are the key components
of .NET Framework:

.NET Framework Class Library


Common Language Runtime
Dynamic Language Runtimes (DLR)
Application Domains
Runtime Host
Common Type System
Metadata and Self-Describing Components
Cross-Language Interoperability
.NET Framework Security
Profiling
Side-by-Side Execution
How are transactions used?

Transactions allow you to group SQL commands into a single unit. The transaction begins with a certain
task and ends when all tasks within it are complete. The transaction completes successfully only if all
commands within it complete successfully. The whole thing fails if one command fails. The BEGIN
TRANSACTION, ROLLBACK TRANSACTION, and COMMIT TRANSACTION statements are used to work
with transactions. A group of tasks starts with the begin statement. If any problems occur, the rollback
command is executed to abort. If everything goes well, all commands are permanently executed via the
commit statement.
What are temp tables? What is the difference between global and local temp tables?

Temporary tables are temporary storage structures. You may use temporary tables as buckets to store
data that you will manipulate before arriving at a final format. The hash (#) character is used to declare
a temporary table as it is prepended to the table name. A single hash (#) specifies a local temporary
table.

CREATE TABLE #tempLocal ( nameid int, fname varchar(50), lname varchar(50) )

Local temporary tables are available to the current connection for the user, so they disappear when the
user disconnects.

Global temporary tables may be created with double hashes (##). These are available to all users via all
connections, and they are deleted only when all connections are closed.

CREATE TABLE ##tempGlobal ( nameid int, fname varchar(50), lname varchar(50) )

Once created, these tables are used just like permanent tables; they should be deleted when you are
finished with them. Within SQL Server, temporary tables are stored in the Temporary Tables folder of the
tempdb database.
What are DMVs?

Dynamic management views (DMVs) and functions return server state information that can be used to
monitor the health of a server instance, diagnose problems, and tune performance; that is, they let you
see what is going on inside SQL Server. They were introduced in SQL Server 2005 as an alternative to
system tables. One example is viewing operating system wait statistics via this query:

SELECT * FROM sys.dm_os_wait_stats;

Another example is examining current sessions, much like the sp_who2 command:

SELECT * FROM sys.dm_exec_sessions;


What is the difference between ExecuteScalar and ExecuteNonQuery?
ExecuteScalar returns output value where as ExecuteNonQuery does not return any value but the number
of rows affected by the query. ExecuteScalar used for fetching a single value and ExecuteNonQuery used
to execute Insert and Update statements.
What are ASHX files?

ASP.NET Web handler files have an .ashx file extension. Web handlers work just like .aspx files except
you don't have to deal with the browser interface, thus no worrying about presentation. Web handlers
are generally used to generate content dynamically like returning XML or an image. Web handlers use the
IHttpHandler interface with the ProcessRequest() method invoked when the handler is requested. Web
handlers are simpler than pages (fewer events and wiring), so they are ideal for performance-critical
applications.
What are the components of ADO.NET?
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection
What is the difference between custom controls and user controls?
Custom controls are basically compiled code i.e. DLLs. These can be easily added to toolbox, so it can be
easily used across multiple projects using drag and drop approach. These controls are comparatively hard
to create.
But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly
couple with respect to User Interface and code. In order to use across multiple projects, we need to copy
and paste to the other project as well.
What is IIS? Why is it used?

Internet Information Services (IIS) is created by Microsoft to provide Internet-based services to ASP.NET
Web applications. It makes your computer to work as a Web server and provides the functionality to
develop and deploy Web applications on the server. IIS handles the request and response cycle on the
Web server. It also offers the services of SMTP and FrontPage server extensions. The SMTP is used to
send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form
handler.
What is the code behind feature of ASP.NET?

The code behind feature divides ASP.NET page files into two files where one defines the user interface
(.aspx), while the other contains all of the logic or code (.aspx.cs for C# and .aspx.vb for VB.NET). These
two files are glued together with page directives like the following line, which ties the page to the specific
code behind class.
The code behind feature divides ASP.NET page files into two files where one defines the user interface
(.aspx), while the other contains all of the logic or code (.aspx.cs for C# and .aspx.vb for VB.NET). These
two files are glued together with page directives like the following line, which ties the page to the specific
code behind class.
Define a multilingual Web site.

A multilingual Web site serves content in a number of languages. It contains multiple copies for its
content and other resources, such as date and time, in different languages
What is an ASP.NET Web Form?

ASP.NET Web forms are designed to use controls and features that are almost as powerful as the ones
used with Windows forms, and so they are called as Web forms. The Web form uses a server-side object
model that allows you to create functional controls, which are executed on the server and are rendered
as HTML on the client. The attribute, runat="server", associated with a server control indicates that the
Web form must be processed on the server.
Why do you use the App_Code folder in ASP.NET?

The App_Code folder is automatically present in the project. It stores the files, such as classes, typed
data set, text files, and reports. If this folder is not available in the application, you can add this folder.
One of the important features of the App_Code folder is that only one dll is created for the complete
folder, irrespective of how many files it contains.
What is the function of the ViewState property?

The ASP.NET 4.0 introduced a new property called ViewStateMode for the Control class. Now you can
enable the view state to an individual control even if the view state for an ASP.NET page is disabled.
What is AutoPostBack?

If you want a control to postback automatically when an event is raised, you need to set the
AutoPostBack property of the control to True.

You might also like