Programming Placement Exam Instructions

Last Updated: August 26, 2022

This page contains instructions on how to prepare for the MPCS Programming Placement Exam. If you are registered for this exam, please make sure you read this page carefully.


It is your responsibility to complete the items on this checklist before the exam. If you do not, it will very likely impact your performance in the exam. Please read this list carefully.

❏ You have read and understand the instructions in this page.

If anything is unclear, do not wait until the day of the exam! Contact us as

❏ You have read the exams from previous years.

Links to past exams are provided on this page.

❏ You understand and are aware that the exam will be carried out on a computer lab on campus with computers running Ubuntu Linux 20.04.

No UNIX experience is required to do the exam. Ubuntu 20.04 provides a user-friendly desktop environment similar, but not identical, to the desktop environments found on Windows and Mac machines. Popular developer tools, like Visual Studio Code, are installed on the exam machines. This page includes suggestions on how to familiarize yourself further with the exam machines.

❏ You understand and are aware that the exam will be carried out on HackerRank.

❏ You have familiarized yourself with the input/output requirements of the exam problems, using your programming language of choice.

❏ You have familiarized yourself with the online HackerRank platform which is used to administer the exam. HackerRank provides a Sample Test you can complete to familiarize yourself with their platform. Please note that you will need to create a HackerRank account to access the test. We encourage you to create one with your address.

❏ You have worked through the practice exams on HackerRank (unlike the "sample test" provided by HackerRank, these practice exams use problems from past MPCS exams):

  • Practice Exam #1: Includes three very easy problems (the third one is from a past placement exam)
  • Practice Exam #2: This exam has all the problems from the 2019/20 placement exam.

❏ You have filled out the placement’s exam registration form. We will use the information you provided in that form to send you a private link to take the exam. 

❏ You have verified that your language of choice is supported on HackerRank (see this page for list of supported languages). You understand that you must do the exam in the supported language you are most proficient in. In the past, some students have incorrectly assumed that they had to do the exam in the language they expect to use the most in the MPCS. That is not the case: please do not learn a new language just for this exam. Use the language you are most comfortable with.

It is important that you complete all these items! You should not wait until the day of the exam to familiarize yourself with HackerRank.

Please note: MSCAPP students are NOT allowed to take the programming placement exam in R.

Exam Format

In the programming placement exam, you will have 90 minutes to write programs that solve a series of programming problems of varying difficulty. This exam is meant to be done entirely on a computer, and you are expected to write code that compiles and runs correctly (you cannot submit pseudocode, or sketches of what your solution might look like). 

You will have access to a single computer, and will be allowed to consult Internet sources during the exam. You must not communicate with anyone, either in-person or through the Int​ernet, during the exam. Anyone caught opening an e-mail client (except right at the start of the exam to access your exam link) or a chat client will automatically receive an F on the exam.

Please note that, regardless of any partial credit awarded, you will automatically fail the exam if you are unable to submit at least two problems during the exam, where the solution compiles, runs, and passes at least one sample test case.


During the exam, you will submit your solutions through HackerRank, a web-based platform that will run your solution with a series of test cases, and will tell you whether your solution passed the test cases or not. Although the results of the test cases will be a factor in evaluating your solution, your code will also be stored in a database for further evaluation by a human grader.

HackerRank has a public website that you can access at any time before the exam. This website provides the exact same interface you will encounter during the exam. We recommend taking a look at their sample practice exam to get familiar with the testing environment.

 Before the start of the exam, you will receive an email from us with a link to the exam.  Once you click on the link, fill out all required information and agree to the terms in the “Confirmation Form” section then you will begin the 90 minute exam by clicking on the “Agree & Start” button. The following sections describe the problem structure and information you should know while taking the exam. 

Problem Style

As you will see on the HackerRank site, all the exam problems require you to write a program that will read some input, which you must then process in a way specified in the problem statement, and produce an output in a specific format. You must write your solution in a single file (Java programmers, note that you can include additional top-level classes in a single source file as long as they are unqualified: just "class", without "public")

The format of the input and output is described in each exercise, and you must follow them rigorously. Each problem includes some sample input/output data that you can use to test your solution. Take into account that we will also test your solution with larger test cases.

All input is read from standard input (i.e., it is read “from the console”). You can assume that all input is correct and meets the specifications given in the problem statement; do not waste time validating the input. All output should be printed to standard output. Anything printed to standard error will be ignored (i.e., you can use standard error to print debugging statements).

As you work through past exam problems, you'll notice that the input/output requirements are very similar across problems. In particular, it is useful to think of the input as a stream of tokens (with each value, or token, separated by a space or a newline). All modern programming languages include libraries to easily read in this kind of data, without having to read in the file byte by byte or doing any complicated parsing. In particular, you may want to look at:

  • C: fscanf()

  • C++: The iostream library, including the << and >> operators.

  • Python:

  • Java: StreamTokenizer

Note: You are not limited to using just the above mechanisms. They are just suggestions; if you have another preferred method of reading tokenized input in your programming language of choice, you are welcome to use it (as long as it doesn't require using external libraries not included with the language's standard library).

Exam machines

