Hi everybady,

i have faced few Qns in one of i attended interview, please help me out with these below Qns.
1. how to join values without using join function?
2. how to compare values without using String compare function?
3. input is Bangalore, but i need output like this below format, what is function to use and get this outcome
B
A
N
G
A
L
o
R
E
4. Input is "CapGemini" but uotput should be like this "inimeGpaC"
5. Input is
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Can someone let me know results of this Qns, please. Thanks.

Answer Posted / cnu_thatavarthi

1. how to join values without using join function?

Ans:
Option Explicit
Dim strValue, arrValue,iCount

arrValue = Array("Srinivasulu","Thatavarthi")

For iCount = 0 To UBound(arrValue)

strValue =strValue&" "& arrValue(iCount)

Next

MsgBox strValue

'Actual Output:
---------------------------

---------------------------
Srinivasulu Thatavarthi
---------------------------
OK
---------------------------
2. how to compare values without using String compare function?
Ans:
Option Explicit
Dim strValue

strValue = "Thatavarthi"

If strValue = "Thatavarthi" Then
MsgBox "Both strings are same"
Else
MsgBox "Both strings are not same"
End If

'Expected out Put
---------------------------

---------------------------
Both strings are same
---------------------------
OK
---------------------------
3. input is Bangalore, but i need output like this below format, what is function to use and get this outcome
B
A
N
G
A
L
o
R
E?
Ans:
Option Explicit
Dim strValue,iCount, strNewValue

strValue = Ucase("Bangalore")

For iCount = 1 To Len(strValue)

strNewValue = strNewValue& vbNewLine& Mid(strValue,iCount,1)

Next
MsgBox strNewValue

'Expected Value:
---------------------------

---------------------------


B

A

N

G

A

L

O

R

E
---------------------------
OK
---------------------------
4. Input is "CapGemini" but uotput should be like this "inimeGpaC"
Option Explicit
Dim strValue,iCount, strNewValue

strValue = "CapGemini"

For iCount = Len(strValue) To 1 Step -1

strNewValue = strNewValue& Mid(strValue,iCount,1)

Next

strNewValue = Trim(strNewValue)
MsgBox strNewValue

'Expected value
---------------------------

---------------------------
inimeGpaC
---------------------------
OK
---------------------------
5. Input is
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Ans:

Option Explicit
Dim iCount,strValue,jcount,arrValue

For iCount = 1 To 5
For jcount = 1 To 5
If iCount = jcount then
strValue = strValue&jcount
Exit For
End IF
Next
arrValue = arrValue&vbNewline& strValue
Next

MsgBox arrValue
'Expected Output
---------------------------

---------------------------


1

12

123

1234

12345
---------------------------
OK
---------------------------

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

By default in vbscript the arguments passed to functions and subroutines are by reference or by value?

629


What is the difference between do until loop and do while loop?

547


What are the 2 ways to pass a value to the function?

523


Explain about .wsf files?

624


Mention when to use function procedures and what are its characteristics?

631






Can anyone send me a vb script function for verifying the functionality of active links on a web page

1604


who will create the object?

1725


How to pass argument by reference to a function in vbscript?

540


Mention how you can call vbscript functions?

587


What is the difference between VBScript and JavaScript?

2073


Which operator is used to perform the comparison among 2 operands in the vbscript language?

532


What methods are used to create text files and open text files in the vbscript language?

540


hi i am trying for testing job for 3+ experience(fake) can u suggest me what type of projects i can keep in my resume and how much of knoeledge i should have abt that project.thnks in advance.urgt plz

2590


What's the difference between vbscript and vb.net?

559


What is the difference between a dictionary and an array?

583