Sunday, May 19, 2013

Testing FAQ

1. What is Black box testing?
Answer: Black box testing is the testing of requirements and functionality without knowledge in internal content. Inputs are fed into the system and outputs are determined expected or unexpected
 2. What is white box testing?
Answer: White box testing is testing based on knowledge of the internal logic (algorithms) of an application’s code. Its an approach that attempts to cover the software’s internals in detail. White box testing is also known as ‘glass box testing’, ‘clear box testing’, ‘transparent box testing’ and ‘structural testing’
 3. What is grey box testing?
Answer: Grey box testing uses a combination of black and white box testing. Grey box test cases are designed with knowledge of the internal logic (algorithms) of an application’s code but the actual testing is performed as black box. Alternately a limited number of white box testing is performed followed by conventional black box testing
 4. What is unit testing?
Answer: Unit testing is the testing of the smallest units of code such as functions. Typically unit testing is performed by the developer and not by testers. It requires knowledge of the internal program’s organization and code. Unit testing may not be easily performed as independent testable components may be difficult to isolate for testing. Some unit testing may require building a driver module to be built. Typically unit testing documentation is minimal if it is documented at all. Unit testing is also known as component testing
 5. What is integration testing?
Answer: Integration testing consists of integrating components (units) of a software design to verify that the components are working well together. Typically tested software modules (units) are integrated progressively until the entire integrated system (software design) is complete
 6. What is system testing?
Answer: System testing verifies that an integrated system (independent of third party systems) meets requirements.
  7. What is System integration testing?
Answer: System integration testing verifies the satisfactory integration of the completed and tested system with external systems (if any).
 8. What is regression testing?
Answer: Regression testing consists of testing for software regressions. Typically regression testing is performed after changes have been made to a preciously released version of the software. The point is to discover any knock on effects (side effects) of having modified the software. Modifications to a system can produce collateral damage such as conflicts within the system, performance issues or reemergence of old previously closed bugs.

9. What is acceptance testing?
Answer: Acceptance testing is typically by the customer performed usually on site on their designated test system. Acceptance testing is also known as user acceptance testing (UAT). Typically this is the last phase of testing before the software is released to the client,
11. What is a trace-ability matrix?
Answer: A trace-ability matrix is a document cross referencing requirements and test points in a test case. The point is the have sufficient test cases to cover all of the requirements
12. What is a Moscow list?
Answer: MoSCoW is an acronym for Must, Should, COuld, Would. It essentially is a priority checklist. When discussing system requirements with the users a MoSCoW list may be used to help prioritize requirements to determine which are most critical.
13. What is a smoke test?
Answer: A smoke test is a quick and dirty test to determine quickly the status of a system. It is used to reveal simple failures severe enough to reject a prospective software release. The smoke test once successful is followed by further testing,
14. What is stability testing?
Answer: Stability testing is performed to determine if a software system is stable over time. Typically a period of time is targeted. A memory leak is a an example of the type of problem that could destabilize a software system over time.
15. What is Usability testing?
Answer: Usability testing consists of testing that the user interface (GUI) is simple to understand , intuitive , consistent and optimized for power users.

16. What is security testing?
Answer: Security testing consists of determining if the system authentication is functional, the system protects data and the system is resistant to hackers
17. What is Scalability testing?
Answer: Scalability testing consists of determining if the system can be scaled up in terms of load supported, the number of transactions, the data volume etc. This can also be classified as performance testing and non-functional testing
18. What is Reliability testing?
Answer: Reliability testing consists of determining the ability of a system or component to perform its required functions under stated conditions for a specified period of time. This can also be classified as performance testing and non-functional testing
19. What is compatibility testing?
Answer: compatibility testing consists of determining the application’s compatibility with the computing environment. Is the application compatible with the hardware (PC, Mac, IBM 360) , peripherals (printer, modem, scanner), operating system (UNIX, Linux, Windows 7, Windows vista), database (oracle, sql server), browser(Firefox ,Opera IE) etc.. This can also be classified as non-functional testing
20. What is Concurrency testing?
Answer: Concurrency testing consists of determining if the system can successfully handle concurrent threads and users. Testing with concurrent users might also include testing concurrent access to a database row.
21. What is Code coverage?
Answer: Code coverage consists of determining percentage of a system’s code that is being verified by a test(s).
22. What is a Sprint?
Answer: A Sprint is the basic unit of development in Agile Scrum development. It is a time box of effort directed towards a specific goal which is a subset of a greater effort and goal. A typical sprint lasts about 3-4 weeks

