a) An argument passed to a ref parameter need not be initialized first b) Variables passed as out ...
View QuestionKeyword used to define call by reference parameter in C# .NET?
a) & b) out c) ref d) && Answer: c Explanation: ref
View Question
What will be the output of the following C# code?
static void Main(string[] args)
{
int a = 5;
int b = 0, c = 0;
method (a, ref b, ref c);
Console.WriteLine(b + ” ” + c);
Console.ReadLine();
}
static int method(int x, int p, ref int k)
{
p = x + x * x;
k = x * x + p;
return 0;
}
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};
fun (ref arr);
for (int i = 0; i < arr.Length ; i++)
Console.WriteLine( arr[i] + ” “);
}
static void fun(ref int[]a)
{
a = new int[6];
a[3] = 32;
a[1] = 24;
}
What will be the output of the following C# code? static void main(string[] args) { ...
View Question
Which method does following C# code explains?
static void Main(string[] args)
{
int a = 10, b = 20;
method(ref a, ref b);
console.writeline(a + ” ” + b);
}
static void swap(ref int i, ref int j)
{
int t;
t = i;
i = j;
j = t;
}
Which method does following C# code explains? static void Main(string[] args) { ...
View QuestionStatements about ‘ref’ keyword used in C#.NET are?
a) The ref keyword causes arguments to be passed by reference b) While using ‘ref’ keyword any changes ...
View Question
What will be the output of the following C# code?
class Program
{
static void Main(string[] args)
{
int i = 5;
int j;
method1(ref i);
method2(out j);
Console.writeline(i + ” ” + j);
}
static void method1(ref int x)
{
x = x + x;
}
static void method2(out int x)
{
x = 6;
x = x * x;
}
}
What will be the output of the following C# code? class Program { ...
View QuestionWhich of these access specifiers must be used for main() method?
a) private b) public c) protected d) none of the mentioned Answer: a Explanation: By default main() ...
View QuestionChoose the statements which are false in nature?
a) The base class member functions can access public member functions of derived class b) An object of ...
View QuestionAccessibility modifier defined in a class are?
a) public, private, protected b) public, internal, protected internal c) public, private, internal, protected internal d) public, private, ...
View Question