Do it yourself. NET development has already entered 4th years. In the past three years, I worked as a small website in my hometown. I have been doing repetitive and useless work. I came to Shanghai three months ago and have joined a good foreign company, I bought this C # entry-level Foundation and started reading it again. I have benefited a lot. Now I want to share the topic of every small chapter in this book. As your learning record.
(You must stick to writing technology blogs. It's nearly a month since I did not write or write it .....), Not much nonsense.
1. Which of the following conversions are not implicit conversions?
A. int to short
B. convert short to int
C. Convert bool to string
D. Convert byte to float
2. Color enumeration Based on the short type contains the rainbow color, followed by black and white.Code. Can the byte type be used for this enumeration?
3. Can the following code be compiled successfully? Why?
String [] blab = new string [5]
Blab [5] = 5 string.
4. Compile a console applicationProgramIt receives a string from the user and outputs the characters in the string in the reverse order of the input.
5. It receives a string and replaces all no in the string with yes.
6. Write a console application that adds double quotation marks to each word in the string.
Next is the answer .....
After a flash bullet ~~~~
Answer: 1. A and C cannot be converted, int is longer than short, and bool is bool string is a string, which is a value type and can only be true or false. string is a reference type, so it cannot be converted.
2. emun color: short
{
Red, orange, yellow, green, blue, indigo, Violet, black, white
}
The byte type can be replaced by numbers between 0 and 256. If different values are used for enumeration, the byte-based enumeration can contain items. If repeated values are used for enumeration items, you can include more items.
3. Compilation fails. First, when the new string is created, [5] The values in the Code array are 0, 1, 2, 3, and 4.
The value cannot be referenced for stirng [5. There are also strings without quotation marks, and there is no semicolon at the end.
4. String A = console. Readline ();
For (INT I = A. Length-1; I> = 0; I --)
{
Console. writeline (A [I]);
}
5. String A = console. Readline ();
Console. writeline (A. Replace ("no", "yes "));
Console. readkey ();
6.
String A = console. Readline ();
A = "\" "+ A. Replace (" "," \ "\" ") + "\"";
Console. writeline ();
Use a space to separate words.