Home / Programming Questions / C# MCQs / Page 1

C# MCQs with answers Page - 1

Dear candidates you will find MCQ questions of C# here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

M

Mr. Dubey • 51.27K Points
Coach

Q. How many Bytes are stored by ‘Long’ Data type in C# .net?

(A) 8
(B) 4
(C) 2
(D) 1

M

Mr. Dubey • 51.27K Points
Coach

Q. Choose “.NET class” name from which data type “UInt” is derived?

(A) System.Int16
(B) System.UInt32
(C) System.UInt64
(D) System.UInt16

M

Mr. Dubey • 51.27K Points
Coach

Q. Correct Declaration of Values to variables ‘a’ and ‘b’?

(A) int a = 32, b = 40.6;
(B) int a = 42; b = 40;
(C) int a = 32; int b = 40;
(D) int a = b = 42;

M

Mr. Dubey • 51.27K Points
Coach

Q. What will be the error in the following C# code?

Code:
Static Void Main(String[] args)
 {
     const int m = 100;
     int n = 10;
     const int k = n / 5 * 100 * n ;
     Console.WriteLine(m * k);
     Console.ReadLine();
 }
(A) ‘k’ should not be declared constant
(B) Expression assigned to ‘k’ should be constant in nature
(C) Expression (m * k) is invalid
(D) ‘m ‘ is declared in invalid format

M

Mr. Dubey • 51.27K Points
Coach

Q. Arrange the following data type in order of increasing magnitude sbyte, short, long, int.

(A) long < short < int < sbyte
(B) sbyte < short < int < long
(C) short < sbyte < int < long
(D) short < int < sbyte < long

M

Mr. Dubey • 51.27K Points
Coach

Q. Which data type should be more preferred for storing a simple number like 35 to improve execution speed of a program?

(A) sbyte
(B) short
(C) int
(D) long

M

Mr. Dubey • 51.27K Points
Coach

Q. Which Conversion function of ‘Convert.TOInt32()’ and ‘Int32.Parse()’ is efficient?
i) Int32.Parse() is only used for strings and throws argument exception for null string
ii) Convert.Int32() used for data types and returns directly '0' for null string

(A) ii
(B) Both i, ii
(C) i
(D) None of the mentioned

M

Mr. Dubey • 51.27K Points
Coach

Q. Correct way to assign values to variable ‘c’ when int a=12, float b=3.5, int c;

(A) c = a + b;
(B) c = a + int(float(b));
(C) c = a + convert.ToInt32(b);
(D) c = int(a + b);

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.