QTP Mock Test


Advertisements

This section presents you various set of Mock Tests related to QTP Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

QTP Mock Test IV

Q 1 - After registering a function to a test object using RegisterUserFunc, it is displayed as .... in Keyword view and Step Generator.

A - Item

B - Operation

C - Library

D - Arguments

Answer : B

Explanation

After registering a function to a test object using RegisterUserFunc, it is displayed as Operation in Keyword view and Step Generator.

Q 2 - Where can you define or override default shortcut keys for editing?

A - Tools > Options

B - Tools > View Options

C - Tools > Customize

D - Shortcut keys cannot be personalized.

Answer : B

Explanation

You can personalize the default keyboard shortcuts for editing at Tools > View options in key binding tab.

Q 3 - Which test object property is used to access native properties of a run-time object?

A - ChildObjects

B - GetROProperty

C - GetTOProperty

D - Object

Answer : D

Explanation

Object property of an object can be used to access native properties of a run-time object.

Q 4 - When you set the path of your application at 'Record and Run Setting' to automatically open the application on recording, what is the statement that gets added in expert view for this step of opening application?

A - SystemUtil.Run

B - ExecuteFile

C - InvokeApplication

D - QTP does not add a statement for this statement.

Answer : D

Explanation

When you specify an application to open using the Record and Run Settings dialog box, QuickTest does not add a SystemUtil.Run or any other statement to your test.

Q 5 - What is the default value for the 'Generate with statements for _____ or more objects' in General pane at Options dialog box ?

A - 0

B - 1

C - 2

D - v

Answer : C

Explanation

Default value is 2 for the option 'Generate with statements'

Answer : B

Explanation

Using asterisk(*) in regular expression indicates to match zero or more specific characters.

Q 7 - You can specify the maximum number of rows at Database checkpoint wizard, that you would like to limit the wizard to check or output. What is the maximum limit that you can specify here?

A - 65356

B - 65000

C - 32000

D - 255

Answer : D

Explanation

You can specify a maximum of 32000 rows.

Q 8 - What is the shortcut key for the standard checkpoint?

A - F8

B - F10

C - F11

D - F12

Answer : D

Explanation

Shortcut key for the standard checkpoint is F12.

Answer : A

Explanation

Table checkpoint can be created by inserting a standard checkpoint on a table object.

Answer : D

Explanation

The correct servername.typename for QTP to open using createobject is QuickTest.Application.

Q 11 - What are the options available under Quality Center version Control menu list?

  1. Check out, Undo Check out, Check In

  2. Check Out, Check In, Version History

  3. Check Out, Check In, Get Latest version

  4. Baseline History, Version History

  5. Verify Version, delete Version

A - (1) (2) and (3) only

B - (1) (4) and (5) Only

C - (1) (2) and (4) Only

D - (2) (3) and (5)

Answer : C

Explanation

Options available under Quality Center control menu are – Check out, Check in, Undo Check out, Version History,Baseline History.

Answer : B

Explanation

The correct syntax for importing a sheet is DataTable.ImportSheet “location of .xls file”,”sheet in .xls file”,”sheet in data table”

Q 13 - What does the following statement return? -

str = "QuickTestProfessional"

msgbox mid(str,instr(str,"P"),len(str))

A - QuickTest

B - Professional

C - TestPro

D - Run Error / Syntax Error

Answer : B

Explanation

str = “QuickTestProfessional”.

Q 14 - Some of the properties of an object can be changed during runtime, which are known as Run time properties but some of them can not be changed, what do we call those?

A - Description Properties

B - Test Properties

C - Test Object Properties

D - Native Properties

Answer : C

Explanation

Object properties which does not change during run time are known as Test Object Properties.

Q 15 - Where can you see the TO and RO properties and methods of an object?

A - Object Identification

B - Object Spy

C - Object Repository

D - Object Repository Manager

Answer : B

Explanation

TO and RO Properties for an object can be seen in Object spy.

Q 16 - There are two objects on a webpage with same description. How will you distinguish between these two objects?

A - using 'text' property

B - using 'class name' property

C - using 'index' property

