Saturday, May 28, 2011

Java vs. C++



The differences between the C++ and Java programming languages can be traced to their heritage, as they have different design goals.

C++ :-
C++ was designed for systems and applications programming, extending the C programming language. To this procedural programming language designed for efficient execution, C++ has added support for statically-typed object-oriented programming, exception handling, scoped resource management, and generic programming, in particular. It also added a standard library which includes generic containers and algorithms.

Java :-
Java was created initially as an interpreter for printing systems but grew to support network computing. Sun Microsystems used it for the basis of their "HotJava" thin client system. It relies on a virtual machine to be secure and highly portable. It is bundled with an extensive library designed to provide a complete abstraction of the underlying platform. Java is a statically-typed object-oriented language that uses a syntax similar to C++, but is not compatible with it. It was designed from scratch, with the goal of being easy to use and accessible to a wider audience.

The different goals in the development of C++ and Java resulted in different principles and design trade-offs between the languages. The differences are as follows :

Java versus C++: General programming issues

Java C++
Method bodies must be defined inside the class to
which they belong.
Method bodies must be defined inside the class to
which they belong.
No forward referencing required. Explicit forward referencing required.
No preprocessor. Heavy reliance on preprocessor.
No comma operator. Comma operator.
No variable-length parameter lists. Variable-length parameter lists.
No optional method parameters. Optional function parameters.
No const reference parameters. const reference parameters.
No goto goto
Labels on break and continue. No labels on break and continue.
Command-line arguments do not include the
program name.
Command-line arguments do not include the
program name.
Main method cannot return a value. Main function can return a value.
No global variables. Global variables.
Character escape sequences can appear in a program. Character escape sequences must appear in a string
or character literal.
Cannot mask identifiers through scope. Can mask identifiers through scope.

Java versus C++: Object-oriented programming
Java C++
Pure object-oriented language. Hybrid between procedural and object-oriented.
All functions (methods) are part of a class. Can have stand-along functions.
No multiple inheritance. Multiple inheritance.
Formal interface specifications. No formal interface specifications.
No parameterized type. Templates as parameterized type.
No operator overloading. Operator overloading.
All methods (except final methods) are dynamically
bound.
Virtual functions are dynamically bound.
Java versus C++: Primitive types
Java C++
Two type categories. Various type categories.
All nonprimitive types are objects. Separate types for structs, unions, enums, and arrays.
All numeric types are signed. Signed and unsigned numeric types.
All primitive types are a fixed size for all platforms. Primitive type size varies by platform.
16-bit Unicode characters. 8-bit ASCII characters.
Boolean data type primitive. No explicit boolean data type.
Conditions must be boolean expressions. Integer results are interpreted as boolean conditions.
Variables are automatically initialized. No automatic initialization of variables.

Java versus C++: Pointers and data structures


Java C++
References, with no explicit pointer manipulation
and no pointer arithmetic.
Pointers, with dereferencing (* or ->) and address (&)
operators.
Array references are not translated to pointer arithmetic. Array references translate to pointer arithmetic.
Arrays automatically check index limits. No automatically array bounds checking.
Array lengths in multidimensional arrays can vary
from one element to the next within one dimension.
Array lengths in multidimensional arrays are all the
same size in a give dimension, fixed by the declaration.
Strings are objects. Strings are null-terminated character arrays.
Built-in string concatenation operator(+). String concatenation through a library function.
Use string concatenation operator for long string literals. Use line continuation (\) for long string literals.
No typedef. typedef to define types.
Java versus C++: Special characteristics
Java C++
Specifically attuned to network and Web processing. No relationship to networks or the Web.
Automatic garbage collection. No automatic garbage collection.
Combination of compiled and interpreted. Compiled.
Slower execution when interpreted. Fast execution.
Architecture neutral. Architecture specific.
Supports multithreading. No multithreading.
Automatic generation of documentation in HTML
format.
No automatic documentation generation

Wednesday, May 25, 2011

One of the best interviews!!!

Interviewer: Tell me about yourself.

Candidate: I am SAMEER GUPTA. I did my Tele Communication engineering from

BabanRao Dhole-Patil Institute of Technology.

Interviewer: BabanRao Dhole-Patil Institute of Technology? I had never heard

of this college before!

Candidate: Great! Even I had not heard of it before getting an admission

into it . What happened is - due to cricket world cup I scored badly! in 12th.I

was getting a paid seat in a good college. But my father said (I prefer to

call him 'baap') - "I can not invest so much of money".(The baap actually said

- "I will never waste so much of money on you"). So I had to join this

college. Frankly speaking this name - BabanRao Dhole-Patil, can at the most be

related to a Shetakari Mahavidyalaya.

Interviewer: ok, ok. It seems you have taken 6 years to complete your

engineering.

Candidate: Actually I tried my best to finish it in 4 years. But you

know, these cricket matches and football world cup, and tennis

tournaments. It is difficult to concentrate. So I flunked in 2nd and

3rd year. So in all I took 4 + 2 = 7 years.

