C # programmer interview answer

xiaoxiao2021-03-06  59

Prerequisites: The status bar panel SBPFILEPATH has been set to your own painting style. When there is a subsection section 1 is executed once:

Snippet 1: private void treeviewArchives_AfterSelect (object sender, System.Windows.Forms.TreeViewEventArgs e) {if (e.Node.Text = ""!) {Try {this.richtexebox.LoadFile (Application.StartupPath e.Node. Text); statusmessages = E.Node.text; sbpfilepath.text = statusmessages; // statusMessages Represents string} catch {messagebox.show ("Load file error, unable to display!");}}}

Code segment 2: private void statusBar1_DrawItem (object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent) {// Draw panel regions sbdevent.Graphics.FillRectangle (Brushes.Green, sbdevent.Bounds); // draw the text sbdevent panel. Graphics.drawstring (statusmessages, sbdevent.font, brushes.white, sbdevent.bounds); sbdevent.graphics.dispose ();

exam questions:

1. Will the code segment 2 will be executed? Answer: will.

2, code segment 2 If it is not performed, why? How to modify it? Answer: Over. Continue the next problem.

3, code segment 2 If it will be executed, will it be repeated (ie two or more times)? Answer: will.

4, code segment 2 If it is repeated, how to modify it only? Answer: 1 may be modified to code segment: private void treeviewArchives_AfterSelect (object sender, System.Windows.Forms.TreeViewEventArgs e) {if {try {this.richtexebox.LoadFile (Application.StartupPath (e.Node.Text = ""!) E.Node.Text); StatusMessages = E.Node.Text; // Note the following: Plus the mandatory method //sbpfilepath.text=statusmessages//statusMessages indicate string statusbar1.invalidate ); Catch {MessageBox.show ("Load file error, unable to display!");}}}

5, code segment 2 sBDEvent.graphics.dispose (); // This statement can be available, why? Answer: To release resources as much as possible, as long as the compilation is not wrong, it should be added. (If there is a dispute in the scene, leave a list, let him go back to test, the next day with test reports again)

6, assume that running the following statement {sbpfilepath.text = statusmessages; sbpfilepath.text = statusmessages;} The problem is 1-3 above, please answer again. Answer: If the code segment 1 is not modified, this segment is running sbpfilepath.text = statusMessages; when the code segment 2 is run twice, then, as long as the value of sbpfilepath.text is constant, the value of StatusMessages The code segment 2 does not continue to run. That is: {sbpfilepath.text = statusmessages; sbpfilepath.text = statusmessages;} Isometric SBPFilePath.Text = StatusMessages; 7, do you think code segment 1 or code segment 2 Does it have errors? (If you think answering the above questions, this question does not have to answer) Answers: The syntax is not wrong, but can modify the code, reduce redraw, save resources.

8. Some people think that C # developed is too slow, how do you think about this problem? Do you give priority to people-oriented, user-oriented thinking? Please briefly. Answer: Part is the truth, and the other part is that many people have completely rely on automatic garbage recycling, but did not consider weak references, dispose (), close (), GC, etc. The substantive problem of C # development is the current cross-platform. The company R & D department believes that if Java developers think that C # developed is too slow, it is definitely not a qualified Java programmer, and his code has little performance and resource. If after 2 reminders, he still insists on this point of view, definitely is an impetuous person, avoid it. Note during the recruitment: Do not try to guide the difference in language of the candidate, and do not publish the language views of the biased, pay attention to the mood of the candidate.

9. Generally speaking, the following books are classic. If you have seen, please pick a book from inside, pointing 5 in the book, you have seriously affect the code segment or error code of the program speed. (I hope to emphasize the principle of our company through this question: how the programmer is, it is to see the code he written and code performance. It is not to see how much he has learned, and he doesn't look at his working age) Answer: The information is not available.

I am abide by your commitment, I have not announced more topics in other websites. And there is absolutely no technical issues and answers other than this article. Once the third round of recruitment results announced, I will pass all the first time to the Internet, and everyone pays attention.

Many people can advice to me, I will cherish someone to advise the opportunity ...

转载请注明原文地址:https://www.9cbs.com/read-112597.html

New Post(0)