23. What is a Test stub?
Answer: A test stub is an bit of code that replaces an undeveloped or fully developed component within a system being tested. The test stub is built such that it mimics the actual component by generating specific known outputs. The stub can be used as a substitute for the actual (fully developed) component for testing purposes. The stub can also be used during testing to isolate system components and troubleshoot problems. A test stub is also known as a test double.
  
24. What is a Test-Driven Development (TDD) ?
Answer: Test-Driven Development (TDD) is a development methodology whereby the developer writes a unit test as a starting point and then writes code that will allow the test to pass. The development of the entire system proceeds one test at a time. Further Info: Test-Driven Development (TDD)
 25. What is a story board ?
Answer: A Story board is a visual representation of a software project’s progress. There are generally four columns ‘To do’, ‘In Progress’,'Test’,” and ‘Done’. Different colored post It notes are placed in each column indicating the progress of individual development items. A story board is typically used in agile development.
  26. What is a Release candidate ?
Answer: A Release candidate is a build or version of a software that can be released to production. Further testing such as UAT may be performed on this version of the product.
 27. What is Re-factoring ?
Answer: Re-factoring is modifying existing code to improve its performance, readability,extensibility etc. The code’s functionality remains as is .
 28. What is an epic ?
Answer: An epic is an agile term for a customer described software feature that is itemized in the product backlog. Epics are subdivided into stories.
 29. What is functional test ?
Answer: A functional test is a type of black box test that based on the specifications of the software object being tested. Functions are tested by inputting known values and examining the output
 30. What is a business facing test ?
Answer: A business facing test can be explained in terms recognizable the subject matter expert using words from the business domain. Example: when an item is placed in cart the sales tax is automatically added. Technology facing tests in contrast can be explained in technical terms not necessarily understood by the subject matter expert. When an item is purchased a cookie is set on the client computer.
 32. What is a use case ?
Answer: A use case is a software modeling technique. A description or a diagram (use case diagram) of a user’s (actor) useful actions on a theoretical software system is created for the purpose of modeling the the software . A useful action is one that achieves a specific goal. Further Info: Use case

What is UML ?
Answer: UML is an acronym for Unified modeling language. UML is a graphical Object oriented software modeling language.The visual models or artifacts include but are not limited to: sequence diagram, activity diagram, class diagram, object diagram, use case diagram, state machine diagram Further Info: UML

34. What is a boundary testing ?
Answer: Boundary testing also known as boundary value analysis is verifying the upper (and just above) and lower (and just below) limits of the input domain. A boundary value analysis test case would input into a function, values that meet the above mentioned criterion

Wednesday, April 10, 2013

difference between options and futures

The main fundamental difference between options and futures lies in the obligations they put on their buyers and sellers. An option gives the buyer the right, but not the obligation to buy (or sell) a certain asset at a specific price at any time during the life of the contract. A futures contract gives the buyer the obligation to purchase a specific asset, and the seller to sell and deliver that asset at a specific future date, unless the holder's position is closed prior to expiration.

Another key difference between options and futures is the size of the underlying position. Generally, the underlying position is much larger for futures contracts, and the obligation to buy or sell this certain amount at a given price makes futures more risky for the inexperienced investor.

Monday, April 8, 2013

Future

A Future is an exchange-traded derivative which is similar to a forward. Both futures and forwards represent agreements to buy/sell some underlying asset in the future for a specified price. Both can be for physical settlement or cash settlement. Both offer a convenient tool for hedging or speculation. For little or no initial cash outlay, both instruments provide price exposure without a need to immediately pay for, hold or warehouse the underlying asset. In this sense, both instruments are leveraged. Futures and forwards trade on a variety of underlies: wheat, oil, live beef, Eurodollar deposits, gold, foreign exchange, the S&P 500 stock index, etc.
The fundamental difference between futures and forwards is the fact that futures are traded on exchanges. Forwards trade over the counter. This has three practical implications.

forward contract

 A forward contract—or forward—is an OTC derivative. In its simplest form, it is a trade that is agreed to at one point in time but will take place at some later time. For example, two parties might agree today to exchange 500,000 barrels of crude oil for USD 42.08 a barrel three months from today.
A forward contract is specified with four variables:
the underlier,
the delivery price k, and
the settlement date on which the underlier and payment will be exchanged.
 
In Above example, oil is the underlier. The notional amount is 500,000 barrels. The delivery price is USD 42 per barrel. The settlement date is the actual date three months from now when the oil will be delivered in exchange for a total payment of USD 21.04MM.
The party who receives the underlier is said to be long the forward. The other party is short.

REPO And Reverse Repo

