C# MCQ Assignment

C# MCQ Assignment

Question 1:

Which of the following is the correct syntax to declare a variable in C#?

  1. int 4value;
  2. int value;
  3. int value=4;
  4. int value=

Correct Answer: 2, 3

Question 2:

Which of the following is the entry point of a C# program?

  1. Main()
  2. Start()
  3. Program()
  4. Begin()

Correct Answer: 1

Question 3:

Which keyword is used to define an interface in C#?

  1. interface
  2. class
  3. struct
  4. enum

Correct Answer: 1

Question 4:

Which of the following is NOT a value type in C#?

  1. int
  2. float
  3. double
  4. string

Correct Answer: 4

Question 5:

Which of the following access modifiers allows a class member to be accessed from within the same assembly, but not from another assembly?

  1. public
  2. private
  3. protected
  4. internal

Correct Answer: 4

Question 6:

What is the size of an int data type in C#?

  1. 2 bytes
  2. 4 bytes
  3. 8 bytes
  4. 16 bytes

Correct Answer: 2

Question 7:

Which of the following statements is used to handle exceptions in C#?

  1. try-catch
  2. catch-try
  3. try-error
  4. handle-exception

Correct Answer: 1

Question 8:

What will be the output of the following code snippet?

csharpCopy codeint a = 10;
int b = 20;
int c = a + b;
Console.WriteLine(c);
  1. 10
  2. 20
  3. 30
  4. Compilation Error

Correct Answer: 3

Question 9:

Which of the following is used to read a line of text from the console in C#?

  1. Console.ReadLine()
  2. Console.Read()
  3. Console.ReadText()
  4. Console.ReadKey()

Correct Answer: 1

Question 10:

Which of the following statements correctly defines a method in C#?

  1. void MyMethod(int a, int b) { }
  2. void MyMethod(int a; int b) { }
  3. void MyMethod(int a, int b);
  4. void MyMethod(int a, int b)

Correct Answer: 1

4 thoughts on “C# MCQ Assignment”

    • Author gravatar

      Hoowdy jjust wanted to give you a quick heads upp and let yoou know
      a few oof the imawges aren’t loading properly. I’m noot sure
      wwhy but I think its a linking issue. I’ve tried iit in two different wweb
      browzers annd both show the same outcome. xnxx

    • Author gravatar

      This piece off writing will help thhe internet people for setting uup
      new weblog oor evven a weblog from start to end.
      xnxx

    • Author gravatar

      Unquestionably bbelieve that which yyou stated. Your favorite reason appeared
      to be on thee internet thhe easeiest thung to be aware
      of. I say tto you, I certainly get irked while pwople consaider worries thaat they plainly do not
      knoww about. You managed tto hhit the nasil upon thhe top and also defined out thhe
      whole thing without having side effect , people can take a signal.
      Wiill probably be ack to geet more. Thanks xnxx

    • Author gravatar

      Yoour way of describing aall iin this artcle iis truy fastidious,
      all be capablle of withoutt difficulty know it, Thanks
      a lot. xnxx

Leave a Reply

Your email address will not be published. Required fields are marked *