Share a summary of the interview on today and face questions of

See the days of high-tech zone interview interview a company, simply talk about today feel the atmosphere of good company, the company environment is also very good because of their own reasons for this interview may only miss

Today interview, you begin to face questions and a related investigation, face questions feel writing is actually quite good, is not that all the problems all right, but my heart is still a little spectrum, the main problem is in this database on the one hand, the database has been floating on the surface only a simple sql view as stored procedures cursor, etc., is not deep enough

Slightly below summarize the relevant face questions of

  The difference between a problem and the dynamic of var

  At the time of the interview answer: var belongs to the existence of a syntactic sugar for her after she was inferred by the compiler program produced for the first time in

                                dynamic compiler is a work-around and write code using dynamic is likely to cause the program to bypass inaccurate because the dynamic compiler compiler so no matter what kind of content will not write error causing a certain degree of insecurity

  Baidu answer: var has been determined at compile time type, initialization, you must provide a value initialized, and dynamic may not be provided, it is to determine the type at runtime.

 

2 The following is his writing method (when the check came back at night found an easier way)
// 112358132134 iterative method of obtaining 17 
1        // 11235813213417 bit using an iterative method of obtaining
 2          // using an iterative method 
. 3          #region written using an iterative method interview themselves
 . 4          static List < int > IDS = new new List < int > ();
 . 5          public  static  int GetGuid ()
 . 6          {
 . 7              IF (ids.Count < 2 )
 . 8              {
 . 9                  ids.Add ( . 1 );
 10                  GetGuid ();
 . 11              }
 12 is              the else if (ids.Count < 17)
13             {
14                 ids.Add(ids[ids.Count - 2] + ids[ids.Count - 1]);
15                 GetGuid();
16             }
17             return ids[ids.Count - 2] + ids[ids.Count - 1];
18         }
19         #endregion

3. Bubble Sort is not much to say directly on the code

 1    #region 冒泡排序
 2         /// <summary>
 3         /// 冒泡排序
 4         /// </summary>
 5         /// <param name="arr"></param>
 6         /// <returns></returns>
 7         private static int[] BubblingSort(int[] arr)
 8         {
 9             for (int i = 0; i < arr.Length; i++)
10             {
11                 for (int j = 0; j < arr.Length - i - 1; J ++ )
 12 is                  {    // described herein why -1 
13 is                      IF (ARR [J]> ARR [J + . 1 ])
 14                      {
 15                          int TEMP = ARR [J];
 16                          ARR [J] = ARR [J + . 1 ];
 . 17                          ARR [J + . 1 ] = TEMP;
 18 is                      }
 . 19                  }
 20 is              }
 21 is              return ARR;
 22 is          }
 23 is          #endregion

 

3 SQL deduplication methods

  ① .group by ordering (data sorting can be achieved according to the effect of weight)

  ② distinct    

    select distinct  * from #tmp1; 

    select distinct Col1, Col2 from table1; (de-weight according to the relevant field) 

 

4    the StringBuilder and String of difference?

String When performing operations (such as assignment, stitching, etc.) will generate a new instance, but will not StringBuilder. So it is best to use StringBuilder when a large number of string concatenation or frequently operate on a string, do not use String

 

Guess you like

Origin www.cnblogs.com/YZM97/p/11735782.html