C# Programming - Strings

Why C# Programming Strings?

In this section you can learn and practice C# Programming Questions based on "Strings" and improve your skills in order to face the interview, competitive examination and various entrance test (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

Where can I get C# Programming Strings questions and answers with explanation?

IndiaBIX provides you lots of fully solved C# Programming (Strings) questions and answers with Explanation. Solved examples with detailed answer description, explanation are given and it would be easy to understand. All students, freshers can download C# Programming Strings quiz questions with answers as PDF files and eBooks.

Where can I get C# Programming Strings Interview Questions and Answers (objective type, multiple choice)?

Here you can find objective type C# Programming Strings questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided.

How to solve C# Programming Strings problems?

You can easily solve all kind of C# Programming questions based on Strings by practicing the objective type exercises given below, also get shortcut methods to solve C# Programming Strings problems.

Exercise :: Strings - General Questions

  • Strings - General Questions
1. 

Which of the following statements are true about the C#.NET code snippet given below?

String s1, s2; 
s1 = "Hi"; 
s2 = "Hi";
  1. String objects cannot be created without using new.
  2. Only one object will get created.
  3. s1 and s2 both will refer to the same object.
  4. Two objects will get created, one pointed to by s1 and another pointed to by s2.
  5. s1 and s2 are references to the same object.

A. 1, 2, 4
B. 2, 3, 5
C. 3, 4
D. 2, 5

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

2. 

Which of the following will be the correct output for the C#.NET code snippet given below?

String s1 = "ALL MEN ARE CREATED EQUAL";
String s2;
s2 = s1.Substring(12, 3); 
Console.WriteLine(s2);

A. ARE
B. CRE
C. CR
D. REA
E. CREATED

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

3. 

Which of the following statements will correctly copy the contents of one string into another ?

A.
String s1 = "String";
String s2; 
s2 = s1;
B.
String s1 = "String" ; 
String s2;
s2 = String.Concat(s1, s2);
C.
String s1 = "String"; 
String s2;
s2 = String.Copy(s1);
D.
String s1 = "String"; 
String s2;
s2 = s1.Replace();
E.
String s1 = "String"; 
String s2;
s2 = s2.StringCopy(s1);

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.

4. 

The string built using the String class are immutable (unchangeable), whereas, the ones built- using the StringBuilder class are mutable.

A. True
B. False

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

5. 

Which of the following will be the correct output for the C#.NET code snippet given below?

String s1 = "Nagpur";
String s2;
s2 = s1.Insert(6, "Mumbai"); 
Console.WriteLine(s2);

A. NagpuMumbair
B. Nagpur Mumbai
C. Mumbai
D. Nagpur
E. NagpurMumbai

Answer: Option E

Explanation:

No answer description available for this question. Let us discuss.