Вы находитесь на странице: 1из 45

Q:1 write the program to use of Substring? Ans: using System; class A { static void Main string!

" b1# { string a $ %&ulvir singh%; string b; b $ a'Substring ()*#; +onsole',rite-ine b#; +onsole'.ead-ine #; / /

012312:

Q:4 write the program of inde5 of #fuction? Ans: using System; class A { static void Main string!" b1# { string a $ %framewor&%; int b; b $ a'6nde50f a#; +onsole',rite-ine b#; b $ a'6nde50f %a%)(#; +onsole',rite-ine b#; +onsole'.ead-ine #; / /

OUTPUT:

Q(:write the program uses of compare to # function? using System; class A { static void Main string!" b1# { string a $ %framewor&%; string b $ %framewor&%; int c; c $ a'+ompare2o b#; +onsole',rite-ine c#; +onsole'.ead-ine #; / / 012312:

Q7:write the program to uses of 89uals #function? Ans: using System; class A { static void Main string!" b1# { string a $ %framewor&%; string b $ %framewor&%; int c; c $ a'89uals b#; +onsole',rite-ine c#; +onsole'.ead-ine #; / /

Q::,rite the program to uses of .eplace # function? Ans: using System; class A { static void Main String!" b1# { string a $ %framewor&%; string b; b $ a'.eplace %o%) %e%#; +onsole',rite-ine b#; +onsole'.ead-ine #; / /

012312:

Q*:write the program to use of 6nsert # function? Ans: using System; class A { static void Main # { string a $ %c shrp %; string b; b $ a'6nsert 7) %;ava%#; +onsole',rite-ine b#; +onsole'.ead-ine #; / /

012312:

<:write the program to use the 2his function ? Ans: using System; class A { int a)b; void f1 int 5)int y# { a$5; b$y; / void f4 int a)int b# { this'a$a; this'b$b; / void f( # {

int c; c$a=b; +onsole ',rite-ine c#; / static void Main string !"b1# { A a1$new A #; a1'f1 1>)4>#; a1'f( #; a1'f4 (>)7>#; a1'f( #; +onsole'.ead-ine #; / / 012312:

Q?:write the program to use the 2his function? Ans: using System; class A { int a)b)c; void f1 # { int a $ 1>) b $ 7>; this'a$a; this'b$b; / void f4 # { c $ a = b; +onsole',rite-ine c#; / static void Main # { A a1 $ new A #; a1'f1 #; a1'f4 #; +onsole'.ead-ine #; / /

012312:

Q@:write the program to function overloading? Ans: using System; class A { void f1 # { +onsole',rite-ine %f1 method%#; / void f1 int 5# { +onsole',rite-ine %f1 method% = 5#; / void f1 int 5) int y# { +onsole',rite-ine %f1 method% = 5 = y#; /

static void Main # { A a1$new A #; a1'f1 #; a1'f1 1>#; a1'f1 1>#; a1'f1 4> ) (>#; +onsole '.ead-ine #; / /

012312:

Q1>:write the program to fuction overloading? Ans: using System; class A { public void f1 # { +onsole',rite-ine %f1 method of A%#; / public void f4 # { +onsole',rite-ine %f4 method of A%#; / class A : A { void f1 # { +onsole',rite-ine %f1 method of A%#; / void f4 # { +onsole',rite-ine %f4 method of A%#; / / static void Main # { A b1 $ new A #; b1'f1 #; b1'f4 #; +onsole'.ead-ine #; / /

012312:

Q11:write the program to array? Ans: using System; class A { static void Main # { int!))"a$new int !4)4)("; int i);)&; +onsole ',rite-ine %enter the array%#; for i$>;iB$1;i==# { for ;$>;;B$1;;==# { for &$>;&B$4;&==# {

a!i);)&"$int'3arse +onsole '.ead-ine ##; +onsole',rite-ine a!i);)&"#; / / / +onsole '.ead-ine #; / /

012312:

Q:14 write the program to copy constructor? Ans: using System; class A { int a) b) c; A # { a $ 1>; b $ 4>; / A int 5# { a$b$5; / A int 5)int y# { a$5; b$y; / void output # { c $ a = b; +onsole',rite-ine c#; / static void Main # { A a1$new A #; A a4$new A 7>#; A a($new A 1>)4>#; a1'output #; a4'output #; a('output #; +onsole'.ead-ine #; / /

012312:

Q1(:e5ample of constructor? Ans: using System; class A { int a)b) c; A # { a$1>; b$4>; / A int 5# { a$b$5; / A int 5)int y#

