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 Testifications.com 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 www.QAJobOpenings.com

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

3 thoughts on “QTP Interview Questions and Answers – QTP Code Corner”

    • String = “welcome to vbscript”
      arrString = Split(String,” “)
      For i = Ubound(arrString) to 0 Step -1
      outputstring = outputString & arrString(i) & ” ”
      print Trim(outputstring)


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Learn Apache JMeter for free. No Strings Attached.Watch Now for FREE
+ +
Share via
Copy link