Multiple choice technology programming languages

What method(s) must be used with the Application object to ensure that only one process accesses a variable at a time ?

  1. Synchronize()

  2. Lock() and UnLock()

  3. Lock()

  4. Asynchroize()

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The Application object in ASP.NET stores global state shared across all users and sessions. To prevent race conditions when multiple requests access the same Application variable simultaneously, you must call Application.Lock() before reading/writing and Application.UnLock() after operations complete. Synchronize() and Asynchroize() are not valid methods, and Lock() alone is insufficient.

AI explanation

In classic ASP, the Application object's Lock() and Unlock() methods are used together to prevent race conditions: Lock() ensures only one client's script can modify an Application-level variable at a time, and Unlock() releases that exclusive access afterward. 'Synchronize()' and 'Asynchroize()' aren't real Application object methods, and 'Lock()' alone without the corresponding 'Unlock()' would leave the variable permanently locked, so the pair is required together.