Select an option to see the answer and solution.
Arrays and Strings in C Sharp
practice.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
134
Questions
3/7
Page
Pick an option on a question to see the right answer and solution.
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.
Select an option to see the answer and solution.
Select an option to see the answer and solution.
class math
{
public int a,b;
public math(int i, int j)
{
a = i;
b = j;
}
public void sum(math m)
{
m.a *= 2;
m.b += 2;
}
}
class Program
{
static void Main(string[] args)
{
math t = new math(20, 10);
t.sum(t);
Console.WriteLine(t.a + " " + t.b);
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.
Select an option to see the answer and solution.
static void Main(string[] args)
{
String a = "Ilove";
String b = "CSHARP";
b = string.Concat(a, ' ', b);
Console.WriteLine(b);
Console.ReadLine();
}Select an option to see the answer and solution.
static void Main(string[] args)
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
string s = obj+" "+obj1;
Console.WriteLine(s.IndexOf('r'));
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.
Select an option to see the answer and solution.
static void main(string[] args)
{
int i;
int res = fun (out i);
console.writeline(res);
console.readline();
}
static int fun(out int i)
{
int s = 1;
i = 7;
for (int j = 1; j <= i; j++ )
s = s * j;
return s;
}Select an option to see the answer and solution.
static void Main(string[] args)
{
String obj = "hello";
String obj1 = "world";
String obj2 = obj;
string s = obj + " " + obj1;
Console.WriteLine(s.Substring(6 ,5));
Console.ReadLine();
}Select an option to see the answer and solution.
static void Main(string[] args)
{
int i, j;
int[, ] arr = new int[ 3, 3];
for (i = 0; i < 3; ++i)
{
for (j = 0; j < 3; ++j)
{
arr[i, j] = i * 2 + i * 2;
Console.WriteLine(arr[i, j]);
}
Console.ReadLine();
}
}Select an option to see the answer and solution.
Select an option to see the answer and solution.
static void Main(string[] args)
{
object[] a = {" 1 ", 4.0f, " harsh "};
fun(a);
Console.ReadLine();
}
static void fun(params object[] b)
{
for (int i = 0; i < b.Length - 1; i++)
Console.WriteLine(b[i] + " ");
}Select an option to see the answer and solution.