Sunday, November 23, 2014

Quality Center Interview Questions

Quality Center Interview Questions (Beginners)
What is Test Lab?
In order to execute a Test Case (Developed in the Test Plan Module) either manual or automated it needs to imported into Test Lab Module. In sum, Test Cases are created in Test Plan Module while they are executed in Test Lab Module.
What is meant by Instance?
A Test Case imported from Test Plan module to Test Lab module is called an Instance of that test case. It is possible to have multiple instances of the same Test Case in the Test Lab Module.
Is it possible to maintain test data in Quality Center?
Yes. One can attach the test data to the corresponding test cases or create a separate folder in test plan to store them.
How to ensure that there is no duplication of bugs in Quality Center?
In the defect tracking window of QC,  there is a “find similar defect” icon. When this icon is clicked after writing the defect, if anybody else has entered the same defect then it points it out.
What will be the status in Quality Center if you give "Suggestion" to the Developer?
This is a trick question. You can give "Suggestion" to the developer using the Comments sections provided in QC. This will not change the current status of Defect in QC. In sum, the status of the defect remains the same, as that before giving suggestion to the developer.
How will you generate the defect ID in Quality Center?
The Defect ID is automatically generated after clicking Submit button.
How to import test cases from Excel / Word  to Quality Center?
·         Install and Configure the Microsoft Excel / Word Add-In for Quality Center.
·         Map the Columns in  Word / Excel spreadsheet with Columns available  in  Quality Center.
·         Export the data from Word/Excel to Quality Center Using Tools >Export to Quality Center Option in Word/Excel.
·         Rectify errors if Any.
Can we export the file from Quality Centre to Excel / Word. If yes then how?
Yes, It can be done by following ways:
1.      Requirement tab– Right click on main Req/click on export/save as word, excel or other template. This would save all the child requirements
2.      Test plan tab: Only individual test can be exported. No parent child export is possible. Select a test script, click on the design steps tab, right click anywhere on the open window. Click on export and save as.
3.      Test lab tab: Select a child group. Click on execution grid if it is not selected. Right click anywhere. Default save option is excel. But can be saved in documents and other formats
4.      Defects Tab: Right click anywhere on the window, export all or selected defects and save excel sheet or document.
What is Business Component  ?
·         Quality Center provides Business Component  for Business Process Testing (BPT).
·         Many Enterprise Applications are
§  Complex
§  Require extensive test scripts/case  
·         A Test /Automation Engineer can not handle both complexity of Application Under Test as well as  extensive test script/test case creation.
·         Using Business Component,  Subject Matter Experts ( who are experts on the  Application  Under Test ) can create tests in a script free environment without involving in the Nitty-gritty of test case/script designing. It helps increase test coverage and creates re-usable business components used for testing essential Business Processes.
·         Development of Test Script / Cases is done by Automation / Test Engineer.
How can we save the tests Executed in test lab?
·         The tests executed, are automatically saved when the user clicks on "END RUN" in the Test Lab
How to export test cases from QTP into QC?
To export test cases from QTP to QC, you first need to establish QTP-QC connection
1)       In QTP , Go to File > Quality Center Connection.
2)       Enter QC URL project name/domain/username/password and click on Login. QTP is now connected to QC.
3)       Next you can select the save the QTP Script in QC.
4)       In QTP, Select File Menu > Save As > Save in QC
5)       Select the Folder in QC where you wan to save the QTP Script
6)       Click OK to Save.
How to use QTP as an automation tool in Quality Center ?
You need to install QTP add-in in Quality Center (Usually done by Quality Center Administrator) . You then create and store QTP scripts in QC.
How to switch between two projects in Quality Center ?
You can switch between two projects by select Tools>Change Projects>Select Project.
In other version older than 9.2, you will need to log-off and log-in again.
What is the main purpose to storing requirement in Quality Center?
a)      To ensure 100% coverage : You can create and track test plan / sets for the requirements stored in Quality Center to ensure all the requirements are tested.
b)      Easy Change Management : If any requirement changes during course of test case creation , the underlying test case is automatically highlighted and Test Engineer can change the test case to suite the new requirement.
c)      Ease of Tracking : Using Advanced Reporting & Graphs provided by QC , Managers can determine various metrics useful in project tracking and monitoring.
What is Coverage status, what does it do?
Coverage status is percentage of testing covered at a given time. For Example, If you have 100 test cases in a project and you have executed 35 test cases than your coverage status of the project is 35% Coverage status is helps keep track of project deadline.

