0

it's an unusual question: I want to know a list of character that I could substitute on a Java code to prevent it from being copied, pasted and compiled.

Explanation: I'm teaching a course on Java and have to apply an online exam using Microsoft Forms. One of the question that I like to use is "Be The Compiler" (inspired in the Head First books), in which the student have to run the code in his head and write down the output. The problem is that, because of the Covid-19, it's been online from home, the student could just copy and paste the code and run it.

PS: Microsoft Form only accept one small image for each question. And accept nor HTML tag, nor LaTex tag, nor markdown tag.

PS: The idea is inspired by JavaScript Prank / Joke

  • 1
    Just find unicode characters which look like regular ones, but are not. Lots of almost-similar latin letters there, I think there's at least 6 different dashes which can be substituted for minus sign, quite a few whitespace-like characters, too. But depending on the code length, the student might just type it out, so there won't be a sure-fire way. – pafau k. May 28 '20 at 19:04
  • Thanks, the idea is that the student will not have enough time to type it out ;) It's readable, but verbose. – vinicius de novaes May 28 '20 at 19:13
  • 1
    It's gonna take some work sifting through these, but [take a look at the list of 'confusables'](http://www.unicode.org/Public/security/latest/confusables.txt). There's stuff like single symbols for a digit in parentheses, 'mathematical parentheses' that look just like regular ones, or a letter starting with apostrophe (just add a closing apostrophe to get a pretend char value). Make sure to use a non-breaking space for whitespace, too. – pafau k. May 28 '20 at 19:32
  • 1
    Thanks @pafauk. I'm making a list and will post as an answer with a python script to change the original code. – vinicius de novaes May 28 '20 at 20:32
  • A shame that characters didn't worked as expected, trying to merge characters of two different fonts: lc ca to emen ble – vinicius de novaes May 28 '20 at 22:03

1 Answers1

1

Thanks to that list (given by pafau) I was able to find some symbols:

  • 202F ; 0020 ; (   → ) NARROW NO-BREAK SPACE → SPACE
  • 201A ; 002C ; ( ‚ → , ) SINGLE LOW-9 QUOTATION MARK → COMMA
  • 037E ; 003B ; ( ; → ; ) GREEK QUESTION MARK → SEMICOLON
  • 1400 ; 003D ; ( ᐀ → = ) CANADIAN SYLLABICS HYPHEN → EQUALS SIGN

The following code in python put the number of the line and replace those symbols:

# -*- coding: utf-8 -*-

import sys

text_numbered = ''

with open(sys.argv[1], 'r') as my_file:
    for counter, line in enumerate(my_file, 1):
        text_numbered += '{:3d}'.format(counter) + ' - ' + str(line)

text = text_numbered
# 202F; 0020; (   →   ) NARROW NO-BREAK SPACE → SPACE
text = text.replace(' ', ' ')
# 201A; 002C; ( ‚ → , ) SINGLE LOW-9 QUOTATION MARK → COMMA
text = text.replace(',', '‚')
# 037E; 003B; ( ; → ; ) GREEK QUESTION MARK → SEMICOLON
text = text.replace(';', ';')
# 1400; 003D; ( ᐀ → = ) CANADIAN SYLLABICS HYPHEN → EQUALS SIGN
text = text.replace('=', '᐀')
print(text)

Unfortunately I was not able to find a sequence of letters that is identical to "LATIN SMALL LETTER" or "LATIN CAPITAL LETTER"