Search⌘ K
AI Features

Quiz Yourself: Classes and OOP

Assess your understanding of C# classes and object-oriented programming.

We'll cover the following...
Technical Quiz
1.

Why does the variable score remain unchanged in this example?

static void Main() {
    int score = 100;
    Reset(score);
    // score is still 100
}

static void Reset(int val) {
    val = 0;
}
A.

The method Reset creates a new stack location containing a copy of the value.

B.

Integers are immutable reference types that cannot be changed.

C.

The garbage collector prevents the modification of primitive types.

D.

The method modifies the original stack location but reverts it upon returning.


1 / 14
...