Microsoft 2004-10-16 Pen Test Analysis

xiaoxiao2021-03-06  67

Writing testing

Microsoft

2004-10-16 parsing analysis

Author: Yang Yanqing E-mail: Blankmanattomdotcom's exquisite: http://blog.9cbs.net/blankman/archive/2004/11/we_ms_20041016.aspx (Microsoft 2004-11-13 pen test analysis, if there is If you invade Microsoft copyright, please let us know, immediately delete it) 1. Ask the function return value, enter x = 9999; int func (x) {int countX = 0; while (x) {countx ; x = x & (x-1 } Return countx;} [Question analysis] When this question, if you take out a binary number to analyze, X = X & (X-1) is actually the binary form of X The last "1" becomes "0", and how many "1" cycles do in the binary form of X. 9999/256 = 39 15. The two numbers are converted soon. 39 = 32 4 2 1 = 00100111 15 = 0f = 00001111 So 9999 = 001001100001111, there are 8 1, the answer is 8 2. Implement the following procedures to facilitate the Binary Search. To process the error statement. The size of the assignment of the queue is fixed Max_LEN, input by the second parameter INSERT (int * arr, // queue size_l Len, // Queue size SIZE_L Count, // Queue Element Number INT VARL // To Process Data) Returns Index (INT * ARR, SIZE_L LEN, SIZE_L COUNT, INT VARL) of Insert Data Remove Index Search (int " * Arr, size_l len, size_l count, int var, Returns the index of the search path element [Question analysis] There are data structures. 3, the stack r, from the top to the end: {2, 4, 6, 8, 10}, take out the queue Q by one by one, then take out in the q, ask now the order of the top to bottom in the stack R .

[Question analysis] This is not available, {10, 8, 6, 4, 2} 4, the result of writing procedures: ___________ int funa (int * a) {a [0] ;} int funb (int B []) {b [1] = 5;} main () {Int a [5] = {2, 3, 4, 5, 6}; int b [5] = {2, 3, 4, 5 , 6}; int * p; p = & a [0]; (* p) ; funa (p); for (int i = 0; i <3; i ) Printf ("% d,", A [ I]); p = & b [1]; funb (p); for (i = 0; i <3; i ) printf ("% d,", b [i]);} [topic analysis] result is: 4, 3, 4, 2, 3, 9 (* p) ; that is, A [0] ; Funa (P); A [0] is the array A [0] , only the first element is added twice 1, p = & b [1]; Point P to the second element FUNB (P) of the array B; B [1] = 5 is Add 55 in the third element in the array b [2] = 5 array b, find the Bugint CopystringandCount (CHAR * STR) of the following program 1 {int ncount = 0; char * pBuffer; 2 PBuffer = New char [MAX_PATH_LENGTH]; 3 4 STRCPY (PBuffer, Str); For (; PBuffer 5; PBuffer ) IF (PBuffer 6 == '//') ncount ; 7 return ncount;} [Topic Analysis] 1 (const char * STR) If you do not need to change the content of the string in the function, it is best to add const to avoid erroneous modification string content 2 char * pBuffer = null; pointer declaration, it is best to assign the initial value NULL 3 if (! PBuffer) Return -1 After the opening of the space, there is no success, there is no error check 4 if (Strlen (STR)> (MA) X_Path_Length-1)) Return -2; No newly opened space can accommodate the string, otherwise it is possible to cross the world in the PBUFFER topic is to jump out of the cycle when the string is at the end of the string, so it should be taken The content of the string 6 is the same as 57 delete pBuffer; pBuffer = null; no newly opened space will cause memory leaks 6, what is the next generation browser should add? [Topic Analysis] Casual written, such as security, search function, etc.

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

New Post(0)