Tuesday, January 10, 2012

All You Can Expect In A TCL Interview

TCL is an easy to learn language that has a number of features and it can be used for a wide range of applications. The most common one is the automation. It can be used with expect to create interactive applications, where we send the commands to the command line, expect an output and evaluate the output using TCL via scripts.

Having a base in any programming language will help you learn TCL quickly. But this is not mandatory because most of the commands in TCL are simple and self explanatory. This post is meant for aspiring engineers who wish to work in a TCL automation project. This post would be useful especially for people who have started attending interviews and trying hard to get into this field.

To be honest, there are very few people who know TCL here in this industry. This is because the developers who are good at programming go for usual stuff like C, C++, Java etc. Testers are mostly manual testers who always develop a fear for programming. The concept of automation is something that bothers the testers as they consider it is as a very difficult task. As a result of all these attitudes, we have very less people for TCL automation but there are quite a lot of opportunities.

A little bit of practice is more than enough to get into a TCL automation project. Most of the requirements would say, “Should be good at TCL/TK. Knowledge of networking is preferred”. So going through the basics of networking would definitely help. One month before you start attending interviews, start taking notes of OSI layers from the net or from good networking books. This would be useful for you to brush up the concepts on the previous day of the interview. Have a clear cut idea about the layers, what they do and the protocols they use. Difference between TCP and UDP is a standard question in any networking interview. A detailed and crispy answer to this is available here:

http://networkinterviewquestionsandanswers.blogspot.in/2012/08/difference-between-tcp-and-udp-best.html

Since it involves testing, some of the testing questions can be asked. Eg:

1. Difference between black box and white box testing.
2. Who does white box testing(Developers or testers)?
3. Is unit testing white box or black box?
4. Difference between regression and re-testing
5. Why is testing essential for a project? What is the significance of testing?
6. Name a critical bug that you had raised in your project that was appreciated?

The answers to the above questions are available here

http://tclinterviewquestions.blogspot.com/2011/12/answers-to-questions.html

Now we will come to the important part where most of the questions will be asked i.e TCL. If the interviewer is not a TCL person (though it does not happen mostly) the expected questions would be:

1. Write down all the list commands and explain what they do?
2. Write down all the string commands and explain what they do?
3. Write a regexp to match an ip address.(very common question)
4. Write the syntax of “for” and “if” loops?

If the interviewer is a TCL person, the questions might be:

1. Write a regexp to match an ip address?
2. How do you pick each part of the ip address and place them in separate variables?
3. What do these signify (. * ? +) in regexp?
4. What is command substitution, variable substitution and backslash substitution?(very common question)
5. Difference between using curly braces and quotes in TCL?
6. Convert a string into a list.
7. Convert a list into a string.
8. Write a program to reverse a string.
9. Find the length of a string without using “string length” command.
10. What are your strong areas in TCL?(string, list regexp etc..)
11. What is upvar and uplevel in TCL?
12. Write a program to connect to a system and to login using EXPECT script?

Answers to some of these questions are available here. Planning to post the remaining as well.

http://tclinterviewquestions.blogspot.in/2012/01/answers-to-tcl-interview-questions.html

Hope this post was useful for aspiring engineers. All the best everyone!
If you require answer for any of these questions, feel free to leave a comment.

Programs
1. Find the length of a string without using string length command


set s "Arun"
set len 0
foreach item [split $s ""] {incr len}
puts "The length of the string is : $len"

In the above program, a string is converted to a list [split $s ""] and then for each letter in the word (element in the list) the variable len is incremented until it reaches the end. Thus len contains the string length.



List Command:
List command returns a list comprising of all the arguments specified.

Syntax:
list arg1 arg2....

Example:
list a b "c d e  " "   f { g h }"
returns : a b {c d e } {  f {gh} }
======================================================================
Lappend Command:
lappend command treats var1 as a list and appends all the values to the list with a space between elements. If var1 does not exist then a new list called var1 is created with the elements value1, value2, value3 etc.

Syntax:
lappend var1 value1 value2 value3...
set var1 1
1
lappend var1 2
1 2
lappend var1 3 4 5
1 2 3 4 5
======================================================================
 
Easiest Example To Explain Upvar Command

Usage:

Used when we have to change the value of a global variable from inside a procedure’s scope

Example
proc example {one two} {
upvar $one local1
upvar $two local2

set local1 Kavitha
set local2 Anbarasu

}

set glob1 David
set glob2 Beckam

puts $glob1
puts $glob2\n

example glob1 glob2

puts $glob1
puts $glob2

Output
David
Beckam

Kavitha
Anbarasu

In the above example we are able to change the value of two global variables glob1 and glob2 from within a procedure

======================================================================
regsub Command Usage


