Strings Flashcards

1
Q

Given a string, how to determine if its permutation could form a palindrome ?

A

If a string with an even length is a palindrome, every character in the string must always occur an even number of times. If the string with an odd length is a palindrome, every character except one of the characters must always occur an even number of times

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

What function determines that character is a letter or digit?

A

Char.IsLetterOrDigit(‘c’);

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

What character function converts the character to lower case?

A

Char.ToLower(‘c’);

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

How to reverse the string in C#?

A
char[] charArray=str.ToCharArray();
Array.Reverse(charArray);
string reversedString=new string(charArray);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Given integer, how to get its corresponding character?

A

(char)number

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

What is the string Builder.Remove signature looks like?

A

Remove (int startIndex, int length);

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

Can we use foreach with string builder?

A

foreach statement cannot operate on variables of type ‘StringBuilder’ because ‘StringBuilder’ does not contain a public instance definition for ‘GetEnumerator’

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