Showing posts with label Interview. Show all posts
Showing posts with label Interview. Show all posts

Monday, October 5, 2015

Infosys Puzzles

1.There is a escalator and 2 persons move down it.A takes 50 steps and B takes 75 steps while the escalator is moving down. Given that the time taken by A to take 1 step is equal to time taken by B to take 3 steps. Find the no. of steps in the escalator while it is stationary.
100 Steps 110 Steps 120 Steps 130 Steps

2.If 5/2 artists make 5/2 paintings using 5/2 canvases in 5/2 days then how many artists r required to make 25 paintings using 25 canvases in 25 days?
25 26 27 24

3.If the digits of my present age are reversed then i get the age of my son.If 1 year ago my age was twice as that of my son.Find my present age.
Father - 72, Son - 38 Father - 71, Son - 39 Father - 73, Son - 37 Father - 73, Son - 38

4.There are 6561 balls out of them 1 is heavy. Find the minimum number of times the balls have to be weighed for finding out the heavy ball.
7 8 9 10

5.If I walk with 30 miles/hr I reach 1 hour before and if I walk with 20 miles/hr I reach 1 hour late. Find the distance between 2 points and the exact time of reaching destination is 11 am then find the speed with which it walks.
120miles and 24 miles/hr 121miles and 24 miles/hr 122 miles and 24 miles/hr 123 miles and 24 miles/hr

Monday, February 2, 2015

Campus Interview Tips

Campus Interview Tips
1. Know Thyself 

Not everyone is good in each and every field. Each one of us has our fortes and weaknesses too. But that's not a stumbling block! What we look for are people who know their area of specialization and are an expert in it. Therefore, it pays to be a master in some fields if not the jack of all.
The most common mistakes many make is to profess knowing a field of which they know little about. Remember that huge and bulky resumes are as tough to read as they are to make. So, identify your skill set, and keep your resumes simple and straight. Know your limits and polish on your strengths.

2. Testing What You Know and NOT What You Don't. 
Many interviewers may ask the student the subjects that she/he wishes to be interviewed upon. Eureka !! Here's a golden opportunity. Answer this wisely! Never end up choosing a difficult subject that you know only little about, rather choose the one you are most confident of.

3. Rack Your Brain - Analyze 

Monday, March 28, 2011

50 Common Interview Questions and Answers

1. Tell me about yourself:
The most often asked question in interviews. You need to have a short statement prepared in your mind. Be careful that it does not sound rehearsed. Limit it to work-related items unless instructed otherwise. Talk about things you have done and jobs you have held that relate to the position you are interviewing for. Start with the item farthest back and work up to the present.
2. Why did you leave your last job?
Stay positive regardless of the circumstances. Never refer to a major problem with management and never speak ill of supervisors, co- workers or the organization. If you do, you will be the one looking bad. Keep smiling and talk about leaving for a positive reason such as an opportunity, a chance to do something special or other forward- looking reasons.
3. What experience do you have in this field?
Speak about specifics that relate to the position you are applying for. If you do not have specific experience, get as close as you can.


