What happens when this C# code runs: int? n = null; int x = n.Value;?
Correct answer D. An InvalidOperationException is thrown
Subject / 929 questions
Page 25 of Programming multiple-choice questions with answers. Tap an option to check yourself.
Page 25 of 47
Correct answer D. An InvalidOperationException is thrown
Correct answer B. double to int
Correct answer A. 2
Correct answer B. Converting a value type to object or an interface type, which copies it into a heap object
Correct answer A. An InvalidCastException is thrown
Correct answer C. abc in small letters
Correct answer A. 532
Correct answer B. The type is inferred at compile time and the variable stays strongly typed
Correct answer B. dynamic defers member binding and type checking to run time, while var is resolved at compile time
Correct answer B. const is fixed at compile time; readonly can be assigned at declaration or in a constructor
Correct answer B. 3
Correct answer B. -1
Correct answer D. 12
Correct answer C. A managed execution environment with memory management, type safety and exception handling
Correct answer C. Common Intermediate Language (CIL) plus metadata
Correct answer D. It converts CIL into native machine code when methods are first called at run time
Correct answer C. Code whose execution is controlled by the .NET runtime, which handles memory and safety services
Correct answer A. A compiled unit of deployment and versioning, such as a .dll or .exe, containing CIL and a manifest
Correct answer D. Core types such as System.String, collections, file I/O and threading used by all .NET programs
Correct answer D. When the object is no longer reachable from any root, at a time chosen by the runtime