Regsub Usage

Replaces a value with a given value

Syntax:
regsub “”  $string “


Example:

set string "My name is Kavitha"

regsub "Kavitha" $string "Mythri" name2
puts "$name2"

Output

My name is Mythri

======================================================================

:? Command Usage

Usage:

?: is used in sub patterns in a regexp
When ever you don’t want a particular subpattern to be included as a sub-pattern use “?:” in front of the sub-pattern

Example:

set string "Projects: Brocade Cisco Fujitsu"

regexp "Projects: (Brocade|Cisco) (?:Fujitsu|Juniper|Cisco) (Fujitsu|Juniper)" $string sub1 sub2 sub3

puts "$sub1\n$sub2\n$sub3\n"

In the above example, the output will be

Projects: Brocade Cisco Fujitsu
Brocade
Fujitsu

The pattern “Cisco” does not come under sub pattern as “?:” is given

The output without ?: would be


Projects: Brocade Cisco Fujitsu
Brocade
Cisco

======================================================================

Different String Commands In TCL

set one “np”
set two “gqaxbnp”
puts [string compare $one $two]
puts [string length $one]
puts [string index $two 2]
puts [string first $one $two]
puts [string last $one $two]

o/p:
1
2
a
5
5

To Know More About What Happens in a TCL Network Testing Project and the Issues Faced And Their Resolutions Refer The Below url

http://tclautomationnetworktesting.blogspot.in/



==================================================
Though it is not relevant, just an addition information on a different subject :)
To know about taking care of babies click here

http://kavitha-allaboutbabies.blogspot.in

==================================================

Thursday, December 1, 2011

General Interview Tips

For any interview, the first thing to prepare is the resume. It creates an impression about you even before meeting you. Make it look neat, short and crisp. Do not leave the achievements column blank. Write a brief overview about your previous projects. Do not boast, but make diplomatic statements that will show that you are capable.

Next would be your appearance. Neatly pressed formal clothes would be mandatory for an interview. Be confident when you approach the interviewer. Never show your nervousness out. Be very honest when you answer the questions. Always be ready to say “I am not aware of this” when you don’t know something (But not for all the questions ofcourse! :)). Never give wrong answers. Listen carefully and understand the questions. Prepare well to talk all about your project and your role that you have stated in your resume. Do not say anything negative about your current employer. Be very clear with your concepts and never mess up with that.

TCL Tutorial


If you are beginner in TCL and would like to teach yourself this simple language, you can do it using a tcl tutor. You need not buy expensive books or search the net for online materials to learn the language. All you have to do is, download tcl tutor from the below link and start working on it from the first chapter

https://tcltutor.software.informer.com/3.0/

TCL tutor is designed in such a way that you can learn concepts and keywords from the chapters listed in the tutor and at the same time execute them and look for the output. Sample code will be available in each chapter which can be executed and you can also write your own code and try to execute it and look for the output.

To start with, beginners can go through the tutor chapter by chapter and execute them and understand the concepts. Experienced programmers working on TCL projects can also use this tutor. You can go to the particular concept or keyword that you have problem with, and refer the tutorial. You can also copy paste your piece of code that you have an issue with and execute them in the tutor to find out the flow and locate your mistake. TCL is mostly used for automation testing and hence if you are stuck up with a particular line in the script due to syntax errors or any other issues, you can verify them using the tutor and then make changes accordingly and then go for the next execution, instead of running the whole script again to find another syntax error in some other line! This way it is a big gift for TCL programmers.

Some Useful Links To Refer Before Attending Software Testing Interviews

Testing Interview Questions And Answers

These are the answers to the "software testing" questions:-

1. Difference between black box and white box testing.
Black box Testing:

Black box testing is the testing where the tester is unaware of the code and structures inside the application that is tested. The tester knows only the valid inputs supplied and the expected outputs corresponding to those inputs. If the expected result is not obtained, the tester files a bug.

White Box Testing:

White Box testing is one where the tester is aware of the internal code flow and structures and he tries to test if all the modules are hit properly when different inputs are supplied. In most cases developers perform the white box testing as they are aware of the modules they have created.

2. Who does white box testing(Developers or testers)?
Black box testing is performed by testers
White box testing is mostly performed by developers

3. Why the name 'black box' and 'white box' testing?

If we look at the application as a single box, in the case of black box testing, the tester is unaware of the code structures inside and hence the application looks like a black box to him with just the input going into it and the output that is expected to come out of it.

In the case of a white box testing, the tester (in fact the developer) knows the application in and out including the code structures. So the applications looks like a white transparent box to him, where he can see the modules in it and test if all the modules are hit properly and the code is optimized.

