# Running Secure Exams

Ensuring a secure and fair exam environment is essential. CodeGrade allows you to conduct exams with confidence by offering robust access controls. By setting up a dedicated exam course, you can manage all restrictions at the course level, ensuring every exam runs smoothly and securely.

<figure><img src="/files/GFkECFyvin1k4TdDPQbT" alt=""><figcaption><p><em>Student view of an active exam session with Session Lockdown enabled</em></p></figcaption></figure>

## Step 1: Set Up an Exam Course

Create a dedicated course specifically for exams. This provides a centralized place for all exam access controls.

## Step 2: Manage Course‑Level Access Restrictions

Navigate to ***Course Settings → Access***

Here, you can configure:

* **Password Protection**: A course-level password that students must enter to access the course.
* **IP Restriction**: Limit access to certain IPv4 addresses or ranges.
* **Session Lockdown**: When enabled, students are restricted to this course and cannot access other courses or platform features such as search or snippets. Any attempt to do so will result in token or access-related errors.
* **Idle Session Detection:** *(Enabled by default when Session Lockdown is turned on.)* Ends the exam session after 5 minutes of inactivity, even if the student's laptop stays unlocked. Each interaction extends the session by another 5 minutes, up to the cap set at entry. The setting is remembered if you toggle Session Lockdown off and on.
* **Entry Limits**: Set how many times a student can enter the course (e.g., one entry). You can adjust per-student overrides in the entry log.

Save your changes to apply them to the entire course.

<figure><img src="/files/wxo4XMMwmBhUcd7ivN50" alt=""><figcaption><p>Course Settings → Access, showing Session Lockdown enabled and Idle Session Detection turned on for an exam course.</p></figcaption></figure>

**How the idle session detection works**\
\
Exam sessions stay alive automatically while students are active on the exam tab, and send an immediate heartbeat when a student returns from a locked laptop or a backgrounded tab. If the heartbeat fails, the student sees a clear session interrupted message and is asked to log back in. With Idle Session Detection enabled, 5 minutes of inactivity ends the session even if the device is still unlocked.

## Step 3: Monitor and Adjust Entries

In the same ***Access*** section, you’ll find the entry log. It shows:

* Each student’s name and username
* The number of successful entries
* The limit set for them

You can override or reset limits if needed.

## Step 4: Assignment-Level Access (Optional)

If necessary, you can also set access restrictions for individual assignments. Navigate to ***Assignment Settings → Access***

Here, you can add assignment-specific password or IP restrictions if required.

## Best Practices

* Use IP restrictions for on-site exams (e.g., campus networks).
* Share passwords securely, just before the exam.
* Use "Student View" to test the entire setup, including Session Lockdown, restrictions, and Heartbeat Enforcement if enabled.
* If Session Detection is turned on, let students know that stepping away from the exam for more than 5 minutes will end their session and require them to log back in.
* If both course-level and assignment-level restrictions are applied, course-level rules will apply broadly while assignment rules add further control.

For students, once they start the exam course, their session is locked. Any attempt to switch courses or reuse a session will lead to access errors, ensuring a secure, focused exam environment.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.codegrade.com/setup-assignment/other-features/running-secure-exams.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
