FactSet Research Systems, Inc Interview Question for Software Engineer / Developers






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

<pre lang="" line="1" title="CodeMonkey90927" class="run-this">abstract class Tool
{
private static Name=getClass().getName();
private final void init()
{
}
abstract public void type();
public void Action()
{
}
}
</pre><pre title="CodeMonkey90927" input="yes">
</pre>

- Anonymous August 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

it says 'about C++'...

- Anonymous August 18, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <typeinfo>
  
  class Tool{
   
      public:
           Tool() {};
           
           virtual void type() = 0; // pure virtual
           virtual void Action();   // virtual
      
      private:
           void init();   //private
           string & Name() { return typeid(this).name();}  // RTTI
  };

- Anonymous August 19, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

First of all you cannot initialize non-const std::string with

const char*

which

typeid(this).name()

returns, also you are returning reference to a TEMPORARY VARIABLE!!!. If you want to return string you should return it by value.

Second I don't think name of BASE class is what they asked by saying "which class's instance this object is" not which _base_ class.

- NarkoBaron August 23, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Actually, they want "Name" as a variable, not as a function.
So, the class will look like this:

class Tool
{
public:
Tool()
{
Name = typeid(*this).name();
}

// blah blah

public:
string Name;
};

Please pay attention to "typeid(*this)", not "typeid(this)", - else we will have the class name as "Tool*" instead of "Tool"!

- sergey.a.kabanov January 11, 2012 | Flag


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