quine Questions

11

Solved

Wikipedia says it's called a quine and someone gave the code below: char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";main(){printf(s,34,s,34);} But, obviously you have to add #include <stdi...
Eidson asked 20/4, 2012 at 0:23

10

Solved

I think this might be a classic question but I am not aware of an answer. Can a program output a copy of itself, and, if so, is there a short program that does this? I do not accept the "emp...
Nanon asked 25/9, 2009 at 20:45

13

Python 2.x (30 bytes): _='_=%r;print _%%_';print _%_ Python 3.x (32 bytes) _='_=%r;print(_%%_)';print(_%_) Is this the shortest possible Python quine, or can it be done better? This one seems t...
Diocesan asked 3/6, 2011 at 5:23

6

Solved

Has anyone constructed a quine ("A program that generates a copy of its own source text as its complete output": http://www.nyx.net/~gthompso/quine.htm) in R? (The [quine] tag pulls up lo...
Ipsus asked 27/6, 2011 at 16:30

4

Solved

Today I surfed some random geek-stuff articles on wikipedia to get my daily dose of useless knowledge. I stumbled accross quines, which are programs that print their own source-code. I found that a...
Sporadic asked 21/4, 2011 at 13:7

7

Solved

This is a very interesting wiki article about programs that print their own source code without any access to physical source file (in the filesystem). Examples in the articles include C and Scheme...
Bioplasm asked 23/10, 2010 at 21:35

3

After poking around on the internet I wasn't able to find anyone who had written a quine in R (Edit: since writing this, have found several on SO, but am still interested in this one). So I figured...
Bo asked 3/11, 2015 at 21:50

4

Solved

Per the title, is it possible to create a (non-trivial) quine in HTML? My definition of an HTML quine: A non-trivial HTML quine is one that is not null and uses at least one HTML tag, under the...
Blowtorch asked 6/12, 2011 at 13:23

10

Solved

I have seen a lot of C/C++ based solutions to this problem where we have to write a program that upon execution prints its own source. some solutions -- http://www.cprogramming.com/challenges/so...
Copyholder asked 19/9, 2008 at 21:20

9

Solved

Is it possible to make a Java program that prints its source code to a new file, and compiles it, and runs the compiled program?
Littoral asked 11/4, 2010 at 16:45

4

Solved

I just wanted to know if it is 100% possible, if my language is turing-complete, to write a program in it that prints itself out (of course not using a file reading function) So if the language ju...
Cece asked 2/4, 2010 at 17:10

3

Solved

So I just came across the term Quine on Wikipedia and cannot figure out what the heck it is meant for. I'm more than confused about it. Are there any real-world uses for it?
Kimon asked 28/4, 2012 at 22:3

4

Solved

I came across a program that prints itself on this site, i.e. it prints the program code. The program code is: #include <stdio.h> char *program = "#include <stdio.h>%cchar *program = ...
Ortegal asked 7/10, 2011 at 17:39

2

Solved

Found this example of quine: s='s=%r;print(s%%s)';print(s%s) I get that %s and %r do the str and repr functions, as pointed here, but what exactly means the s%s part and how the quine works?
Octavalent asked 12/10, 2015 at 0:12

3

Solved

The more I try to understand this perplexed enigma the more I want to give up. char *s = "char *s = %c%s%c; main(){printf(s,34,s,34);}"; main(){printf(s,34,s,34);} How is happening for thi...
Granulocyte asked 28/8, 2015 at 9:26

4

Solved

This code is from Hacker's Delight. It says this is the shortest such program in C and is 64 characters in length, but I don't understand it: main(a){printf(a,34,a="main(a){printf(a,34,a=%c%s%c,3...
Beheld asked 24/4, 2015 at 1:29

1

Solved

I came across this while researching quines. I am curious to know what %% does in the following print '%r k%%k'%'a' I understand that %r takes the string representation of the argument that's pas...
Buran asked 31/1, 2015 at 19:5

4

I have a little quiz that I cannot solve by myself. I want to build a program that will print its own source code with java. Anyone knows how to do this? Like this example: public class Sour...
Swore asked 26/6, 2012 at 4:1

1

Solved

What is the proper way to use the "ap" monad in Haskell? I want to do something similar to this: main = (putStr . ap (++) show) "main = (putStr . ap (++) show) " but I get the error "Not in scop...
Trainbearer asked 29/4, 2013 at 17:11

2

Solved

I read Ken Thompson's classic paper Reflections on Trusting Trust in which he prompts users to write a Quine as an introduction to his argument (highly recommended read). A quine is a computer p...
Zingale asked 15/1, 2012 at 20:10

2

Solved

I have found this code block on Wikipedia as an example of a quine (program that prints itself) in Ruby. puts <<2*2,2 puts <<2*2,2 2 However, I do not get how it works. Especially, w...
Inositol asked 3/6, 2012 at 19:42

1

Solved

I came across this little quine program, written without main method: enum f { f; System z; String s="enum f{f;System z;String s=%c%s%1$c;{z.out.printf(s,34,s);z.exit(0);}}"; {z.out.printf(s,3...
Bakelite asked 2/2, 2012 at 22:22

2

Solved

Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/ In it, the author argues the case for using a quine as ...
Halla asked 19/3, 2010 at 3:43

1

Solved

main(a){printf(a="main(a){printf(a=%c%s%c,34,a,34);}",34,a,34);} How it is reproducing itself after compilation? What is the role of writing 34 in printf function?
Rudyrudyard asked 21/12, 2011 at 20:56

1

Solved

Just out of curiosity, does there exist a valid zip-file (according to format spec) that, contains nothing but itself? Put another way, does the function implemented by unzip have a fix-point? Ca...
Cortneycorty asked 2/7, 2010 at 21:36

© 2022 - 2025 — McMap. All rights reserved.