4. Do you consider yourself successful?
You should always answer yes and briefly explain why. A good explanation is that you have set goals, and you have met some and are on track to achieve the others.
5. What do co-workers say about you?
Be prepared with a quote or two from co-workers. Either a specific statement or a paraphrase will work. Jill Clark, a co-worker at Smith Company, always said I was the hardest workers she had ever known. It is as powerful as Jill having said it at the interview herself.
6. What do you know about this organization?
This question is one reason to do some research on the organization before the interview. Find out where they have been and where they are going. What are the current issues and who are the major players?
7. What have you done to improve your knowledge in the last year?
Try to include improvement activities that relate to the job. A wide variety of activities can be mentioned as positive self-improvement. Have some good ones handy to mention.
8. Are you applying for other jobs?
Be honest but do not spend a lot of time in this area. Keep the focus on this job and what you can do for this organization. Anything else is a distraction.
9. Why do you want to work for this organization?
This may take some thought and certainly, should be based on the research you have done on the organization. Sincerity is extremely important here and will easily be sensed. Relate it to your long-term career goals.
10. Do you know anyone who works for us?
Be aware of the policy on relatives working for the organization. This can affect your answer even though they asked about friends not relatives. Be careful to mention a friend only if they are well thought of.
11. What kind of salary do you need?
A loaded question. A nasty little game that you will probably lose if you answer first. So, do not answer it. Instead, say something like, That's a tough question. Can you tell me the range for this position? In most cases, the interviewer, taken off guard, will tell you. If not, say that it can depend on the details of the job. Then give a wide range.
12. Are you a team player?
You are, of course, a team player. Be sure to have examples ready. Specifics that show you often perform for the good of the team rather than for yourself are good evidence of your team attitude. Do not brag, just say it in a matter-of-fact tone. This is a key point.
13. How long would you expect to work for us if hired?
Specifics here are not good. Something like this should work: I'd like it to be a long time. Or As long as we both feel I'm doing a good job.


14. Have you ever had to fire anyone? How did you feel about that?
This is serious. Do not make light of it or in any way seem like you like to fire people. At the same time, you will do it when it is the right thing to do. When it comes to the organization versus the individual who has created a harmful situation, you will protect the organization. Remember firing is not the same as layoff or reduction in force.


15. What is your philosophy towards work?
The interviewer is not looking for a long or flowery dissertation here. Do you have strong feelings that the job gets done? Yes. That's the type of answer that works best here. Short and positive, showing a benefit to the organization.
16. If you had enough money to retire right now, would you?
Answer yes if you would. But since you need to work, this is the type of work you prefer. Do not say yes if you do not mean it.
17. Have you ever been asked to leave a position?
If you have not, say no. If you have, be honest, brief and avoid saying negative things about the people or organization involved.
18. Explain how you would be an asset to this organization.
You should be anxious for this question. It gives you a chance to highlight your best points as they relate to the position being discussed. Give a little advance thought to this relationship.
19. Why should we hire you?
Point out how your assets meet what the organization needs. Do not mention any other candidates to make a comparison.
20. Tell me about a suggestion you have made.
Have a good one ready. Be sure and use a suggestion that was accepted and was then considered successful. One related to the type of work applied for is a real plus.
301 Smart Answers to Tough Interview Questions101 Great Answers to the Toughest Interview Questions501+ Great Interview Questions For Employers and the Best Answers for Prospective EmployeesHigh-Impact Interview Questions: 701 Behavior-Based Questions to Find the Right Person for Every Job
21. What irritates you about co-workers?
This is a trap question. Think real hard but fail to come up with anything that irritates you. A short statement that you seem to get along with folks is great.
22. What is your greatest strength?
Numerous answers are good, just stay positive. A few good examples: Your ability to prioritize, Your problem-solving skills, Your ability to work under pressure, Your ability to focus on projects, Your professional expertise, Your leadership skills, Your positive attitude
23. Tell me about your dream job.Stay away from a specific job. You cannot win. If you say the job you are contending for is it, you strain credibility. If you say another job is it, you plant the suspicion that you will be dissatisfied with this position if hired. The best is to stay genetic and say something like: A job where I love the work, like the people, can contribute and can't wait to get to work.
24. Why do you think you would do well at this job?
Give several reasons and include skills, experience and interest.


26. What kind of person would you refuse to work with?
Do not be trivial. It would take disloyalty to the organization, violence or lawbreaking to get you to object. Minor objections will label you as a whiner.


27. What is more important to you: the money or the work?
Money is always important, but the work is the most important. There is no better answer.