Quality Center Interview Questions (Experienced)
3 Types of Licences with QC:
1)      Site
2)      Area &
3)      Global.
What is Quality Center?
·         HP Quality Center is Web based Test Management tool.
·         Can be accessed over the internet or intranet, via a Web browser.
·         Involves interrelated steps such as defining release, developing requirement, designing and execution of tests, monitoring and reporting defects.
·         Simplifies and organizes application management by giving us systematic control over the process.
·         Helps in creating framework and foundation for application management workflow.
·         Helps in organizing and tracking application release, enabling us to align business priorities and quality expectation with our project’s requirement, test and defects
 What are the modules of Quality Center?
1.     Management Module: This module includes following sub modules:
1. Release module: Enable us to define release and cycles for the application management process.
2. Libraries module: Enables us to define libraries to track changes in project, reuse entities in project, or share entities across multiple projects.
2.     Requirement Module: Helps us to manage requirements. This includes defining what we are testing, defining requirement topics and items, also analyzing requirements.
3.     Test Plan: Enable us to develop and manage test in a hierarchical tree-structure. Tests can be linked to requirement and defects.
4.     Test Resources: Enables us to manage test resources in a hierarchical tree structure. Tests resources can be associated with tests.
5.     Test lab: Enables us to run tests and analyze the results.
6.     Defect Module: Helps us to report defects, determine, repair priorities and reopen defects.
7.     Dashboard: Helps to create graphs, reports and excel reports.
What are the benefits of Requirement Traceability?
·         Requirement Traceability defines a relationship between two or more requirements. When analyzing the impact of a change proposed in specific requirements, the traceability links indicate the other          requirements in the requirements tree.
·         We can establish traceability between the requirements. Using this tab in the Requirement Details view, you can add traceability link to and from selected requirement. Trace from links indicates requirements that affect a selected requirement. Trace to links indicates requirements that are affected by a selected requirement.
·         When a requirement change QC alerts the affected requirements this can be seen by all users. QC sends email notification to the authors of the affected requirements.
Can We Convert or Generate Test from the requirements?
Yes, we can convert and also generate test case from the requirements. There are two methods we can use to generate tests from the requirements:
1.     Convert Requirement to test: convert requirement to test in a specified subject in the test plan tree. We can convert selected requirement or all requirements in the requirements tree.
2.     Generate a test from requirements: convert requirement to a test in a specified subject in the test plan tree and a specified test set in the Test Lab modules. This method enables us to quickly run a test when analyzing our requirements.
Explain Version Control.
  • Version Control helps us to keep track of changes made to entities in our project including requirements.
  • In this we can create and manage QC entities while maintaining previous version of those entities in requirements.
  • To make changes in an entity in a version control enabled project, first we have to check out the entity. When we check out an entity, QC locks the entity, preventing other users from overwriting any changes we make.
  • The checked out version of the entity is not visible to the other user. We can check out an entity in the following ways:
1.     Checking Out Entities Automatically
2.     Checking Out Entities Manually
How many built in tables does Quality Center have?
There are six tables accessible to user via QC’s customized project interface:
1.     Test Table
2.     Test Step Table
3.     Test Set Table
4.     Run Table
5.     Defect Table
6.     Requirement Table

Can we create a QTP test from QC?

Yes we can create QTP test from QC but we must first make sure QTP has the ability to execute tests from Quality Center. Please ensure the following option in QTP Run Settings is enabled: When QTP is enabled, follow the below steps to schedule and execute tests from Quality Center:
1. Login to Quality Center and Navigate to Test Lab Module
2. After selecting the correct Test Set, Click the Execution Flow Tab.
3. Right-click on the test that requires configuration of Time Dependency and click Test Run Schedule.
4. In the Run Schedule window, select the Time Dependency tab. The time and date of execution can be configured.
5. Time dependency will be added to the relevant test.
6. After time dependency has been added, navigate back to the Execution Grid pane. From the Execution Grid, select the tests to be run at the designated date and time.
7. From the Automatic Runner dialog, click Run All.
8. Once Run All is clicked from the Automatic Runner dialog, the test status will change to Waiting and QC will fire the tests to be run at the scheduled date and time:
9. QC will fire the tests in the sequence configured in the Execution Flow pane. The Test Run Scheduler will show all the tests that were selected and are executing and are to be executed.
What is Purge Run?
Purge Run is used to delete old test run result in project. By default Purge Run delete all the run result in the selected test sets. Purge run can be used to:
  • Delete only Test Runs: In this we can select a period of time before which we want to delete test run result
  • Delete only Run Steps: In this we can select a period of time before which we want to delete run steps.
