Barclays Capital Interview Question for Software Engineer / Developers






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

Class won't compile, reasons:
1. String st='mansoor-shaikh'; //This should go into double quotes
2. String int = 90; //You can't use reserve keywords, here is "int". Second no quotes are there for String data type :)

Class can't be serialized
Reasons: Doesn't implement serializable interface.

- Anshuman April 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

should be no problem to serialize this object. since its juz a reference varibles, several bits refering to nothing.

- lwpro2@gmail.com February 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think Thread myThread does not implement serializable, so can be a problem , it wont work

- I'm mansoor-shaikh Senior Vice President of Barclays Fixed Income Analytics February 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think the answer to this is to make Thread variable transient. Reason being that Thread isn't serializable and hence should be declared transient. Transient variables are those which may not be serialized.

- heena2k4 February 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Ansh has a valid point after fixing those, should work. The class gets serialized and if the value needs to be serialized to, then change the AMod. to public.

public class Class1
{
public string st="mansoor-shaikh";
public string st1 = "90";
Thread myThread;
}

- SP April 17, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Assume the code compiles successfully,

Can any one tell , what will happen if a class contain a reference which does not implement Serializable interface ?

- CNR September 10, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

you would get an runtime exception: java.io.NotSerializableException

- lwpro September 10, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

To be more precise, if a class contain a reference which does not implement Serializable interface and it is not null then only you will get a 'NotSerilizableExcetion' . To avoid this, transient modifier should be used against that reference.

In this question Thread reference is null so you won't get any runtime serialize exception.

- atul43.singhal September 19, 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