CSE MCQs :: C#.Net MCQs
-
Predict the output for the given set of code correctly.static void Main(string[] args){int b= 11;int c = 7;int r = 5;int e = 2;int l;int v = 109;int k;int z,t,p;z = b * c;t = b * b;p = b * r * 2;l = (b * c) + (r * e) + 10;k = v - 8;Console.WriteLine(Convert.ToString(Convert.ToChar(z)) + " " + Convert.ToString(Convert.ToChar(t)) + Convert.ToString(Convert.ToChar(p)) + Convert.ToString(Convert.ToChar(l)) + Convert.ToString(Convert.ToChar(v)) + Convert.ToString(Convert.ToChar(k)));Console.ReadLine();}
-
Select the relevant code set to fill up the blank for the following program : static void Main(string[] args){int x = 10, y = 20;int res;/*_______________*/Console.WriteLine(res);}
- Which is the String method used to compare two strings with each other ?
- Minimum and Maximum range of values supported by 'float' data type are ?
- Which datatype should be more preferred for storing a simple number like 35 to improve execution speed of a program?
-
What will be output of the following conversion ? static void Main(string[] args){char a = 'A';string b = "a";Console.WriteLine(Convert.ToInt32(a));Console.WriteLine(Convert.ToInt32(Convert.Tochar(b)));Console.ReadLine();}
-
Predict the output for the following set of code : static void Main(string[] args){int a = 3, b = 5, c = 1;int z = ++b;int y = ++c;b = Convert.ToInt32((Convert.ToBoolean(z)) && (Convert.ToBoolean(y)) || Convert.ToBoolean(Convert.ToInt32(!(++a == b))));a = Convert.ToInt32(Convert.ToBoolean(c) || Convert.ToBoolean(a--));Console.WriteLine(++a);Console.WriteLine(++b);Console.WriteLine(c);}
-
Scope of variable is related to definition of variable as: 1. Region of code within which variable value is valid and hence can be accessed.2. No, relation with region where variable is declared its value is valid in entire scope.
- Type of Conversion in which compiler is unable to convert the datatype implicitly is ?
-
Select output of the given set of Code : static void Main(string[] args){String name = "Dr.Gupta";Console.WriteLine("Good Morning" + name);}