Programming in C++ - Exam Tests

Exams

The exams take place in a computer lab (S[UW][12] or N8/N11). To ensure equal environment, students must use only the computers of the lab, either in Windows or in Linux mode. The use of notebooks (or other computing devices not installed in the lab) is not allowed during the exams. Students shall not use any resource other than the compiler, debugger, editor and/or IDE installed at the lab, their documentation, and the language reference manuals at cppreference.com.

Each student must work independently.

Before attempting a test

Make sure that you are familiar with the development environment at the lab computers. (See also below.)

For this purpose, the SU1 lab is available at most times. Note that if you log in with your CAS account, you will have to install and configure the VS Code extensions manually as described here. During exam, you will use the "exam" account which has the extensions preinstalled.

Remember to take your ISIC or another photo-id with you. You will have to prove your identity at the exam.

Restricted environment in the labs

During exams, the lab computers will be configured into a restrictive environment:

  • To log into the operating system, use the login exam and the password exam (instead of CAS credentials)
  • Access to the Internet is restricted to the following sites: Search engines are not available - you have to enter full URLs into your browsers. Use Symbol Index to search in cppreference.com.
  • Your home folder is not available

Warning: If you log-off, your computer crashes, or the end-of-test time passes, you will lose all your files.
Submit your sources into Recodex frequently, even if incomplete.
Recodex is your only backup.

Restricted access to Recodex during exams

There will be a special Recodex group for each of the exam term. For the duration of the exam, members of the group (i.e. the students enrolled for the exam term) will be able to access Recodex only after locking themselves to a particular computer by pressing a special button in Recodex.

After locking, you will be able to access the test assignment and submit solutions, but only from the computer you locked from.

If you need to switch your seat during the test (e.g. due to a computer failure), you must ask the teacher to be released from the lock, then lock again at the new seat. Your source code in recodex will be preserved.

You will not be able to access your homeworks because the exam will happen in a dedicated group different from your tutorial group.

Development tools in the labs

You can select Windows or Linux by rebooting the computer.

C++ development tools known to work in the restricted environment:

Hints

  • Build environment - setting-up the project
    • cmake (VS Code; also Visual Studio in Folder mode)
      • Create file CMakeLists.txt
        cmake_minimum_required(VERSION 3.20)
        project("labtest")
        
        add_executable("my_prog" "source.cpp")
        
        set_property(TARGET "my_prog" PROPERTY CXX_STANDARD 23)
        
      • VS Code: Go to menu item "View" > "Command Palette", search for "CMake: Show Configure Command"; then use Build icon at the bottom VSCode toolbar.
  • Debugging - set-up the program and arguments
    • Visual Studio in project mode
      Go to the menu "PROJECT" > "Properties", then set "Debugging" > "Command Arguments". Also make sure that "Working Directory" is set to "$(ProjectDir)".
    • Visual Studio in Folder mode:
      Go to the menu "DEBUG" > "Debug and launch settings", then edit launch.json as in this example:
      {
          "version": "0.2.1",
          "defaults": {},
          "configurations": [
            {
              "type": "default",
              "project": "CMakeLists.txt",
              "projectTarget": "my_prog.exe",
              "name": "my_prog.exe",
              "currentDir": ".",
              "args": [ "expr1.txt", "input1.csv", "output1.csv" ]
            }
          ]
        }
      
    • VS Code in Windows:
      Go to the menu "Run" > "Add configuration", select "(Windows) launch", and edit .vscode/launch.json as in this example:
      {
          "version": "0.2.0",
          "configurations": [
          {
              "name": "(Windows) Launch",
              "type": "cppvsdbg",
              "request": "launch",
              "program": "${workspaceFolder}/build/Debug/my_prog.exe",
              "args": ["expr1.txt", "input1.csv", "output1.csv"],
              "stopAtEntry": true,
              "cwd": "${workspaceFolder}",
              "environment": [],
              "console": "externalTerminal"
          }
          ]
      }
      
    • VS Code in Linux:
      Go to the menu "Run" > "Add configuration", select "(gdb) launch", and edit .vscode/launch.json as in this example:
      {
          "version": "0.2.0",
          "configurations": [
          {
              "name": "(gdb) Launch",
              "type": "cppdbg",
              "request": "launch",
              "program": "${workspaceFolder}/build/my_prog",
              "args": ["expr1.txt", "input1.csv", "output1.csv"],
              "stopAtEntry": true,
              "cwd": "${workspaceFolder}",
              "environment": [],
              "externalConsole": false,
              "MIMode": "gdb",
              "setupCommands": [
                  {
                      "description": "Enable pretty-printing for gdb",
                      "text": "-enable-pretty-printing",
                      "ignoreFailures": true
                  },
                  {
                      "description": "Set Disassembly Flavor to Intel",
                      "text": "-gdb-set disassembly-flavor intel",
                      "ignoreFailures": true
                  }
              ]
          }
          ]
      }
      

Various useful resources

  • vim settings ((C) Jan Černohorský):
    • cpp.vim - vim setting suitable for C++
    • clangd.lua - neovim plugin to enable clangd-based suggestions etc.
    Look for comments inside the files for details.

If you have a setting or similar resource that could help someone during the test or exam, it may be placed here, on the condition that it is documented so that it may be useful to everyone. Just send it by email.