Subject B!sics of ."#T Subject Co$e BSIT % &' Assignment TA (Compu(sory ) 1) What does .NET framework comprised off? Ans: .NET Framework comprises of programming methodologies (is!al "t!dio.NET and #i$ed lang!age programming)% &latform technologies (A'(.NET% Windows Form) and )ode E$ec!tion en*ironment. All these things are comprised together into a framework% to pro*ide o+,ect-oriented de*elopment platform. .) Which are the platform technologies s!pported +/ .NET framework? Ans: 'ifferent platform technologies s!pported +/ .NET framework: 0 AS) ."#T 1 2t is a set of we+ application de*elopment technologies that ena+les programmers to de*elop d/namic we+sites% we+ applications and $ml we+ ser*ices. 0 A*+ ."#T 1 This technolog/ is !sed for accessing the data+ases. 0 ,in$o-s .orms 1 2t is designed to +e !sed for 342 de*elopment. 2t helps in eas/ creation of command windows% +!ttons% men!s% tool+ars% and other screen elements. 0 *!t! Bin$ing 1 2t is the process that esta+lishes a connection a!tomaticall/ +etween the application 42 and the +!siness logic. 5) 6ow the windows programming is different from .NET programming? Ans: ,in$o-s )rogr!mming - 2n Windows &rogramming the application programs call windows A&2 f!nction directl/. The applications r!n in the windows en*ironment i.e. operating s/stem itself. These t/pes of applications are called !nmanaged or !nsafe applications. ."#T )rogr!mming - 2n .NET &rogramming the application programs call .Net 7ase )lass li+rar/ f!nctions which will comm!nicate with operating s/stem. The applications r!n in .Net 8!ntime en*ironment. These t/pes of applications are called as managed or safe applications. The .Net 8!ntime starts code e$ec!tion% manages threads% pro*ides ser*ices% manages memor/ etc. The .Net 7ase classes are f!ll/ o+,ect-oriented. 2t pro*ides all f!nctionalities of traditional windows A&2 along with f!nctionalities in new areas like accessing data+ase% internet connections and we+ ser*ices. 9) What is the f!nction of )T"? E$plain the classification of t/pes in )T" with a diagram. Ans: Common Type System (CTS) performs the following functions: Establishes a common framework that enables cross-language integration, type safety, and high performance code execution. Provides an object-oriented model. efines rules that languages must follow, so that different languages can interact with each other. !lassification of "ypes "he !"# supports two categories: * Value Types $ %t directly stores data in the variable. &alue types can be built-in type, user defined types or enumerations. * Reference Types $ %t store a reference to the data's memory address. (eference types can be self describing types, pointer types or interface types. #elf-describing types are further split into arrays and class types. "he class types are user defined classes, boxed value types and delegates. )ll types derive from the #ystem.*bject base type. :) What are assem+lies? What are static and d/namic assem+lies? Ans: Assem+lies are the +asic elements of packaging in .NET. An assem+l/ consists of 2; code% metadata that descri+es what is in the assem+l/% and an/ other files or information that the application needs to r!n% s!ch as graphics and so!nd files. St!tic Assemb(ies can incl!de .NET t/pes (interfaces and classes)% as well as re<!ired reso!rces for the assem+l/ (+itmaps% =&E3 files% reso!rce files% and so on). "tatic assem+lies are stored on disk in &E files. *yn!mic Assemb(ies are one which r!n directl/ from memor/ and are not sa*ed to disk +efore e$ec!tion. The/ can +e sa*ed to disk after the/ ha*e e$ec!ted. >) E$plain general str!ct!re of c?? Ans: )? program can consist of one or more files. Each file can contain one or more namespaces. A namespace contains gro!p of related t/pes s!ch as classes% str!cts% interfaces% en!merations% and delegates. Namespaces ma/ +e nested. The following is the skeleton of a )? program that contains all of these elements. @@ A skeleton of a )? program !sing "/stemA namespace Namespace1 B class )lass1 B C str!ct "tr!ct1 B C interface 2nterface1 B C delegate int 'elegate1()A en!m En!m1 B C namespace Namespace. B C class )lass. B p!+lic static *oid #ain(stringDE args) B C C C F)6ow do namespaces and t/pes in c? ha*e !ni<!e names? 3i*e e$amples. Ans: Fully Qualifed Names describe the logical hierarchy of the type or object. Namespaces and types always have unique names. For example, f there are ! class with same name but are present in di"erent namespaces then both the objects will have their unique fully qualifed names. namespace #$% && #$% ' class %lass( && #$%.%lass( ' ) ) namespace *+, && *+, ' class %lass( && *+,.%lass( ' ) ) -ere the #$%.%lass( and *+,.%lass( are two di"erent types, even if the class name is same. n the following code example shows the nested classes and namespaces. %arefully examine the fully qualifed names given as comments. namespace #$% && #$% ' class %lass( && #$%.%lass( ' class %lass! && #$%.%lass(.%lass! ' ) ) namespace *+, && #$%.*+, ' class %lass! && #$%.*+,.%lass! ' ) ) ) From the above code example. / 0he namespace #$% is a member of the global namespace. ts fully qualifed name is #$%. / 0he namespace *+, is a member of #$%. ts fully qualifed name is #$%.*+,. / 0he class %lass( is a member of the #$%. ts fully qualifed name is #$%.%lass(. / 0he class name %lass! is used twice in this code. -owever, the fully qualifed names are unique. 0he frst one is declared inside %lass(1 thus its fully qualifed name is. #$%.%lass(.%lass!. 0he second is declared inside a namespace *+,1 thus, its fully qualifed name is #$%.*+,.%lass!. 2sing the preceding code segment, you can add a new class member %lass3 to the namespace #$%.*+, as follows. namespace #$%.*+, ' class %lass3 && #$%.*+,.%lass3 ' ) G)What is delegate? What is the !se of it? 3i*e e$ample. Ans: # delegate is a type that safely encapsulates a method, similar to a function pointer in % and %44. 2nli5e % function pointers, delegates are object6oriented, type safe, and secure. 0he type of a delegate is defned by the name of the delegate. 0he use of delegates promotes good separation of functionality between the boo5store database and the client code. 7xample .6 %8 && %reate a method for a delegate. public static void 9elegate:ethod;string message< ' =ystem.%onsole.>rite?ine;message<1 ) !. %8 && nstantiate the delegate. 9el handler @ 9elegate:ethod1 && %all the delegate. handler;A-ello >orldB<1 H)Write a program to demonstrate !se of en!ms in )?? Ans: #n enum type declaration defnes a type name for a related group of symbolic constants. 7nums are used for Amultiple choiceB, in which a runtime decision is made from a fxed number of choices that are 5nown at compile6 time. 7xample. 7num %olor ' Ced, $lue, Dreen ) %lass =hape ' Eublic void Fill;%olor color< ' =witch;color< ' %ase.%olor.Ced. %onsole.>rite?ine;AC79B<1 brea51 %ase.%olor.$lue. %onsole.>rite?ine;A$?27B<1 brea51 %ase.%olor.Dreen. %onsole.>rite?ine;ADC77NB<1 brea51 default. brea51 ) ) ) 1I)What is the !se of attri+!tes in )? programs? Ans: #ttributes are special classes that can be applied to classes, properties, and methods at design time. #ttributes provide a way to describe certain aspects of an element or determine the behavior of other classes acting upon the element. 0hose descriptions and behaviors can then be accessed and examined at run time. +ou can thin5 of attributes as a way of adding special modifers to your class members. 7xample, if you have written >eb services, you are no doubt aware that the >eb :ethod attribute must be applied to methods for them to be exposed through the service. 0his is a perfect example to show the usage of attributes because the >eb :ethod attribute is used to extend the programming model. 0here is no built6in way in %8 of signifying that a method should be exposed through the >eb service ;as there is, for example, of signifying that a method should be private<, so the >eb :ethod attribute was written to satisfy this need. Assignment TB (Compu(sory) PART - A Answer all questions: +. ,hat are the advantages of using .-E" . )ns: Adanta!es +. "ess time to produce product /. "ess Comple#ity$ 0. %asily to access comple# &$S functions 1. %asily to 'uild (ata &riented Pro)ect * Support +u!e (, functions$ 2. -ana!ed 3. Support ,ot+ .indows and .e' Application$ 4. %asy to create (ynamic sites$ /. Explain .-E" framework. )ns : "he .-E" framework is a software development framework from 5icrosoft. %t provides a controlled programming environment where software can be developed, installed and executed on ,indows-based operating systems. "he principal design features are: %nteroperability: "his allows for .-E"-developed programs to access functionalities in programs developed outside .-E". !ommon (untime Engine: )lso known as the common language runtime, this allows programs developed in .-E" to exhibit common behaviors in memory usage, exception handling and security. 6anguage %ndependence: !ommon language infrastructure specifications 7!6%8 allow for the exchange of data types between two programs developed in different languages. 9ase !lass 6ibrary: ) library of code for most common functions--used by programmers to avoid repetitive rewriting of code. Ease of eployment: "here are tools to ensure the ease of installing programs without interfering with previously installed applications. #ecurity: Programs developed in .-E" are based on a common security model. 0. ,hat is unsafe code. Explain. 1. ,hat are the different types of arrays supported by !: programming. 2. ;ow .-E" remoting different from web services and !*5 . PART - , Answer any /0V% full questions: +. a8 ,rite a program in !: to display <,elcome to ! #harp=. Explain the program. b8 ,hat is the function of !"# . Explain the classification of types in !"# with a diagram. /. a8 ,hat is operator overloading. Explain with an example. b8 ;ow does !: supports multiple inheritance. 0. a8 ,rite a program to !: to add two matrics. b8 ,hat is data provider. Explain. 1. a8 ,rite a program to show the demonstration of )*.-E" architecture. b8 Explain )*.-E" architecture. 2. a8 ,rite a program in !: to check a given string is palindrome or not. b8 Explain different string functions supported by !: . 3. a8 ,rite a program to display <,elcome to )#P.-E"= > times in increasing font si?e using )#P.-E". b8 ,hat is the role of system web. 4. a8 Explain the steps involved in implementing .-E" remoting applications. b8 Explain remoting architecture. >. Explain the following: a8 )bstract class b8 #tatic constructors c8 @%" compiler.