4. Is unit testing white box or black box?
Testing an individual module of an application is called unit testing.
Developers perform unit tests and therefore it comes under white box testing.
In white box testing the basic path coverage, loops and functions written in the code are tested
On the other hand, black box testing tests the functionality of an application

5. Difference between regression and re-testing?

Regression Testing
When we perform testing after making changes to the current build it is called regression testing. In other words regression testing is performed time and again on different builds to see if the code changes in the subsequent builds affect the output/functionality.

Retesting

On the other hand, when we perform testing time and again on the same build it is called retesting. Sometimes an application might behave in an inconsistent way giving different outputs when we retest. To capture such bugs we do retesting.

6. Why is testing essential for a project? What is the significance of testing?
Testing is an integral part of a project as it improves the quality of an application that is created. Any basic functionality that is left out during the development phase can be captured during the testing phase. A developer over looks certain issues as he does not want his code to break. But a tester's main aim is to break the application when a valid input is given, which means the application has a bug and needs to be fixed.

7. Name a bug that you had raised in your project that was appreciated?
Think of something that brought you several appreciation mails from clients. Something that the developer had really missed and if delivered as is, could have caused a big blow.


8. Difference between Verification and Validation testing is a very common question in any testing interview. I had faced this question time and again and was really very much interested to shoot it on the bull's eye. That is when I found these explanations from a site. I made a backup and it is available here

http://networkinterviewquestionsandanswers.blogspot.in/2012/08/excellent-explanation-for-difference.html

Friday, July 9, 2010

All You Can Expect In A TCL Interview

TCL is an easy to learn language that has a number of features and it can be used for a wide range of applications. The most common one is the automation. It can be used with expect to create interactive applications, where we send the commands to the command line, expect an output and evaluate the output using TCL via scripts.

Having a base in any programming language will help you learn TCL quickly. But this is not mandatory because most of the commands in TCL are simple and self explanatory. This post is meant for aspiring engineers who wish to work in a TCL automation project. This post would be useful especially for people who have started attending interviews and trying hard to get into this field.

To be honest, there are very few people who know TCL here in this industry. This is because the developers who are good at programming go for usual stuff like C, C++, Java etc. Testers are mostly manual testers who always develop a fear for programming. The concept of automation is something that bothers the testers as they consider it is as a very difficult task. As a result of all these attitudes, we have very less people for TCL automation but there are quite a lot of opportunities.

A little bit of practice is more than enough to get into a TCL automation project. Most of the requirements would say, “Should be good at TCL/TK. Knowledge of networking is preferred”. So going through the basics of networking would definitely help. One month before you start attending interviews, start taking notes of OSI layers from the net or from good networking books. This would be useful for you to brush up the concepts on the previous day of the interview. Have a clear cut idea about the layers, what they do and the protocols they use. Difference between TCP and UDP is a standard question in any networking interview. A detailed and crispy answer to this is available here:

http://networkinterviewquestionsandanswers.blogspot.in/2012/08/difference-between-tcp-and-udp-best.html

Since it involves testing, some of the testing questions can be asked. Eg:

1. Difference between black box and white box testing.
2. Who does white box testing(Developers or testers)?
3. Is unit testing white box or black box?
4. Difference between regression and re-testing
5. Why is testing essential for a project? What is the significance of testing?
6. Name a bug that you had fixed in your project that was appreciated?

The answers to the above questions are available here

http://tclinterviewquestions.blogspot.com/2011/12/answers-to-questions.html

Now we will come to the important part where most of the questions will be asked i.e TCL. If the interviewer is not a TCL person (though it does not happen mostly) the expected questions would be:

1. Write down all the list commands and explain what they do?
2. Write down all the string commands and explain what they do?
3. Write a regexp to match an ip address.(very common question)
4. Write the syntax of “for” and “if” loops?

If the interviewer is a TCL person, the questions might be:

1. Write a regexp to match an ip address?
2. How do you pick each part of the ip address and place them in separate variables?
3. What do these signify (. * ? +) in regexp?
4. What is command substitution, variable substitution and backslash substitution?(very common question)
5. Difference between using curly braces and quotes in TCL?
6. Convert a string into a list.
7. Convert a list into a string.
8. Write a program to reverse a string.
9. Find the length of a string without using “string length” command.
10. What are your strong areas in TCL?(string, list regexp etc..)
11. What is upvar and uplevel in TCL?
12. Write a program to connect to a system and to login using EXPECT script?

Answers to some of these questions are available here. Planning to post the remaining as well.

http://tclinterviewquestions.blogspot.in/2012/01/answers-to-tcl-interview-questions.html

Hope this post was useful for aspiring engineers. All the best everyone!
If you require answer for any of these questions, feel free to leave a comment.