Thursday, 3 November 2011

Predict the output or error(s) for the following:

class Sample

{

public:

int *ptr;

Sample(int i)

{


        ptr = new int(i);


        }

~Sample()

{


        delete ptr;


        }

void PrintVal()

{


        cout << "The value is " << *ptr;


        }

};

void SomeFunc(Sample x)

{

cout << "Say i am in someFunc " << endl;


}

int main()

{

Sample s1= 10;


SomeFunc(s1);


s1.PrintVal();


}

Answer:

Say i am in someFunc


Null pointer assignment(Run-time error)


Explanation:

Wednesday, 2 November 2011

Sun Certified Java Programmer (SCJP)-6

Flow control statements


The flow control statements allow you to conditionally execute statements, to repeatedly execute a block of statements, or to just change the sequential flow of control.

if/else statement


The if/else statement is used for decision-making -- that is, it decides which course of action needs to be taken. The syntax is:

if(boolean expression)
{

Tuesday, 1 November 2011

What is CODE Access security?

CAS is part of .NET security model that determines whether or not a piece of code is allowed to run and what resources it can use while running. Example CAS will allow an application to read but not to write and delete a file or a resource from a folder.

What is the difference between System exceptions and Application exceptions?

All exception derives from Exception Base class. Exceptions can be generated programmatically or can be generated by system. Application Exception serves as the base class for all applicationspecific exception classes. It derives from Exception but does not provide any extended functionality. You should derive your

What is the difference between VB.NET and C# ?

Well this is the most debatable issue in .NET community and people treat there languages like religion. Its a subjective matter which language is best. Some like VB.NET’s natural style and some like professional and terse C# syntaxes. Both use the same framework and speed is also very much equivalents. But still let’s list down some major differences between them :-

Advantages of VB.NET :-

  • Has support for optional parameters which makes COM

What is concept of Boxing and Unboxing ?

Boxing permits any value type to be implicitly converted to type object or to any interface type implemented by value type. Boxing is a process in which object instances are created and copy values into that instance.

Unboxing is vice versa of boxing operation where the value is copied

What are Value types and Reference types ?

Value types directly contain their data which are either allocated on the stack or allocated in-line in a structure.

Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types.

Variables that are value types each have their own copy of the data,