Vidyalelo
C# Programming · Q98

Arrays and Strings in C Sharp

Programming · C# Programming · question 98

Q98

What will be the output of the following C# code? static void Main(string[] args) Program p = new Program(); p.display(2, 3, 8); int []a = 2, 56, 78, 66 ; Console.WriteLine("example of array"); Console.WriteLine("elements added are"); p.display(a); Console.ReadLine(); public void display(params int[] b) foreach (int i in b) Console.WriteLine("ARRAY IS HAVING:0", i);

A.
Compile time error
B.
Run time error
C.
Code runs successfully but prints nothing
D.
Code runs successfully and prints given on console
Answer

Answer: Option D

Solution

Answer: Option D
No explanation is given for this question Let's Discuss on Board