You will be doing the exam on a Linux computer running Ubuntu 20.04. These machines include the following compilers:

  • OpenJDK Java 17.0.3

  • GCC 9.4.0

  • Python 2.7.18 and 3.8.10

  • Ruby 2.7.0

  • Mono C# compiler 6.8.0

The following programming tools are also provided:

  • Visual Studio Code 1.45.1

  • GEdit (a barebones text editor)

  • GNU Make 4.2.1

  • GDB 9.2

  • GNU Emacs 26.3

  • vim 8.1

No UNIX experience is required to do well in the exam. All the problems can be solved by using just a barebones text editor to write and edit code, and then submitting that code through the HackerRank website; no special tools or libraries are required. 

Additionally, bear in mind that the HackerRank website itself provides an interface for editing, compiling, and running your code. This means the exam can also be done using just a web browser.

If you would like to familiarize yourself with the exam machines before the exam, you have two options:

  1. Logging into a CS machine before the exam. We are working on confirming whether it will be possible to access the computer labs in advance of the exam, and will update this page when that information is available.

  2. Using the CS department's Ubuntu 20.04 VM. The department provides students with a Virtual Machine (VM) image that approximates the software environment found on the CS Linux machines. This provides a convenient mechanism for familiarizing yourself with our computing environment without having to install Linux on your own machine.

    You can download the CS department's VM image here: That page also includes instructions on how to install and run the VM.

  3. Using an Ubuntu Live CD or bootable USB drive. If you are unable to run a VM on your computer, you can also run Ubuntu on your computer by booting your computer from a “Live CD” or a bootable USB drive with Ubuntu on it. You can find instructions on how to do this here: Please note that, while this will allow you to familiarize with the desktop environment in Ubuntu, the software environment provided in these "Live CD"s or bootable USB drives may not have the same tools and compilers that are installed on the CS Linux machines and on the CS VM.

During the exam

The exam will include five problems. The difficulty of the problems will be similar to the sample exams from previous years. In this exam, we need to see evidence that you know how to write code that compiles and runs correctly: Three partial solutions (as long as they compile and run) are actually much better to us than a single solution (even if it is 100% correct). The more code we see from you, the better.

We suggest you follow this strategy during the exam:

  1. Select a problem that you feel you can solve easily, and write a solution in your text editor/IDE.

  2. Manually test the solution with the sample input provided. Since all programs must read from standard input, when your program runs it will be waiting for input to be entered on the console. You can just copy-paste the sample input and press Control-D to signal the end of input. Check whether it produced the exact same output shown in the problem statement. If it does not, your solution is incorrect.

  3. If your output matches the output shown in the problem statement, submit to HackerRank by copying over your code into the  code window for the problem.  Clicking the “Run” button and then clicking the “Test Results” tab will show you whether you passed all test cases for a problem.

    If you get an “All available test cases passed” message, you're done with this problem. Move on to the next one.

    If you get anything other than “All available test cases passed”, it's likely that your solution is substantially correct, but is failing on a corner case.

    Don't obsess over this! If your solution (1) compiles, (2) runs, and (3) solves the problem correctly for the sample test cases, then your solution is very likely 95% correct. Move on to the next problem, and revisit any non-Accepted problems if you have time at the

    Please note that you can write and test your code directly into the code window for any problem. If you feel more comfortable working in a text editor/IDE on your personal computer then we recommend that you work within that environment and then copy over your solution. However, there is no file uploading on HackerRank so you must copy over your solution once you feel it's ready to be fully tested on HackerRank. 

  4. Make sure to click the “Submit Test” button on the main exam page once you have completed the test. 

Past Exams

All our past placement exams are available on Kattis, which uses a problem format that is similar to HackerRank’s. You can view these exames on this section of the Kattis website:

On that page, click on an academic year, and then on the “Problem list” link. This will show you a list of all the problems from that year's exam. To submit a solution to a problem, you will need to create an account on the general Kattis site:

You should also read the documentation provided by Kattis, specially their tutorials on submitting solutions:

Academic Honesty

During the exam, you will be allowed to consult online sources, as long as you cite their usage in your code (please use code comments at the top of your code, or in the relevant portions of your code). However, please note the following:

  • You must use online sources for reference only

  • You must not use anyone else's code, including code you find on the Internet, in your solutions. 

  • You must not communicate with any other person on the exam. Anyone caught opening an e-mail client (except right at the start of the exam to access your exam link) or a chat client, or caught communicating in any other way with other people, will automatically receive an F on the exam.

  • You are strictly forbidden from using any electronic devices during the exam, including phones, tablets, laptops, etc. (except right at the start of the exam if required for performing two-factor authentication). Please note that this includes the use of USB storage devices. Anyone caught using an electronic device, or connecting a USB device to a computer, will automatically receive an F on the exam.

Any instances of academic dishonesty will result in a FAIL on the exam. For MPCS students, you will be required to begin the MPCS program with MPCS 50101 Concepts of Programming and you will be placed on academic probation until you complete three core classes in the MPCS. For students in other programs, you will be ineligible to take MPCS classes for the entire duration of your program, and the incident will be reported to your program, with a recommendation for you to be placed on academic probation, or to impose a comparable penalty.