28. What would your previous supervisor say your strongest point is?
There are numerous good possibilities: Loyalty, Energy, Positive attitude, Leadership, Team player, Expertise, Initiative, Patience, Hard work, Creativity, Problem solver
29. Tell me about a problem you had with a supervisor.
Biggest trap of all. This is a test to see if you will speak ill of your boss. If you fall for it and tell about a problem with a former boss, you may well below the interview right there. Stay positive and develop a poor memory about any trouble with a supervisor.
30. What has disappointed you about a job?
Don't get trivial or negative. Safe areas are few but can include:Not enough of a challenge. You were laid off in a reduction Company did not win a contract, which would have given you more responsibility.
31. Tell me about your ability to work under pressure.
You may say that you thrive under certain types of pressure. Give an example that relates to the type of position applied for.
32. Do your skills match this job or another job more closely?
Probably this one. Do not give fuel to the suspicion that you may want another job more than this one.
33. What motivates you to do your best on the job?
This is a personal trait that only you can say, but good examples are: Challenge, Achievement, Recognition
34. Are you willing to work overtime? Nights? Weekends?
This is up to you. Be totally honest.
35. How would you know you were successful on this job?
Several ways are good measures:You set high standards for yourself and meet them. Your outcomes are a success.Your boss tell you that you are successful
36. Would you be willing to relocate if required?
You should be clear on this with your family prior to the interview if you think there is a chance it may come up. Do not say yes just to get the job if the real answer is no. This can create a lot of problems later on in your career. Be honest at this point and save yourself uture grief.
37. Are you willing to put the interests of the organization ahead of your own?
This is a straight loyalty and dedication question. Do not worry about the deep ethical and philosophical implications. Just say yes.
38. Describe your management style.
Try to avoid labels. Some of the more common labels, like progressive, salesman or consensus, can have several meanings or descriptions depending on which management expert you listen to. The situational style is safe, because it says you will manage according to the situation, instead of one size fits all.
39. What have you learned from mistakes on the job?
Here you have to come up with something or you strain credibility. Make it small, well intentioned mistake with a positive lesson learned. An example would be working too far ahead of colleagues on a project and thus throwing coordination off.
40. Do you have any blind spots?
Trick question. If you know about blind spots, they are no longer blind spots. Do not reveal any personal areas of concern here. Let them do their own discovery on your bad points. Do not hand it to them.


41. If you were hiring a person for this job, what would you look for?
Be careful to mention traits that are needed and that you have.
42. Do you think you are overqualified for this position?
Regardless of your qualifications, state that you are very well qualified for the position.
43. How do you propose to compensate for your lack of experience?
First, if you have experience that the interviewer does not know about, bring that up: Then, point out (if true) that you are a hard working quick learner.
44. What qualities do you look for in a boss?
Be generic and positive. Safe qualities are knowledgeable, a sense of humor, fair, loyal to subordinates and holder of high standards. All bosses think they have these traits.
45. Tell me about a time when you helped resolve a dispute between others.
Pick a specific incident. Concentrate on your problem solving technique and not the dispute you settled.
46. What position do you prefer on a team working on a project?
Be honest. If you are comfortable in different roles, point that out.


47. Describe your work ethic.
Emphasize benefits to the organization. Things like, determination to get the job done and work hard but enjoy your work are good.
48. What has been your biggest professional disappointment?
Be sure that you refer to something that was beyond your control. Show acceptance and no negative feelings.
49. Tell me about the most fun you have had on the job.
Talk about having fun by accomplishing something for the organization.
50. Do you have any questions for me?
Always have some questions prepared. Questions prepared where you will be an asset to the organization are good. How soon will I be able to be productive? and What type of projects will I be able to assist on? are examples.
201 Knockout Answers to Tough Interview Questions: The Ultimate Guide to Handling the New Competency-Based Interview StyleThe Behavioral Based Interview & Common Behavioral Based Interview Questions



Tuesday, March 22, 2011

TIPS FOR DESIGNING AN EFFECTIVE RESUME