D - using 'html tag' property

Answer : C

Explanation

For more than one object with same description, you can define the index property for the description.

Q 17 - An object repository can be imported from an _________ file.

A - xls

B - xsl

C - xml

D - htm

Answer : C

Explanation

You can export and import and object repository to an xml file.

Q 19 - If you need to open a text file in your test to write some data, which object will you use?

A - ADODB

B - TextStream

C - FileSystemObject

D - None of the above

Answer : C

Explanation

You can use Scripting.Filesystemobject to open a text file

Q 20 - Which environment variable can be used to determine the path of the folder in which the test is located?

A - ProductDir

B - TestDir

C - ResultDir

D - None of the above

Answer : B

Explanation

Environement varaible ‘TestDir’ is used to get the test location.

Q 21 - In case QTP is not able to identify an object, what could be the possible reasons for it?

A - UFT installation is corrupt

B - Test is using a non-reusable action

C - The required/correct Add-ins are not loaded.

D - None of these could be an issue

Answer : C

Explanation

If the required Add-ins for an object are not loaded, QTP may identify the object properly.

Q 22 - Which statement can be used to handle unexpected errors in your test?

A - On Error Goto 0

B - On Error Goto ErrHandler

C - On Error Resume Next

D - ON Error SKIP

Answer : C

Explanation

We can use ‘On error resume next’ in UFT script to handle unexpected errors.

Q 23 - What is the numeric value for a Pass step for Eventstatus while sending result using Reporter.ReportEvent

A - 0

B - 2

C - 3

D - 1

Answer : A

Explanation

value for micPass event status is 0

Q 24 - Selecting File > Print Preview, Displays the _________ as it will look when printed and enables you to modify the page setup.

A - Keyword view

B - Expert view

C - Object repository

D - Test Flow

Answer : A

Explanation

Print Preview displays the preview only for Keyword view.

Q 25 - Which toolbar contains pause button, to interrupt a run session?

A - Automation toolbar

B - Debug toolbar

C - Edit Toolbar

D - Action Toolbar

Answer : B

Explanation

The pause button is contained in Debug toolbar.

Answer : C

Explanation

A date constant must start and end with a # e.g. Const sDate = #30-04-2014#

Q 27 - How many times 'LearnQTP' will be Printed?

Dim x, y

For x = 0 to 5 step 2

For y = 5 to 0 step -1

print “LearnQTP”

Next

Next

A - 36

B - 18

C - 15

D - 25

Answer : B

Explanation

Executing the given statements will print 'LearnQTP' 18 times as outer for loop executes for 3 times(index variable incremented by 2) and inner loop by 6 times.

Q 28 - If not explicitly defined, a function procedure is ..... by Default

A - Private

B - Public

C - Protected

D - Preserve

Answer : B

Explanation

By Default, a function created is Public.

Q 29 - Which of the following statements can be used to clear the errors occurred in earlier statements if any?

A - Err.Raise

B - Err.Delete

C - Err.Clear

D - Err.Number = 0

Answer : C

Explanation

Err.Clear statement is used to clear the errors occured earlier in the statements, if any.

Q 30 - Which objectRepositoryUtil method is used to add an object to the object repository?

A - Load

B - GetObject

C - AddObject

D - Add

Answer : C

Explanation

You can add an object to Object Repository using the ObjectRepositoryUtil method AddObject.

Q 31 - How many counters are getting displayed at system monitor tab in test result?

A - 0

B - 1

C - 2

D - 3

Answer : C

Explanation

System Monitor tab can display a maximum of 2 counters at a time.

Answer : D

Explanation

There is an option to enable editing for read-only function library at File > Enable Editing.

Q 34 - How many types of ordinal identifiers are there in UFT?

A - 3

B - 2

C - 4

D - 5

Answer : A

Explanation

Index, Location and CreationTime.

Q 35 - What could be the value of Creation time for first opened browser?

A - 0

B - 1

C - -1

D - None

Answer : A

Explanation

First opened browser has creation time value as 0.

Q 36 - What are the default mandatory properties for a WebImage object?

A - class, filename, html id

