What is the difference between Dim And Redim

Answers were Sorted based on User's Feedback



What is the difference between Dim And Redim..

Answer / ravi_kanakam

Dim statement is used to formally declare a variable, where
as ReDim statement is used to resize a dynamic array that
has already been formally declared.

Is This Answer Correct ?    97 Yes 9 No

What is the difference between Dim And Redim..

Answer / paayal

Dim is a data type(variant) that user can assign to a
variable like Dim User
User = "QTP"

Redim can be use to reinitialize the variable. We can give
a new value to the same variable and can use it again in
the script.

Is This Answer Correct ?    59 Yes 16 No

What is the difference between Dim And Redim..

Answer / deepa

Dim Statement

Declares variables and allocates storage space.

Dim varname[([subscripts])][, varname[([subscripts])]] . . .

Variables declared with Dim at the script level are
available to all procedures within the script. At the
procedure level, variables are available only within the
procedure.

You can also use the Dim statement with empty parentheses
to declare a dynamic array. After declaring a dynamic
array, use the ReDim statement within a procedure to define
the number of dimensions and elements in the array. If you
try to redeclare a dimension for an array variable whose
size was explicitly specified in a Dim statement, an error
occurs.


ReDim Statement
Declares dynamic-array variables, and allocates or
reallocates storage space at procedure level.

ReDim [Preserve] varname(subscripts) [, varname
(subscripts)] . . .

The ReDim statement is used to size or resize a dynamic
array that has already been formally declared using a
Private, Public, or Dim statement with empty parentheses
(without dimension subscripts). You can use the ReDim
statement repeatedly to change the number of elements and
dimensions in an array.

If you use the Preserve keyword, you can resize only the
last array dimension, and you can't change the number of
dimensions at all. For example, if your array has only one
dimension, you can resize that dimension because it is the
last and only dimension. However, if your array has two or
more dimensions, you can change the size of only the last
dimension and still preserve the contents of the array.

The following example shows how you can increase the size
of the last dimension of a dynamic array without erasing
any existing data contained in the array.

ReDim X(10, 10, 10)
. . .
ReDim Preserve X(10, 10, 15)
Caution If you make an array smaller than it was
originally, data in the eliminated elements is lost.

Is This Answer Correct ?    20 Yes 7 No

What is the difference between Dim And Redim..

Answer / sabitha reddy

Dim statement is used to declare a variable

The redim statement is used to change the array size within the script,

for example..
if we have declared an array dim customer (30)
but after that we want to change the size of the array , we can do it with the help of Redim statement
like-Redim customer(100)

Is This Answer Correct ?    14 Yes 5 No

Post New Answer

More QTP Interview Questions

Hi All, I have QTP installed on my machine but the application under test (AUT) is on remote desktop.My scenarios is like that,it should contain following steps. 1)Automatically it should click on start and then on remote desktop connection. 2)it should enter the IP address and then connect to remote desktop. 3)and then it should be able to record the application in remote machine and then run it also. Can somebody tell me how to record the application which is in remote machine.

0 Answers  


Which functionalities of QTP used in banking project? pls any say answer?

0 Answers  


regular expression in qtp standar check point for months from accepting months from january to december only

0 Answers  


i have to pass the testcases into userid anf password of gmail login page using functions you can take your own testcaseslike userdid should take only lowerletters it should not take special charactors and uppercase letters and password should take only numericvalues it should not take alphanumeric and alphabets

2 Answers  


Explain the check points in QTP?

22 Answers   Gray Matrix, IBM, Microsoft, Prapan Solutions, Zensar,






Are u place all QTP Framework folders in VSS?

4 Answers   TCS,


I recorded a Web App with a Oracle backend using QTP 9.5 and for some reason the scripts don't play back> What am I missing at this point. I recorded the same Apps under Sybase and they work great. This is Oracle 10g. Why won't my scripts play back.

0 Answers  


When The Low Level Recording is Used in QTP

17 Answers  


how to write testcases for web based insurance,from the script by using qtp.

1 Answers  


Explain the difference between call to action and copy action?

0 Answers  


Where can I find and view run-time data table?

0 Answers  


hi everyone today is the first time i saw this website,and hi iam siraj,iam very impressed by seeing evryones response towards questions,iam a newcomer and i have got tryining in testing can anyone please send me some projects relaited to testing.i know it is very confidential but still if u send it will a great help. my mail id venku_krs@yahoo.co.in

1 Answers  


Categories