A repurchase agreement (or repo) is an agreement between two parties whereby one party sells the other a security at a specified price with a commitment to buy the security back at a later date for another specified price
Most repos are overnight transactions, with the sale taking place one day and being reversed the next day. Long-term repos—called term repos—can extend for a month or more. Usually, repos are for a fixed period of time, but open-ended deals are also possible.
 Reverse repo is a term used to describe the opposite side of a repo transaction. The party who sells and later repurchases a security is said to perform a repo. The other party—who purchases and later resells the security—is said to perform a reverse repo.

derivative

A derivative instrument (or simply derivative) is a financial instrument which derives its value from the value of some other financial instrument or variable. For example, a stock option is a derivative because it derives its value from the value of a stock. An interest rate swap is a derivative because it derives its value from one or more interest rate indices. The value(s) from which a derivative derives its value is called its underlier(s).
By contrast, we might speak of primary instruments, although the term cash instruments is more common. A cash instrument is an instrument whose value is determined directly by markets. Stocks, commodities, currencies and bonds are all cash instruments. The distinction between cash and derivative instruments is not always precise, but it is a useful informal distinction.

SWAP


A swap is an agreement between two counterparties to exchange two streams of cash flows—the parties "swap" the cash flow streams. Those cash flow streams can be defined in almost any manner. All that matters is that their present values be equal. Their fundamental purpose is to change the character of an asset or liability without liquidating that asset or liability.
 When a swap is first entered into, it has zero market value. This is because both cash flow streams have identical, offsetting market values. As time goes by, the swap is likely to take on a positive or negative market value. This may happen for one or two reasons:
Market variables that affect the market values of one or both cash flow streams will fluctuate, causing the values of the cash flow streams to change.
One cash flow stream may have more accelerated payments than the other, so the swap takes on a positive market value for the party making the more accelerated payments. An extreme case of this is some customized swaps that require one party to make a substantial payment right at the outset.
A swap is a cash-settled OTC derivative under which two counterparties exchange two streams of cash flows. It is called an interest rate swap if both cash flow streams are in the same currency and are defined as cash flow streams that might be associated with some fixed income obligations.
The most popular interest rate swaps are fixed-for-floating swaps under which cash flows of a fixed rate loan are exchanged for those of a floating rate loan.

OPTION

An option is a contract, or a provision of a contract, that gives one party (the option holder) the right, but not the obligation, to perform a specified transaction with another party (the option issuer or option writer) according to specified terms. The owner of a property might sell another party an option to purchase the property any time during the next three months at a specified price.
Option contracts are a form of derivative instrument. Stand-alone options trade on exchanges or OTC.
Options take many forms. The two most common are:
call options, which provide the holder the right to purchase an underlier at a specified price;
put options, which provide the holder the right to sell an underlier at a specified price.
The strike price of a call (put) option is the contractual price at which the underlier will be purchased (sold) in the event that the option is exercised. The last date on which an option can be exercised is called the expiration date. Options may allow for one of two forms of exercise:
With American exercise, the option can be exercised at any time up to the expiration date.
With European exercise, the option can be exercised only on the expiration date.
 

A third form of exercise, which is occasionally used with OTC options, is Bermudan exercise. A Bermuda option can be exercised on a few specific dates prior to expiration. Yes, the name was chosen because Bermuda is half way between America and Europe.

Tuesday, March 19, 2013

stack unwinding

“When an exception is thrown and control passes from a try block to a handler, the C++ run time calls destructors for all automatic objects constructed since the beginning of the try block. This process is called stack unwinding. The automatic objects are destroyed in reverse order of their construction.
If an exception is thrown during construction of an object consisting of subobjects or array elements, destructors are only called for those subobjects or array elements successfully constructed before the exception was thrown. A destructor for a local static object will only be called if the object was successfully constructed.
If during stack unwinding a destructor throws an exception and that exception is not handled, the terminate() function is called.”

Stack Unwinding

program looks to see if the exception can be handled immediately (which means it was thrown inside a try block). If not, it immediately terminates the current function and checks to see if the caller will handle the exception. If not, it terminates the caller and checks the caller’s caller. Each function is terminated in sequence until a handler for the exception is found, or until main() terminates. This process is called unwinding the stack

Monday, March 18, 2013

Shared pointers ,Smar Pointer

Shared pointers (std::shared_ptr) implement shared pointer ownership — they keep the object alive as long as there are alive references to it, because there is no single owner. It's usually done with reference counting, which means they have additional runtime overhead as opposed to unique pointers. Also reasoning about shared ownership is more difficult than reasoning about exclusive ownership — the point of destruction becomes less deterministic.
  