What is test set notification, and when we need it?
Test set notification is used to inform specified user. We can instruct QC to send email to a specified user if any of the following events occurs for a test set:
1.     Any test is the test set fails.
2.     Test in the test set fails due to reason other than the test logic itself, Environmental failure could include. Ex. Functional call not returning access violations, version incompatibility between application components, a missing DLL.
3.     All tests in the test set that were run have been finished running. But this does not include tests that are not executed.
What is the need of Host Manager?
We can run test on a host connected to our network. Using the Host Manager Dialog box we can create a list of available host for test execution and also organize hosts into groups to be used for a specific project.
Following condition must be kept in mind before executing test on remote host:
1. QTP must be installed on each machine where you wish to execute the tests.
2. QTP must be configured to allow other HP products to run
3. QTP Connectivity add-in installed on both the Host (QTP) machines as well as the QC machine.
4. Define your host machines in the Host Manager of QC.
5. Ensure that Object Repositories and/or Function Libraries which are used by all scripts are 'shared' and accessible from all machines.
Explain Linking Defect to test in Quality Control.
·         We can link a test in our test plan to a specific defect in the Defect Grid. For example, when a new test is created specifically for a known defect. By creating a linking, we can determine if the test should be run based on the status of the defect.
·         We can also link the defect to other entities, such as requirements. A defect can be linked directly or indirectly to an entity. When we add a defect link to an entity, QC adds a direct link to this entity and indirect link to other related entities.
·         When we link a defect to run step, it adds an indirect link to its run, test instance, test set and test.
·         If the same test is covered by a requirement, an indirect link is also added to the requirement, but indirect linkage is one directional flow.
What are Matching Defects?
Matching Defects enables us to eliminate duplicate or similar defects in project. When we add a new defect, QC stores list of keywords from the Summary and Description Fields. When we search for similar defects, keywords in these fields are matched against other defects. Keywords are more than two characters and they are not case sensitive. We have two methods to conduct search of similar defects.
  1. Finding similar Defects: compare a selected defect with all other existing defects in project.
  2. Finding similar Text: compare a specific test string against all other existing defects in project.
What is Defect Tracking?
Defect Tracking means locating and repairing application defect efficiently. Defects can be added or detected to project by the users during all stages of application management process. The defect tracking workflow consists of following:
  • Adding Defects: After finding new defect we submit to QC project. The project stores defect information that can be accessed by authorized users.
  • Reviewing New Defects: Reviewing all new defects and decide which one to fix.
  • Repairing Open Defects: Fix the Open defects.
  • Testing a New Application Build: Run test on the new build of the application.
  • Analyzing Defect Data: View Defect Report to see how many defects were resolved, and how many still remain open.
How many types of report are there in QC?
We can generate reports any time during the testing process from each QC module, using default or customized setting. We can apply filters and sort conditions, and display information according to our specification. Following types are reports are available to us in QC:
  1. Requirement Module Reports: Standard Requirements, Tabular, Requirement with coverage test, requirement with Coverage test and Steps, requirement with linked Defects, requirements with Traceability, report selected.
  2. Test Plan Module Reports: standard test planning, subject tree, tests with design steps, tests with covered Requirements, tests with linked Defect, report Selected,
  3. Test Lab Module Reports: current test set, cross test set, test set Hierarchy with tests, cross test set with tests, execution notification.
  4. Defects Module Reports: standard Defects, Tabular defects, fixed or rejected Defects, report selected.
How many types of Graphs are there in QC?
Following types are reports are available to us in QC:
  1. Requirement Module Graphs: requirements summary graph, requirements progress graph, requirements coverage graph, requirements- trend graph, graph wizard.
  2. Test Plan Module Graphs: test planning summary graph, test planning progress graph, test plan trend graph, graph wizard,
  3. Test Lab Module Graph: test execution summary graph( current test set), test execution progress graph(current test set), test execution summary graph(cross test set), test execution progress graph(cross test set) , graph wizard.
  4. Defect Module Graph: defect summary graph, defect progress graph, defect age graph, defect trend graph, graph wizard.
What are the features of Quality Center?
Features of QC are listed below:
  • QC helps to maintain project database of test that covers all functionality of application.
  • QC offers integration with HP testing tools (WinRunner, QTP and Load Runner) as well as third party tools.
  • QC provides an intuitive and efficient method for scheduling and executing test sets, collecting test results, and analyzing the data.
  • Qc helps in defect tracking, enabling to monitor defects closely from initial detection to resolution.
  • By linking QC to email system, defect tracking information can be shared by all application development, quality assurance and customer support.
How to use Quality Centre in real time project?
After completing the test cases, we do:
1.     Export the test cases into Quality Centre.
2.     The test cases will be loaded in the test plan module.
3.     When execution is started. We move the test cases from test plan tab to the test lab module
4.     In test lab, we execute the test cases and put as pass or fail or incomplete. We generate the graph in the test lab for daily report and sent to the specific user.
5.     If we got any defects and raise the defects in the defect module. When raising the defects, attach the defects with the screen shot.
How to map the requirements with test cases in Quality Centre?
For mapping the requirement with test cases we do:
1.     In requirements tab select coverage view
2.     Select requirement by clicking on parent/child or grandchild
3.     On right hand side (In coverage view window) another window will appear. It has two tabs.
a.     Tests coverage
b.     Details
Test coverage tab will be selected by default or you click on it.
4.     Click on select tests button a new window will appear on right hand side and you will see a list of all tests. You can select any test case you want to map with your requirements.
How can we use Filter in QC?
·         We can use Filter on Quality Center data to display only those record that meets the criteria that we define.
·         We can assign a single item (such as failed) or logical expression (such as Passed or Failed) to a filter. Only record meeting all the criteria of the filter appear in the grid or tree. In addition, we can define multiple filters.
·         For example, we can define the Status filter as Failed and the tester as “Ravindra or Richa”. Only test runs performed by Ravindra and Richa are displayed.
What is difference between Generate Test from the requirements and Convert requirements to test?
When we convert the requirements to test in a specified subject in the test plan tree where as in generating test case, the test case generates from requirements are stored in a specified subject in a test plan tree and a specific test set in Test Lab module. And by default we cannot generate a test for the following, which do not enable to coverage:
  • Business
  • Folder
  • Groups
Is 'Not covered' and 'Not run' status are same?
No, Not Covered status means all those requirements for which the test cases are not written where as Not Run status means all those requirements for which test cases are written but are not run.
What is the advantage of libraries in Quality center?
·         A library represents a collection of entities in a QC, including their relationship to each other.
·          When dealing with many similar projects, it offers the advantage of not having repeatedly created entities.
·         Libraries can be imported form Project A into Project B, compare against each other, or even synchronized.
·          A library also allows one to collect the same entities as in versioning. With Quality Center Premier Edition, defects are not included, but they can be shared with the new HP Quality Center Synchronizer manually among several QC project.
What types of database are used in QC?
When we create a QC project. We need to store and manage the data generated and collected by Quality Center. Each project is supported by a database that stores project information.
The following database application could be used to store and manage Quality Center information:
  • Oracle 9.2.0.6 Standard/Enterprise Edition
  • Oracle 10.2.0.3
  • Microsoft SQL Server 2005 (SP2).

Saturday, November 22, 2014

Interview Questions for QTP

Hello Friends,
In this Section, We have tried to explore those questions which are usually asked during Technical Round. If you are going to face an interview either in Sapient/Accenture/TCS/HCL etc then wrack your brain for these questions
  1. How to find out the regularly changing value in a single line?
  2. What is AOM? How we can Launch QTP outside & Open Test?
  3. There are 10 checkboxes. How can I check only first 5 check boxes by using descriptive programing? 
  4. If there are some browsers opened and I don't know how many browsers are open, now I want to close all the browsers that I don't know how many are opened. What would be Descriptive programming for this in QTP using VB Script?
5.    Using simple string a[0]=I, a[1]=N, a[2]=D   like that it goes on.. Output I need INDIA. How?
6.    How do we run the scripts in QTP? What are the three options?
7.    What are the main components of keyword driven automation frame work in QTP?
8.    What are the various extentions in QTP?
9.    How to find the particular word in text file and how to split and capture total line of the founded word using vb scripting?
10.  Display the list data in the order-first even position rows and then odd position rows?
11.  I want to open a Notepad window without recording a test and I do not want to use SystemUtil.Run command as well How do I do this?
12.  VB Script to count the no. of links on a web page.
13.  How you will display all the upper case alphabet characters in reverse order except the characters mentioned in the string. Eg: if my string is "Sumit" then the result should have all the alphabets from "Z to A" except the following letters "S","U", “M”, “I” and "T".
14.  Explain about scrrun.dll?
15.  Explain about ADODB.Stream class?
16.  How many types of Parameters are available in QuickTest Professional (QTP)?
17.  What are the different ways to invoke an application using QTP?
18.  What is Smart identification?
19.  Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?
20.  I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons?”
21.  What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for?
22.  How can you close the second opened browser?
23.  How to get Nth Highest Salary of the Employee using SQL? Highest, 2nd Highest, 3rd Highest....
24.  What is a self join? Explain it with an example?
25.  Suppose we have the Employee table below, and we want to retrieve all of the cities that the employees live in, but we don’t want any duplicates. How can we do this in SQL?
26.  How to reverse a string without using strreverse in VB?
27.  Write a Program to show usage of Output value using QTP?
28.  What is Error Handling in QTP? How many types of Errors are there in QTP?

If you are not able to answer, please prepare again. However, Below are the solutions for above questions.

