Data Manipulation with Strings in Studio Flashcards

1
Q

What is data manipulation?

A

Data manipulation is the process of modifying, structuring, formatting, or sorting data in order to facilitate its usage and increase its management capabilities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does String.Concat method do?

A

Concatenates the string representations of two specified objects.

Expression: String.Concat (VarName1, VarName2)

Output datatype: String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the method that can be used to check whether a specified substring occurs within a String?

A

Contains method. It returns true or false.

Expression: VarName.Contains (“text”)

Output datatype: Boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is String.Format method do?

A

Converts the value of objects to strings (and inserts them into another text).

Expression: String.Format(“{0} is {1}”, VarName1, VarName2)

Output datatype: String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the IndexOf method do?

A

Returns the zero-based index of the first occurrence of a specified Unicode character or string within this instance.

Expression: VarName1.IndexOf(“a”)

Output datatype: Int32

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does LastIndexOf method do?

A

Reports the zero-based index position of the last occurrence of a specified Unicode character or string within this instance.

Expression: VarName1.LastIndexOf(“author”)

Output datatype: Int32

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the method to use to concatenate the elements in a collection and displays them as String.

A

String.Join

Expression: String.Join(“|”, CollVarName1)

Output datatype: String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What method should you use to replace all the occurrences of a substring in a string.

A

Replace.

Expression: VarName.Replace (“original”, “replaced”)

Output datatype: String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the output data type of Split method?

A

Array of Strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does Substring method do?

A

Extracts a substring from a string using the starting index and the length.

Expression: VarName1.Substring(startIndex, length)

Output datatype: String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the function of the Matches method in RegEx Builder?

A

Searches an input string for all the occurences and returns all the successful matches.

Output datatype: System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Match></System.Text.RegularExpressions.Match>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the function of the IsMatch method in RegEx Builder?

A

Indicates whether the specified regular expression finds a match in the specified input string.

Output datatype: Boolean

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the function of the Replace method in RegEx Builder?

A

Replaces strings that match a regular expression pattern with a specified replacement string.

Output datatype: String

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Choose four typical uses of RegEx:
A. String Parsing
B. Data Scraping
C. Interacting with UI Elements
D. String manipulation
E. Debugging
F. Input validation

A

A. String Parsing
B. Data Scraping
D. String manipulation
F. Input validation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Consider the string variable Letters = “abcdefg”.

Which out of the four values would the expression Letters.Substring(1,2) return?

  1. “ab”
    2.”bcd”
    3.”abc”
    4.”bc”
A
  1. “bc”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which out of the three activities can be used to process every item in a collection individually?
1. While
2. For Each
3. Do While

A
  1. For Each
17
Q

Pair the following methods that use the RegEx builder with the correct explanations.
A. Matches
B. Replace
C. IsMatch

1.Searches an input string for all occurrences and returns all the successful matches.
2. Indicates if the specified regular expression finds a match in the specified input string.
3. Replaces strings that match a Regex pattern with a specified replacement string.

A

A. 1
B. 3
C. 2

18
Q

Which out of the four options is the correct way to concatenate a string variable (Username) with a string (“ is online”)?
1. Username + is online
2. Username + “ is online”
3. “Username” + “ is online”

A
  1. Username + “ is online”
19
Q

What will the following expression return?

String.Format(“{1} is {0}”, “home”, “John”, “far away”, 0, 1)

A. “John is far away”
B. “1 is 0”
C. “Home is far away”
D. “John is home”

A

D. “John is home”

20
Q

Consider the list of strings ListOfContinents = {“Africa”, “Antarctica”, “Asia”, “Australia”, “Europe”, “North America”, “South America”}.

What value will the expression ListOfContinents(2) return?

A

Asia

21
Q

Which of the three collection data types is the best to store several cake recipes (names and ingredients)?

A

Dictionary