Online Exam Quiz

questionQuestion  1 to 30

What is the default access modifier for a class in C#?

  • public
  • private
  • internal
  • protected
Mark for review

What is the purpose of the 'static' keyword in C#?

  • To define a constant value
  • To define a variable that is shared among all instances
  • To define a method that cannot be overridden
  • To define a method that is specific to an instance
Mark for review

What is the default value of an uninitialized bool variable in C#?

  • TRUE
  • FALSE
  • null
  • undefined
Mark for review

What is the extension of a .NET assembly?

  • .dll
  • .exe
  • Both
  • .com
Mark for review

What is the use of the 'lock' statement in C#?

  • To provide a handle to a thread
  • To prevent multiple threads from accessing a resource
  • To release a thread from waiting
  • To end the execution of a thread
Mark for review

Which of these classes allows a collection to grow or shrink dynamically?

  • Array
  • LinkedList
  • List
  • ArrayList
Mark for review

What is the purpose of the 'virtual' keyword in C#?

  • To define a new method
  • To override a base class method
  • To allow a method to be overridden
  • To prevent a method from being overridden
Mark for review

Which of the following statements is true about .NET assembly?

  • It is always a DLL
  • It is always an EXE
  • It can be either DLL or EXE
  • It is a namespace
Mark for review

Which of the following is true about 'const' keyword in C#?

  • The value can be changed at runtime
  • The value cannot be changed at runtime
  • It defines a method
  • It defines a variable that can be changed
Mark for review

What is the main advantage of using properties in C#?

  • Type safety
  • Performance
  • Encapsulation
  • None of the above
Mark for review

Which of the following is a value type in .NET?

  • System.String
  • System.Collections.ArrayList
  • System.Int32
  • System.Object
Mark for review

Which of the following is NOT a .NET data provider?

  • SQL Server
  • OLE DB
  • XML
  • Oracle
Mark for review

What does the 'finally' block do in exception handling?

  • It executes only when an exception occurs
  • It executes only when no exception occurs
  • It executes regardless of an exception
  • It stops the execution of the catch block
Mark for review

Which of the following is true about 'ref' keyword in C#?

  • It allows passing a value by reference
  • It allows passing a reference by value
  • It allows passing a value by value
  • It allows passing a reference by reference
Mark for review

How do you mark a method as asynchronous in C#?

  • Using the 'async' keyword
  • Using the 'await' keyword
  • Using the 'thread' keyword
  • Using the 'task' keyword
Mark for review

What is the purpose of 'override' keyword in C#?

  • To hide a method
  • To define a new method
  • To override a base class method
  • To extend a class
Mark for review

Which keyword is used to overload a method in C#?

  • override
  • new
  • overload
  • extends
Mark for review

Which of these is a valid statement to define a nullable type?

  • int? num
  • Nullable<int> num
  • Both
  • None
Mark for review

How do you prevent a class from being inherited in C#?

  • By using the 'sealed' keyword
  • By using the 'final' keyword
  • By using the 'static' keyword
  • By using the 'readonly' keyword
Mark for review

Which of the following is true about an abstract class?

  • It can be instantiated
  • It cannot be inherited
  • It can contain abstract methods
  • It cannot contain non-abstract methods
Mark for review

What is the purpose of the 'params' keyword in C#?

  • To pass an unknown number of parameters
  • To define optional parameters
  • To define named parameters
  • To define output parameters
Mark for review

Which of the following classes is immutable?

  • String
  • StringBuilder
  • List
  • Dictionary
Mark for review

What is the maximum size of a Decimal in C#?

  • 4 bytes
  • 8 bytes
  • 16 bytes
  • 32 bytes
Mark for review

What is the base class for all exceptions in .NET?

  • System.Exception
  • System.ApplicationException
  • System.SystemException
  • System.Runtime.InteropServices.ExternalException
Mark for review

What is the main difference between 'String' and 'StringBuilder' in C#?

  • String is mutable
  • StringBuilder is immutable
  • StringBuilder is mutable
  • Both are immutable
Mark for review

Which of the following is NOT a valid access modifier in C#?

  • public
  • protected internal
  • internal protected
  • private
Mark for review

How do you define a read-only property in C#?

  • public int MyProperty { get; }
  • public int MyProperty { get; set; }
  • public readonly int MyProperty { get; }
  • public int MyProperty { get { return _myProperty; } }
Mark for review

What is the purpose of the 'yield' keyword in C#?

  • To create a lambda expression
  • To define a delegate
  • To return multiple values from a method
  • To simplify the implementation of an iterator
Mark for review

What is the purpose of the 'is' keyword in C#?

  • To check the type of an object
  • To cast an object to a different type
  • To compare two objects
  • To define a new type
Mark for review

What is the use of 'throw' keyword in C#?

  • To catch an exception
  • To create an exception
  • To throw an exception
  • To log an exception
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review