Interview Question


Country: United States




Comment hidden because of low score. Click to expand.
1
of 1 vote

My favorite way to answer this question is to present an empty Python file.

- eugene.yarovoi July 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>

int main()
{
char d;
int ret=0;
FILE *fp;
fp = fopen(__FILE__,"r");
ret = fscanf(fp,"%c",&d);
while(ret != EOF)
{
printf("%c",d);
ret = fscanf(fp,"%c",&d);
}
return 0;
}

- nik July 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Google Search for Quine. That is what you are looking for. I dont understand what do they get by asking such questions in interview. :(

- nerd July 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <stdio.h>

int main()
{

char ch;
FILE *file;

file=fopen("printitself.c","r");

while((ch=fgetc(file))!=EOF)
printf("%c",ch);

return 0;
}

- alien August 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<stdio.h>
#include<stdlib.h>
void main()
{
	FILE *fp;
	fp=fopen("fileprog1.c","r");
	if(fp==NULL)
	{
		printf("error!\n");
		exit(1);
	}
	char c;
	while(fread(&c,sizeof(c),1,fp)!=NULL)
	{
		printf("%c",c);
	}
	fclose(fp);

}

- kathrotiyanimesh July 19, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More