Curriculum-Vitae’ (C.V for short) is a brief account of your personal details, educational and professional qualifications and the jobs you have held. T is a British expression. The American term for the same is ‘Resume’.
What should a C.V Do?
-    It must highlight your potential and value to an employer.
-   Provide a framework with which an interview can be designed.
-    Provide a vivid account of your achievements as a student and as a professional along with the skills you would bring to an organization, in case you are hired.
-    Although a C.V never ensures an employment, it should at least arouse the employer’s interest and get you an interview call.
Charlie Rose (June 11, 2008)Charlie Rose -Interview Magazine Celebrates Andy Warhol / Tom Wolfe (June 11, 2008)Interview Magazine November 2005 Scarlett JohanssonMike Myers Autographed/Hand Signed Authentic Interview Magazine PSA/DNAThe Miles Davis Reader - Interviews and Features from DownBeat Magazine

Lay out of a C.V
An effective C.V should be visually appealing. That means it should appear neat and orderly. It should beclear, concise and easy to read. The way, in which the information is presented on paper, goes a long way in creating a favorable first impression.
Things to Remember
1. Make sure that you use very good quality paper for your C.V and the covering letter that goes with it.
2. Leave clear margins and be consistent while presenting your information.
3. It should be typed neatly.
4.  Be brief and to the point. Do not use ‘ten’ words where ‘five’ will do. However substance should not be sacrificed for the sake of ‘brevity’. Right attributes and achievements should be mentioned and emphasized properly. It is important to present yourself as a valuable candidate for the job advertised.
5. It is advisable to show the finished product to someone well meaning and knowledgeable. Be prepared to incorporate suggestions and changes if they enhance the quality of your C.V.
6. Never give false information.
7.  It is of utmost importance to understand the job requirements and your suitability for the post.
8. Highlight areas, where you can contribute fruitfully and effectively, rather than harping on your aspirations.
Key Components of a C.V
National GeographicCosmopolitan (1-year auto-renewal)Marie Claire (1-year auto-renewal)Maxim (1-year auto-renewal)



Given below are the main constituents of a Resume.
The Information given hereunder need not appear in the same order. Freshers and students may use the same sequence but working professionals may rearrange it to suit their preference and requirements.
1. Personal Details
•    Full Name
•    Age/Date of Birth
•    Place of Birth
•    Sex/Gender  (Male/Female)
•    Address for Correspondence
•    Telephone Numbers (Landline/Mobile)
•    Nationality (In case of overseas employment)
•    Passport Number.               –Do-
•    Driving License Number
•    Health (Unless some serious ailment, it should be stated as sound/excellent)
•    Personal Hobbies and Interests
•    Preferred Location
2. Educational and Professional Qualifications
Note: – You may mention here your professional qualifications or your occupation. For example: Computer Engineer, Law Graduate, Chartered Accountant etc.
Educational qualifications can be mentioned in the form of a table given below: -
Examination         Year    University    Percentage    Class/Div.
It may be written in the descending order, i.e. from the highest degree to the S.S.C examination or in the ascending order, i.e. beginning from the secondary education to the highest qualification acquired by you. Below secondary level education is not to be mentioned.
Any additional training, diplomas and special courses undertaken must find place after the main educational details have been given.


3. Career History
It is the most crucial information for the employer. If you are already employed or are looking for a change, you must provide information regarding the jobs you have held. Your present assignment, the work experience you have gathered, the responsibilities you have shouldered and the skills developed during the work span, all have to be mentioned here. You may have the best of qualifications but your hands on experience in the relevant field are of greater value to the employer.
Success Magazine Investor Education: The 5-Step Online Investing Formula (Book, dvds, magazine)The FreemanInstructor Magazine (1-year auto-renewal)Absolutely MAD Magazine - 50+ Years