Shared pointers are slightly more costly as they hold a reference count. In some case, if you have a complex structure with shared pointer at multiple recursive levels, one change can touch the reference count of many of those pointers.
Also in multiple CPU core architectures, the atomic update of a reference count might become not slightly costly at least, but actually really costly, if the multiple core are currently accessing the same memory area.
However shared pointers are simple and safe to use, whereas the assignment properties of auto pointers is confusing, and can become really dangerous.

Smart pointers usually is frequently used just as a synonym of shared pointer, but actually covers all the various pointers implementation in boost, including the one that's similar to shared pointers.

Smart pointer is a term that encompasses all types that behave like pointers, but with added (smart) semantics, as opposed to raw T*. Both unique_ptr and shared_ptr are smart pointers.

new operator vs operator new

The method for dynamically allocating memory is to use the new operator. This operator can be overloaded. To distinguish between the default operator and an overloaded version, the default is called “new operator” and the overloaded version is called “operator new”

The new operator calls a function to perform the requisite memory allocation, and you can rewrite or overload that function to change its behavior. The name of the function the new operator calls to allocate memory is operator new.

The new operator: C++ supports dynamic allocation of objects using the new operator. The new operator allocate memory for objects from a pool called the free store. The new operator calls the special function operator new.

operator new: If the request is for zero bytes of storage, operator new returns a pointer to a distinct object (that is, repeated calls to operator new return different pointers). If there is insufficient memory for the allocation request, operator new returns NULL or throws an exception. The first argument to operator new must be of type size_t (a type defined in STDDEF.H), and the return type is always void *.
When do you call copy constructors?
Copy constructors are called in these situations:
i.)when compiler generates a temporary object
ii.)when a function returns an object of that class by value
iii.)when the object of that class is passed by value as an argument to a function
iv.)when you construct an object based on another object of the same class

Name the implicit member functions of a class.

i.) default ctor
ii.) copy ctor
iii.) assignment operator
iv.) default destructor
v.) address operator

Explain storage qualifiers in C++.

i.) Const - This variable means that if the memory is initialised once, it should not be altered by a program.
ii.) Volatile - This variable means that the value in the memory location can be altered even though nothing in the program code modifies the contents.
iii.) Mutable - This variable means that a particular member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant.

Explain dangling pointer.

When the address of an object is used after its lifetime is over, dangling pointer comes into existence. Some examples of such situations are: Returning the addresses of the automatic variables from a function or using the address of the memory block after it is freed.

In what situations do you have to use initialization list rather than assignment in constructors.

When you want to use non-static const data members and reference data members you should use initialization list to initialize them.

When does a class need a virtual destructor?

If your class has at least one virtual function, you should have a virtual destructor. This allows you to delete a dynamic object through a baller to a base class object. In absence of this, the wrong destructor will be invoked during deletion of the dynamic object.

What is the type of “this” pointer? When does it get created?

It is a constant pointer type. It gets created when a non-static member function of a class is called.

Explain Stack unwinding

Stack unwinding is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.

Program to an interface, not an implementation

Programming to Interfaces rather than concrete implementations is a good design practice.

While developing an application we will divide the whole system into sub-systems and one sub-system will talk to other sub-system to complete the whole task.
Each sub-system is separated in such-way that it should be responsible for certain kind of tasks.

So when you design the architecture of a system, first we need to divide the whole system into several sub-systems and we need to clearly define the responsibilities of each sub-system without bothering about how to implement those responsibilities. In this way we develop a prototype/blueprint of our system to be developed.

Once we have a prototype, then we need to turn these design into coding. To do this we need to use Interfaces rather than classes as we don't know the actual implementations.
And also this approach will expose the contract between the sub-systems on how to interact with each other.

Exception Handling

An exception is a problem that arises during the execution of a program. A C++ exception is a response to an exceptional circumstance that arises while a program is running, such as an attempt to divide by zero.
Exceptions provide a way to transfer control from one part of a program to another. C++ exception handling is built upon three keywords: try, catch, and throw.
  • throw: A program throws an exception when a problem shows up. This is done using a throw keyword.
  • catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.
  • try: A try block identifies a block of code for which particular exceptions will be activated. It's followed by one or more catch blocks.
Assuming a block will raise and exception, a method catches an exception using a combination of the try and catch keywords. A try/catch block is placed around the code that might generate an exception.

Exceptions can be thrown anywhere within a code block using throw statements. The operand of the throw statements determines a type for the exception and can be any expression and the type of the result of the expression determines the type of exception thrown.