Subscribe by Email


Thursday, May 17, 2012

Explain concatenated loops in detail?


Loops as we all know are quite an essential programming constructs in the program that involve solving the complex problems with the repetition of the simple statements. With the loops it has been possible to reduce the drudgery of the programmers and developers of writing the same code again and again innumerable number of times. Everyone is familiar with the three types of loops namely:
   (i)  For loop
   (ii) While loop and lastly
   (iii) The do while loop
Based up on the structure of the loops, they have been categorized as mentioned below:
   (i)  Structured loops and
   (ii) The unstructured loops

There are various kinds of other loops like the nested loops and simple loops. Yet there is one more kind of loops that we are going to discuss in this article namely “the concatenated loops”. Before going to the discussion regarding the concatenated loops let us clear up with the meaning of the concatenation. 

What is meant by Concatenation and Concatenated Loops


- To concatenate means to join two things mostly statements or words or strings together end by end to make them in to one single statement, word or string respectively as the case may be. 
- Concatenated loops are the loops that occur in following to the preceding loop in the code of the program.
- The execution of the next loop begins only after the termination of the previous loop. 
Concatenated loops are usually found to be the independent loops since the number of times they have to be iterated does not depends on the iterations of any other loop.
- They are treated normally as the other simple loops in the sequence.

Guidelines for testing concatenated loops


For testing these loops separate guidelines are followed rather than the simple loops.
- For the first and the last loop in the concatenated sequence, simple loop tests are conducted at the minimum possible values. 
- For the successive loops also the simple loop tests are carried out and keeping minimal values for the upper loops and typical values for the lower loops.
- Loop concatenation along with another looping technique called loop replication is used for increasing the network capacity. 
- The above mentioned approach is to be used only if the concatenated loops are found to be independent loops.
- If they are not found to be independent than the nested approach for testing is to be followed. 
- If there are two concatenated loops say loop 1 and loop 2 and if the loop counter of the loop1 is used as the initial value for the loop 2 or vice versa, then the loops are not said to be independent. 

More about Concatenated Loops


- The concatenated loops are quite easy to maintain as compared to the other types of loops except the simple loops.
- Concatenated loops form the basis of most of the program algorithms.
- The testing of these loops is carried out in accordance with the white box testing techniques. 
- The testing techniques are applied based up on the validity of the loop constructs.
- It depends up on the programmer whether the loops are tested independently or in groups. 
- The following tests can be applied to the concatenated loops:
  1. Skipping of the entire loop
  2. Giving one pass to the loop
  3. Giving m passes to the loop where the m is less than n.
  4. Giving, n, n + 1, n – 1 passes through the loop.
In the third test the n is the number of maximum passes allowed for the loop.


No comments:

Facebook activity