POINTS TO REMEMBER
1. You should always catalog your jobs in the reverse order. Begin with your present employment or the most recent one, as it is of greatest interest to the prospective employer.
2.  Avoid the use of first person, if possible.
•    Work experience described under headings such as:
•    Period  ——–From——-To—–
•    Employer——Name of the Organization
•    Designation————–
•    Reporting To——-Name of the immediate Boss—-
And a Work Profile given as mentioned below: -
•    To assist the Departmental Head
•    Time to time maintenance of electrical machines
•    Trouble-shooting problems arising in the shop floor machines etc.
Is not only more appealing; it gives a clear idea of the person’s work and responsibilities at a quick glance.
3. The information should be so organized in this section that it gives a clear idea of your strengths to the prospective employer.
4. In case you have undertaken a number of similar jobs, enlist them under one section, if possible.
5.  Salary: – It is advisable not to mention salary at this point. At most an expected salary range can be mentioned.
6. References – These must be provided if asked by the employer. But you must seek permission from the persons whose names have been given as referees.
A Squid's Story My First Four Years in the United States NavyBlack UNITED STATES NAVY Eagle T-Shirt 80315 Size X-LargeThree Hit AlbumsAnchor Aweigh Marines Hymn- Can Also Be Used As Ringtone

CONCLUSION
Suggested above is the basic structure of curriculum vitae. There can be several variants of the above-mentioned information. One may reorganize various headings, choosing to begin with very little personal details and devoting more space to the career history and educational qualifications, one’s career objectives, work ethics, specialized skills etc.
Actually for an experienced professional these elements should be highlighted and mentioned first of all, immediately after ‘The Name of the Person’. Other details can be given in the end.
If you are a fresher and have no work experience to mention, then lay emphasis on your educational qualifications or any other achievements during the school and campus life.
The idea is, to present a well-rounded picture of yourself and the valuable differences you can make to the organization, you seek to join.

Saturday, March 19, 2011

C Interview Question



How can you determine the size of an allocated portion of memory?
You can’t, really. free() can , but there’s no way for your program to know the trick free() uses. Even if you disassemble the library and discover the trick, there’s no guarantee the trick won’t change with the next release of the compiler.


Can static variables be declared in a header file?
You can’t declare a static variable without defining it as well (this is because the storage class modifiers static and extern are mutually exclusive). A static variable can be defined in a header file, but this would cause each source file that included the header file to have its own private copy of the variable, which is probably not what was intended.



Can a variable be both const and volatile?
Yes. The const modifier means that this code cannot change the value of the variable, but that does not mean that the value cannot be changed by means outside this code. For instance, in the example in FAQ 8, the timer structure was accessed through a volatile const pointer. The function itself did not change the value of the timer, so it was declared const. However, the value was changed by hardware on the computer, so it was declared volatile. If a variable is both const and volatile, the two modifiers can appear in either order.


Can include files be nested?
Yes. Include files can be nested any number of times. As long as you use precautionary measures , you can avoid including the same file twice. In the past, nesting header files was seen as bad programming practice, because it complicates the dependency tracking function of the MAKE program and thus slows down compilation. Many of today’s popular compilers make up for this difficulty by implementing a concept called precompiled headers, in which all headers and associated dependencies are stored in a precompiled state.
Many programmers like to create a custom header file that has #include statements for every header needed for each module. This is perfectly acceptable and can help avoid potential problems relating to #include files, such as accidentally omitting an #include file in a module.


When does the compiler not implicitly generate the address of the first element of an array?
Whenever an array name appears in an expression such as
- array as an operand of the sizeof operator
- array as an operand of & operator
- array as a string literal initializer for a character array
Then the compiler does not implicitly generate the address of the address of the first element of an array.


What is a null pointer?

There are times when it’s necessary to have a pointer that doesn’t point to anything. The macro NULL, defined in , has a value that’s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.
The null pointer is used in three ways:
1) To stop indirection in a recursive data structure
2) As an error value
3) As a sentinel value

What is the difference between text and binary modes? 
Streams can be classified into two types: text streams and binary streams. Text streams are interpreted, with a maximum length of 255 characters. With text streams, carriage return/line feed combinations are translated to the newline n character and vice versa.
 Binary streams are uninterrupted and are treated one byte at a time with no translation of characters. Typically, a text stream would be used for reading and writing standard text files, printing output to the screen or printer, or receiving input from the keyboard.
A binary text stream would typically be used for reading and writing binary files such as graphics or word processing documents, reading mouse input, or reading and writing to the modem.

