Beruflich Dokumente
Kultur Dokumente
Sl. No.
1 2 3 # & ( ) + * 1, 11 12 13 1# 1& 1( 1) 1+ 1* 2, 21 22 23
Particulars
Lab Instructions Hardware and Software e!uire"ents Introduction to .Net $ra"ewor% P' T ' Progra" 1 Progra" 2 Progra" 3 Progra" # Progra" & Progra" ( Progra" ) Progra" + Progra" * Progra" 1, Progra" 11 Progra" 12 Progra" 13 Progra" 1# Progra" 1& Progra" 1( Progra" 1) Progra" 1+ P' T - . Sa"/le for" Pro/osed 0I0' 1uestions
Page No.
3 # & 1& 1( 1) 1* 2, 2& 2+ 3, 33 3& 3( 3+ #, ## #* &, &3 &( &) &+
Enter value )or c > %oots are imaginary %un 2 ;uadratic E:uation Solution (a51/$5/c=.) Enter value )or a , Enter value )or $ @ Enter value )or c > ?ot& root &ave di))erent value %oot,8 +..>ABBC,,1DBD.C1D %oot18 +B.D2,,1BBC>,>@1C
int counter=.; int temp=top; (&ile(tempH=+,) { counter//; temp++; 0 Console. rite!ine("EnEtEtEt<otal no. o) items is stacF is8 "/counter); 0 0 class test { pu$lic static void Main() { stacF o$,=ne( stacF(); Console. rite!ine("EnEnter siGe o) t&e stacFEt"); int len=int.Parse(Console.%ead!ine()); o$,.siGe(len); int c&; do { Console. rite!ine("EnEn44444444444444444444444444"); Console. rite!ine("En,.Pus&"); Console. rite!ine("En1.Pop"); Console. rite!ine("En2.Iisplay"); Console. rite!ine("En>.Count"); Console. rite!ine("EnD.E5it"); Console. rite!ine("EnEn44444444444444444444444444"); Console. rite!ine("EnEnter your c&oiceEt"); c&=int.Parse(Console.%ead!ine()); s(itc&(c&) { case ,8 Console. rite!ine("EnEnter itemEt"); int item=int.Parse(Console.%ead!ine()); o$,.pus&(item); $reaF; case 18 o$,.pop(); $reaF; case 28 o$,.display(); $reaF; case >8 o$,.count(); $reaF; case D8 $reaF; de)ault8 Console. rite!ine("EnEtEtEt=nvalid c&oiceHHH"); $reaF; 0 0(&ile(c&H=D);
0 0
%un , Enter siGe o) t&e stacF > 44444444444444444444444444 ,.Pus& 1.Pop 2.Iisplay >.Count D.E5it 44444444444444444444444444 Enter your c&oice , Enter item ,1 44444444444444444444444444 ,.Pus& 1.Pop 2.Iisplay >.Count D.E5it 44444444444444444444444444 Enter your c&oice , Enter item ,2 44444444444444444444444444 ,.Pus& 1.Pop 2.Iisplay
>.Count D.E5it 44444444444444444444444444 Enter your c&oice 2 ,2 ,1 44444444444444444444444444 ,.Pus& 1.Pop 2.Iisplay >.Count D.E5it 44444444444444444444444444 Enter your c&oice > <otal no. o) items is stacF is8 1 44444444444444444444444444 ,.Pus& 1.Pop 2.Iisplay >.Count D.E5it 44444444444444444444444444 Enter your c&oice 1 Popped item is 8,2 44444444444444444444444444 ,.Pus&
1.Pop 2.Iisplay >.Count D.E5it 44444444444444444444444444 Enter your c&oice 2 ,1 44444444444444444444444444 ,.Pus& 1.Pop 2.Iisplay >.Count D.E5it 44444444444444444444444444 Enter your c&oice D
0 class test { pu$lic static void Main() { over o$, = ne( over(); over o$1 = ne( over(); over o$2 = ne( over(); Console. rite!ine("Enter )or o$,++++++++++++"); o$,.value(); Console. rite!ine("Enter )or o$1++++++++++++"); o$1.value(); Console. rite!ine("Eno$,8++++++++-"); o$,.display(); Console. rite!ine("Eno$18++++++++-"); o$1.display(); i) (o$, == o$1) Console. rite!ine("o$, J o$1 are e:ual"); else i) (o$, - o$1) Console. rite!ine("o$, is greater t&an o$1"); else i) (o$, 6 o$1) Console. rite!ine("o$1 is greater t&an o$,"); else Console. rite!ine("o$, J o$1 are not e:ual"); o$, = +o$,; Console. rite!ine("Ena)ter negating o$,8++++++++-"); o$,.display(); o$1.display(); o$2 = o$, / o$1; Console. rite!ine("Eno$2=o$,/o$18++++++++-");
0 pu$lic static $ool operator 6=(over o$,9 over o$1) { i) (H(o$,.a - o$1.a)) return (true); else return ()alse); 0 pu$lic static $ool operator 6(over o$,9 over o$1) { i) (o$,.a 6 o$1.a) return (true); else return ()alse); 0 pu$lic static $ool operator -=(over o$,9 over o$1) { i) (H(o$,.a 6 o$1.a)) return (true); else return ()alse); 0
o$2.display(); Console.%ead!ine(); 0 0
Run 1 Enter )or o$,++++++++++++ Enter a8 1 Enter $8 > Enter )or o$1++++++++++++ Enter a8 D Enter $8 2 o$,8++++++++a= 1 $= > o$18++++++++a= D $= 2 o$1 is greater t&an o$, a)ter negating o$,8++++++++a= +1 $= +> a= D $= 2 o$2=o$,/o$18++++++++a= 2 $= +,
Alternate program
using System; class seclargest { pu$lic static void Main() { int[] arr = ne( int[1.]; int temp9 i9 p9 s; p = .; s = .; Console. rite!ine("Second largest num$er"); Console. rite!ine("Enter t&e array siGe8 "); int n = int.Parse(Console.%ead!ine()); Console. rite!ine("Enter " / n / " num$ers"); )or (i = .; i 6 n; i//) { arr[i] = int.Parse(Console.%ead!ine()); 0 )or (i = .; i 6 n; i//) { temp = arr[i]; i) (temp - p) { s = p; p = temp; 0 i) (temp - s JJ temp 6 p) { s = temp; 0 0 Console. rite!ine("!argest num$er 8 " / p); Console. rite!ine("1nd largest num$er 8 " / s); Console.%ead!ine(); 0 0
%un , Second largest num$er Enter t&e array siGe8 D Enter D num$ers 1 12 , DA CB !argest num$er 8 CB 1nd largest num$er 8 DA
0 0 %un ,
0 i) (col, H= ro(1) { Console. rite!ine("Matri5 multiplication is not possi$le"); temp = ,; 0 else { )or (i = .; i 6 ro(,; i//) { )or (* = .; * 6 col1; *//) { c[i9 *] = .; )or (F = .; F 6 col,; F//) { c[i9 *] = c[i9 *] / a[i9 F] 4 $[F9 *]; 0 0 0 0 i) (temp == .) { Console. rite!ine(); Console. rite!ine("Multiplication o) Matri, and Matri51++++++-"); )or (i = .; i 6 ro(,; i//) { )or (* = .; * 6 col1; *//) { Console. rite(" " / c[i9 *]); 0 Console. rite!ine(); 0 0 Console.%ead!ine();
)or (* = .; * 6 col1; *//) { Console. rite(" " / $[i9 *]); 0 Console. rite!ine();
Matri5 Multiplication (Matri5,4Matri51) Enter no. o) ro(s )or matri5, 1 Enter no. o) columns )or matri5, 2 Enter A elements )or Matri5, , 1 2 > D A
Enter no. o) ro( )or matri51 2 Enter no. o) columns )or matri51 1 Enter A elements )or Matri51 A D > 2 1 , Elements o) Matri5,++++++, 1 2 > D A Elements o) Matri51++++++A D > 2 1 , Multiplication o) Matri, and Matri51++++++1. ,> DA >, %un 1 Matri5 Multiplication (Matri5,4Matri51) Enter no. o) ro(s )or matri5, 1 Enter no. o) columns )or matri5, 2 Enter A elements )or Matri5, , 1 2 > D A Enter no. o) ro( )or matri51 1 Enter no. o) columns )or matri51 2 Enter A elements )or Matri51 ,1 1 2 > D A Elements o) Matri5,++++++, 1 2 > D A Elements o) Matri51++++++,1 1 2 > D A
/. Program to ind the sum o all the elements present in a 0agged arra- o 3 inner arra-s.
using System; class *agKarray { pu$lic static void Main() { int[][] *ag; int i9 *; int var; int sum = .; Console. rite!ine("Lagged 7rray"); Console. rite!ine("Enter no. o) ro(s "); int ro( = int.Parse(Console.%ead!ine()); *ag = ne( int[ro(][]; )or (i = .; i 6 ro(; i//) { Console. rite!ine("Enter total no. o) elements )or ro( " / (i / ,)); var = int.Parse(Console.%ead!ine()); *ag[i] = ne( int[var]; Console. rite!ine("Enter " / var / " elements"); )or (* = .; * 6 var; *//) { *ag[i][*] = int.Parse(Console.%ead!ine()); 0 Console. rite!ine(); 0 Console. rite!ine("<&e Lagged array is++++++-"); Console. rite!ine(); Console. rite!ine("*ag[" / ro( / "][]8 "); )or (i = .; i 6 ro(; i//) { )or (* = .; * 6 *ag[i].!engt&; *//) { Console. rite(" " / *ag[i][*]); sum = sum / *ag[i][*]; 0 Console. rite!ine(); 0 Console. rite!ine(); Console. rite!ine("7ddition o) all elements o) *agged array is 8" / sum); Console.%ead!ine(); 0 0 %un , Lagged 7rray Enter no. o) ro(s 2 Enter total no. o) elements )or ro( ,
2 Enter 2 elements , 1 2 Enter total no. o) elements )or ro( 1 > Enter > elements , 1 2 > Enter total no. o) elements )or ro( 2 D Enter D elements , 1 2 > D <&e Lagged array is++++++*ag[2][]8 , 1 2 , 1 2 > , 1 2 > D 7ddition o) all elements o) *agged array is 82,
11. Program usingTr-2 Catch and 3inall- blocks in C# to demonstrate error handling.
using System; class test { pu$lic static void Main() { int a = ,.9 $ = .9 c9 i; int[] arr = ne( int[2] { ,9 19 2 0; try { try { int d = arr[B]; 0 catc& (=nde5MutM)%angeE5ception e) { Console. rite!ine("EnEn" / e); Console. rite("EnEn7rray elements are++++-"); )or (i = .; i 6 arr.!engt&; i//) { Console. rite("En7rr [" / i / "]=" / arr[i]); 0 0 )inally { int d = arr[1]; Console. rite("EnEn<&e last element o) array = " / d); 0 c = a ' $; 0 catc& (Iivide?yNeroE5ception e) { Console. rite("EnEn" / e); 0 )inally { c = a ' ($ / 1); Console. rite("EnEnc = " / c); 0 Console.%ead!ine(); 0 0 %un , System.=nde5MutM)%angeE5ception8 =nde5 (as outside t&e $ounds o) t&e array. at test.Main() in C8EIocuments and SettingsE7dministratorE!ocal SettingsE7ppl ication IataE<emporary Pro*ectsEConsole7pplication,EProgram.cs8line ,1 7rray elements are++++-
7rr [.]=, 7rr [,]=1 7rr [1]=2 <&e last element o) array = 2 System.Iivide?yNeroE5ception8 7ttempted to divide $y Gero. at test.Main() in C8EIocuments and SettingsE7dministratorE!ocal SettingsE7ppl ication IataE<emporary Pro*ectsEConsole7pplication,EProgram.cs8line 1B c = D
%un , Simple Calculator Enter value )or a Enter value )or $ , 7ddition 1 Su$traction 2 Iivision > Oraction D Multiplication A.E5it Enter your c&oice , %esult 8 D , 7ddition 1 Su$traction 2 Iivision > Oraction D Multiplication A.E5it Enter your c&oice 1 %esult 8 +, , 7ddition 1 Su$traction 2 Iivision > Oraction D Multiplication A.E5it Enter your c&oice 2 %esult 8 . , 7ddition 1 Su$traction 2 Iivision > Oraction D Multiplication A.E5it Enter your c&oice > %esult 8 1 , 7ddition 1 Su$traction 2 Iivision > Oraction D Multiplication A.E5it Enter your c&oice D %esult 8 A , 7ddition 1 Su$traction 2 Iivision > Oraction D Multiplication A.E5it Enter your c&oice A
1 2
13. 4emonstrate 5se o 6irtual and o+erride ke- words in C# with a simple program
using System; class student { pu$lic string name; pu$lic string college; pu$lic void getdata,() { Console. rite("Enter name8Et"); name = Console.%ead!ine(); Console. rite("Enter college8Et"); college = Console.%ead!ine(); 0 pu$lic virtual void display() { Console. rite!ine("#ame8 " / name); Console. rite!ine("College8 " / college); 0 0 class ugstudent 8 student { pu$lic int p&y; pu$lic int c&em; pu$lic int mat&; pu$lic void getdata1() { getdata,(); Console. rite("Enter p&y8Et"); p&y = int.Parse(Console.%ead!ine()); Console. rite("Enter c&em8Et"); c&em = int.Parse(Console.%ead!ine()); Console. rite("Enter mat&8Et"); mat& = int.Parse(Console.%ead!ine()); 0 pu$lic override void display() { Console. rite!ine("EnEn4444444QRS<QIE#<4444444EnEn"); Console. rite!ine("#ame8 " / name); Console. rite!ine("P&ysics8 " / p&y); Console. rite!ine("C&emistery8 " / c&em); Console. rite!ine("Mat&8 " / mat&); Console. rite!ine("College8 " / college); Console. rite!ine("EnEn4444444444444444444444444EnEn"); Console.%ead!ine(); 0 0 class pgstudent 8 student { pu$lic int im,; pu$lic int im1; pu$lic int im2; pu$lic int sem; pu$lic int t; pu$lic int )inal;
0 class researc&stud 8 student { pu$lic string researc&Ksu$; pu$lic void getdata>() { getdata,(); Console. rite("Enter researc& paper8Et"); researc&Ksu$ = Console.%ead!ine(); 0
pu$lic void getdata2() { getdata,(); Console. rite("Enter internal marFs,8Et"); im, = int.Parse(Console.%ead!ine()); Console. rite("Enter internal marFs18Et"); im1 = int.Parse(Console.%ead!ine()); Console. rite("Enter internal marFs28Et"); im2 = int.Parse(Console.%ead!ine()); Console. rite("Enter semester8Et"); sem = int.Parse(Console.%ead!ine()); 0 pu$lic void calculate() { int p = .; int s = .; int temp; int[] arr = ne( int[2] { im,9 im19 im2 0; )or (int i = .; i 6 2; i//) { temp = arr[i]; i) (temp - p) { s = p; p = temp; 0 i) (temp - s JJ temp 6 p) { s = temp; 0 0 t = p / s; )inal = t ' 1; 0 pu$lic override void display() { Console. rite!ine("EnEn4444444PRS<QIE#<4444444EnEn"); Console. rite!ine("#ame8 " / name); Console. rite!ine("=nternal ,8 " / im,); Console. rite!ine("=nternal 18 " / im1); Console. rite!ine("=nternal 28 " / im2); Console. rite!ine("O=nal =nternal MarFs8 " / )inal); Console. rite!ine("Semester8 " / sem); Console. rite!ine("College8 " / college); Console. rite!ine("EnEn4444444444444444444444444EnEn"); Console.%ead!ine(); 0
0 class test { pu$lic static void Main() { Console. rite!ine("EnEn++++++++++++++QR student+++++++++++++++"); ugstudent ug, = ne( ugstudent(); ug,.getdata1(); ug,.display(); pgstudent pg, = ne( pgstudent(); Console. rite!ine("EnEn++++++++++++++PR student+++++++++++++++"); pg,.getdata2(); pg,.calculate(); pg,.display(); Console. rite!ine("EnEn++++++++++++++%esearc& student+++++++++++++++"); researc&stud rs = ne( researc&stud(); rs.getdata>(); rs.display(); 0 0 %un , ++++++++++++++QR student+++++++++++++++ Enter name8 us&a Enter college8 $msce Enter p&y8 AC Enter c&em8 B@ Enter mat&8 CC 4444444QRS<QIE#<4444444 #ame8 us&a P&ysics8 AC C&emistery8 B@ Mat&8 CC College8 $msce 4444444444444444444444444 ++++++++++++++PR student+++++++++++++++ Enter name8 anand Enter college8 amc Enter internal marFs,8 BB Enter internal marFs18 DD Enter internal marFs28 AA
pu$lic override void display() { Console. rite!ine("EnEn4444444%ESE7%C3 S<QIE#<4444444EnEn"); Console. rite!ine("#ame8 " / name); Console. rite!ine("%esearc& paper8 " / researc&Ksu$); Console. rite!ine("College8 " / college); Console. rite!ine("EnEn4444444444444444444444444EnEn"); Console.%ead!ine(); 0
Enter semester8 > 4444444PRS<QIE#<4444444 #ame8 anand =nternal ,8 BB =nternal 18 DD =nternal 28 AA O=nal =nternal MarFs8 CC Semester8 > College8 amc 4444444444444444444444444 ++++++++++++++%esearc& student+++++++++++ Enter name8 Fumar Enter college8 c$pit Enter researc& paper8 net(orF 444444%ESE7%C3 S<QIE#<4444444 #ame8 Fumar %esearc& paper8 net(orF College8 c$pit 4444444444444444444444444
1$. 7mplement linked lists in C# using the e%isting collections name space.
using System; using System.Collections.Reneric; using System.<e5t; class !inFed!istIemo { pu$lic static void Main() { !inFed!ist6string- o$ = ne( !inFed!ist6string-(); int c&; do { Console. rite!ine("EnEnEt!inFed !ist =mplementationEnEn"); Console. rite!ine(",. 7dd at $eginnning"); Console. rite!ine("1. 7dd at end"); Console. rite!ine("2. %emove at $eginnning"); Console. rite!ine(">. %emove at end"); Console. rite!ine("D. 7dd at a speci)ied position"); Console. rite!ine("A. Iisplay t&e !=nFed !ist"); Console. rite!ine("C. Oind item"); Console. rite!ine("B. E5it"); Console. rite("Enter your c&oiceEt"); c& = int.Parse(Console.%ead!ine()); s(itc& (c&) { case ,8 Console. rite!ine("Enter t&e item to $e inserted at $eginning"); String item = Console.%ead!ine(); o$.7ddOirst(item); $reaF; case 18 Console. rite!ine("Enter t&e item to $e inserted at end"); String item, = Console.%ead!ine(); o$.7dd!ast(item,); $reaF; case 28 i) (o$.Count - .) { o$.%emoveOirst(); Iisplay(o$); 0 else Console. rite!ine("EnEt!inFed !ist is empty"); $reaF; case >8 i) (o$.Count - .) { o$.%emove!ast(); Iisplay(o$); 0 else Console. rite!ine("EnEt!inFed !ist is empty"); $reaF; case D8 Console. rite("Enter t&e positionEt"); int n = int.Parse(Console.%ead!ine()); i) (n - o$.Count SS n 6 ,)
else {
0 private static void Iisplay(!inFed!ist6string- o$) { i) (o$.Count - .) { Console. rite!ine("EnEtContents o) t&e !inFed list"); )oreac& (o$*ect o$* in o$) { Console. rite(o$* / "Et"); 0 0 else Console. rite!ine("EnEt!inFed !ist is empty"); Console. rite!ine(); 0 private static void insert(!inFed!ist6string- o$9 int n) { !inFed!ist#ode6string- lin = o$.Oirst; )or (int i = .; i 6 n + ,; i//) lin = lin.#e5t; Console. rite!ine("Enter t&e item to $e inserted"); string item1 = Console.%ead!ine(); o$.7dd?e)ore(lin9 item1); 0 0
0 $reaF; case A8 Iisplay(o$); $reaF; case C8 Console. rite!ine("Enter item to $e searc&ed"); item = Console.%ead!ine(); !inFed!ist#ode6string- node, = o$.Oind(item); i) (node, == null) Console. rite!ine("Searc& is unsuccess)ull"); else Console. rite!ine("Searc& is success)ull"); Console.%ead!ine(); $reaF; case B8 $reaF; de)ault8 Console. rite!ine("EnEt=nvalid C&oice"); $reaF;
%un ,
!inFed !ist =mplementation ,. 7dd at $eginnning 1. 7dd at end 2. %emove at $eginnning >. %emove at end D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice , Enter t&e item to $e inserted at $eginning ,1 !inFed !ist =mplementation ,. 7dd at $eginnning 1. 7dd at end 2. %emove at $eginnning >. %emove at end D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice 1 Enter t&e item to $e inserted at end ,> !inFed !ist =mplementation ,. 7dd at $eginnning 1. 7dd at end 2. %emove at $eginnning >. %emove at end D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice , Enter t&e item to $e inserted at $eginning ,D !inFed !ist =mplementation ,. 1. 2. >. 7dd at 7dd at %emove %emove $eginnning end at $eginnning at end
D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice 1 Enter t&e item to $e inserted at end ,B !inFed !ist =mplementation ,. 7dd at $eginnning 1. 7dd at end 2. %emove at $eginnning >. %emove at end D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice A ,D Contents o) t&e !inFed list ,1 ,> ,B !inFed !ist =mplementation ,. 7dd at $eginnning 1. 7dd at end 2. %emove at $eginnning >. %emove at end D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice D Enter t&e position 2 Enter t&e item to $e inserted >D ,D Contents o) t&e !inFed list ,1 >D ,> ,B !inFed !ist =mplementation ,. 1. 2. >. D. A. C. B. 7dd at $eginnning 7dd at end %emove at $eginnning %emove at end 7dd at a speci)ied position Iisplay t&e !=nFed !ist Oind item E5it
,. 7dd at $eginnning 1. 7dd at end 2. %emove at $eginnning >. %emove at end D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice > ,1 Contents o) t&e !inFed list >D ,> !inFed !ist =mplementation ,. 7dd at $eginnning 1. 7dd at end 2. %emove at $eginnning >. %emove at end D. 7dd at a speci)ied position A. Iisplay t&e !=nFed !ist C. Oind item B. E5it Enter your c&oice C Enter item to $e searc&ed >D Searc& is success)ull
1). Program in C# to build a class which implements an inter ace which alread- e%ists.
using System; using System.Collections; pu$lic class Employee 8 =Compara$le { string name; int id; pu$lic Employee() { 0 pu$lic void getTalue() { Console. rite("EnEnter id8Et"); id = int.Parse(Console.%ead!ine()); 0 pu$lic Employee(string name9 int id) { t&is.name = name; t&is.id = id; 0 pu$lic int Compare<o(o$*ect o$*) ''int =Compara$le.Compare<o(o$*ect o$*) { Employee emp1 = (Employee)o$*; i) (t&is.id - emp1.id) return (,); i) (t&is.id 6 emp1.id) return (+,); else return (.); 0 pu$lic static =Comparer Sort?y#ame { get { return ((=Comparer)ne( Sort?y#ameClass()); 0 0 pu$lic static =Comparer Sort?y=d { get { return ((=Comparer)ne( Sort?y=dClass()); 0 0 pu$lic string display() ''pu$lic override string <oString() { return (name / "8" / id); 0
class Sort?y#ameClass 8 =Comparer { pu$lic int Compare(o$*ect o$*,9 o$*ect o$*1) { Employee emp, = (Employee)o$*,; Employee emp1 = (Employee)o$*1;
0 0
class Sort?y=dClass 8 =Comparer { pu$lic int Compare(o$*ect o$*,9 o$*ect o$*1) { Employee emp, = (Employee)o$*,; Employee emp1 = (Employee)o$*1; return (((=Compara$le)emp,).Compare<o(o$*1)); 0 0 class MainClass { pu$lic static void Main() { Employee[] arr = ne( Employee[>]; arr[.] = ne( Employee("I"9 ,,,); arr[,] = ne( Employee("P"9 1.); arr[1] = ne( Employee("N"9 >>); arr[2] = ne( Employee("7"9 ,1); 7rray.Sort(arr9 Employee.Sort?y#ame); -En"); Console. rite!ine("EnEnemployees is no( sorted $y name+++++++ )oreac& (Employee emp in arr) '' emp is an o$*ect Console. rite!ine("Employee8 {.0"9 emp.display()); 7rray.Sort(arr9 Employee.Sort?y=d); -En"); Console. rite!ine("EnEnemployees is no( sorted $y id+++++++++ )oreac& (Employee emp in arr) Console. rite!ine("Employee8 {.0"9 emp.display()); Employee myo$*ect = ne( Employee(); myo$*ect.getTalue(); int temp = 7rray.?inarySearc&(arr9 myo$*ect); i) (temp -= .) { Console. rite("EnSearc& is success)ul..."); Console. rite("EnPosition " / (temp / ,)); 0
0 else {
%un , employees is no( sorted $y name+++++++Employee8 Employee8 Employee8 Employee8 78,1 I8,,, P81. N8>>
employees is no( sorted $y id+++++++++Employee8 Employee8 Employee8 Employee8 Enter id8 78,1 P81. N8>> I8,,, ,1
{ 0 0
get; set;
class concrete 8 Myclass, { pu$lic override int ; { get { return 5; 0 set { 5 = value; 0 0 0 class test { pu$lic static void Main() { Console. rite("EnEnReneral Property++++++++++-"); Myclass mc, = ne( Myclass(); mc,.U = ,.; ''set is invoFed; int val = mc,.U; ''get is invoFed Console. rite("EnEnPrivate mem$er 5 8 " / val); Console. rite("EnEnEn%ead+Mnly Property++++++++++-"); Myclass mc1 = ne( Myclass(); Console. rite!ine("EnEnPrivate mem$er 5 8 " / mc1.V); Console. rite("EnEnEn rite+Mnly Property++++++++++-"); Myclass mc2 = ne( Myclass(); mc2.N = 1.; Console. rite!ine("EnEnPrivate mem$er 5 8 " / mc2.display()); Console. rite("EnEnEnStatic Property++++++++++-"); Myclass.P = 1..; ''identi)ied $y type class val = Myclass.P; Console. rite!ine("EnEnPrivate sattic mem$er y 8 " / val); Console. rite("EnEnEn7$stract Property++++++++++-"); concrete mc> = ne( concrete(); mc>.; = ,...; ''set is invoFed; val = mc>.;; ''get is invoFed Console. rite("EnEnPrivate mem$er 5 8 " / val); Console.%ead!ine();
0 0
Pro/osed 0i2a 1uestions 1. Name the building blocks of .NET rame!ork ". #hat is .NET frame!ork$ %. State at least fi&e most important highlights of '( language. ). State significant differences bet!een '** and '( +. ,o! is '( better than -a&a$ .. State some features of '** that ha&e not been incorporated into '(. /. State some features that are uni0ue to '( language. 1. #hat is '2R$ 3. #hat is 'TS$ 14. #hat is '2S$ 11. #hat is managed code$ 1". 2ist some of the important ser&ices the rame!ork Base 'lasses can offer to the users. 1%. 2ist the languages supported b5 the .NET rame!ork. 1). #h5 do !e use the using directi&e in a '( program$ 1+. #hat are the steps in&ol&ed in implementing an application program in '($ 1.. #hat is bo6ing and unbo6ing$ 1/. #hat do 5ou mean b5 implicit con&ersion$ 11. #hat do 5ou mean b5 e6plicit con&ersion$ 13. 7ention the different t5pes of operators a&ailable in '(. "4. E6plain the usage of foreach statement in '(. "1. E6plain the difference bet!een break and continue statement. "". #hat is a label$ ,o! and !hen a label is used in a program$ "%. 2ist the different access modifiers a&ailable. "). #hat are the different t5pes of parameters a&ailable$ "+. State the difference bet!een ref and out parameters. ".. #hat are parameter arra5s$ #hat are the restrictions in declaring parameter arra5s$ "/. State the differences bet!een rectangular arra5 and 8agged arra5. "1. ,o! does an arra5 of Arra52ist class differ from an arra5 of Arra5 class$ "3. State some of the methods a&ailable in Arra52ist class. %4. #hat is the difference bet!een 7utable and 9mmutable string$ %1. #hat is a &erbatim string$ %". #hen do 5ou use the StringBuilder class$ %%. #hat are Regular E6pressions$ ,o! do 5ou use them$ %). 7ention the differences bet!een classes and structs. %+. 7ention the important characteristics of a constructor. %.. #h5 do !e usuall5 declare constructors as public$ %/. #hat is a cop5 constructor$ %1. #hat is a propert5$ E6plain the different t5pes. %3. #hat is an inde6er$ #hat is it used for$ )4. ,o! does an inde6er differ from a propert5 in terms of implementation$ )1. #hat are the different t5pes of inheritance$ )". #hat is the difference bet!een o&erloading and o&erriding$
)%. State the characteristics of abstract classes and abstract methods. )). #hen do !e use sealed classes$ )+. #hat is a &irtual method$ ).. #hat is pol5morphism$ )/. #hat is an interface$ )1. #hat are the ma8or differences bet!een a class and an interface$ )3. #hat are the similarities bet!een a class and an interface$ +4. #hat is e6plicit interface implementation$ #hen it is used$ +1. :istinguish bet!een an abstract class and an interface. +". 'an an abstract class implement interfaces$ 9f 5es; ho! are the interface methods implemented$ +%. Name some of the built<in interfaces a&ailable. +). #hat is 9disposable interface$ E6plain its usage. ++. #hat is ='$ #hat are the different generations a&ailable$ +.. :ifferentiate bet!een 9comparable and9'omparer interfaces. +/. =i&e the usage of 9enumerator interface. +1. #hat are the comparison operators$ ,o! are the5 o&erloaded$ +3. #hat is a delegate$ #hat is it used for$ .4. =i&e the s5nta6 of a delegate declaration. .1. #hat are the modifiers that can be applied to a delegate$ .". #hat are the places a delegate can be defined in a program$ .%. #hat are the re0uirements of a delegate method$ .). #hat is a multicast delegate$ State the characteristics. .+. #hat do 5ou mean b5 As5nchronous delegates$ #h5 is it re0uired$ ... #hat is an e&ent$ =i&e the s5nta6 of an e&ent declaration. ./. #hat is an e&ent handler$ ,o! is it designed$ .1. #hat is numeric formatting$ .3. =i&e the general format of the standard numerical format. /4. #hat is an e6ception$ =i&e some e6amples. /1. :escribe the tasks in&ol&ed in handling e6ceptions. /". 2ist atleast four e6ceptions that occur commonl5 in '( programs. /%. #hat happens !hen a tr5 block is neither follo!ed b5 a catch block; nor b5 a finall5 block$ /). :istinguish bet!een the parameter less catch and the catch >E6ception e? statements. /+. #hat is the purpose of using a finall5 block$ =i&e some e6amples. /.. #hen do !e use a parameterless catch handler$ //. #h5 is a proper ordering of catch blocks necessar5 in '($ /1. #hat is an Assembl5$ /3. :ifferentiate bet!een 7anifest and 7etadata. 14. :ifferentiate bet!een ph5sical and logical &ie! of an assembl5. 11. =i&e the usage of checked and unchecked ke5!ord. 1". =i&e the usage of unsafe ke5!ord. 1%. :ifferentiate bet!een pri&ate assembl5 and shared assembl5. 1). E6plain the usage of 9cloneable interface. 1+. :istinguish bet!een :eep cop5 and shallo! cop5.