Java Questions & Answers
1. What is the difference between an Applet and an Application?
A Java application is made up of a main() method declared as public static void that accepts a string array argument, along with any other classes that main() calls. It lives in the environment that the host OS provides.
A Java applet is made up of at least one public class that has to be subclassed from java.awt.Applet. The applet is confined to living in the user's Web browser, and the browser's security rules, (or Sun's appletviewer, which has fewer restrictions).
The differences between an applet and an application are as follows:
1. Applets can be embedded in HTML pages and downloaded over the Internet whereas Applications have no special support in HTML for embedding or downloading.
2. Applets can only be executed inside a java compatible container, such as a browser or appletviewer whereas Applications are executed at command line by java.exe or jview.exe.
3. Applets execute under strict security limitations that disallow certain operations(sandbox model security) whereas Applications have no inherent security restrictions.
4. Applets don't have the main() method as in applications. Instead they operate on an entirely different mechanism where they are initialized by init(),started by start(),stopped by stop() or destroyed by destroy().
2. What are java beans?
JavaBeans is a portable, platform-independent component model written in the Java programming language, developed in collaboration with industry leaders. It enables developers to write reusable components once and run them anywhere -- benefiting from the platform-independent power of Java technology. JavaBeans acts as a Bridge between proprietary component models and provides a seamless and powerful means for developers to build components that run in ActiveX container applications.
Java beans is very powerful tool you can use in your servlet/JSP bridge. You can use the servlets to build the bean and can be passed over to the JSP for reading. This provides tight encapsulation of the data while preserving the sanctity of servlets and JSP.
3. What is RMI?
RMI stands for Remote Method Invocation. Traditional approaches to executing code on other machines across a network have been confusing as well as tedious and error-prone to implement. The nicest way to think about this problem is that some object happens to live on another machine, and that you can send a message to the remote object and get a result as if the object lived on your local machine. This simplification is exactly what Java Remote Method Invocation (RMI) allows you to do.
4. What gives java it's "write once and run anywhere" nature?
Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platorm specific and hence can be fed to any platform. After being fed to the JVM, which is specific to a particular operating system, the code platform specific machine code is generated thus making java platform independent.
5. How does Java inheritance work?
A class can only directly extend one class at a time. Multiple inheritance is only allowed with regard to interfaces. A class can implement many interfaces. But a class can only extend one non-interface class.
6. What are native methods? How do you use them?
Native methods are used when the implementation of a particular method is present in language other than Java say C, C++.
To use the native methods in java we use the keyword native
public native method_a()
This native keyword is signal to the java compiler that the implementation of this method is in a language other than java.
Native methods are used when we realize that it would take up a lot of rework to write that piece of already existing code in other language to java.
7. Class A subclass B subclass C. All override foo(). I cast C to A and call foo(). What happens? Can C call A->foo()?
An instance of Class C is of type Class B and A (both). SO you can cast C to A. You CANNOT cast an instance of A to C.
8. What does the "static" keyword mean in front of a variable? A method? A class? Curly braces {}?
-- static variables: These are class level variable whose value remain same irrespective of the number of instances of the class.
-- static methods:
These are those methods that can be called without the need for creating the objects of the class i.e. they are class level methods. They can call only static methods. They cannot refer to "this" as they are not associated with any particular instance.
-- static block: These are called before the main is called and are called only once. Subsequent invocation of the java program containing static block would not call it again. Hence, they can be used to load libraries say in native function call.
-- Only Inner class could be declared as a "static". This declaration suppress the generation of the reference to the outer class object. 这意味着:1)为创建一个static内部类的对象,我们不需要一个外部类对象;2)不能从static内部类对象访问一个外部类对象。
9. How many different types of JDBC drivers are present? Discuss them.
There are four JDBC driver types.
Type 1: JDBC-ODBC Bridge plus ODBC Driver:
The first type of JDBC driver is the JDBC-ODBC Bridge . It is a driver that provides JDBC access to databases through ODBC drivers. The ODBC driver must be configured on the client for the bridge to work. This driver type is commonly used for prototyping or when there is no JDBC driver available for a particular DBMS.
Type 2: Native-API partly-Java Driver:
The Native to API driver converts JDBC commands to DBMS-specific native calls. This is much like the restriction of Type 1 drivers. The client must have some binary code loaded on its machine. These drivers do have an advantage over Type 1 drivers because they interface directly with the database.
Type 3: JDBC-Net Pure Java Driver:
The JDBC-Net drivers are a three-tier solution. This type of driver translates JDBC calls into a database-independent network protocol that is sent to a middleware server. This server then translates this DBMS-independent protocol into a DBMS-specific protocol, which is sent to a particular database. The results are then routed back through the middleware server and sent back to the client. This type of solution makes it possible to implement a pure Java client. It also makes it possible to swap databases without affecting the client.
Type 4: Native-Protocol Pure Java Driver
These are pure Java drivers that communicate directly with the vendor's database. They do this by converting JDBC commands directly into the database engine's native protocol. This driver has no additional translation or middleware layer, which improves performance tremendously.
10. Does Java have "goto"?
Yes and No. There is no "goto" operator used in Java, but it is a reserved keyword, and one can use break statements to branch to a labelled statement, exactly as one would use a goto.
11. Why "bytecode"? Can you reverse-engineer the code from bytecode?
yes, with some tools.
12. How does exception handling work in Java?
1.It separates the working/functional code from the error-handling code by way of try-catch clauses.
2.It allows a clean path for error propagation. If the called method encounters a situation it can't manage, it can throw an exception and let the calling method deal with it.
3.By enlisting the compiler to ensure that "exceptional" situations are anticipated and accounted for, it enforces powerful coding.
4.Exceptions are of two types: Compiler-enforced exceptions, or checked exceptions and Runtime exceptions, or unchecked exceptions. Compiler-enforced (checked) exceptions are instances of the Exception class or one of its subclasses -- excluding the RuntimeException branch. The compiler expects all checked exceptions to be appropriately handled. Checked exceptions must be declared in the throws clause of the method throwing them -- assuming, of course, they're not being caught within that same method. The calling method must take care of these exceptions by either catching or declaring them in its throws clause. Thus, making an exception checked forces us to pay heed to the possibility of it being thrown. An example of a checked exception is java.io.IOException. As the name suggests, it throws whenever an input/output operation is abnormally terminated.
13. Does Java have destructors?
Java does not have destructors. Garbage collector does this job periodically depending upon the memory requirements of the machine and on the fact that a particular object is no longer needed.
But it has finalizers that does a similar job. The syntax is
public void finalize() { }
If an object has a finalizer, the method is invoked before the system garbage collects the object, but using finalize() does not guarantee that it would be called b4 garbage collector is invoked.
14. What does the "final" keyword mean in front of a variable? A method? A class?
A final variable cannot be reassigned, but it is not constant. For instance,
final StringBuffer x = new StringBuffer();
x.append("hello");
is valid. X cannot have a new value in it, but nothing stops operations on the object that it refers, including destructive operations.
Also, a final method cannot be overridden or hidden by new access specifications. This means that the compiler can choose to in-line the invocation of such a method. (I don't know if any compiler actually does this, but it's true in theory.)
The best example of a final class is String, which defines a class that cannot be derived.
15. Access specifiers: "public", "protected", "private", nothing?
Public? Any other class from any package can instantiate and execute the classes and methods
Protected? Only subclasses and classes inside of the package can access the classes and methods
Private? The original class is the only class allowed to execute the methods.
And in case if there is no modifier specified, it means, only the classes inside the package can access this class and its methods, it is also called "Friendly".
面试时最经常被问到的问题(Frenquently asked interview questions)之 Databases 篇
Databases Questions & Answers
1. What are two methods of retrieving SQL?
Answer:
2. What cursor type do you use to retrieve multiple recordsets?
Answer:
3. What action do you have to perform before retrieving data from the next result set of a stored procedure?
Answer: Move the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row. Before you can get to the first row, you would need to Move the cursor down by one row ( For ex: in java the first call to next makes the first row the current row; the second call makes the second row the current row, and so on).
4. What is the basic form of a SQL statement to read data out of a table?
Answer: SELECT * FROM table_name;
5. What structure can you have the database make to speed up table reads?
Answer: The question is not correct. "What structure can you have the database make to speed up table reads?" It is not clear what exactly the term "structure" means in this case. Follow the rules of DB tuning we have to:
1) properly use indexes ( different types of indexes)
2) properly locate different DB objects across different tablespaces, files and so on.
3) Create a special space (tablespace) to locate some of the data with special datatypes( for example CLOB, LOB and ...)
4)...
5)...
6. What is a "join"?
Answer: Joins merge the data of two related tables into a single result set, presenting a denormalized view of the data.
7. What is a "constraint"?
Answer: A constraint allows you to apply simple referential integrity checks to a table. There are 5 primary types of constraints that are currently supported by SQL Server:
PRIMARY/UNIQUE - enforces uniqueness of a particular table column.
DEFAULT - specifies a default value for a column in case an insert operation does not provide one.
FOREIGN KEY - validates that every value in a column exists in a column of another table.
CHECK - checks that every value stored in a column is in some specified list
NOT NULL - is a constraint which does not allow values in the specific column to be null. And also it is the only constraint which is not a table level constraint.
8. What is a "primary key"?
Answer: Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property.
9. What is a "functional dependency"? How does it relate to database table design?
Answer: What functional dependence in the context of a database means is that: Assume that a table exists in the database called TABLE with a composite primary key (A, B) and other non-key attributes (C, D, E). Functional dependency in general, would mean that any non-key attribute - C D or E being dependent on the primary key (A and B) in our table here.
Partial functional dependency, on the other hand, is another corollary of the above, which states that all non-key attributes - C D or E - if dependent on the subset of the primary key (A and B) and not on it as a whole.
Example :
----------
Fully Functional Dependent : C D E --> A B
Partial Functional dependency : C --> A, D E --> B
Hope that helps!
10. What is a "trigger"?
Answer: A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert, update, delete and query statements. Basically, trigger is a set of SQL statements that execute in response to a data modification/retrieval event on a table.
Other than table triggers there are also schema and database triggers. These can be made to fire when new objects are created, when a user logs in, when the database shutdown etc. Table level triggers can be classified into row and statement level triggers and those can be further broken down into before and after triggers. Before triggers can modify data.
11. What is "index covering" of a query?
Answer: A nonclustered index that includes (or covers) all columns used in a query is called a covering index. When SQL server can use a nonclustered index to resolve the query, it will prefer to scan the index rather than the table, which typically takes fewer data pages. If your query uses only columns included in the index, then SQL server may scan this index to produce the desired output.
12. What is a SQL view?
Answer: View is a precomplied SQL query which is used to select data from one or more tables. A view is like a table but it doesn't physically take any space. View is a good way to present data in a particular format if you use that query quite often.
View can also be used to restrict users from accessing the tables directly.
A view otherwise known as a virtual table is a mere window over the base tables in the database. This helps us gain a couple of advantages:
1) Inherent security exposing only the data that is needed to be shown to the end user
2) Views are updateable based on certain conditions. For example, updates can only be directed to one underlying table of the view. After modification if the rows or columns don't comply with the conditions that the view was created with, those rows disappear from the view. You could use the CHECK OPTION with the view definition, to make sure that any updates to make the rows invalid will not be permitted to run.
3) Views are not materialized (given a physical structure) in a database. Each time a view is queried the definition stored in the database is run against the base tables to retrieve the data. One exception to this is to create a clustered index on the view to make it persistent in the database. Once you create a clustered index on the view, you can create any number of non-clustered indexes on the view.
面试时最经常被问到的问题(Frenquently asked interview questions)之Internet Technologies篇
Internet Technologies Questions & Answers
1、 What is HTTP? How does it work (in basic terms)?
HTTP: (HyperText Transport Protocol) The communications protocol used to connect to servers on the World Wide Web. Its primary function is to establish a connection with a Web server and transmit HTML pages to the client browser. Addresses of Web sites begin with an http:// prefix; however, Web browsers typically default to the HTTP protocol. Web browsers communicate with Web servers via the TCP/IP protocol. The browser sends HTTP requests to the server, which responds with HTML pages and possibly additional programs in the form of ActiveX controls or Java applets.
2、 What is a CGI program? How does one get invoked?
CGI(Common Gateway Interface script) A small program written in a language such as Perl, Tcl, C or C++ that functions as the glue between HTML pages and other programs on the Web server. For example, a CGI script would allow search data entered on a Web page to be sent to the DBMS (database management system) for lookup. It would also format the results of that search as an HTML page and send it back to the user. The CGI script resides in the server and obtains the data from the user via environment variables that the Web server makes available to it.
CGI scripts have been the initial mechanism used to make Web sites interact with databases and other applications. However, as the Web evolved, server-side processing methods have been developed that are more efficient and easier to program. For example, Microsoft promotes its Active Server Pages (ASPs) for its Windows Web servers, and Sun/Netscape nurtures its Java roots with JavaServer Pages (JSPs) and servlets
3、 What is the difference between GET and POST methods of submitting form data?
get-- This has a limit as to number of characters that it can pass. In get the request is sent in the the form of a query string from the web browser to the web server. The max. no. of characters that can be passed are 255. Since the request is sent in the query string that is visible in the address bar of the web browser, this method is not suited for passing confidential info. such as passwords/credit card no's etc.
post-- There is no such limit on the no. of characters that can be passed at a time as the request is passed in the body of the message. So this is useful for passing confidential data. Also, one can pass any length of info. to the server.
4、 What is "URL Encoding"?
URL Encoding is a method by which a string is converted into a format which is suitable for HTTP URL.
Example : Server.URLEncode("sitename=imilap")
Results is sitename%3Dimilap. = is converted into characters which can be used in the URL
5、 What is an HTML "entity"?
Character entity references, or entities for short, provide a method of entering characters that cannot be expressed in the document's character encoding or that cannot easily be entered on a keyboard. Entities are case-sensitive and take the form &name;. Examples of entities include © for the copyright symbol and Α for the Greek capital letter alpha.
6、 How can you do a "redirect" to another page?
This is easily achieved using the Meta tag as below
<META HTTP-EQUIV="Refresh" CONTENT="3;URL=http://www.redirect.to.com">
But I think there are 2 aspects of the problem, redirect from the client side or the server side. As to the client side, if we are using VBScript, just call the navigate method of window object is OK, if not, we can set the window object’s location.href property to the URL of the target page. As to the server side, if differs from languages to languages.
7、 What web servers do you have experience with? Apache? IIS?
8、 How does an XML DTD work, and what are some of its limitations?
XML DTD: Extensible Markup Language Document Type Definition. It is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements. A DTD can be declared inline in your XML document, or as an external reference.
The drawbacks of DTD:
1) DTD doesn’t comply with the XML syntax,
2) The data types of DTD is limited,
3) DTD is not extensible,
4) DTD doesn’t support namespace.
9、 What are session variables?
When a user logs in a web site a session is created. Session variables are a variable which remain active throughout this session.
The use of Session variables is to store information pertinent to that particular session. Example: user preferences etc.
10、 What problems do the vendors of ODBC Technology face with ASP/ADO?
ADO 's apartment threaded, and ASP doesn't support threading at all.
The main problem would be locking unnecessarily or dead-locking when multiple requests are made thru the same connection object.
11、 What are the three tags of a form tag in HTML form?
ACTION, METHOD, Target and EncType (encoding type)
12、 What are the two tags for framesets?
Frameset, frame and noframes. Example:
<frameset framespacing="0" border="false" frameborder="0" rows="95,*">
<frame name="banner" scrolling="no" noresize target="contents" src="indianlook_top.html">
<frame name="main" src="http://www.imilap.com">
<noframes>
<p>This page uses frames, but your browser doesn't support them.
</noframes>
</frameset>
13、 How do you create Drop Down Combos in HTML?
Using Select tag. Example:
<select name="gender">
<option value="0" SELECTED>Male</option>
<option value="1" >Female</option>
</select>
14、 In DHTML what is the difference between FontSize and Font Size?
FontSize is a property, Font Size is a style.
15、 What is the tag CodeBase and why do we use it?
After writing and compiling a Java applet, you can display it in a web page by using the APPLET tag. The CODE attribute specifies the name of the Java applet to run. The CODEBASE attribute specifies the subdirectory or folder containing the Java applet. You can use PARAM tags between the <APPLET> and </APPLET> tags to provide information about parameters, or arguments, to be used by the Java applet.
Syntax
<APPLET
CODE="classFileName"
CODEBASE="classFileDirectory"
ARCHIVE="archiveFile"
ALT="altText"
ALIGN="LEFT"|"RIGHT"|"TOP"|"ABSMIDDLE"|"ABSBOTTOM"| "TEXTTOP"| "MIDDLE" | "BASELINE" | "BOTTOM"
HEIGHT="height"
WIDTH="width"
HSPACE="horizMargin"
VSPACE="vertMargin"
NAME="value"
>
<PARAM ...>
</APPLET>
The CODE attribute is required (otherwise there is no applet to run). Netscape Navigator 3 and Navigator 4 can display applets if the WIDTH and HEIGHT attributes are omitted, but some other browsers cannot, so for best results you should always include the WIDTH and HEIGHT attributes.
CODE ="classFileName"
specifies the filename of the applet to load. All Java class files end with a .class extension (for example, myApplet.class). Many browsers will display the applet correctly even if you omit the .class extension in the filename.
CODEBASE="classFileDirectory"
is the directory containing the applet class file and any resources the applet needs. The value is a URL for an absolute or a relative pathname. An absolute URL is used as is without modification and is not affected by the document's BASE tag. A relative CODEBASE attribute is relative to the document's base URL defined by the BASE tag. If the document does not define a BASE tag, it is relative to the directory containing the HTML file.
For short, the code property indicates the Qualified Class Name (including package name), ending with .class or not is both OK; the codebase is the well known classpath!
16、 Walk me through the OSI seven-layer model, then explain at what layer a switch, router and hub all operates.
7. Application layer
6. presentation layer
5. Session layer
4. Transport layer
3. Network layer
2. Datalink layer
1. Physical layer
A hub is a physical layer device providing absolute NO intelligence. A switch is a data link layer device which isolates collision domains vs. routers which isolate broadcast domains, giving each connection to a switch a "private" connecting (no collisions/contention). Think of a switch as a multi-port bridge of sorts, allocation a time slice to each connection, but very quickly.
17、 Describe how DNS works. Describe the difference between a resolver and an authoritative master server.
18、 Describe TCP/IP and it's components. What is ARP/RARP? What does a TCP/IP packet looks like?
Address Resolution Protocol (ARP) performs IP address-to-Media Access Control (MAC) address resolution for outgoing packets.
19、 Describe the process that happens when you click a link in your web browser to fetch another web page.
20、 How would you design the web page for a company that sells screws?
How can you have different number of cells for each row of a table?
Its just sufficient to give the number of column<td> tags within the row tags ... and its fine if the cells are varying within each rows.
Colspan will help you keep the alignment of your overall table, that is avoids the step or zig-zag pattern due to different no. of cells in different rows.
面试时最经常被问到的问题(Frenquently asked interview questions)之Misc. Topics篇
Misc. Topics Questions & Answers
1. Differences between Mac, Windows, UNIX
MacOS (up until osX, anyhow) was single-user and (technically) did not have multitasking capabilites (some people will try to tell you that the mac has "cooperative multitasking", but I wouldn't even cosider that multitasking, since it requires each running program to voluntarily pause and wait for others to run).
Windows, starting with Win95 (*) is a single-user, multasking OS. Although newer versions like XP and 2000 support file permissions via EFS, the DO NOT allow multiple users to be logged in at once. (NEWS: win 2003 support this)
UNIX is 100% multi-user and multitasking, and is therefore (why therefore?) inherently stable, secure, and confusing. Once you go UNIX, though, you'll never go back! UNIX (in all caps) was developed by AT&T waaaay back, Unix (no caps) usually refers to a family of operating systems (including the free-but-overrated Linux) that are based on UNIX. Solaris, BSD, OSF, SCO, and Tru64 are all flavors of Unix.
2.How does Windows programming differ from DOS programming?
Windows – GUI DOS - CUI.
Windows - 32bit O.S Dos is 16 bit O.S.
Windows - multithreading and multitasking O.S Dos is stranger to these concepts.
Traditional dos programming is procedural, meaning that your program starts at one place, and steps through the code sequentially.
Windows programming is event-based, meaning that each time an event (like a button-click) occurs; a handler is invoked to produce a response. The difference can be frustrating, since in event-driven code you can inadvertently have several functions running simultaneously on the same data.
3.What is the advantage of Windows?
GUI, Multitasking, Multithreaded O.S., you can also add: supports a vast variety of devices and has a large base of developers and software.
4.What does winmain and wndproc do?
wndmain is the entry point for a win32 app (like main() would be in a dos/unix app). It is used in almost exactly the same way, except that you pass it a lot of worthless params that your code probably won't use anyhow.
wndproc (aka "window procedure") is a function that will be run by your program to process events that occur within it. The wndproc is specified when you call CreateWindow() and usually consists of several nested switch() statements.
5.How does user input are trapped in Windows?
6.Define and explain COM.
COM is a binary standard on Microsoft (and some UNIX platforms) that enables objects to interoperate in a networked environment regardless of the language in which they were developed or on which computers they reside. COM allows an object to expose its functionality to other components and to host applications. It defines both how the object exposes itself and how this exposure works across processes and across networks. COM also defines the object's life cycle.
7.What is IUnknown and what are its three parts?
IUnknown is the Basic COM interface on which all others are based on.
The Three methods of IUnknown are
1) QueryInterface
2) Addref
3) Release
All the COM interfaces inherit these three methods from IUnknown.
8.What is Marshalling?
Marshalling is the process of converting data into a format for transferring over the network.
9.Differences between Windows 3.1, Windows 95/98, and Windows NT
Windows 3.1 : 16-bit
Windows 9x : 32-bit
Windows NT : 32-bit, more secure, users must login
10.Describe a two tier Windows NT Domain.
11.Describe the file system layout in the UNIX OS.
Bin, boot, dev, etc, home, initrd, lib, lost+found, misc, mnt, opt, proc, root, sbin, tmp, usr, var…
12.In UNIX, are the files allocated contiguous blocks of data?
a) if no, how is the fragmented data kept track of
b) describe the direct blocks and indirect blocks in UNIX file system
13.How is a thread different from a process?
A process runs in its own address space. No two processes share their address space.
Threads will run in the same address space of the process that owns them. Threads belonging to the same process will run in the same address space. They will also share the process's stack and heap. No two processes will share their stacks or their heaps.
14.How is multithreading useful for a web server? A browser?
Web Servers are typically capable of serving multiple clients concurrently, this is achieved using Multi Threading.
15.Why not use multi-process for this? Why would you WANT to run a multi-process web server?
Because if you have a high performance webserver handling thousands of requests, if each of them spawns a new process this creates a lot of overhead. Threads are cheaper.
The reason you use a multi-process web server is for robustness in the face of failure. On a multithreaded server one thread can wipe out all the rest when it crashes the server. In a multi-process server only the offending process goes down. As far as speed is concerned most multi-process servers allow you to spawn at the beginning any number of processes to handle requests so speed differences on a running system are not much different between multi-threading and multi-process servers.
16.What locking constructs are available on platform X (NT = semaphore, critical section, mutex), What are the main differences between them?
17.Familiar with multi-reader, single writer locks?
18.How could you implement that given a simple binary semaphore OS construct?
19.How does this implementation behave? Can it starve readers? Starve writers?
面试时最经常被问到的问题(Frenquently asked interview questions)之General / Fundamentals篇
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=a+b;
b=a-b;
a=a-b;
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.
7. Electrical/Physical
----------------------
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
Network points.
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
& Vice-Versa.
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.
1、项目进入实现(implementation)阶段,发现原计划3个月的开发根本无法完成,你会采取什么措施?
2、做需求交流的时候,你对一个流程不明白,而客户方也不清楚,你该怎么办?
答---------------------
第一个问题:
1)弄清楚现在的处境,项目进行的阶段;
2)弄明白接下来要做的事情,根据实际的需求,通过添加资源就可以完成的添加资源(包括时间和人力),要是添加再多人力无法完成的就砍功能;
3)排定新的计划。
第二个问题:
1)试探性的从客户那里挖掘他真正想表达的东西。
-----------------------
1.确立在项目延期后会给公司超成什么损失,量化损失
我不赞成在项目无法完成的时候增加人力,这会事得其反
深入找到项目延期的问题根源,如果是人力问题,或者是人员问题(人力问题和人员问题是两个不同的问题),或者是其它问题,针对问题进行研究,而且项目合同只有功能,流程的定格,可以在界面,操作上进行简化,提高项目速度
做为项目经理来说,要以技术支持和热情代动Team,把不可能变成可能
2.这个是一个方法问题,如果真面试的时候,再说吧
--------------------------
1.寻找突破口,--集中精力尽量补救 --完成部分组织评审 --未完成部分申请延期
2.进入客户的角色(企业文化/工作环境/思维方式等)-- 换位思考 -- 提出思路进行商讨 ---改进流程--部门调研确认 --修改、结束
------------------------
第一個問題﹕
我記得一個項目真正要做好要管理好九個方面﹕
整合﹐成本﹐溝通﹐視角
質量﹐風險﹐時間﹐人員和涉外采購。
首先找出是哪個環節出了問題﹐然后對症下藥。
其次勇敢說NO﹐對于主要的勇敢說YES。
第二個問題﹐
1搞清楚為什么他不清楚這個需求
2做模型或者提問題匯總需求或者轉換SCOPE
-------------------------------
我当时的回答是:
1、如果没有什么别的办法,就只好砍功能了。我们都知道软件开发中的二八原理,即主要的80%的功能是20%的代码完成的,其他的80%的代码一般是实现一些辅助的功能。因此我们可以想办法在这80%中想办法看看能不能砍。(面试的一听就乐了,连连点头。我心里想:靠,地道的JS!)
2、这是需求分析中常常遇到的问题。我一般的处理方法是冷处理,即如果客户不知道,引导了也不知道,那就干脆放一放,把其他的他清楚的地方做完了再说。就象我们画画,可以先勾勒出轮廓,轮廓出来了,细节就比较好处理。(面试的听了只点头,我心里想:靠,应当找你收学费的!)