What is static memory allocation and dynamic memory allocation?
Static memory allocation: The compiler allocates the required memory space for a declared variable.By using the address of operator,the reserved address is obtained and this address may be assigned to a pointer variable.Since most of the declared variable have static memory,this way of assigning pointer value to a pointer variable is known as static memory allocation. memory is assigned during
compilation time. Dynamic memory allocation: It uses functions such as malloc( ) or calloc( ) to get memory dynamically.If these functions are used to get memory dynamically and the values returned by these functions are assingned to pointer variables, such assignments are known as dynamic memory allocation.memory is assined during run time.


When should a far pointer be used?
Sometimes you can get away with using a small memory model in most of a given program. There might be just a few things that don’t fit in your small data and code segments. When that happens, you can use explicit far pointers and function declarations to get at the rest of memory. A far function can be outside the 64KB segment most functions are shoehorned into for a small-code model. (Often, libraries are declared explicitly far, so they’ll work no matter what code model the program uses.) A far pointer can refer to information outside the 64KB data segment. Typically, such pointers are used with farmalloc() and such, to manage a heap separate from where all the rest of the data lives. If you use a small-data, large-code model, you should

explicitly make your function pointers far.


How are pointer variables initialized?
Pointer variable are initialized by one of the following two ways
- Static memory allocation
- Dynamic memory allocation

Difference between arrays and pointers?
- Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by them
- Arrays use subscripted variables to access and manipulate data. Array variables can be equivalently written using pointer expression.


Is using exit() the same as using return?
No. The exit() function is used to exit your program and return control to the operating system. The return statement is used to return from a function and return control to the calling function. If you issue a return
from the main() function, you are essentially returning control to the calling function, which is the operating system. In this case, the return statement and exit() function are similar.


What is a method?
Method is a way of doing something, especially a systematic way; implies an orderly logical arrangement (usually in steps).


What is indirection?
If you declare a variable, its name is a direct reference to its value. If you have a pointer to a variable, or any other object in memory, you have an indirect reference to its value.


What is modular programming?
If a program is large, it is subdivided into a number of smaller programs that are called modules or subprograms. If a complex problem is solved using more modules, this approach is known as modular programming.


How many levels deep can include files be nested?
Even though there is no limit to the number of levels of nested include files you can have, your compiler might run out of stack space while trying to include an inordinately high number of files. This number varies according to your hardware configuration and possibly your compiler.


What is the difference between declaring a variable and defining a variable?
Declaring a variable means describing its type to the compiler but not allocating any space for it. Defining a variable means declaring it and also allocating space to hold the variable. You can also initialize a variable at the time it is defined.


What is an lvalue?
An lvalue is an expression to which a value can be assigned. The lvalue expression is located on the left side of an assignment statement, whereas an rvalue is located on the right side of an assignment statement. Each assignment statement must have an lvalue and an rvalue. The lvalue expression must reference a storable variable in memory. It cannot be a constant.


Differentiate between an internal static and external static variable?
An internal static variable is declared inside a block with static storage class whereas an external static variable is declared outside all the blocks in a file.An internal static variable has persistent storage,block
scope and no linkage.An external static variable has permanent storage,file scope and internal linkage.

C interview Questions

"union" Data Type What is the output of the following program? Why?
#include
main() {
typedef union {
int a;
char b[10];
float c;
}
Union;
Union x,y = {100};
x.a = 50;
strcpy(x.b,"hello");
x.c = 21.50;
printf("Union x : %d %s %f n",x.a,x.b,x.c);
printf("Union y : %d %s %f n",y.a,y.b,y.c);
}


What does static variable mean?
there are 3 main uses for the static.
1. If you declare within a function: It retains the value between function calls
2.If it is declared for a function name: By default function is extern..so it will be visible from other files if the
function declaration is as static..it is invisible for the outer files
3. Static for global variables: By default we can use the global variables from outside files If it is static global..that variable is limited to with in the file


