C# Programming Questions and Answers
What is the Size of ‘Char’ datatype?
Answer: Option (C)
Choose the output for the following set of code.
staticvoid Main(string[] args)
{
char c = 'g'
string s = c.ToString();
string s1 ="I am a human bein"+ c;
Console.WriteLine(s1);
Console.ReadLine();
}
‘g’is stored in character variable ‘c’ which later on is converted to string using method Convert.Tostring() and hence appended at last of the string in s1.
Output: I am a human being.
Select the correct differences between char and varchar datatypes?
1. varchar is non unicode and char is unicode character datatype
2. char is ‘n’ bytes whereas varchar is actual length in bytes of data entered in terms of storage size
3. varchar is variable in length and char is the fixed length string
4. For varchar, if a string is less than the maximum length then it is stored in verbatim without any extra characters while for char if a string is less than the set length it is padded with extra characters to equalize its length to given length
Answer: Option (D)
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);
Answer: Option A
Explanation:
No answer description available for this question.
The string built using the String class are immutable (unchangeable), whereas, the ones built- using the StringBuilder class are mutable.
Answer: Option A
Explanation:
No answer description available for this question.
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);
Answer: Option B
Explanation:
No answer description available for this question.
What will be the output of the C#.NET code snippet given below?
|
Answer: Option D
Explanation:
No answer description available for this question.
Which of the following will be the correct output for the C#.NET code snippet given below?
|
Answer: Option B
Explanation:
No answer description available for this question.