1.What is the difference between keywords 'var' and 'dynamic'? A) ‘var’ is introduced in C# (3.0) and ‘dynamic’ is introduced in C# (4.0) B) ‘var’ variable declaration is done at compile time while ‘dynamic’ declaration is achieved at runtime by compiler C) For ‘var’ Error is caught at compile time and for ‘dynamic’ Error is caught at runtime D) All of the mentioned View Answer Report DiscussAnswer: Option D Explanation:Currently no explanation available Improve this answer lets discuss in forum
2.What is the output of following set of code ? int x,y; x = (y = 10) + 5; A) y = 10, x = 5 B) y = 15, x = 5 C) x = 15, y = 10 D) x = 10, y = 10 View Answer Report DiscussAnswer: Option CExplanation:y is assigned 10 and after that its value is added with 5 and then saved in x, so x will be 15.
3.What will be the output for the following set of code? static void Main(string[] args) { const int x = 10; const int y = 20; for (int i = 1; i <= 5; i++) {x = x * i;y = y * i; } Console.WriteLine(x); Console.WriteLine(y); Console.ReadLine(); } A) 1200, 2400 B) Compile time error C) 2400, 1200 D) 12, 24 View Answer Report DiscussAnswer: Option BExplanation:The left hand side of an assignment must be a variable, property or indexer i.e for both ‘x’ and ‘y’
4.What will the output of the given set of Code? static void Main(string[] args){ String name = "Dr.Saju"; Console.WriteLine("Good Morning" + name);} A) Dr.Saju B) Good Morning C) Good MorningDr.Saju D) Good Morning Dr.Saju View Answer Report DiscussAnswer: Option C Explanation:Currently no explanation available Improve this answer lets discuss in forum
5.What will be output of the following conversion ? static void Main(string[] args) { char x = 'X'; string y = "x"; Console.WriteLine(Convert.ToInt32(x)); Console.WriteLine(Convert.ToInt32(Convert.ToChar(y))); Console.ReadLine(); } A) 88, 120 B) 120, 88 C) 88, 121 D) 121, 80 View Answer Report DiscussAnswer: Option AExplanation: ASCII value of character ‘X’ is 88 and ASCII value of string “x” is 120. So, output: 88, 120