QTP Interview question 34: Explain the difference between VBScript function and VBScript subroutine?

Advanced QTP interview questions may examine not only various aspects of QA tester's hands-on experience with HP QTP, but how deep the interviewee knows VBScript - HP Quick Test Professional scripting language. The candidate for QTP QA tester position should be familiar with VBScript variables and arrays, able to explain the difference between VBScript function and VBScript subroutine and for some high level test position show the real life experience working with VBScript classess.

VBScript subroutine is a series of statements, enclosed by the Sub and End Sub statements, can perform actions, but does not return a value, can take arguments and without arguments, it should include an empty set of parentheses.

VBScript function is a series of statements, enclosed by the Function and End Function statements, can perform actions and can return a value, can take arguments that are passed to it by a calling procedure, without arguments should include an empty set of parentheses and returns a value by assigning a value to its name.

The major difference between VBScript function and a subroutine, is that a function can return a value back to where it was called from.

No comments:

Common QTP Interview Questions