1.       What is AOM? How we can Launch QTP outside & Open Test?
Automation Object Model (AOM) - It is a mechanism using which we can control various QTP operations outside QTP. Using AOM, we can launch QTP, Open the Test, Associate Function Libraries etc. The Following Vbscript should be saved with Extension .vbs and upon executing the same, QTP will be launched and test would start executing.
 'Launch QTP
 Set objQTP = CreateObject("QuickTest.Application")
 objQTP.Launch
 objQTP.Visible = True
'Open the test
 objQTP.Open "D:\GUITest2", False, False
 Set objLib = objQTP.Test.Settings.Resources.Libraries
 'Associate Function Library if NOT associated already.
 If objLib.Find("C:\lib1.vbs") = -1 Then
 objLib.Add "C:\lib1.vbs", 1
 End
__________________________________________________________________________________
There are 10 checkboxes. How can I check only first 5 check boxes by using descriptive programing?
Dim objCheckBox
set objCheckBox=Description.Create()
objCheckBox("micclass").Value="WebCheckBox"
set objChildObjects=Browser("micclass:=Browser").Page ("micclass:=Page").Childobjects(odesc)
for i=1 to 5
objChildObjects(i).Set "ON"
Next
_________________________________________________________________________________
If there are some browsers opened and I don't know how many browsers are open, now I want to close all the browsers that I don't know how many are opened. What would be Descriptive programming for this in QTP using VB Script?
Set odesc=description.Create
odesc("micclass").value="Browser"
Set a=Desktop.ChildObjects(odesc)
print a.count
For i = 0 to a.count-1
browsername= a(i).getroproperty("name")
print browsername             
Next _________________________________________________________________________________
Using simple string a[0]=I, a[1]=N, a[2]=D   like that it goes on.. Output I need INDIA. How?
You can use the function JOIN
Dim arr(10)
arr(0)="I"
arr(1)="N"
arr(2)="D"
arr(3)="I"
arr(4)="A"
Msgbox Join(arr) - it will display INDIA
__________________________________________________________________________________
How do we run the scripts in QTP? What are the three options?
1. "Verify Run-Mode"
(Normal Run Mode) F5, aiming towards testing the application.
2. Debug Run-Mode
(Aim is to know the syntactical and Logical Errors)
F11- step into
F10 - Step Over
Shift+F11 - step out
3. Update Run-mode (Automation -> update run mode)
(Aim is to Update the object physical Description) using this mode qtp can update:
1. Object Repository Physical Description
2. Check point Property Values
3. Active Screen images
________________________________________________________________________________
What are the main components of keyword driven automation frame work in QTP?
1.       Scripts Library (.vbs, .txt, .qfl)
2.       OR - Object Repository
3.       Test Data (generally in excel format)
4.       QTP - Settings and Environment Variables
5.       Reports - (Generally in HTML format)
6.       Test Driver Script/ Test Engine
__________________________________________________________________________________
What are the various file extensions in QTP?
1.       QTP Script File                  :  .mts  ( mercury test script)
2.       QTP Local Repository     :  .bdb  ( berkely database)
3.       Shared Repository             :  .tsr ( test shared repository)
4.       Load test configuration file Default.cfg
5.       Load test configuration file Default.usp
6.       Test Settings File                : Test.tsp
7.       Test Parameters file          : Parameters.mtr
8.       Resources associated information like function library, recovery, shared repository: Resource.mtr
9.       Datatable ( Excel file)       : Default.xls
10.    Recovery Scenario            :.qrs
11.    Function library                 :.vbs / .qfl / .tst
12.    Test Batch                            :.mtb
13.    Action Template                 :.mst ( mercury shared template)
14.    Virutal Object                     :.vot  ( virtual object template)
15.    Created when the QTP test is opened: lock.lck
__________________________________________________________________________________
How to find the particular word in text file and how to split and capture total line of the founded word using vb scripting?
1.      open the text file to search the word in
2.      set fso = createobject("scripting.filesystemobject")
3.      set mytxt = fso.OpenTextFile("C:\Users\sumit\Desktopf1.txt")
4.      c_LineMatch=0                                                               
5.      o_wordMatch =0
6.      regex for the word to be searched 
7.      Set myregex = new RegExp
8.      with myregex
a.       .Global = true
b.       .Pattern = "QTP"
c.        .IgnoreCase = True
9.      End With
10.  Do until mytxt.AtEndOfStream
a.       Read one line at a time
b.       str1 = mytxt.ReadLine
c.        Set colMatches = myregex.Execute(str1)
d.       no of words matched in the Text file
e.        o_wordMatch = o_wordMatch +colMatches.Count 
f.        Count no of lines which have the words to search        
g.        if colMatches.Count > 0 then
                                                                       i.      c_LineMatch=c_LineMatch+1
