C# and .NET Fundamentals

Test your knowledge of C# programming fundamentals including object-oriented concepts, constructors, inheritance, exception handling, and .NET-specific syntax.

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

A local variable

  1. Can be used anywhere in the program
  2. Is declared within a method
  3. Must accept a class
  4. Represent a class object
Question 2 Multiple Choice (Single Answer)

An instance variable

  1. is an object of a class
  2. represents an attribute of an object
  3. is a method of a class
  4. a and c
Question 3 Multiple Choice (Single Answer)

Private Button print = new button();

  1. creates a button control
  2. initializes a button control
  3. instantiates button control
  4. a and b
  5. a and c
Question 4 Multiple Choice (Single Answer)

An instance method

  1. Represents the behavior of an object
  2. Represents the attribute of an object
  3. Represents another class
  4. a and b
Question 5 Multiple Choice (Single Answer)

A Constructor

  1. is used to create objects
  2. must have the same name as the class it is declared within
  3. maybe overloaded
  4. b and c
  5. all of the above
Question 6 Multiple Choice (Single Answer)

class Test: Form { }

  1. Creates the class Test : Form
  2. Creates the class Test that inherits the class Form
  3. Creates the class form that inherits the class Test
  4. a and b
Question 7 Multiple Choice (Single Answer)

A variable declared inside a method is called a________variable

  1. Static
  2. Private
  3. Local
  4. Serial
  5. b and d
Question 8 Multiple Choice (Single Answer)

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

  1. Loading
  2. Overloading
  3. Multiplexing
  4. Duplexing
Question 9 Multiple Choice (Single Answer)

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

  1. Name
  2. Formal parameters
  3. Return type
  4. No errors
Question 10 Multiple Choice (Single Answer)

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

  1. call
  2. this
  3. do
  4. that
Question 11 Multiple Choice (Single Answer)

Classes declared with the sealed keyword cannot be base class.

  1. True
  2. False
Question 12 Multiple Choice (Single Answer)

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

  1. Trys
  2. Catches
  3. Throws
  4. a and b
Question 13 Multiple Choice (Single Answer)

Exception objects are derived from the class.

  1. Try
  2. Catch
  3. Exception
  4. Event
  5. System
Question 14 Multiple Choice (Single Answer)

An abstract class

  1. may contain instance variables
  2. may contain constructors
  3. may extend another class
  4. a and b
  5. all of the above
Question 15 Multiple Choice (Single Answer)

A____block enclose the code that could throw an exception.

  1. Try
  2. Catch
  3. Exception
  4. Error
  5. a and b