C# Programming

Test your knowledge of C# programming fundamentals including preprocessor directives, data types, access modifiers, object-oriented programming concepts, exception handling, and delegates.

16 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which of the following directive is used to undefine any symbol used in the C# program?

  1. #define
  2. #error
  3. #warning
  4. #undef
  5. #if
Question 2 Multiple Choice (Single Answer)

The 'bool data type' in C# belongs to ________________ type.

  1. struct
  2. enumeration
  3. simple
  4. class
  5. character
Question 3 Multiple Choice (Single Answer)

Which of the following is the correct method of using the 'if statement' in c#?

  1. if expression
    text if true
  2. expression if#
    text if true
  3. #if expression
    text-if-true
  4. #endif
  5. #elif
Question 4 Multiple Choice (Single Answer)

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?

  1. #endregion
  2. #region
  3. #line
  4. #undef
  5. #define
Question 5 Multiple Choice (Single Answer)

Which of the following member modifier in C# indicates that a method or accessor does not contain an implementation?

  1. const
  2. abstract
  3. event
  4. extern
  5. override
Question 6 Multiple Choice (Single Answer)

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?

  1. public
  2. private
  3. protected
  4. internal
  5. static
Question 7 Multiple Choice (Single Answer)

Which of the following member modifier in C# indicates that the method or accessor can be overridden by inheriting classes?

  1. static
  2. override
  3. virtual
  4. readonly
  5. const
Question 8 Multiple Choice (Single Answer)

What is the meaning of the following statement written in C#?
class A : B

  1. Class A is derived in class B
  2. Method of class A is implemented in class B
  3. Class B is derived in class A
  4. Class A and class B are same class
  5. Class B cannot be derived in class A
Question 9 Multiple Choice (Single Answer)

Which of the following type is used in C# when a value is boxed?

  1. Object type
  2. Class type
  3. Interfaces
  4. Delegates
  5. String type
Question 10 Multiple Choice (Single Answer)

Which of the following exception is raised in C# when a method throws an exception in case an argument is null where not allowed?

  1. SystemException
  2. ArgumentNullException
  3. IndexOutOfRangeException
  4. InteropException
  5. ComException
Question 11 Multiple Choice (Single Answer)

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?

  1. #undef
  2. #warning
  3. #define
  4. #elif
  5. #else
Question 12 Multiple Choice (Single Answer)

Which of the following data type in C# is the type-safe and secure version of function pointers?

  1. Interfaces
  2. Class
  3. Object
  4. Delegates
  5. String
Question 13 Multiple Choice (Single Answer)

Which of the following statement is used in C# to output any value or expression?

  1. System.out.println(xyz);
  2. cout<
  3. Console.WriteLine(xyz)
  4. dbms_output.put_line(xyz)
  5. printf(%s,a);
Question 14 Multiple Choice (Single Answer)

Which of the following is the best method of accessing a method of the base class in C#?

  1. Declare the method outside the base class only.
  2. Declare the method in the derived class only.
  3. Declare the method in both base class and derived class.
  4. Declare the method in the base class with the keyword 'Hide'.
  5. Delete the method declared in base and derived class.
Question 15 Multiple Choice (Single Answer)

Which of the following Exception class is used when the call to the method is invalid for the objects current state?

  1. SystemException
  2. InvaildOperationException
  3. ArgumentException
  4. SEHException
  5. ComException
Question 16 Multiple Choice (Single Answer)

Which of the following Exception class is used when the call to the method is invalid for the objects current state?

  1. SystemException
  2. InvaildOperationException
  3. ArgumentException
  4. SEHException
  5. ComException