B - alt, html id, html text

C - class, html tag, image type

D - alt, html tag, image type

Answer : D

Explanation

Defualt mandatory properties for an WebImage Object are – alt, html tag and image type.

Answer : B

Explanation

Childobjects returns the collection of child objects contained within the object.

Q 38 - When you export a captured movie to a file, the file is saved as ________ file.

A - mpg

B - dat

C - fbr

D - fsr

Answer : C

Explanation

When you export a captured movie to a file, the file is saved as fbr file.

Answer : D

Explanation

The three export format available to export test results are – Short, Details and user-defined xsl.

Q 40 - What is the method of datatable which can be used to retrieve information from datatable?

A - Value

B - GetCell

C - GetValue

D - Import

Answer : A

Explanation

Datatable.Value retrives information from a datatable.

Answer : C

Explanation

List of recovery scenarios can be made by default all the tests by selecting ‘Set as Default’ button at Recovery pane of test setting.

Q 42 - If a list of recovery scenarios are made default for all new tests that you create. What happens if you make any changes to this list for a new test?

A - it affects the current test only

B - it affects all the existing tests

C - the defined default list changes.

D - there will be no affect at all.

Answer : A

Explanation

If you make any changes to the default list of recovery scenarios, it affects the current test only where the changes have been made.

Q 43 - In update run mode, QuickTest saves the updated objects in _________ Repository

A - Local

B - Shared

C - Local and Shared both

D - either Local or Shared

Answer : A

Explanation

UFT saves the updated objects in the local object repository.

Q 44 - After running a test which has been parameterized using Datatable, where can you view the actual values taken from the data table during Run session?

A - Local Data table

B - Global Data table

C - Run Time Data table

D - Debug viewer

Answer : C

Explanation

Value set to or taken from a data table during run session can be viewed in Run Time Data table.

Answer : B

Explanation

The argument 2 used in ExitAction statement is the return value of an action.

Q 46 - Which tool can be used to merge checkpoints and output objects from primary or secondary object repository into a shared object repository?

A - Object Spy

B - Object Repository Merge Tool

C - Object Repository Comparison Tool

D - No tool can merge checkpoint or output objects

Answer : D

Explanation

There is no tool available to merge checkpoint or output objects.

Q 47 - How can you select multiple items in a multi-selection list?

A - using Select method

B - using AppendSelect method

C - using MultiSelect method

D - Using ExtendSelect method

Answer : D

Explanation

ExtendSelect method is used to select multiple item in multi-select list.

Q 48 - What is the Return Type for Click method?

A - Number

B - String

C - Boolean

D - None

Answer : D

Explanation

Click method does not return anything.

Q 49 - What are the naming restrictions for a variable?

  1. Must not begin with an alphabetic character.

  2. Cannot contain an embedded period.

  3. Must not exceed 255 character

  4. Must be unique in the scope in which it is declared.

  5. Cannot contain an underscore.

A - (1) ,(3) and (5)

B - (2) and (4) only

C - (2) and (5) only

D - (2), (3) and (4) only

Answer : D

Explanation

A variable name must be unique and in the scope in which it is declared. it should not exceed 255 chars and also it should not contain an embedded period

Q 50 - Which statement(s) can be used to declare a variable explicitly?

  1. Dim

  2. ReDim

  3. Static

  4. protected

  5. DECLARE

A - (1) and (2) only

B - (2) and (3) only

C - (3) and (5) only

D - (4) and (5) only

Answer : A

Explanation

A variable can be declared explicitly using Dim, ReDim, Private, Public

Answer : A

Explanation

Contains information about license code and can be found under C:\Program Files\Common Files\HP\License Manager\lservrc

Q 52 - Which third party tool should be installed on your machine to enable debugging in QTP scripts?

A - JInitiator

B - Oracle Debugger

C - Microsoft Debugger

D - HP Assist

Answer : C

Explanation

MS Debugger should always be installed on a QTP machine to make use of debug feature

Q 53 - What "method" is used to send custom message to result window?

A - Reporter

B - ReportEvent

C - MessageBox

D - Send

Answer : B

Explanation