Interviewer: But 4+2 is 6.

Candidate: Oh, is it? You know I always had KT in maths. But I will try

to keep this in mind. 4+2 is 6, good, thanks. These cricket matches

really affect exams a lot. I think they should ban it.

Interviewer: Good to know that you want cricket matches to be banned.

Candidate: No, no... I am talking about Exams!!

Interviewer: Ok, What is your biggest achievement in life?

Candidate: Obviously, completing my Engineering. My mom never thought I

would complete it. In fact, when i flunked in 3rd year, she was looking for a job

for me in BEST (Bus corporation in Maharashtra) through some relative.

Interviewer: Do you have any plans of higher study?

Candidate: he he he.. Are you kidding? Completing 'lower' education

itself was so much of pain!!

Interviewer: Let's talk about technical stuff. On which platforms have

you worked? Candidate: Well, I work at SEEPZ, so you can say Andheri is my current

platform. Earlier I was at Vashi center. So Vashi was my platform then. As you can

see I have experience of different platforms! (Vashi and Andheri are the

places in Mumbai)

Interviewer: And which languages have you used?

Candidate: Marathi, Hindi, English. By the way, I can keep quiet in

German, French, Russian and many other languages.

Interviewer: Why VC is better than VB?

Candidate: It is a common sense - C comes after B. So VC is a higher

version than VB. I heard very soon they are coming up with a new

language VD!

Interviewer: Do you know anything about Assembly Language?

Candidate: Well, I have not heard of it. But I guess, this is the

language our ministers and MPs use in assembly.

Interviewer: What is your general project experience?

Candidate: My general experience about projects is - most of the times

they are in pipeline!

Interviewer: Can you tell me about your current job?

Candidate: Sure, Currently I am working for Bata InfoTech ltd. Since

joining BIL, I am on Bench. Before joining BIL, I used to think that

Bench was another software like Windows.

Interviewer: Do you have any project management experience?

Candidate: No, but I guess it shouldn't be difficult. I know Word and

Excel. I can talk a lot. I know how to dial for International phone call

and use speaker facility. And very important - I know few words like -

'Showstoppers ' , 'hotfixes',

'SEI-CMM','quality','versioncontrol','deadlines' , 'Customer

Satisfaction' etc. Also I can blame others for my mistakes!

Interviewer: What are your expectations from our company?

Candidate: Not much.

1. I should at least get 40,000 in hand.

2. I would like to work on a live EJB project. But it should not have

deadlines. I personally feel that pressure affects natural talent.

3. I believe in flexi-timings.

4. Dress code is against basic freedom, so I

would like to wear t-shirt and jeans.

5. We must have sat-sun off. I will suggest Wednesday off also, so as to

avoid breakdown due to overwork.

6. I would like to go abroad 3 times a year on short term

preferably 2-4 months) assignments. Personally I prefer US, Australia and

Europe. But considering the fact that there is a world cup in West Indies in

2007, I don't mind going there in that period. As you can see I am modest and

don't have many expectations. So can I assume my selection?

Interviewer: he he he ha ha ha. Thanks for your interest in our

organization. In fact I was never entertained so much before. Welcome to

INFO-SYS .. :-))

No intention to offend anybody..

Tuesday, May 10, 2011

How to Catch a LION

Newton 's Method:

Let, the lion catch you.

For every action there is an equal and opposite reaction.

Implies you caught lion.

Einstein Method:

Run in the direction opposite to that of the lion.

Due to higher relative velocity, the lion will also run faster and will get tired soon.

Now you can trap it easily.

Indian Police Method:

Catch any animal and interrogate it & torture it to accept that its a lion.

Rajnikanth Method :

Keep warning the lion that u may come and attack anytime.

The lion will live in fear and die soon in fear itself.

Jayalalitha Method:

Send Police commissioner Muthukaruppan around 2AM and kill it, while it's sleeping !

Manirathnam Method (director):

Make sure the lion does not get sun light and put the lion in a dark

room with a single candle lighted.

Keep murmuring something in its ears.

The lion will be highly irritated and commit suicide.

Karan Johar Method (director):

Send a lioness into the forest.

Our lion and lioness fall in love with each other.

Send another lioness in to the forest, followed by another lion.

First lion loves the first lioness and the second lion loves the 2nd lioness.

But 2nd lioness loves both lions.

Now send another lioness (third) into the forest.

You don't understand right... ok....read it after 15 yrs, then also u wont!

Yash Chopra method (director):

Take the lion to Australia or US.. and kill it in a good scenic location.

Govinda method:

Continuously dance before the lion for 5 or 6 days.

Menaka Gandhi method:

Save the lion from a danger and feed him with some vegetables continuously.

George bush method:

Link the lion with Osama bin laden and shoot him!!!

Rahul Dravid s method:

Ask the lion to bowl at u.

U bat for 200 balls and score 1 run

Lion tires and surrenders

And finally ..

Software Engineer Method:

Catch a cat and claim that your testing has proven that its a Lion.

If anyone comes back with issues tell that you will upgrade it to Lion.