IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C++ Programming C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C# Programming - Strings

@ : Home > C# Programming > Strings > General Questions

Exercise

  • General Questions
"Nothing in life is to be feared, it is only to be understood."
- Marie Curie
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

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. AREB. CRE
C. CRD. REA
E. CREATED

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);

4. 

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

A. TrueB. False

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



© 2008-2013 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Contact us: info@indiabix.com     Follow us on twitter!