面试时最经常被问到的问题（Frenquently asked interview questions）之General / Fundamentals篇
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
General / Fundamentals Questions & Answers
1． How would you redesign an ATM?
--ATM machine would "eat" your card if you give "three strikes" failure. This is what I hate the most. So I would add a feature so that a user could regain the card. For example, let user have way to add a secrete question and answer to that question.
--I would eliminate the need for a physical card an opt for some kind of biometric id such as a retinal scan or some such.
--I would orient the display to eliminate the opportunity for overlookers to view it - ie. make it horizontal like a table.
--I would eliminate the masking of account information behind names such as 'checking', 'savings', etc. and ensure that at least the balances are always displayed. This would help eliminate a good deal of 'you don't have enough funds'-type msgs.
--Add an Undo capability where appropriate, i.e. for transfers/deposits. It would also negate any costs associated with the original transaction.
--Remember the most common transactions done by the user and make them macros automatically.
--I would add a way for the system to intermingle different languages during the transaction. This way, you could learn how to take out money in foreign languages while you were at the bank machine. Cool.
--Some possibilities are: security, user interface, user privacy, minimize datacom traffic, make ATM cheaper to build/program. Like all engineering, it's a matter of balancing tradeoffs. If we were optimizing for user interface, the first thing to do is to analyze what we're doing to annoy current users and stop doing that (application of basic Hippocratic Oath "above all do no harm"). One basic UI problem I've noticed with many ATMs is that the keyboard is not near the screen. Users need to keep shifting eye focus. This change might make ATMs more expensive to build... so we're back to making engineering tradeoffs.
2．What is a balanced tree?
A binary tree is balanced if the depth of two subtrees of every node never differs by more than one, can also be called AVL trees.
3．How would you decide what to test for given that there isn't enough time to test everything you want to?
--Prioritize what you want to test, in the order,
.whether is taking right input and giving right output,
.whether all the output conditions expected are meet,
.which really can crash the system, checking the boundary conditions
.which really annoy the user, hanging etc.
.Which can cause loss of data, like memory corruption, memory leaks etc?
--Use the requirements to dictate your tests. If your product satify the requirments, then you can ship it. That's how they do it a MS. :-)
--If you are a tester, ask the developer or the manager for more time or simply automize a part of testing so that multiple parts of the system can be tested in parallel. The product should and cannot be shipped without complete testing.
-- The goal of any project is to test the entire code base, but in reality that doesn't always happen. In many cases a 'ship date' is dictated and changing it, to allow more testing, is not in a company's best interests. The quality of a product is a factor similar to features and resources required. Testing for most products should be prioritized the same way features are.
So, automate as much as possible and ensure that the most important features are tested.
4．What is Lex? Yacc? What are they used for?
5．Tell me about fundamentals of RPC.
Remote Procedure Call (RPC) is a protocol that one program can use to request a service from a program located in another computer in a network without having to understand network details. (A procedure call is also sometimes known as a function call or a subroutine call.) RPC uses the client/server model. The requesting program is a client and the service-providing program is the server. Like a regular or local procedure call, an RPC is a synchronous operation requiring the requesting program to be suspended until the results of the remote procedure are returned. However, the use of lightweight processes or threads that share the same address space allows multiple RPCs to be performed concurrently.
When program statements that use RPC are compiled into an executable program, a stub is included in the compiled code that acts as the representative of the remote procedure code. When the program is run and the procedure call is issued, the stub receives the request and forwards it to a client runtime program in the local computer. The client runtime program has the knowledge of how to address the remote computer and server application and sends the message across the network that requests the remote procedure. Similarly, the server includes a runtime program and stub that interface with the remote procedure itself. Results are returned the same way.
6．Tradeoff between time spent in testing a product and getting into the market first.
-- In Microsoft’s case. Ship it out. Who cares about bugs...just fix it in the next release.
-- I think it depends more on the market situation...many a times, in the hi-tech market, you are going to be able to sell only if u are the first guy out with the product. It is really really important to be the market pioneer. If the market demands it, u better get the product out and ask the developers and testers to go to hell. Getting a prototype of the product into the market is the least you can do. At the same time if you can afford the time (no pressure from competitors, new entrants, substitute products or buyers) then do as much as testing as possible.
The balance between testing and the release should totally depend on the market!
7．You're part of the QA team for a large web-site. You want to create as much automated testing as possible. What could/would you test? How? How much maintenance would these tests require as the web site changes?
I would write automated tests that do the following:
1. A poller that just checks to see if the site is up and running.
2. A test that pushes a lot of test data to the site and measure time taken for push.
3. A test that pulls a lot of test data from site and measure time taken.
4. Programatically invoke applets, ActiveX controls and verify results of operation.
5. Simulate a multiple user scenario and stress out the web site, determine its breaking point.
8．What would be your language of choice for implementing CGI programs on a web server? Why?
I think Perl has extremely flexible and not a strict language by any means. Ideal for quick and dirty (?) web applications.
9．How do you multiply a variable by 16 without using the multiplication operator '*'?
10．How do you swap two integers without using any extra memory?
a becomes (a XOR b)
b becomes (b XOR a)
a becomes (a XOR b)
// only when b <> 0
a = a * b;
b = a / b;
a = a / b
11．What was the most difficult program you had to write?
12．Describe the most interesting software project you've done in school.
13．Name 7 layers of OSI models and define their functionality.
Responsible for defining various Electrical standards, like standardized Cables, Bit Stream Standards etc, to be used while communicating between HOSTS (Computers).
6. Link Layer
Responsible for Encoding & subsequent
De-Coding of Data Packets at various
5. Network Layer
Responsible for providing LOGICAL paths for
Data packets to pass through. It basically
provides SWITCHING & ROUTING facilities.
4. Transport Layer
Responsible for TRANPARENT flow of data
between HOSTS (Computers), without due
consideration to HARDWARE details. This
layer is not concerned as to which
applications are sharing data; rather it
is only concerned with TRANSFERRING
DATA PACKETS FROM ONE POINT TO ANOTHER-
3. Session Layer
Responsible for maintaining a REGISTRY of
all currently active connections from
various HOSTS (Computers).
2. Presentation Layer
Responsible for isolating different Data
formats from each other. Ex.: Encryption
process involves the AUTOMATIC conversion
of Application data Format to Network Format
1. Application Layer
Responsible for END-USER friendly protocols,
like HTTP, FTP, TELNET etc. Software
Developers directly interact with this
layer of protocol to write programs.