Volume A (R & D written questions)
Part 1 (required): computer science basics
1. (single choice) the criteria for module division in software design are:
A. Low cohesion low coupling B. High Cohesion low coupling C. Low cohesion high coupling D. High Cohesion high Coupling
2. In the worst case of (single choice), the time complexity is not the Sorting Algorithm of N (n-1)/2:
A. Fast sorting B. Bubble Sorting C. Insert directly to sort D. Heap sorting
3. The methods for resolving conflicts in the hash table can be divided into two types: Open addressing and chaining. Please explain the general implementation principles of the two types of conflict resolution methods respectively.
4. the simple linked list structure has good performance in inserting and deleting nodes, but the random positioning (obtain the nth node of the linked list) is not good in operation performance, please design an improved linked list structure to optimize the performance of the random location operation, and provide the design idea and the time complexity of the improved Random location operation.
5. What is the NP problem? List typical NP problems (at least two )? How do you determine if a given question is an NP problem?
6. The following is a tree traversal algorithm and the queue is a FIFO queue. Please refer to the tree below and select the correct output.
1
/\
2 3
/\/\
4 5 6 7
Queue. Push (tree. Root)
While (true ){
Node = queue. Pop ();
Output (node. Value); // Number of the output Node
If (null = node)
Break;
For (child_node in node. Children ){
Queue. Push (child_node );
}
}
A.m. 1234567
B. 1245367
C. 1376254
D. 1327654.
Part 2 (optional): C/C ++ Programming
1. There are three Class a B c defined as follows. Please confirm the size order of sizeof (a) sizeof (B) sizeof (C) and give reasons
Struct {
A (){}
~ A (){}
Int M1;
Int m2;
};
Struct B {
B (){}
~ B (){}
Int M1;
Char m2;
Static char m3;
};
Struct c {
C (){}
Virtual ~ C (){}
Int M1;
Short m2;
};
2. Use C ++ to implement the following print function to print all elements in linked list I. Each element is a single row.
Void print (const STD: List <int> & I ){
}
3. assume that a C project contains. C and B. c. c defines a global variable Foo in B. what should I do when I want to access this variable in C?
4. The new operator in C ++ usually completes two tasks: allocating memory and calling the corresponding constructor initialization.
Excuse me:
1) how to make the new operator not allocate memory and only call constructor?
2) What is the use of this method?
5. What is the output of the following program? Why?
Class {
Public:
A () {P ();}
Virtual void P () {print ("")}
Virtual ~ A () {P ();}
};
Class B {
Public:
B () {P ();}
Void P () {print ("B ")}
~ B () {P ();}
};
Int main (INT, char **){
A * A = new B ();
Delete;
}
6. What is C ++ traits? Examples
Part 3 (optional): Java programming
1. (single choice) the following Java program running structure is:
Public class tester {
Public static void main (string [] ARGs ){
Integer var1 = new INTEGER (1 );
Integer var2 = var1;
Dosomething (var2 );
System. Out. Print (var1.intvalue ());
System. Out. Print (var1 = var2 );
}
Public static void dosomething (integer ){
Integer = new INTEGER (2 );
}
}
A. 1 true
B. 2 true
C. 1 false
D. 2 false
2. (single choice) insert an internal class declaration to the code segment of the outerclass class, which is correct:
Public class outerclass {
Private float F = 1.0f;
// Insert the code here
}
A.
Class innerclass {
Public static float func () {return F ;}
}
B.
Abstract class innerclass {
Public abstract float func (){}
}
C.
Static class innerclass {
Protected static float func () {return F ;}
}
D.
Public class innerclass {
Static static float func () {return F ;}
}
3. What is the function of interfaces in Java? Examples are provided to illustrate which scenarios are suitable for interface and under which scenarios abstract classes are suitable.
4. How can I implement Java multithreading? How can classes in Java ensure thread security? Describe the usage and applicable scenarios of threadlocal.
5. How can thread-safe map be implemented in JDK 1.5 and later environments?
6.
1) briefly describe the Java classloader model and describe its hierarchy and the main process of class loading.
2) typea. the class is located under classpath,/absolute_path/typea. class is the absolute path in the file system, and the class file is smaller than 1 K. myclassloader is a custom Class Loader. Are the following class loaders correct, if there is a mistake, indicate which line is wrong and briefly describe the reason
Import java. Io. file;
Import java. Io. fileinputstream;
Import java. Io. inputstream;
Public class tester {
Public static void main (string [] ARGs ){
Myclassloader cl1 = new myclassloader ();
Try {
File F = new file ("/absolute_path/typea. Class ");
Byte [] B = new byte [1024];
Inputstream is = new fileinputstream (f );
Int I = is. Read (B );
Class C = cl1.definemyclass (null, B, 0, 1 );
Typea A = (typea) C. newinstance ();
} Catch (exception e ){
E. printstacktrace ();
}
}
}
Part 4 (selected): Linux Application and Development
1. Write the Linux Command to complete the following functions:
1) Search for the string "example" in all. cpp files in the current directory and Its subdirectories, Which is case insensitive;
2) use the SED command to replace all AAA words in the file XYZ with BBB;
3) use one command to create three sub-directories of AA BB CC
4) Mount CDROM. ISO to the/dev/CDROM directory
5) set ulimit so that the program can generate coredump in case of serious errors such as segment fault;
2. If umask is set to 002, what is the permission for the newly created file?
A.-RW-rwr --
B. rwxrwx-w-
C. ------- w-
D. rwxrwxr-x
3. What is the difference between the. bashrc and. bash_profile files in the home directory?
4. Write the gdb command to complete the following functions (you can use the command in short form ):
1) Use GDB to debug the program Foo and use the coredump file core.12023;
2) view thread Information
3) view the call stack
4) set a breakpoint on the function Foo of the class classfoo.
5) set a breakpoint, triggered when the value of the expression expr is changed
5.
1) give a brief description of the function names provided by the pthread library commonly used for multi-thread programming in Linux (at least five)
2) which two thread synchronization mechanisms are provided by the pthread library to list the main APIs?
3) What connection parameters need to be added during compilation of multi-threaded programs using the pthread library?
Part 5 (selected): Windows Development
1. What types of DC (device context) are there? What is the difference?
2. Collision detection is a basic technology frequently used in games. For two-dimensional situations, please answer the following questions:
1) how to judge a point in a polygon
2) how to determine the intersection of two polygon
3) how to determine whether the surrounding areas of the complete graph formed by the two point sets overlap?
3. What is the difference between postmessage sendmessage and postthreadmessage?
4. What is Alpha hybrid? Which of the following popular image formats support alpha channels? What is the difference between a layered window and a normal window?
5. If you want to implement a multi-threaded (non-MFC) program, choose multi-threaded CRT and use createthread or _ beginthreadex () to create a thread. Why?
Why use _ beginthreadex () instead of createthread?
When you plan to implement a multi-threaded (non-MFC) program, will you select a single-threaded CRT (C Runtime Library? If your answer is no, there will be another question. Have you selected createthread to create a thread? Most people may immediately answer yes. Unfortunately, this is a wrong choice.
Let me explain my conclusions and I will tell you why later.
For multi-threaded (non-MFC) programs
-Use malloc (), free (), new
-Call stdio. h or IO. H, including fopen (), open (), getchar (), write (), printf (), errno
-Use floating-point variables and floating-point operation functions
-Call functions that use static buffers, such as asctime (), strtok (), and rand.
You should use a multi-threaded CRT with _ beginthreadex (this function only exists in multi-threaded CRT). In other cases, you can use a single-threaded CRT with createthread.
Because for the generated thread, _ beginthreadex performs additional bookkeeping work for the above operations than createthread. For example, it helps strtok () to prepare a buffer for each thread.
However, in rare cases, multi-threaded programs do not use the above functions (such as memory allocation or IO), so instead of thinking about whether to use _ beginthreadex or createthread every time, it is better to finalize _ beginthreadex with a stick.
Of course, you may use Win32 to handle memory allocation and IO. At this time, you can indeed use a single-thread CRT with createthread, because the IO task has been transferred from the CRT to Win32. In this case, you should usually use heapalloc and heapfree to handle memory allocation, and use createfile or getstdhandle to process Io.
Another important thing is that although _ beginthreadex returns an unsigned long, it is actually a thread handle (in fact, _ beginthreadex calls createthread internally ), so you should end it with closehandle. Do not use exitthread () to exit the thread created by _ beginthreadex, which will lead to the loss of the chance to release the bookkeeping data. Use _ endthreadex.
Part 6 (selected): Database Development
1. What is the difference between a hash-based index and a tree-based index?
2. the user table is used to record user-related information. The photo table is used to record user photo information. The two tables are defined as follows:
Create Table user (-- User information table
Userid bigint, -- Unique User ID
Account varchar (30) -- unique account of the user
);
Create Table photo (-- photo info table
Photoid bigint, -- Unique photo ID
Userid bigint, -- ID of the photo
Accesscount int, -- number of visits
Size bigint -- actual size of the photo file
)
1) Please give the ID of the five photos with the largest number of user visits with the SQL printing account "dragon;
2) the IDs of the top 10 users with the largest total photo file size (total_size) in SQL printing are displayed and sorted in descending order according to total_size.
3) To optimize the preceding two queries, what indexes should be created on the user and photo tables?
4) What is the impact of indexes on database performance?
3. What is a two-phase commit protocol?
4. Basic concepts of database transactions:
1) What is the acid nature of transactions?
2) What are the transaction isolation levels defined in SQL standards?
3) which two concurrency control protocols are most commonly used in databases?
4) list the concurrency control protocols used in the database management system as you know.
5. Tables in the database include user (ID, name, age ):
The data in the table may be in the following format:
ID name age
001 Zhang San 56
002 Li Si 25
003 Wang Wu 56
004 Zhao liu21
005 Qian Qi 39
006 sun Ba 56
..............
Since the age of a person may be equal, write an SQL statement to query the records with the smallest ID among the persons with the largest age.
6. The connection pool is often used for concurrent access to the database. What are the advantages of using the connection pool? When multiple application servers access a central database concurrently, database access often becomes a System Bottleneck. Which issues should I pay attention to when designing and using the connection pool on the application server, to ensure the correctness and overall performance of the system. assume that each application server executes the same task and performs load balancing.
Part 7 (selected): Web Development
1. Which of the following JavaScript statements will generate a running error:
A. var OBJ = ();
B. var OBJ = [];
C. var OBJ = {};
D. var OBJ = //;
2. The following page Code (the doctype of the sample code is strict)
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
<HTML xmlns = "http://www.w3.org/1999/xhtml" XML: lang = "ZH" lang = "ZH">
<Head>
<Title> test </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = GBK"/>
<Meta http-equiv = "content-style-type" content = "text/CEE"/>
<Meta http-equiv = "content-script-type" content = "text/JavaScript"/>
<SCRIPT type = "text/CSS">
* {Margin: 0; padding: 0}
HTML {width: 100%; Height: 100%;
Overflow: Scroll; overflow-X: auto;
Text-align: center; Border: 0}
. Test {Height: 200px}
</SCRIPT>
</Head>
<Body>
<Div class = "text"> & nbsp; </div>
</Body>
</Html>
The size of the hypothetical a.jpg image is 200pxx100px. Calculate the distance from the current background image to the top of the Div. A and the result (CSS)
3. Knowledge about HTTP
A) what are common http request header fields?
B) How does a web server distinguish a visitor from a common browser user or a search engine spider?
C) which two types of cookie are classified by life cycle? How long is the lifecycle? When setting a cookie to a browser, what attributes can be set for the cookie?
D) What does keep-alive mean in HTTP? What are the advantages of using keep-alive and the negative effects on the server? Solutions to adverse effects
4. Briefly describe one or more of your most commonly used Web servers, and describe how to establish a reverse proxy between the Web server and the Application Server
5. Briefly describe the common development frameworks at various levels of MVC that you know and describe their features
6. Briefly describe several remote calling methods in the Web application environment, and compare their advantages and disadvantages in terms of performance heterogeneity.
Part 8 (selected): Flash Development
7. How does flash interact with JS?
8. What are the differences between the event object target and currenttarget in Flash event processing?
Part 9 (selected): Software Testing
1. Please describe your understanding of the test, including the test process, test type, test method, and test tool.
2. If one day you go to work in the morning and find that you cannot access the Internet, what steps will you use to locate the problem?
3. the Web application implements the friend function. Users can send "Add as friend" requests to others. After sending a request, they can cancel the request. After receiving the request, the other party can choose to accept or reject the request. each of the two friends can unilaterally delete each other. Please imagine as many paths as possible to design test cases for this function. Each test case includes test steps and expected results.
4. The company has developed a web chat tool for chatting between network users. A single user can chat with multiple users at the same time. The function is similar to im tools such as MSN.
The system is required to be able to withstand 10 thousand online users. On average, each user will chat with three people at the same time. When the network conditions are normal, the delay required for the user to receive the message cannot exceed 1 minute. now you need to perform a performance test on the system to verify whether the system meets the predefined requirements. Please write a performance test plan. the prompt is as follows:
1) The performance testing process is generally to simulate a large number of client operations, while monitoring the server performance and client response, according to the server performance indicators and client response status for analysis and judgment
2) the system performance problem can be considered from two perspectives. One is a server problem and a poorly designed program. The server will be down when the server is under heavy load or long-running hours; the other is the client problem. When the load is high, the client response slows down.
3) in the answer, you can clarify your testing ideas without involving performance testing tools, monitoring tools, and other details.
5. in the automatic function test, test cases are organized into a test set to run in a unified manner. The test set suite can be divided into several module modules by function. Each module contains several test cases. the current test set has been run, but you need to count the failure rate of each module in the test report, and record the module names with a failure rate of more than 20% and their failure rate as an alarm, compile the gettestreport function that implements the preceding functions. you can use Java, C ++, and other programming languages. The interfaces and methods provided are as follows:
Test Set interface isuite:
Collection <itest> gettests () // obtain all test cases in the test set.
Test Case interface itest:
String getmodule () // obtain the module name module corresponding to the use case.
Int getresult () // get the execution result of this case: 0 failed 1 succeeded
Alarm function:
Void alertmessage (string message)
Public static void gettestreport (isuite suite ){
// Write your implementation here
}