{ a$5; b$y; / void output # { c$a=b; +onsole ',rite-ine c#; / static void Main string !"aig# { A a1$new A #; A a4$new A 7>#; A a($new A (>)*>#; a1'output #; a4'output #; a('output #; +onsole'.ead-ine #; / /

012312:

Q17: e5emple of constructor? Ans: using System; class A { int a)b) c; A # { a$1>; b$4>; / A int 5# { a$b$5; / A int 5)int y# { a$5; b$y; / A A a1# { a $ a1'a; b $ a1'b; / void output # { +onsole ',rite-ine a#; +onsole',rite-ine b#; / static void Main string !"aig# { A a1$new A #; A a4$new A 7>#; A a($new A :>)*>#; A a7 $ new A a1#; A a: $ new A a4#; A a* $ new A a(#; a1'output #; a4'output #; a('output #;

a7'output #; a:'output #; a*'output #; +onsole'.ead-ine #; / /

012312:

Q1:: ,rite the program Cob;ect is locate memory space for all the non static data memory avalible in class? Ans: using System; class A { int a$1>)b$4>) c$(>; void f1 # { +onsole',rite-ine a#; +onsole',rite-ine b#; +onsole',rite-ine c#; / static void Main string !"aig# { A a1$new A #; +onsole',rite-ine siDeof int##; +onsole',rite-ine siDeof decimal##; +onsole'.ead-ine #; / /

012312:

Q1::write the program of defult constructor? Ans: using System; class A { protected internal A # { +onsole',rite-ine %defult constructor%#; / / class A { static void Main string!"a# { A a1$new A #;

+onsole'.ead-ine #; / /

012312:

Q1*: e5ample of single inheritance? Ans: using System; class A { internal void f1 # { +onsole',rite-ine %f1 method of class A%#; / /

class A : A { void f4 # { +onsole',rite-ine %f4 method of class A%#; / static void Main string!"a# { A b1$new A #; b1'f1 #; b1'f4 #; +onsole'.ead-ine #; / /

012312:

Q1<: e5ample of multi inheritance' Ans:

using System; class A { internal void f1 # { +onsole',rite-ine %f1 method of class A%#; / / class A : A { internal void f4 # { +onsole',rite-ine %f4 method of class A%#; / / class + : A { internal void f( # { +onsole',rite-ine %f( method of class +%#; / static void Main string!" a# { + c1 $ new + #; c1'f1 #; c1'f4 #; c1'f( #; +onsole'.ead #; / /

012312:

Q1?: e5ample of hierarchal inheritance ' Ans:

using System; class A { internal void f1 # { +onsole',rite-ine %f1 method of class A%#; / / class A : A { internal void f4 # { +onsole',rite-ine %f4 method of class A%#;

/ / class + : A { internal void f( # { +onsole',rite-ine %f( method of class +%#; / static void Main string!" a# { A b1 $ new A #; b1'f1 #; b1'f4 #; + c1 $ new + #; c1'f1 #; c1'f( #; +onsole'.ead #; / / 012312:

Q1@: Ans:

85emple of inner class?

using System; class A { public class A { public static void f1 # { +onsole',rite-ine %f1 method%#; / public void f4 # { +onsole',rite-ine %f4 Method%#; / / public void f( # { +onsole',rite-ine %f( method%#; / / class + { static void Main string!" args# { A'A b1 $ new A'A #; b1'f4 #; A'A'f1 #; A a $ new A #; a'f( #; +onsole'.ead-ine #; / /

012312:

Q4>:85ample of call by value )call by refrens? Ans: using System; class A { void Swap ref int a)ref int b# { int c; c $ a; a $ b; b $ c; +onsole',rite-ine a = % % = b#; / static void Main string!" args# { int 5)y;

+onsole',rite-ine %enter the two integer%#; 5 $ int'3arse +onsole'.ead-ine ##; y $ int'3arse +onsole'.ead-ine ##; A a1$new A #; a1'Swap ref 5)ref y#; +onsole',rite-ine 5=% %=y#; +onsole'.ead #; / /

012312:

Q41:e5ample of is Eeyword? Ans: using System; class A { / class A : A { / class + { static void Main string!" args# { A a1 $ new A #; A b1 $ new A #; if a1 is A# { +onsole',rite-ine %a1 is ob;ect A A%#; if b1 is A# { +onsole',rite-ine %b is a ob;ect of A%#; if b1 is A# { +onsole',rite-ine %b1 contain the feature of A%#; if a1 is A# { +onsole',rite-ine %contain the featureof A%#; / / / / +onsole'.ead-ine #; / /

012312:

Q44: e5ample of -in&ed -ist class' Ans: using System; using System'+ollections'Feneric; class A { static void Main string!" a# { -in&ed-istBintG b $ new -in&ed-istBintG #; b'AddHirst 1>#; b'Add-ast 4>#; b'Add-ast :#; int i; foreach int 5 in b# { +onsole',rite-ine 5#;

/ +onsole'.ead-ine #; / /

012312:

Q4(:85ample of 4 I 6nde5er? Ans: using System; class A { int a; int this!int 5) int y" { get { return a; / set { a $ value; / / static void Main # { A a1$new A #; int i);; for i$>;iB$1;i==# { for ;$>;;B$1;;==# { a1!i);"$i=;; +onsole ',rite-ine a1!i);"#; +onsole '.ead-ine #; / / / /

012312:

Q47: e5ample of stac& in 'net framewor&? Ans: using System; using System'+ollections; class A { static void Main string!" a# { Stac& S $ new Stac& #; S'3ush %1>%#; S'3ush %4>%#; S'3ush %(>%#; foreach string 5 in S# { +onsole',rite-ine 5#;

+onsole',rite-ine S'3op ##; +onsole'.ead-ine #; / / /

012312:

Q4:: 85ample of Queue 6n 'net Hrame,or&? Ans: using System; using System'+ollections; class A { static void Main string!" a# { Queue 9 $ new Queue #; 9'8n9ueue %1>%#; 9'8n9ueue %4>%#; 9'8n9ueue %(>%#; foreach string 5 in 9# +onsole',rite-ine 5#; 9'Ie9ueue #; foreach string 5 in 9# +onsole',rite-ine 5#; +onsole'.ead-ine #; / / 012312:

Q4*: +reate an application to input a string at runtime and copy into another strig' Ans: using System; class A { static void Main string!" args# { string a) b; +onsole',rite-ine %8nter a string: %#; a $ +onsole'.ead-ine #; b $ a; +onsole',rite-ine b#; +onsole'.ead #; / /

012312:

Q4<: +reate an application to input two strings and the two strings are e9ual or not' Ans: using System; class A { static void Main string!" args# { string a) b; +onsole',rite-ine %8nter a string: %#; a $ +onsole'.ead-ine #; b $ +onsole'.ead-ine #; if a'+ompare2o b# $$ ># +onsole',rite-ine %89ual%#; else +onsole',rite-ine %not e9ual%#; +onsole'.ead #; / / 012312:

Q4?: ,rite a program of threading' Ans: using System; using System'2hreading; class A { string a; A string b# { a $ b; / public void run # { +onsole',rite-ine a#; / static void Main # { A a1 $ new A %2hread1%#; A a4 $ new A %2hread4%#; A a( $ new A %2hread(%#; 2hread t1 $ new 2hread a1'run#; 2hread t4 $ new 2hread a4'run#; 2hread t( $ new 2hread a('run#; t1'Start #; t4'Start #; t('Start #; +onsole'.ead #; / /

012312:

Q4@: e5ample of property ? Ans: using System; class A { int a; int abc { get { return a; / set { a $ value; / / static void Main #

{ A a1 $ new A #; a1'a $ 1>; +onsole',rite-ine a1'a#; +onsole'.ead-ine #; / /

012312:

Q(>:85ample of Iele9ate? Ans: using System; delegate void abs string a#; class A { void f1 string 5# { +onsole',rite-ine 5#; / void f4 string y# { +onsole',rite-ine y#; / static void Main # { A a1 $ new A #; abs a; a $ a1'f1; a %itm%#; a $ a1'f4; a %graphic%#; +onsole'.ead #; / /

012312:

Q(1:85ample of interface in 'net framewor&? Ans: using System; interface A { void f1 #; void f4 #; / class A:A { public void f1 # { +onsole ',rite-ine %f1 method of class A%#; / public void f4 # { +onsole ',rite-ine %f4 method of class A%#; / static void Main # {

A b1$new A #; b1'f1 #; b1'f4 #; +onsole '.ead-ine #; / / 012312:

Q(4: 85ample of interface? Ans: using System; interface A { void f1 #; void f4 #; / interface A {

void f( #; void f7 #; / class +:A)A { public void f1 # { / public void f4 # { +onsole ',rite-ine %f4 method of class A%#; / public void f( # { +onsole',rite-ine %f( method of class A%#; / public void f7 # { / static void Main # { + c1$new + #; c1'f1 #; c1'f4 #; c1'f( #; c1'f7 #; A a1; a1 $ c1; a1'f1 #; a1'f4 #; A b1; b1 $ c1; b1'f( #; b1'f7 #; +onsole'.ead-ine #; / /

012312:

Вам также может понравиться