https://www.qatechies.com

QTP or UFT and Vbscript: Technical Interview Questions (Latest UFT Interview Questions) set 1

Latest Tosca,QTP,UFT,CodedUI Interview Questions

Latest QTP Technical Interview Questions and Answers (Latest UFT Interview Questions)-Set 1


 

Welcome to this post! -“Latest QTP Interview Questions and Answers (Latest UFT Interview Questions)-set 1”

If you are looking for latest HP UFT \ QTP  interview Questions, then you are at right place. This post consists of some exhaustive questions which had been part of interviews. Usually these are assumed to be known after having some years of experience in using the UFT or QTP, Go ahead and enjoy reading…

 

Below post discusses about some important questions and answers on HPE UFT (Micro Focus) QTP/UFT interview.


1. Reverse the string without using any vbscript string functions?

 

      Let us discuss the solution here:

 

Line 1,2 – create local variables for both input and output string,

Line 3  – use “inputbox” method to receive the input from msgbox and store it in the input string variable, “inpStr”,

Line 4 – use the “Len” method to get the length of string,

Line 5,6,7, – use “mid” method to get the single character at a time, and store plus add that into a variable of output “outStr”.  Finally print the appended string using msgbox method.

 

Dim inpStr

Dim outStr

inpStr= inputbox(“Enter the desired string”)

count= Len(inpStr)

For i = 1 to count

 outStr= mid(inpStr,i,1)&outStr

Next

msgbox outStr

Below are the execution screens:

This slideshow requires JavaScript.


2. Close all opened browsers?

 

Let us discuss the solution here:

 

Step 1 – create the object of Description

Step 2 – set the description object “desc” with property value pair as ‘micclass’,’Browser’

Step 3 – now count the number of desktop child objects using the method Desktop.ChildObjects. This will return the child objects of type “desc” i.e. browser objects.

Step 4,5,6, –   Use internal property of browser “creationtime” and close one by one in a loop.

 

Set desc = Description.Create

desc( “micclass” ).Value = “Browser”

If Desktop.ChildObjects(desc).Count > 0 Then

  For x = 0 To Desktop.ChildObjects(desc).Count – 1

   Browser( “creationtime:=” & x ).Close

  Next

End If

 


3. Regular Expression Example

 

Let us discuss the solution here:

Step 1 – create the object of regular expression.

Step 2,3 – set the regex object with properties value as true for ignorecase and global resp.

Step 4,5 – now set the pattern you are looking for in the given string.

Step 6, –   Use regex.Execute method to get matches collection object.

Step 7 –  iterate through each of the values in matches collection and output it using msgbox.

 

Set regex= New RegExp

regex.IgnoreCase=true

regex.global=true

regex.Pattern=”[0-9]*a”

testStr= “1a12ijk332a444lmo5895abc”

Set totMatches= regex.Execute(testStr)

msgbox totMatches.count

For each match in totMatches

   msgbox match.Value

Next

Below are the execution screens:

This slideshow requires JavaScript.

Continue Reading to UFT Technical\General interview questions set 2:

UFT Technical Questions Set 2

 

If you would like to keep track of further articles on UFT (QTP). I recommend you to subscribe by Email and have new UFT articles sent directly to your inbox.


 

Leave a Reply

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

advanced-floating-content-close-btn
https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5034726663464946 (adsbygoogle = window.adsbygoogle || []).push({});
advanced-floating-content-close-btn 
*************************** Do you want to learn TOSCA? Do you want to excel in Career? Try my New Courses: 1. Tricentis Tosca and Working with Excel   2. Tricentis Tosca and UI Automation Great News!!   Price has been slashed down for limited period of time.So Hurry!!! Click The Shown Links and Enjoy Learning. ***************************
 
error: Content is protected !!