C# Programming
Test your knowledge of C# programming fundamentals including preprocessor directives, data types, access modifiers, object-oriented programming concepts, exception handling, and delegates.
Questions
Which of the following directive is used to undefine any symbol used in the C# program?
- #define
- #error
- #warning
- #undef
- #if
The 'bool data type' in C# belongs to ________________ type.
- struct
- enumeration
- simple
- class
- character
Which of the following is the correct method of using the 'if statement' in c#?
- if expression
text if true - expression if#
text if true - #if expression
text-if-true - #endif
- #elif
Which of the following statement is used in C# to specify a block of code that can be expanded or collapse when using outlining feature of the Visual Studio Code Editor?
- #endregion
- #region
- #line
- #undef
- #define
Which of the following member modifier in C# indicates that a method or accessor does not contain an implementation?
- const
- abstract
- event
- extern
- override
Which of the following access modifier is used to access members in the class and all the derived classes of the base class, but no access from any outside class, which is not the derived class of the base class?
- public
- private
- protected
- internal
- static
Which of the following member modifier in C# indicates that the method or accessor can be overridden by inheriting classes?
- static
- override
- virtual
- readonly
- const
What is the meaning of the following statement written in C#?
class A : B
- Class A is derived in class B
- Method of class A is implemented in class B
- Class B is derived in class A
- Class A and class B are same class
- Class B cannot be derived in class A
Which of the following type is used in C# when a value is boxed?
- Object type
- Class type
- Interfaces
- Delegates
- String type
Which of the following exception is raised in C# when a method throws an exception in case an argument is null where not allowed?
- SystemException
- ArgumentNullException
- IndexOutOfRangeException
- InteropException
- ComException
Which of the following directive is used in C# to define a symbol, which can be used with the #if directive to evaluate any expression?
- #undef
- #warning
- #define
- #elif
- #else
Which of the following data type in C# is the type-safe and secure version of function pointers?
- Interfaces
- Class
- Object
- Delegates
- String
Which of the following statement is used in C# to output any value or expression?
- System.out.println(xyz);
- cout<
- Console.WriteLine(xyz)
- dbms_output.put_line(xyz)
- printf(%s,a);
Which of the following is the best method of accessing a method of the base class in C#?
- Declare the method outside the base class only.
- Declare the method in the derived class only.
- Declare the method in both base class and derived class.
- Declare the method in the base class with the keyword 'Hide'.
- Delete the method declared in base and derived class.
Which of the following Exception class is used when the call to the method is invalid for the objects current state?
- SystemException
- InvaildOperationException
- ArgumentException
- SEHException
- ComException
Which of the following Exception class is used when the call to the method is invalid for the objects current state?
- SystemException
- InvaildOperationException
- ArgumentException
- SEHException
- ComException