You are on page 1of 8

QTP Questions

VB Script Syntax (50 Examples)


1 Print Hello World
2 Find whether given number is a odd number
3 Print odd numbers between given range of numbers
4 Find the factorial of a given number
5 Find the factors of a given number
6 Print prime numbers between given range of numbers
7 Swap 2 numbers with out a temporary variable
8 Write a program to Perform specified Arithmetic Operation on two given numbers
9 Find the length of a given string
10 Reverse given string
11 Find how many alpha characters present in a string.
12 Find occurrences of a specific character in a string
13 Replace space with tab in between the words of a string.
14 Write a program to return ASCII value of a given character
15 Write a program to return character corresponding to the given ASCII value
16 Convert string to Upper Case
17 Convert string to lower case
18 Write a program to Replace a word in a string with another word
19 Check whether the string is a POLYNDROM
20 Verify whether given two strings are equal
21 Print all values from an Array
22 Sort Array elements
23 Add two 3X3 matrices
24 Multiply Two Matrices of size 2X2
25 Convert a String in to an array
26 Convert a String in to an array using ‘I’ as delimiter
27 Find number of words in string
28 Write a program to reverse the words of a given string.
29 Print the data as a Pascal triangle
30 Join elements of an array as a string
31 Trim a given string from both sides
32 Write a program to insert 100values and to delete 50 values from an array
33 Write a program to force the declaration of variables
34 Write a program to raise an error and print the error number.
35 Finding whether a variable is an Array
36 Write a program to Convert value into a currency
37 Write a program to Convert an expression to a date
38 Display current date and Time
39 Find difference between two dates.
40 Add time interval to a date
41 Print current day of the week
42 Convert Date from Indian Format to US format
43 Find whether current month is a long month
44 Find whether given year is a leap year
45 Format Number to specified decimal places
46 Write a program to Generate a Random Number
47 Write a program to show difference between Fix and Int
48 Write a program to find subtype of a variable
49 Write a program to print the decimal part of a given number
50 Write a Function to return a random number
51 Write a Function to add and multiply two numbers
52 Write a Sub Procedure to print “Hello World”
53 Write a Sub Procedure to add and multiply two numbers
54 Write a program to list the Timezone offset from GMT
VB Script Advanced Programming (100 Examples)
1 Write a program to read data from a text file
2 Write a program to write data into a text file
3 Write a program to print all lines that contains a word either “infics” or “solutions”
4 Write a program to print the current foldername
5 Write a program to print files in a given folder
6 Write a program to print subfolders in a given folder
7 Write a program to print all drives in the file system
8 Write a program to print current drive name
9 Print the last modified and creation date of a given file
10 Print the size of the file and size on the disk.
11 Write a program to display files of a specific type
12 Write a program to print the free space in a given drive
13 Write a program to display all subfolders in a given folder
14 Write a program to find whether a given folder is a special folder
15 Write a program to remove all empty files in the folder
16 Write a program to Copy contents of one folder to other folder
17 Write a program to check whether a given path represents a file or a folder
18 Write a program to compress a folder
19 Write a program to rename a folder
20 Write program to display all folders created on a specific date
21 Write a Program to enable disk quotas
22 Write a program to create, modify and delete disk quota
23 Write a program to display all files containing “demo” in their name
24 Write a program to print all lines in a file that ends with “world”
25 Write a program to check whether string starts with “Error”
26 Write a program to Replace all words that contains “demo” in a file with the word
“infics”
27 Write a program to check whether a string contains only alpha numerics
28 Write a program to check whether a string is in email format
29 Write a program to check whether given string is in date format
30 Write a program to print all the lines ending with '$'
31 Check whether middle three characters in a word contains alphanumeric
32 Check whether a given line is an empty
33 Write a program to Add elements to a dictionary
34 Write a program to display items in a dictionary
35 Write a program to check whether specified Key exists in a Dictionary
36 Write a program to Store dictionary items in an array
37 Write a program to delete Key Value pair in the dictionary
38 Write a program to monitor operating system performance
39 Write a program to monitor operating system objects
40 Write a program to monitor web server performance
41 Write a program to monitor browser service performance
42 Write a program to list the PID and PPID of a process
43 Write a program to create a registry key
44 Write a program to list registry files
45 Write a program to list registry value and types
46 Write a program to delete registry key
47 Write a program to Stop and Start alerter service
48 Write a program to list services running and their statuses.
49 Write a program to list services that can be stopped
50 Write a program to start auto start services that have stopped
51 Write a program to Invoke command prompt and execute dir command from the
shell
52 Write a program to schedule a task
53 Write a program to list and delete scheduled tasks
54 Write a program to add a local user account
55 Write a program to disable and delete a local user account
56 Write a program to list all user accounts in the local computer
57 Write a program to display logged in user name
58 Write a program to list cache memory information
59 Write a program to list physical memory properties
60 Write a program to list memory devices
61 Write a program to find Hard Disk size
62 Write a program to find RAM size
63 Write a program to restart a computer
64 Write a program to shutdown a computer
65 Write a program to Execute Perl script from VB Script
66 Find the systems present in the LAN
67 Write a program to Print using remote printer
68 Verify whether IE enhanced security is enabled for logged on user
69 Write a program to add a website to a favourite menu
70 Write a program to list IE LAN settings
71 Write a program to list cache, connection and security zone settings
72 Find the arguments passed to a Windows Script Host
73 Write a program to Map a network drive
74 Write a program to Print to the local printer
75 Write a program to Print to remote printer
76 Write a program to Print Computer name
77 Write a program to Print free memory in the drive
78 Write a program to Print memory and CPU utilized by a process
79 Write a program to Find the ipaddress of a local system
80 Write a program to find Network Drives
81 Write a program to find the Full path name of a shortcut
82 Write a program to Retrieve all the rows in a table
83 Write a program to find the name of columns in a table
84 Write a program to find number of rows in each column
85 Write a program to connect and print data from oracle database
86 Write a program to connect and print data from SQL Server database
87 Write a program to retrieve specific field from the database table
88 Write a program to check whether a column in the database is in ascending order
89 Write a program to insert a new row into the database table
90 Write a program to open the two record sets
91 Write a program to Update the specific field in the database table
92 Write a program to delete all records whose username starts with demo
93 Write a program to sort the record set
94 Write a program to find number of rows in a table
95 Write a program to Write simple text to windows word
96 Write a program to Write table to windows word
97 Write a program to apply style to a table in word document
98 Write a program to open and print a word document
99 Write a program to send an email using outlook
100 Write a program to print data present in all sheets of an excel files
QTP Scripting (100 Examples)
1 Write a program to enter data in login screen
2 Write a program to find the x and y coordinates of a button
3 Write a program to Read items in a list box
4 Write a program to Read items on a desktop
5 Write a program to Capture Desktop Screen shot
6 Write a program to Read tab names from a tabbed window
7 Write a program to Check whether scrollbars exists inside a editor
8 Write a program to check whether edit box is enabled or writable
9 Write a program to Check scroll bars in a web page
10 Write a program to Check whether dialog is middle of the window
11 Write a program to Check whether Window is middle of the screen
12 Write a program to Check whether country contains all the states
13 Write a program to Check whether edit box is focused
14 Write a program to Check default selection in a list box
15 Write a program to Capture webbutton image
16 Write a program to List all links in the web page
17 Write a program to Check whether given link exists
18 Write a program to Find image width and Height
19 Write a program to Print URL displayed in the address bar
20 Write a program to Check whether webpage downloaded completely
21 Write a program to Refresh a web page
22 Write a program to Verify page title is displayed correctly
23 Write a program to Verify whether page contains frames
24 Write a program to Find page load time
25 Write a program to Check given text is displayed on the web page
26 Write a program to Find whether image contains tool tip
27 Write a program to Invoke the Browser with specified URL
28 Write a program to Import an excel file to a Data table
29 Write a program to Read data from first parameter of Global sheet
30 Write a program to Read data from all sheets and all parameters of the excel file
31 Write a program to place data in a specific sheet in the excel file
32 Write a program to Import data to data table from a database
33 Write a program to Read and display data from CSV file
35 Write a program to Find number of rows and columns in a web table
36 Write a program to Display entire data in the web table
37 Write a program to Display all images in the webpage
38 Write a program to Check whether table contains headers
39 Write a program to Find the background colour of a webobject
40 Write a program to Print results in a HTML format
41 Write a program to Select different radio buttons for different script iterations
42 Write a program to Find the dialog Height whose window name is “<Date>
Appointments”
43 Write a program to Read all the items from a services window
44 Write a program to Find screen resolution
45 Write function to compare two bitmaps
46 Write a program to Add and Remove Repositories to the action
47 Write a program to Load Library files
48 Write a program to Enable and Disable Recovery scenarios programmatically
49 Write a program to Report Results status to Results file
50 Write a program to Find the active window name
51 Write a program to List out the windows that are open
52 Write a program to Call reusable actions from different script
53 Write your own standard checkpoint
54 Write your own synchronization function
55 Write a program to Check whether there is a memory leak in the process
56 Write a program to Close all the dialogs open in a window
57 Write a program to Read menu names
58 Write a program to Read menu items
59 Write a program to Check whether a check button is selected or not
60 Write a program to Check whether we can select multiple items in the listbox
61 Write a program to Check whether edit box allows exactly 15 characters
62 Write a program to Check whether items in the page are aligned properly
63 Write a program to Check whether data in the webtable is left aligned
64 Write a program to Find which add-ins are loaded.
65 Write a program to Find available add-ins in the tool
66 Write a program to Change window title
67 Write a program to Find whether specified window is there on the desktop
68 Write a program to Check whether a window is in minimized or maximized
69 Write a program to Check window is resizable
70 Write a program to Check whether logo displayed is correct?
71 Write a program to Read all items in a tree
72 Write a program to Read all elements in the XML file
73 Write a program to Read attributes of a particular element in the XML file
74 Write a program to Modify attribute value
75 Write a program to Add one more elements to XML file
76 Write a program to Display complete contents of an XML file
77 Write a program to Find font type.
78 Write a program to Find Font size
79 Write a program to Check whether text is bold and underlined
80 Write a program to Find the memory utilized by a process
81 Write a program to Verify flash image
82 Write a program to Check pointed link is having different back ground colour?
83 Write a program to Check Marquee
84 Write a program to Check whether selected tab is having different appearance?
85 Write a program to Check whether a link contains image to its left side.
86 Write a program to Check whether stock prices are updating an hourly basis
87 Write a program to Retrieve Action Parameters
88 Write a program to Disable active screen programmatically
89 Write a program to Modify Mandatory and Assistive properties programmatically
90 Write a program to Configure Run options programmatically
91 Write a program to Define test results location through program
92 Write a program to Disable Run settings
93 Write a program to Read and Update data from user defined environmental variable
94 Write a program to Configure maximum timeout value for web page to load
95 Write a program to read and delete cookies
96 Write a program to Verify whether status indicator is moving as the movie is
playing
97 Write a program to Clear the cache in the webpage
98 Write a program to Check whether webpage is loaded from server or from cache
99 Write a program to Configure web options programmatically
100 Write a program to Instruct Quicktest to Capture Movie Segments of Each Error and
Warning
101 Write a program to Check whether new items can be added to a listbox
102 Write a program to Check whether link s pointing to correct URL
103 Write a program to invoke the application
104 Write a program to Read parameters in the data table
105 Write a program to List out the windows that are minimized
106 Write a program to add environmental variables during run time
107 Write a program to check whether tab order is left to right and top to bottom
108 Write a program to find the maximum text length that can be entered in a edit box
109 Write a program to verify min and max length constraints of text in an edit box
110 Write a program to find the kind of data edit box accepts
111 Write a program to add objects to object repository file
112 Write a program to export object repository file to XML
113 Write a program to check whether a column in the database table is a primary key
114 Write a program to display constraints of a column in the database table

You might also like