Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Strings Questions
C#.NET strings: What will be printed by the following code when comparing two differently cased strings? String s1 = 'Five Star'; String s2 = 'FIVE STAR'; int c; c = s1.CompareTo(s2); Console.WriteLine(c); Choose the correct result of the call to CompareTo (case-sensitive, culture-aware comparison).
C#.NET string interning and object references: consider the code String s1, s2; s1 = 'Hi'; s2 = 'Hi'; Which statements about object creation and references are true?
C#.NET String.Insert: determine the output of String s1 = 'Nagpur'; String s2; s2 = s1.Insert(6, 'Mumbai'); Console.WriteLine(s2); What is printed?
C#.NET: Correct ways to convert a String to an int (assume s = '123'). Select all valid C# approaches.
C#.NET strings: What is the correct way to compare two string variables s1 and s2 for equality of contents (not assignment)?
C#.NET strings vs. StringBuilder: choose the correct statement about mutability and immutability.
Where are C#.NET String objects created? Choose the correct statement about the memory location of a String.
String and StringBuilder in C#.NET: select the correct statements. 1) Two strings can be concatenated using s3 = s1 + s2; 2) String is a primitive in C#.NET. 3) A string built with StringBuilder is mutable. 4) A string built with String is immutable. 5) Two strings can be concatenated using s3 = s1 & s2;
Comparing string contents in C#.NET: which of the following are valid ways to determine if two strings s1 and s2 have equal contents? 1) if(s1 = s2) 2) if(s1 == s2) 3) int c; c = s1.CompareTo(s2); 4) if(strcmp(s1, s2)) 5) if (s1 is s2)
Copying the contents of one string to another in C#.NET: choose the statement that correctly creates a new string with the same contents as an existing one.
C#.NET — What does this program print? namespace CuriousTabConsoleApplication { class SampleProgram { static void Main(string[] args) { string str = "Hello World!"; Console.WriteLine(String.Compare(str, "Hello World?").GetType()); } } } Predict the exact console output when the program runs.
C#.NET — Which is the correct way to find the index of the second 's' in the string: "She sells sea shells on the sea-shore"? Choose the valid code snippet that correctly identifies the second occurrence.
C#.NET strings — identify the correct statements about string type, literals, equality, bounds, and mutability.
C#.NET — choose the valid ways to convert a Single (float) to a String.
C#.NET strings — select the correct statement about strings.
C#.NET strings — evaluate the output of: String s1 = "ALL MEN ARE CREATED EQUAL"; String s2; s2 = s1.Substring(12, 3); Console.WriteLine(s2);
C#.NET — Determine the correct output for the code: String s1 = "Kicit"; Console.Write(s1.IndexOf('c') + " "); Console.Write(s1.Length);