h.       end if 
11.  Loop
12.  No of words matched in the text file
13.  Msgbox o_wordMatch 
14.  No of lines having the words to be searched
15.  msgbox c_LineMatch
__________________________________________________________________________
Display the list data in the order-first even position rows and then odd position rows?
Suppose your table is "employee" and column name is "empid" .

Now you want a list which contains EVEN empids first and then ODD empids.

Your query will be like below,
Select empid from employee order by Mod(empid,2),empid;

IF you want a list which contains ODD empids first and then EVEN empids.

Your query will be like below,
Select empid from employee order by Mod(empid,2) desc ,empid;
___________________________________________________________________________
I want to open a Notepad window without recording a test and I do not want to use SystemUtil.Run command as well How do I do this?
1st way: insert->step->step generator->select a function invokeapplication,mention the path to notepad.exe file.Run.2.otherwise in Expert view write a builtin funtioninvokeapplication"c:/whatever the path"Run
2nd Way: to open a notepad is to use ShellObject. Check out with the following example:
Dim aSet a = WScript.CreateObject ("WSCript.shell")a.run "notepad.exe"
3rd Way:
Dim oShell Set oShell = CreateObject ("WSCript.shell") oShell.run "cmd /K notepad.exe"
Set oShell = Nothing
4th Way:
Dim file1,file2
Set file1 = CreateObject("Scripting.FileSystemObject")
Set file2 = file1.OpenTextFile("c:ragu.txt", "2", True)'
---creating text file file2.WriteBlankLines 2 S="Hi Good morning"file2.write(S)
___________________________________________________________________________
VB Script to count number of links in a web page.
Set Des_Obj = Description.Create
Des_Obj("micclass").Value = "Link"
Set link_col = Browser("name:=Google").Page("title:=Google").ChildObjects(Des_Obj)
msgbox link_col.count
_________________________________________________________________________
How you will display all the upper case alphabet characters in reverse order except the characters mentioned in the string.
Eg: if my string is "Sumit" then the result should have all the alphabets from "Z to A" except the following letters "S","U", “M”, “I” and "T".

set reg=New regexp
s="[^ a-z A-Z]"
reg.Global=True
reg.IgnoreCase=True
s0="ZYXWVUTSRQPONMLKJIHGFEDCBA"
s1="Sumit"
s2=""
for i=1 to len(s1)
    a1=mid(s1,i,1)
    reg.pattern=a1
    s0= reg.replace(s0,s2)
Next
msgbox s0

It’s Output will come as ZYXWVRQPONLKJHGFEDCBA

__________________________________________________________________________
Explain about scrrun.dll?
Scripting Runtime library is very important for the functioning of Visual basic script because it gives much more functionality such as File management, text operations and file modification features. Scrrun.dll is used very much in programming VB.
___________________________________________________________________________
Explain about ADODB.Stream class?
ADODB.Stream class can be used as string builder. VBScript string concatenation can be very costly because of frequent memory allocation features. Binary file and memory I/O operation is provided by ADODB.Stream class. This is widely used to convert bytes into string, etc.
___________________________________________________________________________
How many types of Parameters are available in QuickTest Professional (QTP)?
QTP provides three types of Parameter-
                Method Argument
                Data Driven
                Dynamic
__________________________________________________________________________
What are the different ways to invoke an application using QTP?
                a) SystemUtil.Run
                                SystemUtil.Run ( FileName, Parameters, Path, Operation )
                                Example: SystemUtil.Run(“iexplorer.exe”,http://www.google.com)
                                SystemUtil.Run(“test.txt”, “”,”C:\”,”1”)
b) InvokeApplication
                Example: InvokeApplication “C:\Program Files\Internet Explorer\IEXPLORE.EXE   
http://www.google.com”
c) Creating a shell object using VB Script
                Example: Create a “WScript.shell” object.
                Dim testshell
                Set testshell= CreateObject (“Wscript.shell”) testshell.run “%windir%\notepad “
_________________________________________________________________________
What is Smart identification?

If the recorded description does not enable QTP to identify a specific object then QTP uses “Smart identification” mechanism.  It uses the following additional properties to identify the object
                a) Base Filter Properties (primary) – The set of properties that cannot be changed without 
changing the object type
                b) Optional Filter Properties (secondary) – additional properties that help identify the object 
uniquely
__________________________________________________________________________
Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?
 There can be more than one Shared OR’s associated to the same action. If Shared OR1 and Shared OR2 have one object named OBJ1 each and if the action calls for OBJ1 then the order in which the shared ORs were associated will be considered. That means, if Shared OR1 was first associated then the OBJ1 from Shared OR1 will be taken into account.
