Search for what I want-written test

Source: Internet
Author: User
Tags float number

After I continued to update my job, I found there was another thing I could write (Haha, I like to write about East and West ). I can record some technical questions I have not answered or answered. Easy to learn.

In this written test, the job is a test engineer, but the question seems to be a software engineer. Let's just review what I don't remember ~ In fact, there is still a Database Engineer's paper, but there is really no time to do it again. There are 20 questions in total. I only remember 18.

1. breadth-first Traversal Algorithm

Analysis: the algorithm of this graph is remembered before. However, I did not have any contact for a long time. I planned to review it a while ago. I saw other results. There is a bit of image during the test, but it is the second question. I don't want to spend too much time on it. As a result, there will be a lot of questions after the test is completed. I just did not do it.

The breadth-first search traversal is similar to the hierarchy traversal of a tree. A queue must be set up to save the accessed nodes. The algorithm is described as follows,

1) Select a node V0 as the starting point.

2) Access V0.

3) enter the accessed node V0 into the queue.

4) when the queue is not empty, enter the loop:

Node VI team out.

Access the VJ of all nodes that are connected to the VI but have not been accessed.

The accessed node VJ enters the queue.

5) when the queue is empty, the cycle ends, indicating that all nodes that can arrive from V0 have been accessed.

The breadth-first traversal algorithm is as follows (C ++ ):

Typedef int datatype; # include "queue1.h" Void graph1: breadthfs (int K) {queue1 Q1 (vertcount); // Number of vertcount graph nodes int I = K; cout <vertex [I] <""; // The vertex [I] = 1; q1.enqueue (I); While (! Q1.isempty () {I = q1.dequeue (); Int J = 0; while (j <vertcount) {if (I! = J & mat [I] [J]> 0 & mat [I] [J] <maxweight & visited [J] = 0) // int mat [] [] graph's Adjacent matrix {cout <vertex [J] <""; visited [J] = 1; // int visited [] Access tag array q1.enqueue (j);} else J ++ ;}}}

By the way, we will review the depth-first traversal algorithm: Deep-first traversal is similar to the first root traversal of a tree. The recursive algorithm is described as follows,

Start from the selected node V0.

Access V0.

Find another node VJ that is connected to V0 and has not been accessed.

If VJ exists, start from vj and continue in-depth search traversal.

If no VJ is found, all nodes that can be reached from V0 have been accessed and the traversal ends.

The depth-first traversal algorithm is as follows (C ++ ):

