Some topics in C # written examination (collection)

Source: Internet
Author: User

. NET face Test 1

1. Narcissus number

Three-bit positive integer, 153=1~3 + 5~3+3~3

for (int i=100; i<1000; i++)

{

Int bai = 0;

Int shi = 0;

Int GE = 0;

Int Baiyushu = 0;

bai=i/100;

baiyushu=i%100;

Shi = BAIYUSHU/10;

GE = baiyushu% 10;

if (i== Bai*bai*bai + shi*shi*shi+ge*ge*ge)

{

Response.Write ("Narcissus number:" +i+ "<br>");

}

}

2. Fibonacci Series::: Recursive

1,1,2,3,5,8,13,21,..........

private int Fun_feibo (int intn)

{

int intresult = 0;

if (intn==1)

{

Intresult = 1;

}

Else

{

if (intn==2)

{

Intresult = 1;

}

Else

{

We need recursion here.

Intresult = Fun_feibo (intN-2) +fun_feibo (intN-1);

}

}

return intresult;

}

3. What is a delegate in C #. An event is not a delegate.

Commissioned, as the name suggests, is the middle agent of the meaning.

[One method can be used as a parameter into another method]

A delegate can be understood to point to a reference to a function, "pointer to function"

Yes, it's a special kind of delegation.

1. Declaration of Commission

delegate void (int,string) delename (parameter list);

2. Declaration method

Modifier return type method name (argument list)

//         {

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.