___________________________________________________________________________
I have developed and executed a script successfully, and saved the same to QC. When I tried to execute the script from QC, the script is not executing. What are the possible reasons?”
1.       QuickTest Add-In for Quality Center has to be installed.
2.       In the QTP Tools > Options >run tab you should have ‘Allow other Mercury products to run tests and components’ selected.
3.       Make sure you are running QTP as an Admin
4.       All the test resources have to be in the correct path
_________________________________________________________________________________
What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for?
.bdb is the local OR. .mtr is a binary file that contains other information about checkpoints and all. To re-verify the .bdb is the OR, try to rename the file with the extension as .tsr and open it from ORM. The same objects in the OR will be displayed here. The same will not work if you try it on .mtr file.
________________________________________________________________________________
How can you close the second opened browser?
You can know which browser instance was opened after another can be known by using the “creation time” property. In simple terms, this is nothing but a counter for each browser instance that gets launched. For the first one, it is 0 and gets incremented from then on. To close the second opened browser, you can use the following code:
Browser(“creationtime:=1″).Close
_______________________________________________________________________________
How to get Nth Highest Salary of the Employee using SQL?
First, ask ourselves how can we find the highest salary in a table? Well, you probably know that is actually really easy – we can just use the MAX aggregate function:
The highest salary in a table

select MAX(Salary) from Employee;
So, if we can somehow select the highest value from a result set that excludes the highest value, then we would actually be selecting the 2nd highest salary value. Think about that carefully and see if you can come up with the actual SQL yourself before you read the answer that we provide below. Here is a small hint to help you get started: you will have to use the “NOT IN” SQL operator.
The 2nd highest salary in SQL:
SELECT MAX(Salary) FROM Employee
WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee )

And Now, SQL query to find the Nth highest salary (Works for all)
SELECT *
FROM Employee Emp1
WHERE (N-1) = (
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM Employee Emp2
WHERE Emp2.Salary > Emp1.Salary)

nth highest salary using the TOP keyword (in SQL Server)
SELECT TOP 1 Salary
FROM (
      SELECT DISTINCT TOP N Salary
      FROM Employee
      ORDER BY Salary DESC
      ) AS Emp
ORDER BY Salary

nth highest salary using Desc Limit (in MySQL)

SELECT Salary FROM Employee
ORDER BY Salary DESC LIMIT n-1,1

nth highest salary using rownum  (in Oracle)
select * from (
  select Emp.*,
row_number() over (order by Salary DESC) rownumb
from Employee Emp
)
where rownumb = n;  /*n is nth highest salary*/
_________________________________________________________________________________
1.       What is a self join? Explain it with an example
Suppose we have the following table – that is called employee. The employee table has 2 columns – one for the employee name (called employee_name), and one for the employee location (called employee_location):
Employee
employee_name
employee_location
Joe
New York
Sunil
India
Alex
Russia
Albert
Canada
Jack
New York
Now, suppose we want to find out which employees are from the same location as the employee named Joe. In this example, that location would be New York. Let’s assume – for the sake of our example – that we can not just directly search the table for people who live in New York with a simple query like this (maybe because we don’t want to hardcode the city name) in the SQL query
    SELECT employee_name
    FROM employee
    WHERE employee_location = "New York"
So, instead of a query like that what we could do is write a nested SQL query (basically a query within another query – which more commonly called a subquery) like this:
                    SELECT employee_name
                    FROM employee
                    WHERE employee_location in
                    ( SELECT employee_location
                      FROM employee
    WHERE employee_name = "Joe")
A self join is basically when a table is joined to itself. The way you should visualize a self join for a given table is by imagining that a join is performed between two identical copies of that table. And that is exactly why it is called a self join – because of the fact that it’s just the same table being joined to another copy of itself rather than being joined with a different table.
Self Join Example:

SELECT e1.employee_name
FROM employee e1, employee e2
WHERE e1.employee_location = e2.employee_location
AND e2.employee_name="Joe";

This query will return the names Joe and Jack – since Jack is the only other person who lives in New York like Joe.
________________________________________________________________________________

1.       Suppose we have the Employee table below, and we want to retrieve all of the cities that the employees live in, but we don’t want any duplicates. How can we do this in SQL?

                                                     employee
employee_name
employee_location
Joe
New York
Sunil
India
Alex
Russia
Albert
Canada
Jack
New York
Alex
Russia
1st Way: In SQL, the distinct keyword will allow us to do that. Here’s what the simple SQL would look like:
SELECT DISTINCT employee_location from employee;
Running this query will return the following results:
employee_location
New York
India
Russia
Canada

2nd Way: We can actually accomplish this with the GROUP BY keyword. Here’s what the SQL would look like:

SELECT employee_location from employee 
GROUP BY employee_location
_________________________________________________________________________________________
 
How to reverse a string without using strreverse in VB?
 
<body>
<script language="VBScript">
 
