What will be the output of the following C# code? static void Main(string[] args)
View Question
What will be the output of the following C# code?
static void Main(string[] args)
{
int X = 0;
if (Convert.ToBoolean(X = 0))
Console.WriteLine(“It is zero”);
else
Console.WriteLine(“It is not zero”);
Console.ReadLine();
}
What will be the output of the following C# code? static void Main(string[] args) ...
View QuestionSelect correct differences between ‘=’ and ‘==’ in C#.
a) '==' operator is used to assign values from one variable to another variable '=' operator is used ...
View QuestionSelect the wrong statement about ‘ref’ keyword in C#?
a) References can be called recursively b) The ‘ref’ keyword causes arguments to be passed by reference c) ...
View Question
What will be the output of the following C# code?
static void Main(string[] args)
{
int []a = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
func(ref a);
Console.ReadLine();
}
static void func(ref int[] x)
{
Console.WriteLine(” numbers are:”);
for (int i = 0; i < x.Length; i++)
{
if (x[i] % 2 == 0)
{
x[i] = x[i] + 1;
Console.WriteLine(x[i]);
}
}
}
What will be the output of the following C# code? static void Main(string[] args) { ...
View Question
What will be the output of the following C# code?
static void Main(string[] args)
{
int[] arr = new int[] {1, 2, 3, 4, 5};
fun1(ref arr);
Console.ReadLine();
}
static void fun1(ref int[] array)
{
for (int i = 0; i < array.Length; i++)
{
array[i] = array[i] + 5;
Console.WriteLine(array[i] + ” “);
}
}
What will be the output of the following C# code? static void Main(string[] args) { ...
View Question
What will be the output of the following C# code?
static void Main(string[] args)
{
int a = 5;
fun1 (ref a);
Console.WriteLine(a);
Console.ReadLine();
}
static void fun1(ref int a)
{
a = a * a;
}
What will be the output of the following C# code? static void Main(string[] args) ...
View QuestionWhich reference modifier is used to define reference variable?
a) & b) ref c) # d) $ Answer: b Explanation: ref
View Question
What will be the output of the following C# code?
class test
{
public void print()
{
Console.WriteLine(“Csharp:”);
}
}
class Program
{
static void Main(string[] args)
{
test t;
t.print();
Console.ReadLine();
}
}
What will be the output of the following C# code? class test ...
View Question
What does the following C# code imply?
csharp abc;
abc = new charp();
What does the following C# code imply? csharp abc; ...
View Question