Reporter is the object while ReportEvent is one of the methods of Reporter object.

Q 54 - Which of the following characters is an escape character in VB scripting i.e. it indicates that the adjacent special character is to be treated as a literal character?

A - /(forward slash)

B - \(backward slash)

C - *(star)

D - $(dollar)

Answer : B

Explanation

Backslash character is of utmost importance when you want to escape meta characters while using Regular expressions.

Q 55 - Which of the following datatable functions return the column name?

A - getcolumnname()

B - getparametername()

C - columnname()

D - parametername()

Answer : B

Explanation

getparametername return the column name.

Q 56 - Err object contains information about the run time error. Which one of the following is the default property for Err object?

A - Source

B - Description

C - Number

D - HelpText

Answer : C

Explanation

Err object has a total of 5 properties and 2 methods associated with it. Number is the default

Q 57 - Value is a default property of DataTable object. What does the number "1" indicate in the following statement? x = DataTable.Value ("Column", 1)

A - Data is called from the 1st row of DataTable

B - Data is called from the 1st column of DataTable

C - It is a sheet ID that identifies the sheet to be returned.

D - Data is called from the cell 1,1 of DataTable

Answer : C

Explanation

It is a sheet ID that identifies the sheet to be returned.

Q 58 - A Test "DemoApp" has been set to run on row 1-9 in Test Settings Dialog Box.

The "Action call properties" for action "login" is set to "Run All Rows" and the "login" action datasheet has 6 rows in it. How may iteration will the test run if it has 20 rows in the global data sheet?

A - 120

B - 54

C - 180

D - 9

Answer : B

Explanation

Test Settings dialog box controls the global data sheet so it will run 9 rows of global data sheet while action call properties controls the local data sheet so it will run 6 rows. In all 9*6 iterations will run.

Q 59 - A Test "DemoApp" has been set to run on row 1-9 in Test Settings Dialog Box. The "Action call properties" for action "login" use the default configuration and the "login" action datasheet has 6 rows in it. How may iteration will the test run if it has 20 rows in the global data sheet?

A - 120

B - 54

C - 180

D - 9

Answer : D

Explanation

Test Settings dialog box controls the global data sheet so it will run 9 rows of global data sheet. By default action call properties runs for the first row in data table., so it will run 1 rows. In all 9*1 = 9 iterations will run.

Answer : A

Explanation

Data is overwritten when column headers in Excel and the data table match.

Q 61 - When inserting a call to a reusable action, which two ways can the tester handle the data resources in that action?

  1. Have the new action refer to a read-only copy of the data in the original action.

  2. Have the action get an empty set of data resources.

  3. Delete the data.

  4. Store an editable copy of the data in the new action.

  5. Have the new action refer with write permissions to the copy of the data in the original action.

A - (1) (2) and (5)

B - (3) (4) and (5)

C - (1) (2) and (3)

D - (1) and (4)

Answer : D

Explanation

Have the new action refer to a read-only copy of the data in the original action and Store an editable copy of the data in the new action.

Q 62 - A test, EditShoppingCart, has a call to an external action, SaveCart. The owner of SaveCart needs to perform maintenance on it and has turned off its Reusable property. When testers open the EditShoppingCart test, how will they know that the SaveCart action is unavailable?

A - SaveCart is listed with an explanation in the Details column in the Missing Resources panel.

B - HP UFT pops up an informational message when EditShoppingCart is opened.

C - SaveCart is grayed out in the Test Flow panel.

D - SaveCart is grayed out in the External Actions list in the Resources panel.

Answer : B

Explanation

HP UFT pops up an informational message when EditShoppingCart is opened.

Answer : A

Explanation

same name different description, similar description

Q 65 - Which public toolkits are supported by the Web Add-in Extensibility feature? - (select 4)

  1. ASP.NET AJAX

  2. FOX

  3. SUN JWDK

  4. Motif

  5. Google Web Toolkit

  6. YahooUI

  7. Dojo

  8. COM.NET AJAX

A - (1) (5) (6) and (7) only

B - (2) (4) (6) and (8) only

C - (1) (3) (5) and (7) only

