Text-based programming tasks - code submission

Example 1- Hello, World!


This is a simple task to illustrate the submission process and point out any special requirements for each particular programming language. There is only one correct answer. The code you submit will therefore be given a score of either 0 or 10.

Tasks begin with some background information and/or instructions. Below the task information, is the submission area. First write and test your program in your preffered IDE. Next select your preferred language from the dropdown menu and copy and paste your code into the text box below this. After checking your code has pasted in correctly and pressing the Submit button your code will be compiled and evaluated.

Have a look at the interface to get aquainted and then try writing a program and submitting your program. Your code should send the string "Hello, World!" to the standard output of your chosen programming language.

Try this out in a new window ...

Answers:

Language

Filename

Program

C

helloworld.c

int main() {
  printf("Hello, World!\n");
}

C++

helloworld.cpp

#include <iostream>

int main()
{
  std::cout << "Hello, World!";
  return 0;
}

C#

helloworld.cs

using System;
namespace HelloWorld
{
  class Hello
  {
    static void Main()
    {
      Console.WriteLine("Hello, World!");
    }
  }
}

Haskell

helloworld.hs

main = putStrLn "Hello, World!"

Java

helloworld.java

[class needs to have same name as file]

class helloworld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}

Javascript

helloworld.js

console.log("Hello, World!")

Kotlin

helloworld.kt

fun main(args : Array<String>) {
  println("Hello, World!")
}

Pascal

helloworld.pas

begin
  writeln('Hello, World!')
end.

Python 3

helloworld.py

print("Hello, World!")

Ruby

helloworld.rb

puts "Hello, World!"

Visual Basic

helloworld.vb

Module HelloWorld
  Sub Main()
    Console.WriteLine("Hello, World!")
  End Sub
End Module

 

Code submission tasks - Intro

Example 1 - Hello, World!
Example 2 - Postfix
Exercise - Cat Words



Did you know the UK Bebras Challenge is run by the Raspberry Pi Foundation? Discover free teaching resources, tools, and expert support for computing education at raspberrypi.org.