gs gs108 Arrays and Strings - Use of Ref and Out Parameters - Quiz No.1
gs gs108 CSharp Quiz
This quiz belongs to book/course code gs gs108 CSharp of gs organization. We have 110 quizzes available related to the book/course CSharp. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Arrays and Strings. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
static void main(string[] args) { int n = 1; method(n); console.Writeline(n); method1(ref n); console.Writeline(n); } static void method(int num) { num += 20; console.writeline(num); } static void method1(ref int num) { num += 20; console.writeline(num); }
1 1 1 1
21 1 21 21
11 21 21 11
21 1 21 21
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; }
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; }
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; }
static Void main(string[] args) { int a = 5; int b = 6; float c = 7.2f; math (ref a, ref b, ref c); Console.WriteLine(a + " " + b + " " + c); } static int math(/*add parameter declaration */) { a += b; b *= (int)c; c += a * b; return 0; }