If you wish to run these questions, please log in with:
Username: trial
Password: trial

This page demonstrates some of the built-in question types in C (questions 1 through 3) and Java (questions 4 through 6). Only simple questions appear on this page. A much fuller demonstration of the sorts of questions that can be asked is in the main Python3 demo page.

Normally students develop their code in their favourite editor or IDE and then, when they think it's correct, paste it into the answer boxes. That way they avoid any submission penalties due to trivial syntax or logic errors. However, with simple questions, such as in this quiz, it's often possible to develop code directly within the browser. To make such development a little less daunting, all questions in this quiz are set to allow one free erroneous submission, after which a 10% penalty is applied for each wrong submission.

C Examples

This page demonstrates some simple C questions. There are two built-in C question types: C function and C program. For C function questions the student is asked to write a C function to some specification (plus possible additional support functions). Tests generally consist of a call to printf with a call to the student's function as the argument, though multiline tests are possible too. The tests are wrapped into a (hidden) main function.  C program questions require the student to write a program to some specification, usually involving reading data from standard input or from a file and producing specified output.

The C compiler is currently set to accept C11 with -Wall and -Werror, so any warnings cause the submission to be marked wrong.

With C function questions stdio.hstdlib.hctype.h and string.h are automatically included but no files are included with C program questions. 







There are three different Java question types built in to CodeRunner:

  1. Write a method. Here the student is invited to write a stand-alone method (essentially a function) to perform some simple task with its parameters, either printing something or returning some value. This sort of question is useful for rank beginners, who are still learning basic Java syntax and control structures.
  2. Write a class. Here the student writes a single class that satisfies some specification.
  3. Write a program. Here the student writes an entire program in the form of a public class with a public static void main method, which performs some computation (usually involving standard input or a specified file).
One of each of these questions is given below.






Last modified: Wednesday, 15 February 2023, 11:28 AM