I. Single choice (4)
1. The 500 error in HTTP response is: ()
A . Server Internal Error
B File not found
C Client network does not pass
D No access rights
parsing: Common HTTP status codes and their meanings are as follows:
200: normal; the request is complete.
400: Bad Request-there is a syntax problem in the request, or the request cannot be fulfilled.
404: Cannot Find-the server cannot find the given resource; The document does not exist.
500: Internal Error-The server could not complete the request because of an unexpected situation.
2, the role of increasing the cache between CPU and memory is ()
A Improved memory stability
B . Resolving performance bottlenecks with memory speeds below CPU
C Increase memory capacity
D Increased memory capacity and faster access
parsing: The CPU processes the data, the hard disk stores the data, the memory is responsible for connecting the CPU and the hard disk, and storing temporary data. Memory is used only for temporary storage of programs and data, and programs and data are lost once power is turned off or power is off.
The cache is called a cache, and the cache is a first-level memory between the Yu Sicun (memory) and CPU, which is the function of easing the contradiction between the speed mismatch between the central processor and the main memory.
3, about the lock and the transaction description is correct ()
A . Transaction T1 can read and write to D1 after it has obtained an exclusive lock on the data item D1 .
B According to different dynamics, the lock can be divided into: table-level lock, page-level lock, row-level lock, column-level lock
C Table-level locks are more prone to deadlock than row-level locks
D The SELECT statement does not generate a lock
parsing: Common lock with table lock, row lock, page lock, foreign key lock, etc.
Locks have a certain amount of consumption, mainly: To obtain a lock, check whether the lock has been lifted, release locks, etc., these operations will increase the system overhead. table lock Overhead is relatively small, but the concurrency performance is also poor, row lock concurrency performance is high, but requires more locks, the database system generally supports automatic lock escalation, such as a transaction in the case of too many locks, the row lock may be upgraded to a table lock. MySQL's various storage engines use different locking mechanisms depending on the application scenario, and the MyISAM storage engine uses table locks, innodb using row locks. If you perform operations such as alert table, the server also takes a table lock, ignoring the lock mechanism of the storage engine.
page locks, some databases support page locks, page lock granularity between row and table locks, to lock a page that holds data, and 1 pages typically contain n rows of data.
1) Table-level lock: Low overhead, lock fast, no deadlock , lock granularity is high, the probability of lock conflict is highest, the concurrency is the lowest. 2) Row-level lock: Overhead, locking slow, deadlock , lock granularity is the least, the probability of lock conflict is the lowest, the concurrency is the highest. 3) page Lock: Overhead and lock time are bounded between table and row locks, deadlock occurs, locking granularity bounds between table and row locks, and concurrency is common.
Select creates a shared lock.
4, a B two people the probability of a problem is 90% and 80%, respectively, for a judgment question, they are selected "correct", ask the correct probability of the problem is ()
A 9/10
B 18/25
C . 36/37
D 35/36
Analytical:
5, there is a sufficient amount of 2 points, 5 points, 1 cent coins, if you want to gather a dollar, you can have () Chinese law
A . 541
B 270
C 1024
D 128
Analytical:
PackageBasic; Public classCal1 { Public Static voidMain (string[] args) {//TODO auto-generated Method Stub intCount=0; for(inti=0;i<=20;i++){ for(intj=0;j<=50;j++){ for(intk=0;k<=100;k++){ if(5*i+2*j+k==100) {Count++; }}}} System.out.println (count);//print "541" }}
6, 65,8,50,15,37,24, (), the number in parentheses is ()
A 25
B 26
C 22
D 27
7. The following Java code description is correct ()
public class testclass{
private static void TestMethod () {
System.out.println ("TestMethod");
}
public static void Main (string[] args) {
((TestClass) null). TestMethod ();
}
}
A Compile pass, run exception, report NullPointerException
B Compile pass, run exception, report illegalargumentexception
C Compile pass, run exception, report nosuchmethodexception
D . Normal operation, output TestMethod
Package Basic; Public class testclass{ privatestaticvoid TestMethod () { System.out.println ( "TestMethod"); } Public Static void Main (string[] args) { ((testclass)null). TestMethod (); print "TestMethod"} }
8, with an array of Q (1..M) is represented by the ring queue, the Convention F is the current team head element in the array of the lower label, r for the tail element of the next position (in the clockwise direction), if the queue is not empty, the calculation of the number of elements in the queue formula is ()
A . (m+r-f) mod m
B R-f
C (m-r-f) mod m
D (m-r+f) mod m
9, with the map g= (v,e), vertex set V={v0,v1,v2,v3}, Edge set E={<v0,v1>,<v0,v2>,<v0,v3>,<v1,v3>}, If you start the depth-first traversal of the graph from the vertex V0, the number of different traversal sequences you might get is
A 2
B 3
C 4
D . 5
10, the following options, does not constitute the binary lookup in the keyword comparison sequence is ()
A . A, a.
B 500,450,200,180
C 180,500,200,450
D 180,200,500,450
Second, multi-choice
1, Ping the other host with ping command, receive the correct answer, can explain ()
A . Destination host up to
B . The source host's ICMP software and IP software are operating normally
C The ICMP software and IP software of the destination host are operating normally.
D . Normal routing of ping packets
2. For processes and threads, the following options are correct ()
A . Threads can share data with other threads in the process, but have their own stack space, with separate execution sequences
B . Threads are the basic unit in which concurrent programs allocate and manage resources during execution
C . A process is a combination of PCB structure and program data
D Thread changes not only represent changes in the CPU execution process, but also changes in the resources owned by the process.
3. Transactions have multiple characteristics, including ()
A . Consistency
B Continuity of
C . Atomic Nature
D . Isolation of
Resolution: The four attributes that are owned by the database transaction are explained as follows:
Atomicity (atomicity): A transaction is executed as a whole, and the operations contained therein are either completely executed or not executed.
Consistency (consistency): a transaction should ensure that the state of the database transitions from one consistent state to another consistent state. The meaning of a consistent state is that the data in the database should satisfy the integrity constraints.
Isolation (Isolation): When multiple transactions are executing concurrently, the execution of one transaction should not affect the execution of other transactions.
Persistence (Durability): Committed transaction modifications to the database should be persisted in the database.
4, the following options are correct ()
A . Two-dimensional arrays and multidimensional arrays are not special linear structures
B Inserting a node into a binary sort tree can be compared more often than the height of the two fork tree
C . If the single-link list in the adjacency table of a given graph is empty, the out degree of the I vertex is zero
D Regardless of whether the linear table uses sequential storage structures or chained storage structures, the time complexity of deleting nodes with value x is O (n)
parsing: A multi-bit array is the simplest nonlinear structure that uses sequential storage structures. A linear structure is a collection of ordered data elements. Common linear structures are: linear tables, stacks, queues, double queues, arrays, strings. On the generalized table, it is a nonlinear data structure. Common nonlinear structures are: two-dimensional arrays, multidimensional arrays, generalized tables, trees (binary trees, etc.), graphs.
5, a text is known to have 1382 characters, using 1382 bytes for storage, the text is all by a, B, C, D, E, which consists of 5 characters, a appeared 354 times, B appeared 483 times, C appeared 227 times, D appeared 96 times, E appeared 232 times, If you encode these 5 characters using the Huffman (Huffman) algorithm, which of the following statements is correct ()
A . After encoding using Huffman algorithm, storing this text with coded values will cost the least amount of storage space
B Using Huffman algorithm to encode, A, B, C, D, e the 5 characters corresponding to the encoding value is unique
C . Using Huffman algorithm to encode, a, b, C, D, E these 5 characters corresponding to the encoding value can have multiple, each character encoded bit (bit ) number is determined
D . b This character Huffman encoding value should be the shortest, D This character Huffman coded value should be the longest number of digits
Analysis: Huffman coding is a variable-length encoding, which determines the length of character encoding according to the probability of the occurrence of characters, so that the probability of large character encoding length is short, the probability of a small number of characters in the length of the encoding, so can reduce the overall length of the encoding.
Third, programming problems
1, write a function implementation: Determine whether a string is a repeating character, the character set is ASCII.
Requirements: No additional data structures are allowed
PackageBasic; Public classRepeatornot { Public Static Booleanjudge (String str) {Char[] chars=Str.tochararray (); for(inti=0;i<chars.length;i++){ CharC=Chars[i]; String cStr=string.valueof (c); STR=str.replacefirst (CStr, ""); if(Str.indexof (CSTR)!=-1){ return false; } } return true; } Public Static voidMain (string[] args) {//TODO auto-generated Method StubSystem.out.println (Repeatornot.judge ("ABCA"));//print "false"System.out.println (Repeatornot.judge ("ABCD"));//print "true" }}
2. For a string, design an efficient algorithm to find the first repetition of the character.
Test examples:
"QYWYER23TDD", 11
return: Y
PackageBasic;ImportJava.util.HashMap;ImportJava.util.Map; Public classFindthefirstrepeatchar {Private Staticstring Getfirstrepeatchar (String str) {Char[] chars=Str.tochararray (); Map<String,Integer> maps=NewHashmap<string,integer>(); CharC; String cStr; for(inti=0;i<chars.length;i++) {C=Chars[i]; CStr=string.valueof (c); if(Maps.containskey (CSTR)) {returncStr; }Else{maps.put (cStr,1); } } return""; } Public Static voidMain (string[] args) {//TODO auto-generated Method StubSystem.out.println (Findthefirstrepeatchar.getfirstrepeatchar ("QYWYER23TDD")); System.out.println (Findthefirstrepeatchar.getfirstrepeatchar ("QYWAQER23TDD")); }}
3, enter a string, there are numeric and non-numeric characters, such as: ak123x456 17960?302gx14563, the continuous number as a whole, in turn, into an array A, for example, 123 put a[0],456 into a[1],......, Programming counts how many integers they have, and outputs those numbers.
PackageBasic;Importjava.util.ArrayList;Importjava.util.List; Public classGetnumbers {Private Static voidgetnumbers (String str) {Char[] chars =Str.tochararray (); intK, flag = 0; List a=NewArrayList (); for(inti = 0; i < chars.length; i++) {k=integer.valueof (Chars[i]); if(k >= && k <= 57) {flag= Flag * + (k-48); } Else if(Flag! = 0) {a.add (flag); Flag= 0; } } if(Flag! = 0) {a.add (flag); } for(Object o:a) {System.out.println (o); } } Public Static voidMain (string[] args) {//TODO auto-generated Method StubGetnumbers.getnumbers ("abc09ddd124fff456 7898");//print "9 124 456 7898" }}
Refer to blogs and books:
Database lock mechanism: http://www.cnblogs.com/zhouqianhua/archive/2011/04/15/2017049.html
The difference between a process and a thread: http://www.cnblogs.com/way_testlife/archive/2011/04/16/2018312.html
Huffman algorithm Detailed: http://noalgo.info/411.html
Exercises on processes and threads: http://blog.csdn.net/livelylittlefish/
http://blog.csdn.net/livelylittlefish/
Http://c.biancheng.net/cpp/html/2643.html
Data Structure C language version Chen Ming
Telecom 20150924 Questions