Select an option to see the answer and solution.
Miscellaneous in C Sharp
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
170
Questions
4/9
Page
Pick an option on a question to see the right answer and solution.
public static string Concat(string str0, string str1)Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
class UnsafeCode
{
struct MyStruct
{
public int a;
public int b;
public int Sum()
{
return a / b;
}
}
unsafe static void Main()
{
MyStruct o = new MyStruct();
MyStruct* p;
p = &o;
p->a = 60;
p->b = 15;
int c = 30;
Console.WriteLine("Value is : " + p->Sum()*c);
Console.ReadLine();
}
}Select an option to see the answer and solution.
public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase)Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
static void Main(string[] args)
{
string s1 = "olleH";
string s2 = "olleh";
if (s1 == s2)
Console.WriteLine("Equal");
else
Console.WriteLine("Unequal");
if (s1.Equals(s2))
Console.WriteLine("Equal");
else
Console.WriteLine("Unequal");
Console.ReadLine();
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
class Program
{
static void Main(string[] args)
{
double x = 4.772;
double y = 4.76;
double z = Math.Max(x, y);
Console.WriteLine(z);
Console.ReadLine();
}
}Select an option to see the answer and solution.
class sum
{
public int x;
public int y;
public int add (int a, int b)
{
x = a + b;
y = x + b;
return 0;
}
}
class Program
{
static void Main(string[] args)
{
sum obj1 = new sum();
sum obj2 = new sum();
int a = 2;
obj1.add(a, a + 1);
obj2.add(5, a);
Console.WriteLine(obj1.x + " " + obj2.y);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
class UnsafeCode
{
unsafe static void Main()
{
int* p ;
int ch = 13*5;
p = &(ch);
Console.WriteLine(Convert.ToChar(*p));
if (*p == 'A')
Console.WriteLine(Convert.ToBoolean(1));
else
Console.WriteLine(Convert.ToBoolean(0));
Console.ReadLine();
}
}Select an option to see the answer and solution.
object Invoke(object obj, object[] parameters)Select an option to see the answer and solution.
public static int Compare(string strA, string strB)Select an option to see the answer and solution.
Select an option to see the answer and solution.
class Program
{
static void Main(string[] args)
{
float x = 3.14F;
int y = (int)Math.Abs(x);
Console.WriteLine(y);
Console.ReadLine();
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.