C# and .NET Fundamentals
Test your knowledge of C# programming fundamentals including object-oriented concepts, constructors, inheritance, exception handling, and .NET-specific syntax.
Questions
A local variable
- Can be used anywhere in the program
- Is declared within a method
- Must accept a class
- Represent a class object
An instance variable
- is an object of a class
- represents an attribute of an object
- is a method of a class
- a and c
Private Button print = new button();
- creates a button control
- initializes a button control
- instantiates button control
- a and b
- a and c
An instance method
- Represents the behavior of an object
- Represents the attribute of an object
- Represents another class
- a and b
A Constructor
- is used to create objects
- must have the same name as the class it is declared within
- maybe overloaded
- b and c
- all of the above
class Test: Form { }
- Creates the class Test : Form
- Creates the class Test that inherits the class Form
- Creates the class form that inherits the class Test
- a and b
A variable declared inside a method is called a________variable
- Static
- Private
- Local
- Serial
- b and d
Defining two methods with the same name but with different parameters is called.
- Loading
- Overloading
- Multiplexing
- Duplexing
Find any errors in the following BankAccount constructor: public int BankAccount() { balance = 0; }
- Name
- Formal parameters
- Return type
- No errors
In the body of a method, C# uses the variable named_____to refer to the current object whose method is being invoked.
- call
- this
- do
- that
Classes declared with the sealed keyword cannot be base class.
- True
- False
A method_____an exception when that method detects that a problem has occured.
- Trys
- Catches
- Throws
- a and b
Exception objects are derived from the class.
- Try
- Catch
- Exception
- Event
- System
An abstract class
- may contain instance variables
- may contain constructors
- may extend another class
- a and b
- all of the above
A____block enclose the code that could throw an exception.
- Try
- Catch
- Exception
- Error
- a and b