Answer these 700+ C# MCQs and see how sharp is your knowledge of C#. Scroll down and let's start!
A. break;
B. continue;
C. jump;
A. <IsNullable>
B. ?.
C. inline declaration for out params
A. A multi-dimensional array with dimensions of various sizes.
B. A multi-dimensional array with dimensions of the same size.
C. An array of singular dimension with an unknown size.
A. #
B. ^
C. |
D. &
A. none of these
B. Throw Exception
C. try catch finally block
D. ON ERROR Resume NEXT statement
A. x[1]
B. x.First
C. x[0]
A. using System.Strings
B. using System.IO;
C. #include <System.IO>
A. try, catch, finally
B. Garbage Collection
C. the using statement
D. try, catch, deconstruct
A. methods
B. constructors
C. fields
D. all of these
A. try catch finally block
B. none of these
C. Throw Exception
D. ON ERROR Resume NEXT statement
A. .csx
B. .cs
C. .c#
D. .cpp
E. .c
A. 15
B. 10
C. 5
A. Cats myCat = new cats();
B. cats myCat = new cats();
C. Cats myCat = new Cats();
A. Stepping through your code
B. All of these
C. Breakpoints
A. ellipsis
B. semi-colon
C. period
D. colon
A. Console.Write() method
B. System.Write() method
C. Console.Print() method
A. managed
B. manual allocation
A. False
B. True
A. is to delineate the end of a statement to be executed.
B. is to mark the beginning and end of a logical block of code.
C. is to mark function code to be used globally.
D. None of these
A. int
B. bool
C. string
D. single
A. derived classes can override some of the class methods.
B. that you can create objects of that class type.
C. that the class cannot be used for inheritance.
A. all of these
B. version information.
C. supported locales.
A. +
B. &
C. &&
D. *
E. ^
A. using System.Xml;
B. using System.Strings
C. using System.Parser
D. using System;
A. Yes
B. No
A. This would not compile
B. hello, this is a test
C. test, this is a hello
D. {0}, this is a {1}
A. struct
B. Both class and struct
C. class
A. It is the destructor for myClass instances.
B. It is a property called myClass.
C. It is a constructor for myClass instances.
A. Run time error
B. 1
C. true
D. Compile time error
E. false
A. foreach
B. for
C. switch
A. All options.
B. Interface inheritance
C. Implementation inheritance
A. include
B. import
C. use
D. using
A. System.Collections.Generic namespace
B. System.Data namespace
C. System.Collections.Specialized namespace
A. all .NET languages.
B. the Common Language Runtime.
C. the Java Virtual Machine.
A. XMLReader
B. XMLCreation
C. XMLWriter
A. Run Time Error
B. Both
C. Neither
D. Compile Time Error
A. Person<Nullable>
B. Person == null
C. Person.Null
D. Person?
A. The system will throw a MathFormatException
B. x = null;
C. The system will throw a InvalidOperationException
D. The system will throw a DivideByZeroException
E. x = NaN;
A. all of these
B. allowing developers to create their own code generation utilities.
C. developing automatic source code generators.
A. 0
B. null
C. unknown
D. none of these
A. System.Runtime.Serialization
B. System.Threading.ThreadPool
C. System.IO.Compression
A. Person == true ? Employee: Manager
B. Person.Name;
C. Person ?? Employee
A. public, protected, internal, private
B. public, private
C. public, protected, private
D. public, internal, private
E. protected, internal, private
A. Ternary
B. Unary
C. Binary
D. All Options
A. Java
B. Ruby
C. Python
D. Javascript
E. C
A. false
B. true
A. System.Text
B. System.DataAnnotations
C. System.Data
D. System.IO
E. System.Stream
A. all of these
B. integer
C. string
D. enum
A. =>
B. ++
C. +=
D. =
E. ->
A. you should declare it as private in the base class.
B. you should declare it as virtual in the base class.
C. you should declare it as partial in the base class.
A. True
B. False
A. static
B. extern
C. out
D. sealed
A. Both
B. //
C. /* */
D. Neither
A. else(...)
B. if(...)
C. default
D. standard
E. finally
A. 0
B. none of these
C. 1
D. "Monday"
A. It allows you to reference a variable value from anywhere inside of your program.
B. It allows you to change the reference address of the variable.
C. It allows you to pass a parameter to a method by reference instead of by value.
A. An interface contains only methods and delegates.
B. An interface contains only the signatures of methods, delegates or events.
C. Interface is a keyword that allows classes to inherit from other classes.
D. An interface is the UI presented to the user in an application.
E. An interface allows you to define how a class will be named.
A. create a namespace called system from the classes defined in this file.
B. all of these
C. import the collection of classes in the System namespace.
A. none of these
B. the same parameter types.
C. the same number of parameters.
D. the same name.
A. 1/1/0001 12:00:00 AM
B. 0
C. null
D. Compiler error
E. Exception will be thrown
A. no other class instances can access it.
B. it becomes the default access for all members of the class.
C. the member can be accessed by derived class instances.
A. XMLDocument
B. None of these
C. Both XMLDocument and XMLReader
D. XMLReader
A. both private and public members
B. none of these
C. both static and non-static members
D. static members
A. Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
B. No, code gets "locked-down" during runtime.
A. (c =< c.Person)
B. There is no such thing
C. (c <= c.Person)
D. ( c.Person <= c)
A. can be created using the "..." signs in argument list
B. can be created using the "params" keyword in argument list
C. don't exist
A. handler += new EventHandler(Bar);
B. handler = new Event(Bar);
C. handler += new Event(Bar);
D. handler = new EventHandler(Bar);
A. It is a class which contains one or more arrays
B. This class extends the T class
C. It is a generic class
D. This class implements the T class
E. None of these
A. abcdef
B. testabc
C. abc
D. def
E. It doesn't compile.
A. OnDeserialized
B. OnSerializing
C. OnSerialized
D. OnDeserializing
A. LINQ
B. Dynamic Typing
C. Generics
D. A Lambda Expression
A. You can only instantiate a reference to it.
B. You cannot create an instance of it.
C. You cannot inherit another class from it.
A. OutputClass.printMsg();
B. OutputClass oc = new OutputClass(); oc.printMsg();
C. Both of these
A. System.Int64
B. System.Int32
C. System.Math.Int32
D. System.Int
E. Int32
A. The entire block of code is commented.
B. The entire block of code is executed just in debug mode.
C. You can visually expand or collapse the block of code.
A. Replacing the format item in a specified string with the string representation of a corresponding object.
B. Coloring a input string with different colors to be used for text visualization.
C. Making the specified string wordwrapped for text visualization.
D. Prettifying code snippets.
E. Automatically formatting decimals into a currency string representation. Ex: 1000 becomes $1 000
A. myList = new List<Object>();
B. myList = new List<Object>;
C. myList = new List<typeof(Object)>();
D. myList = new List<>(Object);
A. all of these
B. events
C. methods
D. indexers
E. properties
A. static
B. void
C. unsafe
A. keyword "extends"
B. ":" sign
C. all of the answers are correct
D. keyword "inherits"
A. @
B. ~
C. ^
D. `
E. #
A. no other classes can access it inside of your program.
B. the class can be accessed by external dll's.
C. it becomes the default access for all classes in your program.
A. discover types and methods of assemblies on a user's machine.
B. all of these
C. viewing metadata.
D. dynamically invoking methods on a user's machine.
A. implemented within the current project.
B. implemented externally.
C. implemented within one of the C# System classes.
A. x86, x64 specific native code (or both), depending on compilation options
B. Common Intermediate Language, compiled in CPU-specific native code the first time it's executed.
C. Neutral bytecode, executed by the .Net virtual machine.
A. public class myAttribute as System.Attribute
B. public class myAttribute
C. public class myAttribute : System.Attribute
A. private
B. protected
C. public
A. 1
B. 3
C. 0
D. 2
A. catch(ArrayTypeMismatchException ex)
B. catch(InsufficientExecutionStackException ex)
C. catch(IndexOutOfRangeException ex)
D. catch(ArrayIndexOutOfBounds ex)
A. A class can be stored as either a reference or a value.
B. A struct can contain implementation inheritance.
C. A struct stores the value not a reference to the value.
A. true
B. false
A. is
B. as
C. of
D. if
E. in
A. all of these
B. none of these
C. static void Main()
D. static int main()
A. Create generic types
B. Assign a value to a delegate
A. No
B. Yes
A. public string ToString() { }
B. public override string ToString() { }
C. public virtual string ToString() { }
D. private override string ToString() { }
E. public override ToString() { }
A. ICustomAdapter
B. IUsing
C. IMemoryManagement
D. IDisposable
E. Disposable
A. Illegal because List does not implement IEnumerable interface
B. Illegal because the constructor of List cannot be empty
C. Legal
D. Illegal because it is not allowed to create an object of interface type
A. private
B. internal
C. protected
D. public
A. ///
B. <!--
C. //