Very good user, very good... we just have one last whiteboard exercise for you

>very good user, very good... we just have one last whiteboard exercise for you

>create a non-empty computer program which takes no input and produces a copy of its own source code as its only output.

Other urls found in this thread:

pastebin.com/zUSvt8UP
en.wikipedia.org/wiki/Quine_(computing)
twitter.com/SFWRedditImages

i'm not doing your homework

public class Quine
{
public static void main(String[] args)
{
char q = 34; // Quotation mark character
String[] l = { // Array of source code
"public class Quine",
"{",
" public static void main(String[] args)",
" {",
" char q = 34; // Quotation mark character",
" String[] l = { // Array of source code",
" ",
" };",
" for(int i = 0; i < 6; i++) // Print opening code",
" System.out.println(l[i]);",
" for(int i = 0; i < l.length; i++) // Print string array",
" System.out.println(l[6] + q + l[i] + q + ',');",
" for(int i = 7; i < l.length; i++) // Print this code",
" System.out.println(l[i]);",
" }",
"}",
};
for(int i = 0; i < 6; i++) // Print opening code
System.out.println(l[i]);
for(int i = 0; i < l.length; i++) // Print string array
System.out.println(l[6] + q + l[i] + q + ',');
for(int i = 7; i < l.length; i++) // Print this code
System.out.println(l[i]);
}
}

import sys
with open(sys.argv[0]) as f:
for line in f:
print(line,end='')

with open(__file__) as f: print(f.read())

easy

import quine

Guys... is this really the spirit of OP's homework exercise?

Reading a file is generally considered as "taking input" for the purpose of creating quines, so no.

...

""
most lisps

#!/usr/bin/env bash
cat "$0"

run as quine.py

>non-empty
Thanks, we'll call you back.

#!/usr/bin/env ruby
puts File.read(__FILE__)

fu = open(dicpic.py r)
for dic in fu:
print dic

taking input means a command line argument, reading from stdin or prompting for input from the command line

It is non-empty you absolute retard.

Written in H9+
Hello, World!

This. Otherwise I have no idea.

"Quine"
Written in Common Lisp

#include
using namespace std;
int main()
{
cout

>Sepples
AHAHAHAHAHAHAHHAHAHAHAH

>taking input means a command line argument, reading from stdin or prompting for input from the command line
you are retarded

s=[[s=[_[%s]_]print(s:gsub('\95',''):format(s))]]print(s:gsub('\95',''):format(s))

1
Works in R and Matlab.

//string.h, iostream.....
String code = __FILE__;
std::cout

Fucking noobs. I'll post my solution in C in about 15 minutes, just checking the code tags. Can't ever remember which slash goes in the end:
hello world

#include

int main(int argc, char ** argv)
{
HANDLE hFile = CreateFileA(argv[0], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (!hFile)
{
return 1;
}
HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (!hMap)
{
return 2;
}
IMAGE_DOS_HEADER * pBaseAddr = (IMAGE_DOS_HEADER *)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
if (!pBaseAddr)
{
return 3;
}
CloseHandle(hFile);
if (pBaseAddr->e_magic != IMAGE_DOS_SIGNATURE)
{
return 4;
}

IMAGE_NT_HEADERS* pNtHeader = (IMAGE_NT_HEADERS*) ((ULONG_PTR)pBaseAddr + pBaseAddr->e_lfanew);
if (pNtHeader->Signature != IMAGE_NT_SIGNATURE)
{
return 5;
}
char * baseOfCode = (char *)((ULONG_PTR)pBaseAddr + pNtHeader->OptionalHeader.BaseOfCode);
for (int i = 0; i < pNtHeader->OptionalHeader.SizeOfCode; i++)
{
if (i % 8 == 0 && i != 0)
{
printf("\n");
}
printf("0x%02x ", (unsigned char)baseOfCode[i]);
}
getchar();
return 0;
}

here u go champs

if you think that writing a quine oculd come up in an interview, then you clearly have no idea what the employer is looking for when you do whiteboarding.

cat $0

Here's the fucking code. In two parts since it's too long for 4chins.

pt.1:
#include


void esc_to_slash(char dest[], char src[]) {
int i, j;

i = j = 0;
while(src[i] != '\0') {
switch(src[i]) {
case '\n':
dest[j++] = '\\';
dest[j++] = 'n';
++i;
break;
case '\\':
dest[j++] = '\\';
dest[j++] = '\\';
++i;
break;
case '\t':
dest[j++] = '\\';
dest[j++] = 't';
++i;
break;
case '\"':
dest[j++] = '\\';
dest[j++] = '\"';
++i;
break;
default:
dest[j++] = src[i++];
break;
}
}

dest[j] = '\0';
}

...

(You)
fuck i'm having some kind of connection error. testing

I can't post the code for some reason. nvm here's the pastebin:

pastebin.com/zUSvt8UP

>I'm having some kind of connection error
There are a bunch of weird phrases that cloudflare will reject, and it will show as a connection error.

no u

source type

10 list

#!/bin/bash
cat `basename "$0"`

source code here

...

Sir, may I ask, how are these programming games going to help your company with the massive data corruption in your database and blaring bugs in your customer facing production code?

Your implementation will not yield a one for one result. Use sys.stdout.write to remove the extra white space.

import sys

with open(__file__) as f: sys.stdout.write(f.read())

They wont. I just feel very insecure around intelligent programmers so I'd like to make sure you wont take my job.

this

pic related

checkmate atheists

#include
#include

int main(void)
{
FILE *file = fopen("quine.c", "r");

fseek(file, 0, SEEK_END);

long int filesize = ftell(file);

rewind(file);

char *buffer = malloc(filesize + 1);

fread(buffer, filesize, 1, file);

buffer[filesize] = '\0';

printf("%s\n", buffer);

free(buffer);

return 0;
}

slow frogposter

>compile
>send binary to a friend
>he runs it
>Segmentation Fault

Quines are trivial.
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

Can I make bash file named "virus.sh" and have the only line be "cat ./virus.sh"?

...

itt: people not knowing what a fucking quine is.

en.wikipedia.org/wiki/Quine_(computing)

No, you can't pipe the program's source code into itself, this is considered cheating.

The reason it's non empty is because a C programmer once submitted an empty file and declared that it's technically the shortest quine.

The definition was changed and they were awarded biggest abuse of the rules award at the underhanded C competition.

s = 's = %r\nprint(s%%s)'
print(s%s)

is a valid quine in python.