Void graph1: depthfs (int K) {int I = K, j = 0; cout <vertex [I] <""; visited [I] = 1; while (j <vertcount) {if (I! = J & mat [I] [J]> 0 & mat [I] [J] <maxweight & visited [J] = 0) {depthfs (j ); // recursion} else J ++ ;}}

 

2. Draw a simple model for socket communication in Windows

Analysis: At that time, I only remember that socket was the communication mechanism between the server and the client. I took notes when I was reading sun Xin's MFC. At that time, I also made a simple communication tool, I don't know how many years I haven't touched it yet. What impressed me most was that there were three "handshakes ". The result shows an incorrect model.

I think this is the figure below. If not, please point it out.

 

3. Write a string in pure C and reverse the output.

Analysis: during the summer vacation last year, I bought a computer grade examination book, which is pure C. I used the project's free time to finish this book. However, I thought that I learned C #, so I didn't pay much attention to the C syntax. The objective of value reading is right or wrong. I want to use the char pointer method, but I forget it. My method is similar to the following. I used a character array method and output it through the for loop. It must be a cup ~

# Include <stdio. h> # include <string. h> void main (void) {char STR [100]; int Len, I; while (gets (STR )! = NULL)/* Ctrl + z end loop */{Len = strlen (STR); for (I = len-1; I> = 0; -- I) putchar (STR [I]); putchar ('\ n ');}}

There is an ideal method on the Internet, but I don't know if it is the most efficient. I will not list any other methods:

#include<stdio.h>#include<string.h>void func(char *s){char *p1, *p2;char c;p1 = s;p2 = s + strlen(s) - 1;while(p1 < p2){c = *p1;*p1 = *p2;*p2 = c;p1++;p2--;}}void main(){char s[] = "sdlkfjslkdfja";func(s);printf("%s\n", s);}

 

4. Similarities and Differences between interfaces and classes.

Analysis: I have just read the C # programming language book. This question should be well answered. The results are not ideal, but the differences are still written. It feels too much!

Differences:
The interface cannot be instantiated directly. // OK
The interface does not contain the implementation of methods. // OK
Interfaces, classes, and structures can be inherited from multiple interfaces. However, C # only supports single inheritance: the class can only be inherited from one base class. // No
Class definition can be split between different source files. // No
Same:
Interfaces, classes, and structures can be inherited from multiple interfaces. // OK
An interface is similar to an abstract base class: any non-Abstract type that inherits an interface must implement all the members of the interface. // No
Interfaces can contain events, indexers, methods, and attributes. // No
A class can implement multiple interfaces. // No

 

5. Use C/C ++ to write a circular buffer with a depth of XXX and a width of XX.

Analysis: XXX has specific numbers. I forgot. However, this question is speechless.

/* Ringbuf. C */# include <stdio. h> # include <ctype. h> # define Nmax 8int Iput = 0;/* current location of the ring buffer */INT iget = 0;/* current location of the buffer */INT n = 0; /* Total number of elements in the ring buffer */Double Buffer [Nmax];/* address number calculation function of the ring buffer. If it reaches the end of the wake-up buffer, it will return to the header. ** The valid address number for the Ring buffer is: 0 to (NMAX-1) */INT addring (int I) {return (I + 1) = Nmax )? 0: I + 1;}/* obtain an element from the ring buffer */Double get (void) {int Pos; If (n> 0) {pos = iget; iget = addring (iget); n --; return buffer [POS];} else {printf ("buffer is emptyn"); Return 0.0 ;}} /* put one element into the ring buffer */void put (Double Z) {If (n <Nmax) {buffer [Iput] = z; Iput = addring (Iput ); N ++;} else printf ("buffer is fulln");} int main (void) {char opera [5]; Double Z; do {printf ("Please input p | G | E:"); scanf ("% s", & opera ); Switch (tolower (opera [0]) {case 'p':/* put */printf ("Please input a float number:"); scanf ("% lf ", & Z); Put (z); break; Case 'G':/* Get */z = get (); printf ("% 8.2f from buffern", Z ); break; Case 'E': printf ("endn"); break; default: printf ("% s-Operation Command error! N ", opera);}/* end switch */} while (opera [0]! = 'E'); Return 0 ;}

I don't know if this is true or not. There shouldn't be such a long program. It may be these two sentences:

Double Buffer [Nmax];
/* The address number calculation function of the ring buffer. If it reaches the end of the wake-up buffer, it will return to the header. ** Effective address number of the ring Buffer: 0 to (NMAX-1 )*/
Int addring (int I) {return (I + 1) = Nmax )? 0: I + 1 ;}

 

6. The difference between threads and processes, and then talk about synchronization and mutex.

Analysis: the difference between a thread and a process is remembered. However, the answer is not comprehensive, as for synchronization and mutex. Do you know this concept and there is no mistaken Process Synchronization example on my blog.

See http://www.cnblogs.com/kulong995/archive/2008/10/10/1307952.html#1443479

Haha. Unfortunately, the bald teacher's mutex is still in my ears, and I still only have a vague concept.

This guy is similar to me: http://www.ezloo.com/2007/10/thread_process_program.html

I only know that threads are part of processes and processes are part of programs. For more specific differences, see the following:

1. A thread is a part of a process. Therefore, a thread is sometimes called a lightweight or lightweight process.
2. A process without threads can be considered as a single thread. If a process has multiple processes, the execution process of the process is not a line (thread, it is done by multiple threads.
3. When running, the system allocates different memory regions for each process, but does not allocate memory for the thread (the resources used by the thread are the resources of the process to which it belongs ), thread groups can only share resources. That is to say, out of the CPU (the thread occupies CPU resources when running), the allocation of hardware and software resources inside the computer is irrelevant to the thread, and the thread can only share the resources of the process to which it belongs.
4. Similar to the process control table PCB, the thread also has its own control table TCB, but the thread state stored in TCB is much less than that in the PCB table.
5. A process is a basic unit for allocating all resources of the system. It has a complete virtual space address and does not depend on threads but exists independently.

 

7. Use an SQL statement to select the average salary of the hr_depart department and sort the personnel characters in a table (the specific table is about salary, part, personnel, and salary.

PS: This question should be wrong. It may be the sorting of people whose salaries are lower than the average salaries of the Department.

Analysis: We thought it was a simple select where orderby statement. It turns out something is wrong. I have been lazy since I discovered that SQL server can use views to automatically generate SQL statements. The last time I wrote an SQL statement, it seems to have been six months ago (why have I been there in the past six months ?). In addition, I usually ask people, or I search for them. It is rare to calm down and construct T-SQL. As a result, my statement must have been wrong, but I still wrote a little bit. I don't know SQL at all!

I will try to create a table in the database later, which is strange.

 

8. Select the smallest number in (Num int (32), but Min and Max are not allowed.

Analysis: At that time, I felt I was not aware of it. Later I thought of a stupid solution. Select the first result in ascending order. Select top 1 from num orderby num DESC.

I did not find a more suitable answer, here there is a garden friends met a more BT, while querying the maximum and minimum: http://www.cnblogs.com/wszhe/archive/2007/07/20/824815.html

It may also be that I have forgotten the question, that is, to check the maximum and minimum values.

 

9. Differences between final, finally, and finallize

Analysis: To be honest, I only saw finally. So I did not answer this question. Okay, I found this is a Java question.

Final -- if a class is declared as final, it means that it cannot generate a new subclass and cannot be inherited as a parent class. Therefore, a class cannot be declared both abstract and final. Declare variables or methods as final to ensure that they are not changed during use. Variables declared as final must be declared with an initial value, which can only be read and cannot be modified in future references. Methods declared as final can only be used and cannot be overloaded.

Finally-The Finally block is provided for troubleshooting to perform any cleanup operations. If an exception is thrown, the matched catch clause is executed, and the control enters the Finally block (if any ). Finalize-method name. Java technology allows you to use the finalize () method to clear objects from the memory before the Garbage Collector clears them. Once the garbage collector is ready to release the space occupied by the object, it will first call its finalize () method, and the memory occupied by the object will be truly reclaimed when the next garbage collection action occurs. It is defined in the object class, so all classes inherit it. Subclass overwrites the finalize () method to sort system resources or perform other cleanup tasks. The finalize () method is called before the Garbage Collector deletes an object. Garbage collection is only related to the memory. Therefore, the finalize () method is used because the C language is used for memory allocation, this occurs mainly when the "local method" is used. The local method adopts the non-Java code method. Currently, the local method only supports C and C ++, in non-Java code, you may call the malloc () function series of C to allocate the bucket, and the bucket will not be released unless the free () function is called.

For more specific research, see: http://blog.csdn.net/yakihappy/archive/2009/03/11/3979759.aspx
Insert advertisement: Google makes our life better ~ \ (^ O ^ )/~ In fact, I should give myself a brick, and I should use Bing.

 

10. Features of object-oriented technology.
Analysis: I don't think I can answer this question. Okay, I'm going to hit a piece of tofu ~ As confidence increases. I answered the following question: inheritance, polymorphism, encapsulation, and hiding. Every day, I wrote a program using object-oriented C #. I forgot its features. It was the treasure of Tao Ge in the garden, "You must know. Net. You don't know? Out ~ Http://www.cnblogs.com/anytao/ wait for me to recall... It seems like a year and a half ago. Ah, a lot of things have passed along with time.
The three basic features of object-oriented are encapsulation, inheritance, and polymorphism. See: http://www.svn8.com/uml/OOAD/uml200907127306.html
Baidu encyclopedia has multiple abstractions. See http://baike.baidu.com/view/1520586.htm? Func = retitle

 

11. Explain what is interrupt weight X. (With the help of Google, the service can be interrupted again ).

PS: You may have missed the question again. Is it a function reentrant. We can see this concept.
Analysis: I don't know, but I didn't answer any questions.
Okay, I cannot even search. Please let me know.

The so-called function is reentrant (or predictable), that is, the same output should be generated as long as the input data is the same.

12. String S = new string ("ABC"); Memory allocated several times.
Analysis: Didn't a friend in the garden encounter this problem during an interview a few days ago? I thought twice (don't "it ")! I hesitated when I wrote the result myself, but I wrote it twice.

After returning home, I asked gray. His answer is as follows: "The stack space is allocated twice. The heap space is not necessarily. There will be intern, and I don't know if the compiler will optimize this sentence, just as it will optimize "" to string. empty "specific allocation:" the first time the stack space is allocated a pointer to "ABC", the second time it is allocated to new string ("ABC ") ah, the Second stack pointer has a name called S. It should be like this:"

Tao GE's book should have, but I have no book now.

 

13. Characteristics of static functions and static variables.

Analysis: What did I think at the time? I think the question should be in C or C ++. But not familiar with it. I had to write the situation in C # That I was familiar.

About C inside this good: http://hi.baidu.com/gtfcugb/blog/item/57b836dd6e11f5e976c638f1.html

 

14. The difference between & and.

Analysis: we saw this two days ago that & is not a short-circuit operation, and & is a short-circuit operator.

This should be okay, right?

 

15.adp.net common objects.

Analysis: I only answered the connection and command objects.

Connection

Command to execute database commands

Dataadapter connects to data, executes database commands, and fills in Dataset

Dataset data cache in memory, Data Structure

Datareader read-only to the forward Database

More detailed can see: http://www.phome.net/document/net/200504/net111246243813950.html

 

The three questions I still remember are other things. I don't even know what filters are. This is not recorded here.

Through this written test, I realized that my focus in the last six months was on fashionable technologies, such as LINQ and WPF, but I was not able to master them well. As a student, the knowledge in books is almost lost, but he is still thinking about how to write the demand analysis, how to write the outline design, how to write the detailed design, and how to do the project. In fact, I should have gone out to find a place for my internship, rather than just doing it myself. Seeing that I was about to graduate from college, I thought I was not confused. As a result, I found that I was still learning in the fog of the cloud. It turned out that I was getting increasingly confused. I don't know where to put my energy.

I haven't posted a home page in the garden for a long time. I remember the first time I came to the blog garden, I was so confused that I was scolded for sending it to my home page, so I never dared to make it happen again. By taking this opportunity, I hope that I can help my colleagues who are about to graduate and are interviewing for a job. By the way, I can share my experience in job interviews. On the other hand, I want to invite the elders in the garden to enlighten me as a young man who is about to step into society. How can we have a good time in this industry. I found myself writing this essay with a good mood, but later I was in a heavy mood.

PS: If you think there is a problem with writing questions like this, I will immediately cancel this essay. Hope there is no problem ~ If you are confused like me, join the group: 30918609 for discussion.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.