FlexTrade Interview Question for Software Engineer / Developers






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

It will return a dangling pointer. A garbage value.
As str variable is in stack which is accessible only in local function xyz().

- Anonymous July 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

@anon: Hey I dont really get that. You say that str is local to the function xyz, but str is being passed out of the function right ?

- Anonymous July 29, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

function returns address of local variable

- Anon September 21, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

hey @anonymous (the one who posted the question) - Was this a part of the online exam (16 Q's - 30 mins)?

I too have to give one.

- gradStudent July 28, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Gradstudent ,@anonymous
Please tell me some more questions for flextrade online exam . Or can you advise the type of questions they ask??

- nidhi September 14, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Gradstudent ,@anonymous
Please tell me some more questions for flextrade online exam . Or can you advise the type of questions they ask??

- nidhi September 14, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

it will return
Hello there!

- anonymous January 05, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

str is static, so it has value as long as program is in execution. so, output will be
Hello there!

- Anonymous July 01, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

It will return garbage value may be hello there is in garbage...
we need to make static to return always hello there
#include<stdio.h>
#include<string.h>

char *xyz()
{
static char str[32];
strcpy(str,"Hello there!");
return(str);
}

void main()
{
printf("%s",xyz());
}

- vijaymukilan July 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>
#include<string.h>

using namespace std;

char *copy(char str[100])
{
// char str[100];
strcpy(str,"HelloWorld!");
return str;
}

int main()
{
char str[100];
printf("\n%s\n\n",copy(str));
return 0;
}

- Anonymous November 09, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>
#include<string.h>

using namespace std;

char *copy(char str[100])
{
//    char str[100];
	strcpy(str,"HelloWorld!");
	return str;
}

int main()
{
	char str[100];
	printf("\n%s\n\n",copy(str));
	return 0;
}

- anonymous November 09, 2018 | 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