Programming Definitions

Posted by on Jun 12, 2019 in Tutorials | 2 comments

Describe the managed execution process in .NET.

Steps in managed execution process:

Compiler needs to be chosen
Convert the source code to MSIL now known as CIL
Convert MSIL to Native code using JIT. In this step, it is also verified if the code is type safe or not. This is done by examining the MSIL and metadata.
Executing code and various services.

What is OOP? Is a programming language model organized around objects rather than actions and data rather than logic.

What is Inheritance? Is the ability to define the classes that serve as the basis for derived classes; the user can reuse code from the base classes.

What is Polymorphism? Refers to the ability to define multiple classes with functionally different.

What is Classes? Can contain data and functions; introduce use-fine types into a program.

What is Structure? Is a value type that is typically used to encapsulate small groups of related variables.

What is an Interface? An interface contains only declarations of methods, properties, events, or indexers. An interface contains the definitions of a group of related functions that a class or struct can implement. An interface looks like a class, but has no implementation. The only thing it contains are declarations of events, indexers, methods and/or properties. The reason interfaces only provide declarations is because they are inherited by classes and structs, which must provide an implementation for each interface member declared.

What is an Assembly? An assembly is a collection of types and resources that forms a logical unit of functionality. All types in the .NET Framework must exist in assemblies; the common language runtime does not support types outside of assemblies. Each time you create a Microsoft Windows® Application, Windows Service, Class Library, or other application with Visual Basic .NET, you’re building a single assembly. Each assembly is stored as an .exe or .dll file.

Define .Net Assembly: It is a primary unit of deployment in a Microsoft .NET Framework application. It is called as building block of an application which provides all required execution information to common language runtime.

What is reference type and value type? A value type holds all of the data represented by the variable within the variable itself. A reference type contains a reference to a memory address that holds the data instead of the actual data itself.

Briefly describe how garbage collection works: The garbage collector is a thread that runs in the background of managed .NET applications. It constantly traces the reference tree and attempts to find objects that are no longer referenced. When a non-referenced object is found, its memory is reclaimed for later use.

Explain what constructors and destructors are and describe what they are used for: The constructor is the method that initializes a class or structure and is run when a type is first instantiated. It is used to set default values and perform other tasks required by the class. A destructor is the method that is run as the object is being reclaimed by garbage collection. It contains any code that is required for cleanup of the object.

What are application domains? Application domains are the boundaries within which applications run. A process can contain multiple application domains. Application domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use a proxy.

What is boxing? The act of wrapping a Value type, such as an Integer, inside an object so that it can be treated like a Reference type.

What is Cust? An explicit conversion from one type to another.

What is Common Language Runtime (CLR)? The environment in which managed code executes. The common language runtime provides just-in-time compilation, enforces type safety, and manages memory through garbage collection.

What is Common Type System (CTS)? A set of types that are used by all .NET languages, thus ensuring .NET language type compatibility.

What is Explicit and Implicit Conversion? Explicit conversion of one type to another that cannot be performed automatically. An explicit conversion usually presents some danger of a failed conversion or a loss of data.

What is Garbage Collector (GC)? Automatic memory management provided by the common language runtime. Unused memory is automatically reclaimed by garbage collection without interaction with the application.

Briefly contrast connected and disconnected data access in ADO.NET. In ADO.NET: connected data access is available through the DataReader, which is a lightweight class designed to provide very fast and efficient data access. It is severely limited, however, in that it can only provide forward-only data access, it does not allow editing, and it requires the exclusive use of a Connection object. In contrast, disconnected data access is facilitated by a DataAdapter, which manages the commands required for selecting and updating data. The DataAdapter executes a SELECT command against a database, opening a data connection just long enough to retrieve the data, and loads the data into a DataSet, which is an in-memory copy of the data. When the data is ready to be updated, the Data Provider manages the updates in the same way, generating the appropriate commands to update the database and keeping the connection open just long enough to execute those commands.

What is ADO.NET? ADO.NET The data access architecture for the Microsoft .NET Framework. ADO.NET is built around a disconnected data access model that uses a set of classes called a Data Provider to retrieve data from a data source.

What is Transaction? transaction A group of commands (treated as a single unit) that change the data stored in a database. The transaction ensures that the commands are handled in an all-or-nothing fashion—if one of the commands fails, all of the commands fail, and any data that was written to the database by the commands is backed out. In this way, transactions maintain the integrity of data in a database.

Difference between thread and process? Thread – is used to execute more than one program at a time. process – executes single program.

Explain Namespace: Namespaces are logical groupings of names used within a program. There may be multiple namespaces in a single application code, grouped based on the identifiers’ use. The name of any given identifier must appear only once in its namespace.

What is CLR? Common Language Runtime (CLR) is a run-time environment that manages the execution of .NET code and provides services like memory management, debugging, security, etc. The CLR is also known as Virtual Execution System (VES).

What is CLI? The CLI is a set of specifications for a runtime environment, including a common type system, base class library, and a machine-independent intermediate code known as the Common Intermediate Language (CIL).

What is the difference between data reader and data adapter?

DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it’s forward only type). Reader is best fit to show the Data (where no need to work on data).

DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data.

What is Partial class? A Partial class is a class that can be split into two or more classes. This means that a class can be physically separated into other parts of the class within the same namespace. All the parts must use the partial keyword. All the other classes should also have the same access modifier. At the compile time, all the partial classes will be treated as a single class. Let us list some advantages of having partial classes.

DataTable: is the container for rows and columns and could be considered the focal point of all disconnected data.

System.Environment Class: The System.Environment Class provides information about the current environment and platform. The System.Environment Class uses to retrieve Environment variable settings, Version of the common language runtime, contents of the call stack etc. This class cannot be inherited.

Event: is a message sent by an object to signal the occurrence of an action. The action could be caused by user interaction, such as a mouse click, or it could be triggered by some other program logic. The object that raises the event is called the event sender. The object that captures the event and responds to it is called the event receiver.

Delegate: is a class that can hold a reference to a method. Unlike other classes, a delegate class has a signature, and it can hold references only to methods that match its signature. A delegate is thus equivalent to a type-safe function pointer or a callback. While delegates have other uses, the discussion here focuses on the event handling functionality of delegates. A delegate declaration is sufficient to define a delegate class. The declaration supplies the signature of the delegate, and the common language runtime provides the implementation. The following example shows an event delegate declaration.

What is a Enum? An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword. C# enumerations are value data type. In other words, enumeration contains its own values and cannot inherit or cannot pass inheritance.

What is Cast? Casting is a way to convert values from one type to another. Mainly, two types of casting exist, Implicit casting and Explicit casting. Boxing occurs when a value type is cast to an object, or reference type.

What is the main difference between IEnumerable and IQueryable?
The main difference between “IEnumerable” and “IQueryable” is about where the filter logic is executed.
One executes on the client side (in memory) and the other executes on the database.

Differences between Heap and the Stack?
In C# there are two places where an object can be stored, the heap and the stack. Objects allocated on the stack are available only inside of a stack frame (execution of a method), while objects allocated on the heap can be accessed from anywhere.

Difference between Dispose and Finalize?
Method dispose( ) is used to free unman-aged resources whenever it is invoked. Method finalize( ) is used to free unman-aged resources before the object is destroyed. The method dispose( ) is to be implemented whenever there is a close( ) method. The method finalize( ) is to be implemented for unman-aged resources.

Difference between Class and Object?
An object is an instance of a class at any given time. The difference between a class and an object is that the object contains values for the properties.

2 Responses to “Programming Definitions”

  1. stays on topic and states valid points. Thank you.

Leave a Reply