Dim x
x=inputbox("Enter a string")
cnt=len(x)
Do until cnt=0
y = y&mid(x,cnt,1)
cnt=cnt-1
Loop
msgbox y
 
</script>
</body>
 
_________________________________________________________________________________________
 
Write a Program to show usage of Output value using QTP? 
 
Systemutil.Run "C:\Program Files (x86)\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
 
Dialog("Login").WinEdit("Agent Name:").Set DataTable("Agent_Name", dtGlobalSheet)
Dialog("Login").WinEdit("Agent Name:").Type  micTab 
Dialog("Login").WinEdit("Password:").SetSecure DataTable("Password", dtGlobalSheet)
Dialog("Login").WinEdit("Password:").Type  micReturn 
 
Dialog("Login").Dialog("Flight Reservations").Static("Please enter agent name").Output_ CheckPoint("ErrorMessage")
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
Dialog("Login").WinButton("Cancel").Click
__________________________________________________________________________________________
What is Error Handling in QTP? How many types of Errors are there in QTP?
There are various ways on handling errors in QTP. There are three possible kinds of error type one would encounter while working with QTP.
·         Syntax Errors
·         Logical Errors
·         Run Time Errors
Syntax errors are the typos or a piece of the code that does not confirm with the VBscripting language grammar. Syntax errors occur at the time of compilation of code and cannot be executed until the errors are fixed. To verify the syntax one use the keyboard shortcut as Ctrl+F7 and the result is displayed as shown below. If the window is NOT displayed one can navigate to "View" -> "Errors".

LOGICAL ERRORS:
If the script is syntactically correct but it produces unexpected results. Logical error usually does not interrupt the execution but produces incorrect results. Logical errors could occur due to variety of reasons, viz- wrong assumptions or misunderstanding of the requirement and sometimes incorrect program logics(using do-while instead of do-Until) or Infinite Loops.
One of the ways to detect a logical error is to perform peer reviews and also verifying the QTP output file/result file to ensure the tool has performed what it has intended to do.
RUNTIME ERRORS:
As The name states, this kind of Error happens during Run Time. The reason for such kind of errors is that the script trying to perform something but it is unable to do so and the script usually stops as it is unable to continue with the execution. Classic Examples for Run Time Errors are,
1.       File NOT found but the script trying to read the file.
2.       Object NOT found but script is trying to act on that particular object.
3.       Dividing a number by Zero.
4.       Array Index out of bounds while accessing array elements.

Handling Run-Time Errors:
There are various ways to handle errors in the code.
1. Using Test Settings - Error handling can be defined the Test Settings by Navigating to "File" >> "Settings" >> "Run" We can select any of the specified settings and click "OK".

2. Using On Error Statement - On Error statement is used to notify the VBScript engine of intentions to handle the run-time errors by tester, rather than allowing the VBScript engine to display error messages that are not user friendly.
·         On Error Resume Next - On Error Resume Next informs the VBScript engine to process executing the next line of code when an error is encountered.
·         On error Goto 0 - This helps the testers to turn off the error handling.
3. Using Err Object - Error object is an inbuilt object within VBScript that captures the run time error number and error description with which we will be able to debug the code easily.
·         Err.Number - The Number property returns or Sets a numeric value specifying an error. If Err.Number value is 0 then No error had occured.
·         Err.Description - The Description property returns or sets a brief description about an error.
·         Err.Clear - The Clear method resets the Err object and clears all the previous values associated with it.
EXAMPLE:
'Call  the function to Add two Numbers
Call Addition(num1,num2)

Function Addition(a,b)

 On error resume next
 If NOT IsNumeric(a) or IsNumeric(b) Then
   Print "Error number is  " &  err.number & " and description is : " &  err.description
   Err.Clear
   Exit Function
 End If

 Addition = a+b
 
 'disables error handling
 On Error Goto 0
 
End function
4. Using Exit Statement - Exit Statements can be used along with Err object to exit from a test or action or iteration based on the Err.Number value. Let us see each one of those Exit statements in detail.
·         ExitTest - Exits from the entire QTP test no matter what the run-time iteration settings are.
·         ExitAction - Exits the current action.
·         ExitActionIteration - Exits the current iteration of the action.
·         ExitTestIteration - Exits the current iteration of the QTP test and proceeds to the next iteration.
5. Recovery Scenarios - Upon encountering an error, recovery scenarios are triggered based on certain conditions and it is dealt in detail in a seperate chapter.
6. Reporter Object - Reporter Object helps us to report an event to the run results. It helps us to identify if the concerned action/step is pass/fail.
'Syntax: Reporter.ReportEventEventStatus, ReportStepName, Details, [ImageFilePath]

'Example
Reporter.ReportEvent micFail, "Login", "User is unable to Login."
_________________________________________________________________________________