D - (3) (6) (7) and (8) only

Answer : A

Explanation

Web Extensibility features are available for ASP.NET AJAX,Google Web Toolkit, YahooUI ,Dojo

Answer : A

Explanation

It supports testing custom controls on both Internet Explorer and Firefox, and on different versions of these browsers.

Q 67 - What are prerequisites for using Log Tracking? (Select two.)

  1. The log framework must include an UDP appender.

  2. The log files must be placed in a test directory.

  3. The test must support log tracking statements.

  4. All the Optional Steps must be disabled.

  5. The tested application must use Java or .NET log framework.

A - (1) and (5) only

B - (2) and (4) only

C - (3) and (4) only

D - (1) and (2) only (

Answer : A

Explanation

The log framework must include an UDP appender and The tested application must use Java or .NET log framework.

Q 68 - You have created a Bitmap checkpoint and want to allow a certain degree of difference between a stored expected image and an image from the AUT and still consider it a PASS. Which checkpoint feature should you use?

A - RGB tolerance

B - BW tolerance

C - image tolerance

D - bit tolerance

Answer : A

Explanation

Bitmap checkpoints use RBG Tolerance.

Answer : A

Explanation

GETROPROPERTY - to retrieve a property value of a runtime object

Q 70 - How can you add or change recordable or non-recordable operations to your test? (Select three.)

  1. Drag objects from the Available Keywords pane.

  2. Drag objects from the data table or insert from a shared repository.

  3. Change the operation in the Keyword View.

  4. Drag objects from Available Keywords or from the Active Screen.

  5. Use the Step Generator or insert through Keyword View.

  6. Add an operation in the Recording Option Manager.

A - (2) (4) and (6) only

B - (1) (2) and (4) onlu

C - (3) (5) and (6) only

D - (1) (3) and (5) only

Answer : D

Explanation

Drag objects from the Available Keywords pane or change the operation in keyword view or use the step generator.

Q 72 - How does HP UFT identify each object you record? (Select two.)

  1. by class

  2. by properties

  3. by methods

  4. by ID

  5. by name

A - (1) and (3) only

B - (2) and (4) only

C - (1) and (2) only

D - (4) and (5) only

Answer : C

Explanation

UFT recognizes objects through class and properties

Answer : B

Explanation

Description Properties followed by VRI then by Smart identification and finally by ordinal identifier.

Q 74 - You have defined a global synchronization timeout of 30 seconds for your test. The synchronization point timeout for a button to become enabled is set to 30,000. During playback of the script, what is the maximum amount of time HP UFT will wait for the button to become enabled?

A - 30 seconds

B - 33 seconds

C - 60 seconds

D - 30,030 seconds

Answer : C

Explanation

Synchronization point timeout is in ms. Hence 30,000ms = 30s. UFT will wait for 30+30 = 60seconds.

Q 75 - In the test results, square brackets around a test object name indicate that the test object was dynamically created using which functions? (Select two.)

  1. Child Objects method

  2. Smart Identification

  3. DynamicBuild method

  4. Create method

  5. Programmatic Description

A - (2) and (5)

B - (3) and (1)

C - (2) and (4)

D - (1) and (5)

Answer : D

Explanation

Child Objects method and Programmatic Description

Answer Sheet

Question Number Answer Key
1 B
2 B
3 D
4 D
5 C
6 B
7 D
8 D
9 A
10 D
11 C
12 B
13 B
14 C
15 B
16 C
17 C
18 A
19 C
20 B
21 C
22 C
23 A
24 A
25 B
26 C
27 B
28 B
29 C
30 C
31 C
32 D
33 C
34 A
35 A
36 D
37 B
38 C
39 D
40 A
41 C
42 A
43 A
44 C
45 B
46 D
47 D
48 D
49 D
50 A
51 A
52 C
53 B
54 B
55 B
56 C
57 C
58 B
59 D
60 A
61 D
62 B
63 A
64 B
65 A
66 A
67 A
68 A
69 A
70 D
71 D
72 C
73 B
74 C
75 D
qtp_questions_answers.htm
Advertisements