June 11, 2013

QTP Interview Questions and Answers – QTP Code Corner

In this blog post category, I would like to share QTP Interview Questions and Answers and QTP Code Corner which helps test engineers to face technical interview.

QTP Interview Question #1 Get all characters from a string in QTP Below is the code snippet which extracts all characters from a string.

Dim a
a = "QAInsights"
l = Len(a)
For i = 1 to l
b = mid(a,i,1)
MsgBox b

QTP Interview Question #2 In a given string, convert all UPPERCASE characters to lowercase, all lowercase letters to UPPERCASE in QTP.

Dim myStr
myStr = "QAInsights"
For i = 1 to Len(myStr)
getChr = mid(myStr,i,1)
If asc(getChr)>64 and asc(getChr)<91 Then
convert = asc(getChr)+32
Elseif asc(getChr)>95 and asc(getChr)<122 then
End If
output = chr(convert)+ output
MsgBox StrReverse(output)


QTP Interview Question #3 Reverse a given string without using strreverse function

Dim myStr
myStr = "QAInsights"
For i = 1 to Len(myStr)
getChr = mid(myStr,i,1)
output = getChr + output 
MsgBox output

QTP Interview Question #4 Find *.txt files in a folder, if it is older than 1 day, delete it.

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "D:\MyFolder"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
a = Instr(1,objFile.Name,"txt",1)
If a > 0 then
MsgBox objFile.Name
Msgbox objFile.DateCreated

If Now-objFile.DateCreated > 1Then
End If
End If

Thanks for visiting QAInsights! Check out our new portal to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything. Searching for QA Jobs Openings, check it at

Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.

Subscribe to our QAInsights YouTube Channel

Subscribe our free weekly newsletter or Google feeds

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook,, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

Your email address will not be published. Required fields are marked *