Welcome to the Data Types,Variables and Operators MCQs Page
Dive deep into the fascinating world of Data Types,Variables and Operators with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Data Types,Variables and Operators, a crucial aspect of C# Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Data Types,Variables and Operators, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# Programming.
Check out the MCQs below to embark on an enriching journey through Data Types,Variables and Operators. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# Programming.
Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Data Types,Variables and Operators. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!
Data Types,Variables and Operators MCQs | Page 8 of 14
Explore more Topics under C# Programming
Enter a String:BOMBAY.
static void Main(string[] args)
{
string Str, Revstr = " ";
int Length;
Console.Write("Enter A String : ");
Str = Console.ReadLine();
Length = Str.Length - 1;
while (Length >= 0)
{
Revstr = Revstr + Str[Length];
Length --;
}
Console.WriteLine("Reverse String Is {0}", Revstr);
Console.ReadLine();
}
static void Main(string[] args)
{
string teststring = "MIKA@?&";
string hex = ConvertstringToHex(teststring, system.Text.Encoding.Unicode);
Console.WriteLine(hex);
}
a)
static string ConvertstringToHex(string input, system.Text.Encoding encoding)
{
string Bytes = encoding.GetBytes(input);
string Builder sbBytes = new Builder sbBytes();
for each (byte 'b' in StringBytes)
{
sBytes.AppendFormat("{0:x2}", b);
}
return sbBytes.Tostring();
}
b)
static string ConvertstringToHex(string input, system.Text.Encoding encoding)
{
char[]string Bytes = encoding.GetBytes(input);
string Builder sbBytes = new Builder sbBytes(StringBytes.Length*2);
for each (byte 'b' in StringBytes)
{
sBytes.AppendFormat("{0:X2}", b);
}
return sbBytes.Tostring();
}
c)
public static string ConvertStringToHex(String input, System.Text.Encoding encoding)
{
{
Byte[] stringBytes = encoding.GetBytes(input);
StringBuilder sbBytes = new StringBuilder(stringBytes.Length * 2);
foreach (byte b in stringBytes)
{
sbBytes.AppendFormat("{0:X2}", b);
}
Console.WriteLine(sbBytes.ToString());//sbBytes.ToString());
return sbBytes.ToString();
}
}
static void Main(string[] args)
{
string testString = "MIKA@?&^";
string normal = ConvertHexToString (hex, System.Text.Encoding.Unicode);
Console.WriteLine(normal);
Console.ReadLine();
}
a)
public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding)
{
char[] numberChars = hexInput.Length;
byte[] bytes = new byte[numberChars / 2];
for (int i = 0; i < numberChars; i += 2)
{
bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 0), 16);
}
return encoding.GetString(bytes);
}
b)
public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding)
{
int numberChars = hexInput.Length;
byte[] bytes = new byte[numberChars / 2];
for (int i = 0; i < numberChars; i += 2)
{
bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16);
}
return encoding.GetString(bytes);
}
c)
public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding)
{
string numberChars = hexInput.Length;
byte[] bytes = new byte[numberChars];
for (int i = 0; i < numberChars; i += 2)
{
bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16);
}
return encoding.GetString(bytes);
}
string s1 = " I AM BEST ";
string s2;
s2 = s1.substring (5, 4);
Console.WriteLine (s2);
static void Main(string[] args)
{
int a = 5;
int b = 10;
int c;
Console.WriteLine(c = ++ a + b ++);
Console.WriteLine(b);
Console.ReadLine();
}
Suggested Topics
Are you eager to expand your knowledge beyond C# Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!