0% found this document useful (0 votes)
20 views3 pages

String Processing in

Uploaded by

alaabuikhzam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

String Processing in

Uploaded by

alaabuikhzam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Question 1: String Manipulation with Replace

Dim str As String = "The quick brown fox jumps over the lazy dog"

Dim result As String = [Link]("quick", "fast").Replace("dog", "cat")

[Link](result)

Trace the output.

Expected Output: The fast brown fox jumps over the lazy cat

Question 2: Substring and IndexOf

Dim text As String = "[Link] is a powerful language"

Dim sub As String = [Link]([Link]("powerful"), 9)

[Link](sub)

Trace the output.

Expected Output: powerful

Question 3: String Split with Multiple Delimiters

Dim data As String = "apple;orange,banana;grape"

Dim fruits() As String = [Link](";,")

For Each fruit As String In fruits

[Link](fruit)

Next

Trace the output.

Expected Output:
apple
orange
banana
grape

Question 4: String Formatting with Conditional Logic

Dim name As String = "Alice"

Dim age As Integer = 30

Dim result As String = [Link]("Name: {0}, Age: {1}, Status: {2}", name, age, If(age >= 18, "Adult", "Minor"))

[Link](result)
Trace the output.

Expected Output: Name: Alice, Age: 30, Status: Adult

Question 5: String Comparison with IgnoreCase

Dim str1 As String = "hello"

Dim str2 As String = "HELLO"

Dim isEqual As Boolean = [Link](str1, str2, [Link]) = 0

[Link](isEqual)

Trace the output.

Expected Output: True (case-insensitive comparison)

Question 6: StringBuilder Append and Replace

Dim sb As New [Link]("Hello World!")

[Link](" How are you?")

[Link]("World", "[Link]")

[Link]([Link]())

Trace the output.

Expected Output: Hello [Link]! How are you?

Question 7: String Length and Indexing

Dim sentence As String = "Programming in [Link]"

Dim length As Integer = [Link]

Dim index As Integer = [Link]("VB")

[Link]("Length: " & length)

[Link]("Index of 'VB': " & index)

Trace the output.

Expected Output:
Length: 22
Index of 'VB': 14

Question 8: ToUpper, ToLower with String Concatenation

Dim part1 As String = "VB"


Dim part2 As String = ".NET"

Dim result As String = [Link]() & [Link]()

[Link](result)

Trace the output.

Expected Output: [Link]

Question 9: String Trim and StringLength

Dim input As String = " Hello, World! "

Dim trimmed As String = [Link]()

Dim length As Integer = [Link]

[Link]("Trimmed: '" & trimmed & "' Length: " & length)

Trace the output.

Expected Output: Trimmed: 'Hello, World!' Length: 15

Question 10: StringBuilder with Loop

Dim sb As New [Link]()

For i As Integer = 1 To 5

[Link]("Number " & i & " ")

Next

[Link]([Link]())

Trace the output.

Expected Output: Number 1 Number 2 Number 3 Number 4 Number 5

You might also like