Subject / 929 questions

Programming MCQs

Page 25 of Programming multiple-choice questions with answers. Tap an option to check yourself.

Page 25 of 47

Advertisement
Question 484 C#

In C#, what is boxing?

Correct answer B. Converting a value type to object or an interface type, which copies it into a heap object

Open question
Question 488 C#

Which statement about the var keyword in C# is true?

Correct answer B. The type is inferred at compile time and the variable stays strongly typed

Open question
Question 489 C#

How does dynamic differ from var in C#?

Correct answer B. dynamic defers member binding and type checking to run time, while var is resolved at compile time

Open question
Advertisement
Question 490 C#

What is the key difference between const and readonly fields in C#?

Correct answer B. const is fixed at compile time; readonly can be assigned at declaration or in a constructor

Open question
Question 494 C#

In .NET, what does the Common Language Runtime (CLR) mainly provide?

Correct answer C. A managed execution environment with memory management, type safety and exception handling

Open question
Advertisement
Question 496 C#

What is the role of the JIT compiler in .NET?

Correct answer D. It converts CIL into native machine code when methods are first called at run time

Open question
Question 497 C#

What is meant by ‘managed code’ in .NET?

Correct answer C. Code whose execution is controlled by the .NET runtime, which handles memory and safety services

Open question
Question 498 C#

In .NET, what is an assembly?

Correct answer A. A compiled unit of deployment and versioning, such as a .dll or .exe, containing CIL and a manifest

Open question
Question 499 C#

What does the .NET Base Class Library (BCL) provide?

Correct answer D. Core types such as System.String, collections, file I/O and threading used by all .NET programs

Open question
Question 500 C#

When does the .NET garbage collector reclaim the memory of an object?

Correct answer D. When the object is no longer reachable from any root, at a time chosen by the runtime

Open question