what is diff b/n these 2 programs
1) for i=5 to 1 step 2
msgbox "pass"
next
2_) for i=5 to 1 step -2
msgbox "pass"
next

Answers were Sorted based on User's Feedback



what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / veer

From the first one will not display any message box because the condition is not true but it shows result as "done" in the result window .

From the second one will display a message box "pass" 3 times

Is This Answer Correct ?    8 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / mano

the above answer is right but in second program pass wil display 3 times

Is This Answer Correct ?    6 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / manisha

In the first one it will not display any result.Because the
condition given is wrong .

In the second one the result is displayed as pass for 3
times.

Condition for ForLoop:-
the limit must be in increament order (OR) if the limit is
decreament order we have to mention "Step -n",where n is
to skip or jump .


In the above example:-
For the 1st - no result
for the 2nd - The result is displayed as pass for 3 times.
because for i=5 to 1 step -2
i=5
i=3(jumped to 5-2=3)
i=1(jumped to 3-2=1)

Is This Answer Correct ?    5 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / ankit

OH ya...i agree
it will show message 3 times

Is This Answer Correct ?    4 Yes 0 No

what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i..

Answer / ankit

the first one will not print any message because the
condition is not true

the second one will print message pass 2 times

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More VB Script Interview Questions

i have to open a notepad having no. of words in dat file by recording in qtp and then find a particular word and display true or false

0 Answers  


can anyone tell me the procedure of interview held in applabs

0 Answers  


wat is com(common object model)object for mozilla firefox??? if any knows the exact answer....plz rply me

2 Answers  


Give me sm ideas to write Vbscripts abt protocol testing abilash700@gmail.com.

0 Answers  


which is the best institute in banglaore for software testing?

1 Answers  






Explain the arrays in vb script?

0 Answers  


write a vb script to calculate factorial of a number?

5 Answers  


i have developed the below QTP script to count the no of items available in the web list "Select a product" in www.bankrate.com and also want to print what are the items??? can any one help me to rectify the below script??? SystemUtil.Run "iexplore.exe","www.bankrate.com" a=Browser("title:=Mortgage Rates Credit Cards Refinance Home CD Rates by Bankrate.com").page("title:=Mortgage Rates Credit Cards Refinance Home CD Rates by Bankrate.com").Weblist("name:=select").GetTOProperty("items count") msgbox a Dim List() ReDim List(a-1) For i = 1 To a List(i-1)=Browser("title:=Mortgage Rates Credit Cards Refinance Home CD Rates by Bankrate.com").page ("title:=Mortgage Rates Credit Cards Refinance Home CD Rates by Bankrate.com").Weblist("name:=select").GetItem(i) Print List(i-1) Next

1 Answers  


How will you get the last occurrence of one string within another string using vbscript?

0 Answers  


How to create pull down menu box using vb script

0 Answers  


Explain about scrrun.dll in vbscript?

0 Answers  


Can automation testing find ssame no. of bugs what we can find by manual testing?

0 Answers  


Categories