Goldman Sachs Interview Question for Software Engineer / Developers






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

Question didn't ask about static specific to classes.

We can explain a static method in terms of a class or as a normal non-class function.

A staic method in a class's role is to use the static data members only.
and staic method can be accessed by a static/non-static class object.
But a static method cannot have non-static access to the data-members.
And static method cnnot be constant, volatile and virtual.

Now, static non-class method: A staic keyword in front of a non-class method is used to limit the method scope to the current compilation unit. It has internal linkage and one can use this principal in C for information hiding, while class's static method/data-member has external-linkage.
e.g.
In abc.cpp/c
static void print_some_data()
{
}
is limited in abc.cpp/c only, no other compilation unit in an application can use it.

- Maninder Singh June 07, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

good answer

- chacha December 04, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

A static method is not bound to an instance of a class. It does not need a class instance to access it. But to access other (non-static) members of the class from the static method, we need to declare a class instance inside static method.

- webchic April 20, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

plaese explain in detail with example,how can we acess the member of class without instance????

- winner April 24, 2009 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

This is JAVA concept

class Example{

public static int data;
// static block - runs when the class is loaded
// generally only static members are initialized in the static block
static{
data=999;
}

}

- Anony February 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Static Initializer Block is concept of Java. Do we really have this in C++?
Is it same as Initialization of Static variables.

- K2G April 26, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@ naninder you are rocking man!

- donkeyMan August 18, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

we use static so tht there is no need to acces tht method or data thro an object..
eg. in Java,C# we use..

public static void main(String args[])
{ }

bcoz de prog is started from main, the compiler vil not create an object to access this method and from here the execution begins..

- varsha September 08, 2009 | 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