Exercise: Strings
Questions for: Strings
Which of the following statement is correct about a String in C#.NET?
A:
A String is mutable because it can be modified once it has been created.
B:
Methods of the String class can be used to modify the string.
C:
A number CANNOT be represented in the form of a String.
D:
A String has a zero-based index.
Answer: D
No answer description is available. Let's discuss.
Which of the following statements about a String is correct?
A:
A String is created on the stack.
B:
Whether a String is created on the stack or the heap depends on the length of the String.
C:
A String is a primitive.
D:
A String can be created by using the statement String s1 = new String;
Answer: E
No answer description is available. Let's discuss.
Discuss About this Question.
Which of the following is correct way to convert a String to an int?
String s = "123"; int i; i = (int)s;String s = "123"; int i; i = int.Parse(s);String s = "123"; int i; i = Int32.Parse(s);String s = "123"; int i; i = Convert.ToInt32(s);String s = "123"; int i; i = CInt(s);
A:
1, 3, 5
B:
2, 4
C:
3, 5
D:
2, 3, 4
Answer: D
No answer description is available. Let's discuss.
Discuss About this Question.
Which of the following will be the correct output for the C#.NET code snippet given below?
String s1="Kicit";
Console.Write(s1.IndexOf('c') + " ");
Console.Write(s1.Length);
A:
3 6
B:
2 5
C:
3 5
D:
2 6
Answer: B
No answer description is available. Let's discuss.
Discuss About this Question.
Which of the following snippets are the correct way to convert a Single into a String?
Single f = 9.8f; String s; s = (String) (f);Single f = 9.8f; String s; s = Convert.ToString(f);Single f = 9.8f; String s; s = f.ToString();Single f = 9.8f; String s; s = Clnt(f);Single f = 9.8f; String s; s = CString(f);
A:
1, 2
B:
2, 3
C:
1, 3, 5
D:
2, 4
Answer: B
No answer description is available. Let's discuss.
Discuss About this Question.
Ad Slot (Above Pagination)
Discuss About this Question.