CSE MCQs :: C#.Net MCQs
- What is the advantage of using 2D jagged array over 2D rectangular array?
-
Which statement is correct about following set of code ? int[, ]a={{5, 4, 3},{9, 2, 6}};
-
Choose Output for the following set of code : static void Main(string[] args){string s1 = "Hello" + " I " + "Love" + " ComputerScience ";Console.WriteLine(s1);Console.ReadLine();}
- Which of these data type values is returned by equals() method of String class?
-
What will be the output for the given code snippet? static void Main(string[] args){string s = " i love you";Console.WriteLine(s.IndexOf('l') + " " + s.lastIndexOf('o') + " " + s.IndexOf('e'));Console.ReadLine();}
-
What will be the output of the following set of code? class sum{public int x;public int y;public int add (int a, int b){x = a + b;y = x + b;return 0;}}class Program{static void Main(string[] args){sum obj1 = new sum();sum obj2 = new sum();int a = 2;obj1.add(a, a + 1);obj2.add(5, a);Console.WriteLine(obj1.x + " " + obj2.y);Console.ReadLine();}}
-
What will be the output for the given set of code? static void Main(string[] args){String c = "Hello";String a = c + "Bye";Console.WriteLine(a);Console.ReadLine();}
-
What would be the output for the following set of code? static void Main(string[] args){String obj = "hello";String obj1 = "world";String obj2 = obj;Console.WriteLine (obj.Equals(obj2) + " " + obj2.CompareTo(obj) );Console.ReadLine();}
-
What will be the output of given set of code? 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;}
-
What will be the output the of given set of code? static void Main(string[] args){int [] a = {1, 2, 3, 4, 5};fun(a);Console.ReadLine();}static void fun(params int[] b ){for (int i = 0; i < b.Length; i++){b[i] = b[i] * 5 ;Console.WriteLine(b[i] + "");}}