• Admin
  • 05th May, 2021

C# Online Test

Following are mostly asked C# MCQ test that are designed for professionals like you to crack you interviews. You can take this C# online test before appearing to you real interview. This C# quiz there are around 30+ multiple choice questions on C# with four options.

1) A____block enclose the code that could throw an exception.

  • A. Catch
  • B. Exception
  • C. Error
  • D. Try

2) An abstract class

  • A. may extend another class
  • B. may contain constructors
  • C. may contain instance variables
  • D. all of the above

3) Exception objects are derived from the class.

  • A. Try
  • B. Catch
  • C. Event
  • D. Exception

4) A method_____an exception when that method detects that a problem has occured.

  • A. Trys
  • B. Catches
  • C. a and b
  • D. Throws

5) Classes declared with the sealed keyword cannot be base class.

  • A. FALSE
  • B. TRUE
Download Free : C# MCQ PDF

6) Assuming that public class B : A { public B(int i) :base(i) { } } compiles and runs correctly, what can we conclude about the constructors in the class A?

  • A. One constructor takes an argument of type i
  • B. One constructor takes an arguments of the type int
  • C. FALSE
  • D. There is only a default constructor

7) The code public class B : A { }

  • A. Defines a class that inherits all the methods of A
  • B. Errors
  • C. a and b
  • D. Defines a class that inherits the public and protected methods of A only

8) Methods that are declared abstract in the base class must show implementation at the time of declaration.

  • A. TRUE
  • B. FALSE

9) All methods in an abstract base class must be declared abstract.

  • A. TRUE
  • B. FALSE

10) To output the value of multidimensional array, Console.WriteLines(___)

  • A. myArray[1.3];
  • B. myArray{1}{3};
  • C. myArray(1),(3);
  • D. myArray[1][3];

11) The concept of composition specifies that you can.

  • A. Compose good code with C#
  • B. Reduce errors by remaining composed during programming
  • C. all of the above
  • D. Compose C# projects with different objects

12) Every class directly or indirectly extends the______class.

  • A. Drawing
  • B. Console
  • C. System
  • D. Object

13) In order for a class to use an interface, it must

  • A. contain the same methods as the interface
  • B. create an interface objects
  • C. a and b
  • D. inherit the properties of the interface

14) What is the proper header for a class that intends to use an interface.

  • A. class MyClass ; IFace
  • B. class MyCalss {IFace}
  • C. class MyClass IFace
  • D. class MyClass : IFace

15) All interfaces must contain IDrivable

  • A. TRUE
  • B. FALSE

16) Is it possible to pass methods as arguments for other methods without modification.

  • A. FALSE
  • B. TRUE

17) A delegate defines

  • A. a Wahsington representative
  • B. a means of passing arrays into methods
  • C. a substitue for an inherited method
  • D. a class that encapsulates methods

18) Output of String mystring; Creates a(n)

  • A. class
  • B. Constructor
  • C. a and b
  • D. Object

19) In the body of a method, C# uses the variable named_____to refer to the current object whose method is being invoked

  • A. call
  • B. do
  • C. that
  • D. this

20) Find any errors in the following BankAccount constructor: Public int BankAccount() { balance = 0; }

  • A. Formal parameters
  • B. Name
  • C. No errors
  • D. Return type

21) Defining two methods with the same name but with different parameters is called.

  • A. Loading
  • B. Multiplexing
  • C. Duplexing
  • D. Overloading

22) A variable declared inside a method is called a________variable

  • A. Private
  • B. Static
  • C. Serial
  • D. Local

23) What class Test: Form { } code do

  • A. Creates the class Test : Form
  • B. Creates the class form that inherits the class Test
  • C. a and b
  • D. Creates the class Test that inherits the class Form

24) A Constructor

  • A. must have the same name as the class it is declared within
  • B. is a method of a class
  • C. is used to create objects
  • D. b and c

25) An instance method

  • A. Represents the attribute of an object
  • B. Represents another class
  • C. a and b
  • D. Represents the behavior of an object

26) Private Button print = new button();

  • A. creates a button control
  • B. instantiates button control
  • C. initializes a button control
  • D. Creates instantiates and create button

27) An instance variable

  • A. is an object of a class
  • B. is a method of a class
  • C. a and c
  • D. represents an attribute of an object

28) A local variable

  • A. Can be used anywhere in the program
  • B. Must accept a class
  • C. Represent a class object
  • D. Is declared within a method

29) Which of the following .NET components can be used to remove unused references from the managed heap?

  • A. Class Loader
  • B. CTS
  • C. CLR
  • D. Garbage Collector

30) Identify which is true

  • A. find can be done only on sorted columns
  • B. Sorting can be done on multiple columns
  • C. None of these
  • D. DataView ia subset of row and not columns

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

Azure MCQ