Advantages of a macro over a function?
Macro gets to see the Compilation environment, so it can expand __ __TIME__ __FILE__ #defines. It is expanded by the preprocessor.
For example, you can’t do this without macros
#define PRINT(EXPR) printf( #EXPR “=%d\n”, EXPR)
PRINT( 5+6*7 ) // expands into printf(”5+6*7=%d”, 5+6*7 );


You can define your mini language with macros:
#define strequal(A,B) (!strcmp(A,B))
Macros are a necessary evils of life. The purists don’t like them, but without it no real work gets done.


For example, you can’t do this without macros
#define PRINT(EXPR) printf( #EXPR “=%d\n”, EXPR)
PRINT( 5+6*7 ) // expands into printf(”5+6*7=%d”, 5+6*7 );
You can define your mini language with macros:
#define strequal(A,B) (!strcmp(A,B))
Macros are a necessary evils of life. The purists don’t like them, but
without it no real work gets done.


What are the differences between malloc() and calloc()?
There are 2 differences. First, is in the number of arguments. malloc() takes a single argument(memory required in bytes), while calloc() needs 2 arguments(number of variables to allocate memory, size in bytes of a
single variable). Secondly, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.


What are the different storage classes in C?
C has three types of storage: automatic, static and allocated. Variable having block scope and without static specifier have automatic storage duration. Variables with block scope, and with static specifier have static scope. Global variables (i.e, file scope) with or without the static specifier also have static scope. Memory obtained from calls to malloc(), alloc() or realloc() belongs to allocated storage class.


What is the difference between strings and character arrays?
A major difference is: string will have static storage duration, whereas as a character array will not, unless it is explicity specified by using the static keyword.


Actually, a string is a character array with following properties:

* the multibyte character sequence, to which we generally call string, is used to initialize an array of static storage duration. The size of this array is just sufficient to contain these characters plus the terminating
NUL character.
* it not specified what happens if this array, i.e., string, is modified.
* Two strings of same value[1] may share same memory area. For example, in the following declarations:
char *s1 = “Calvin and Hobbes”;
char *s2 = “Calvin and Hobbes”;
the strings pointed by s1 and s2 may reside in the same memory location. But, it is not true for the following:
char ca1[] = “Calvin and Hobbes”;
char ca2[] = “Calvin and Hobbes”;
[1] The value of a string is the sequence of the values of the contained characters, in order.


Difference between const char* p and char const* p
In const char* p, the character pointed by ‘p’ is constant, so u cant change the value of character pointed by p but u can make ‘p’ refer to some other location. in char const* p, the ptr ‘p’ is constant not the character referenced by it, so u cant make ‘p’ to reference to any other location but u can change the value of the char pointed by ‘p’.


What is hashing?
To hash means to grind up, and that’s essentially what hashing is all about. The heart of a hashing algorithm is a hash function that takes your nice, neat data and grinds it into some random-looking integer. The idea behind hashing is that some data either has no inherent ordering (such as images) or is expensive to compare (such as images). If the data has no inherent ordering, you can’t perform comparison searches.

If the data is expensive to compare, the number of comparisons used even by a binary search might be too many. So instead of looking at the data themselves, you’ll condense (hash) the data to an integer (its hash value) and keep all the data with the same hash value in the same place. This task is carried out by using the hash value as an index into an array.


To search for an item, you simply hash it and look at all the data whose hash values match that of the data you’re looking for. This technique greatly lessens the number of items you have to look at. If the parameters are set up with care and enough storage is available for the hash table, the number of comparisons needed to find an item can be made arbitrarily close to one.

One aspect that affects the efficiency of a hashing implementation is the hash function itself. It should ideally distribute data randomly throughout the entire hash table, to reduce the likelihood of collisions. Collisions occur when two different keys have the same hash value. There are two ways to resolve this problem. In open addressing, the collision is resolved by the choosing of another position in the hash table for the element inserted later. When the hash table is searched, if the entry is not found at its hashed position in the table, the search continues checking until either the element is found or an empty position in the table is found. The second method of resolving a hash collision is called chaining. In this method, a bucket or linked list holds all the elements whose keys hash to the same value. When the hash table is searched, the list must
be searched linearly.