A few questions on .NET and C #

    I think many of you will want to test your knowledge of C # and .NET.
    Under the cut you will find interesting questions presented in the form of voting.

    Conducting a study: how well do habrayuzers know the .NET platform and C #?



    UPG Reception of responses completed March 12, 2013 at 21:00.
    Answers with analysis

    I ask under cat.

    Only registered users can participate in the survey. Please come in.

    1. When are static class constructors called in C #?

    • 73.2% Once upon first creation of an instance of a class or upon the first access to static members of class 2080
    • 2.7% After each call to static fields, methods and properties 77
    • 9.3% Strict call order undefined 266
    • 14.6% Static Constructors in C # No 416

    2. How can I intercept the addition and removal of a delegate from an event?

    • 14% Such an opportunity is not provided 344
    • 47.1% There are special keywords add and remove 1157 for this.
    • 7.5% Use the keywords get and set 186
    • 31.2% Override the + and - operators for delegate 767

    3. What happens when the following code is executed? int i = 5; object o = i; long j = (long) o;

    • 57.4% Errors will not occur. Variable j will have a value of 5 1523
    • 7.3% Compilation time error 195 will occur
    • 32.7% The runtime will throw an InvalidCastException 867 exception
    • 2.4% The value of the variable j cannot be predicted 65

    4. Select the tools C # provides for conditional compilation.

    • 90% Directive #if 2021
    • 78.6% #endif 1765 Directive
    • 60.4% #else 1356 Directive
    • 7.5% Directive #typedef 169
    • 38.6% #define 868 Directive
    • 20.4% Attribute Conditional 459
    • 60.1% #elseif 1349 Directive

    5. Select the correct options in which the System namespace contains the Customizer namespace

    • 45.3% namespace System {namespace Customizer {}} 1040
    • 59.5% namespace System.Customizer {} 1364
    • 7.2% namespace System :: Customizer {} 166
    • 27.3% You cannot create your own namespaces in the System 628 namespace

    6. To use unsafe code in the application, you must ...

    • 62.2% Compile application code with the / unsafe 1335 switch
    • 4.6% Mark methods that use insecure code with the fixed 100 keyword
    • 76.2% Flag methods that use unsafe code with the unsafe 1635 keyword
    • 15.3% Flag methods that use unsafe code with the Unsafe 329 attribute

    7. What pattern (design pattern) implementation are events in C #?

    • 4.5% Decorator 101
    • 7.8% Visitor 176
    • 82.1% Publisher-Subscriber 1835
    • 5.4% Template Method 121

    8. What is the difference between constants and read-only fields?

    • 2.1% No different 52
    • 91.7% Constants are initialized at compile time, read-only fields - at run time 2170
    • 3.1% Read-only fields are initialized at compile time, constants at runtime 74
    • 2.9% Constants can be changed, but there are no read-only fields 70

    9. Select items that cannot be marked with an attribute

    • 4.6% Classes 103
    • 4% Methods 88
    • 13.8% Structures 303
    • 59.7% Return Values 1309
    • 18.7% Interfaces 412
    • 30.7% All of the above can be marked with attribute 675

    10. What is the name of the technology due to which the managed code can interact with the Win32 API functions and COM objects?

    • 14.1% Reflection 304
    • 71.2% Interop 1526
    • 8.7% CodeDOM 187
    • 4.2% Remoting 92
    • 1.4% WebServices 32

    11. What happens when compiling a project that uses a class, structure, interface, or enumeration marked with the Obsolete attribute?

    • 3.1% A compilation error will occur and the project will not be built 60
    • 72.9% A warning will be displayed stating that this type is outdated, but the assembly will be created 1398
    • 1.5% An assembly will be created, but a run-time error of 30 will occur at startup
    • 15.3% The Obsolete attribute has no effect on compilation 294
    • 7% No answer needed 135

    12. List the capabilities of the structure (value-types)

    • 51.1% Implementing 887 Interfaces
    • 77.9% Boxing and Unboxing 1351
    • 7.3% Multiple Inheritance 127
    • 8.9% Inheritance from classes 156
    • 42.9% Override the default constructor 744
    • 41% 711 Static Designer Definition
    • 51.4% Indexer Definition 892
    • 41.1% Use of Events 713

    Also popular now: