History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
C# note
1. Define CLR and lists its component
The Common Language Runtime(CLR), the virtual machine component of Microsoft's .NET framework, manages theexecution of .NET programs.
A process known as just-in-timecompilation converts compiled code into machine instructions which the computer's CPU then executes. The CLR
prov ides additional services including memory management, type safety, exception handling, garbagecollection, security and thread management. All
programs written f or the .NET f ramework, regardless of programming language, are executed by the CLR.
There are 4 main components of .Net Framework.
CLR(Common Language Runtime)
CTS(Common type system)
BCL(Base Class Library)
CLS(Common Language Specification)
Is it possible to have two main methods in C#-justify
Yes - y ou can specif y custom entry point if you hav e multiple Main methods.This option specifies the class that contains the entry point to the program,
if more than one class contains a Main method.
using System;
using System.Collections.Generic;
using System.Text;
namespace Multiple_MainClasses
{
class A
{
static void Main(string[] args)
{
Console.WriteLine("I am from Class A");
Console.ReadLine();
}
}
class B
{
static void Main(string[] args)
{
Console.WriteLine("I am from Class B");
Console.ReadLine();
}
}
}
Name the compiler used for C# and lists its type.
Visual C#
Visual C#
Mono
Portable.NET
Sharp Develop
Roslyn
List out the application that is supported by .NET
•ASP.Net Web applications
•Web services
•Windows applications
•Windows services
•Console applications
2. •Mobile applications
•Class libraries
Depict the role of garbage collection in .NET
The Garbagecollection is very important techniqueinthe.Netframeworkto freetheunusedmanaged codeobjects in the memory
and free thespaceto theprocess. The garbagecollection (GC) is new featurein Microsoft .net framework. When we have a class
that represents an object in theruntimethatallocates a memory space in the heap memory, the behavior ofthat objects can be
done in the allotted memory in the form of heap. The heap memory is divided into number ofgenerations. Normally it is three
generations.The Generation0 is for shortlive objects, Generation 1is for medium liveobjects whicharemovedfrom Generation 0.
Generation 3 is mostly stableobjects. Thegarbagecollection uses an algorithm which checks the objects in the generation, the
objects life time get over then it will be removed from the memory.
Define boxing and Un boxing
In C#, all the value types are derived from the class object. So, a reference variable of type object can refer to any other value type. C# introduces two
methods to Boxing and Unboxing, which links value type to reference type. The basic difference between Boxing and Unboxing is that Boxing is the
conversion of the value type to an object type whereas, on other hands, the term Unboxing refers to the conversion of the object type to the value
type.
int i =24;
object ob =i; // Box the integer type n into object type ob.
int j =(int) ob; // Unbox the integer value stored in object type ob to integer
List out the Types of Data in C# with diagrammatic representation
List out the escape sequence in c# also list out there uses.
3. Name the predefined reference type.
Name some C# preprocess directive.
The preprocessor directives give instruction to the compiler to preprocess the information before actual compilation starts.All
preprocessor directives begin with #, and only white-space characters may appear beforea preprocessordirective ona line. Preprocessor
directives arenot statements, so they donot endwitha semicolon(;).C#compilerdoes not havea separatepreprocessor; however, the
directives are processed as ifthere was one. In C#the preprocessor directives are used to help in conditional compilation.
#define
It defines a sequence ofcharacters, called symbol.
#undef
It allows you to undefine a symbol.
#if
It allows testing a symbol or symbols to see ifthey evaluate to true.
#else
It allows to create a compound conditional directive, along with #if.
#elif
It allows creating a compound conditional directive.
#endif
Specifies the end ofa conditional directive.
#line
It lets you modify the compiler's line number and (optionally) the file name output for errors and warni ngs.
#error
It allows generating an error from a specific location in your code.
#warning
It allows generating a level one warning from a specific location in your code.
#region
It lets you specify a block ofcodethatyou canexpand orcollapsewhen using the outlining featureoftheVisualStudio Code Editor.
#endregion
It marks the end ofa #region block.
Describe in Detail the object oriented features of C#
Oops known as object-oriented programming languagesystem is themain featureofC#whichfurthersupports themajor features ofoops
including:
Abstraction.
Encapsulation.
Inheritanceand.
Polymorphism.
Illustrate the .NET architecture with a diagram and explain in detail components.
.NET is tiered, modular, and hierarchal. Each tier of the .NET Framework is a layer of abstraction. .NET languages are the top tier and the most
abstracted level. The common language runtime is the bottom tier, the least abstracted, and closest to the native environment. This is important
since the common language runtime works closely with the operating environment to manage .NET applications. The .NET Framework is partitioned
into modules, each with its own distinct responsibility. Finally, since higher tiers request services only from the lower tiers, .NET is hierarchal. The
architectural layout of the .NET Framework is illustrated in Figure
4. Define role of CTS and list various languages supported by C#
In Microsoft's.NET Framework, the Common Type System (CTS) is a standard that specifies how type definitions and specific
valuesof types are represented in computer memory. It isintendedto allow programswritten in different programming languag es
to easily share information.
Talking about the languages .NET framework support; infact there are many(some 22, 23 lang uages)Some of them are:Visual Basic, C#, C++, Python, COBOL,
Jscript, Eiffel, Java, Haskell, Pascal, ML, Ada, APL, C, C++, Perl, SmallTalk, Oberon, Scheme, Mercury, Oz, RPG, Objective Camlto name some of them
Factorial and square root of given number
Fibonacci number generation
Call By value and call by reference with example./ Demonstrate Ref and out parameters
Demonstrate method overloading with example.
Why xml comments are used in c#
explain the use of foreach loop in c#
5. Explain the use of Null coalescing operator?
What is namespace? What are the members of namespace?
What is the difference between Method overriding and method hiding ?
What is the difference between structure and class?
6. Compare between abstract class and interfaces
What is delegate?
Briefly explain exception handling in C# with example