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 Next
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 convert=asc(getChr)-32 End If output = chr(convert)+ output Next 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 Next 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 objFile.Delete End If End If Next
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
- Perf Calculator – free iOS app for performance testers - July 16, 2017
- How to performance test AngularJS or ReactJS applications? - June 25, 2017
- How to run Apache JMeter tests with Visual Studio Team Services? - June 6, 2017
- Google Test Automation Conference – GTAC 2017 - June 2, 2017
- What’s new in StormRunner 2.5? - June 1, 2017