1.Does the output remain same or different for both cases? 1) char l ='k'; float x = 19.0f; int y; y = (l / Convert.ToInt32(x)); Console.WriteLine(y); 2) char l ='k'; float x = 19.0f; int y; y = Convert.ToInt32(l / x); console.WriteLine(y); A) Yes B) No View Answer Report DiscussAnswer: Option BExplanation:Output: 1) 5.2) 6.
2.To improve execution speed of a program, which datatype should be more preferred for storing a simple number like 45? A) sbyte B) short C) int D) long View Answer Report DiscussAnswer: Option AExplanation:Bigger datatype like int,long takes more time for execution of a program.
3.Select error in the given program: Static Void Main(String[] args) { const int m = 200; int n = 20; const int k = n / 10 * 100 * n ; Console.WriteLine(m * k); Console.ReadLine(); } A) ‘k’ should not be declared constant B) Expression assigned to ‘k’ should be a constant C) Expression (m * k) is invalid D) ‘n‘ is declared in invalid format View Answer Report DiscussAnswer: Option BExplanation:’k’ should be declared as const int k = 20/10 * 100*10 i.e only constant values should be assigned to a constant.
4.Datatype “UInt” is derived from which .NET class? A) System.Int16 B) System.UInt32 C) System.UInt64 D) System.UInt16 View Answer Report DiscussAnswer: Option BExplanation:By Defination class assigned toSystem.Int16 = short.System.UInt32 = UInt.System.UInt64 = ULong.System.UInt16 = UShort.
5.Size of Long Datatype in bytes in C# .net? A) 8 B) 4 C) 2 D) 1 View Answer Report DiscussAnswer: Option AExplanation:Size of Long Datatype is 8 bytes.