conceptnova

Helping you to bring your concepts and ideas to life.

Common Interview Questions

1. Tell me about yourself.
Keep your answer short and focused on your professional life. This is not the time to bring up relationships, childhood experiences, family etc. A brief history of education, career and special interests is what is called for here. End it with why you are interested in this particular job.

2. Why are you applying for this particular job?
Show interest and demonstrate that you have researched the job and know what you are getting into. Bring up evidence from past work/ studies that supports your interest in this role and any skills you have acquired in preparation for the role. You can say something like 'I would like to work for a leader in innovative network and telecommunications solutions and my college degree in computational mathematics has given me a solid background for this role. Mention the value-added you can bring to the job.

3. What do you know about our company?
Indicate what you have learnt from your research activities - from their annual reports,
newspapers, word of mouth, other employees etc. Use this to flatter them and show that you have done your homework.

4. What makes you qualified for this particular job?
Again, explain that you are very interested in the job and demonstrate what it is about your past experiences, education and qualifications that makes you ideal for the job. Show enthusiasm and support your answers with evidence wherever you can (eg. my summer internship at Citibank gave me broad exposure to the area of equity analysis and I think I can apply many of the tools I learnt there in this job). Elaborate on all the past experiences and skill sets that make you suitable for the job. In cases where your past experience is not directly relevant, you can still find elements of it that can be useful. Play up team skills, computer skills, leadership roles, specific courses and independent research activities that can be useful to the job at hand to show your initiative even where you don't have directly relevant job experience.

5. What can you do for us that someone else can't?
Demonstrate key strengths, skills and personal characteristics.

6. Why should we hire you?
See 3. Because you have all the experience/ traits/ credentials demonstrated in 3 and in addition to being qualified, you are enthusiastic, intelligent, hardworking, flexible and willing to learn. Also mention any key relationships you may have that may assist you in the job.

7. What do you look for in a job?
Be honest. Also mention keywords such as challenging, steep learning curve, good work culture, demanding, rewarding, opportunities for advancement and growth, team environment, opportunity to build and maintain client relationships etc.

8. Why are you looking to make a career change?
Mention your interests and make sure you bring up all skills/ experience however insignificant that can support your move in this new direction. It is quite common in this day and age to make a career switch. You need however to show that you have very carefully thought about the change, have a strong interest in the new career and can use some of your previous skills/ education/ relationships to make that move.


9. Why did you leave your last job?
Do NOT use this as an opportunity to badmouth past employers or peers or talk about a failure of any sort. Any of these answers are acceptable: you were looking for a new challenge, your learning curve had flattened out in the previous job and you were looking for a new learning opportunity, the company or department were restructuring, you were ready to start something new after achieving your career goals at the previous company etc.

10. Why do you want to work for us (as opposed to the competitor companies)?
Demonstrate that you know something about the company, that you believe they are leaders/ innovators in what they do, or you think their work culture is exactly what you are looking for, or you like their product(s) or you have friends who work there and have always been attracted to the company etc. Flatter the company and show you know something about it.

11. How long will it take you to start making a meaningful contribution?
Show that you are enthusiastic and willing to learn and will put in all the hours and effort necessary to learn the ropes and start making an immediate contribution. Indicate that your past experiences/ skills/ credentials will enable you to make an immediate contribution at some level while you quickly learn all new aspects of the job. An Interviewer wants someone who is willing and able to learn and will make a return on his investment sooner rather than later.

12. What are your strengths?
See 14 below. In addition, keywords such as good teamplayer, work very well under pressure, very creative, very strong quantitative or computer skills, and very strong client relationship skills may be appropriate depending on your chosen field.

13. What are your weaknesses?
Do NOT mention key weaknesses here. This is not the place to say you are bad at meeting deadlines or you never mastered highschool mathematics etc. Turn this question around to your benefit. For example, you are 'overambitious' or 'extremely attentive to detail' or 'like to take on too many projects'. Make it sound positive.

14. What are your career goals?
Show you have thought forward and are committed to your career.

15. How would you describe yourself?
Any of these are good examples of attributes employers are looking for: intelligent, hardworking, quick to learn, enthusiastic, honest, efficient, productive, ambitious, successful, compassionate (in the medical fields).

16. How would your colleagues describe you?
Do not bring up anything negative here.

17. How would your boss describe you?
They will check references anyways so bring up the most positive attribute you can think of about yourself eg hardworking, honest etc. and leave it to your Boss to say anything to the contrary.

18. What did you most like/ dislike about your past job?
Do not use this to badmouth past jobs/ employers. Keep it light and in your favour eg I outgrew the job, there wasn't a clear career progression, I wasn't learning anything new etc. Ideally, you will have loved your last job and would like to achieve the same kind of success and job satisfaction in a more challenging area as you have now 'outgrown' that job and are ready for 'new challenges'.

19. Describe a situation in your past where you showed initiative?
You could describe any new methods you came up with to do your job or to save money for the company or to turn around a bad situation. It can be something as simple as changing a filing system, or establishing a relationship with a vendor that saved your department a lot of money. If you are in sales, you may want to talk about how you brought in that big account. Creatives may talk about how they came up with that cutthroat image or design that brought in the business.

20. What were your main responsibilities in your last job?
Have these ready and list them all. Dwell on the ones that are most relevant to the new job. This answer should be smooth and practiced.

21. What do you consider your greatest accomplishments?
Many of us have one or two milestones in our career that we are very proud of eg. that early promotion, that 'huge' deal we brought in, the design we came up with, the costs we saved, the revenues we increased, the people we trained, a new invention or process we came up with etc.
Examples of accomplishments may be: 'Reduced costs by X%; or renamed and repositioned a product at the end of its lifecycle, or organized and led a team to do do XYZ, or achieved sales increase of
X% etc. If you are a fresh college graduate, talk about extracurricular activities, leadership roles and grades.

22. Describe your management style (if relevant)
No answer

23. Do you work better in teams or independently?
Show that you are a proactive teamplayer and like to bounce ideas off others and get input; however you are very capable of working independently (give examples).

24. How do you work under pressure?
Well. Give evidence.

25. What other jobs have you applied for?
Don't mention jobs in different career directions (eg advertising and investment banking). Do however bring up any other offers or Interviews from competing firms.

26. How did you do in college?
Keep it positive. It's okay to say you were very busy making the most of college and were very involved in sports, activities, social life etc. Employers want human beings not robots. Mention the areas you did very well in even if it was just one or two courses you excelled in. They will check for themselves.

27. What kind of hours would you like to work?
Employers want to see flexibility. Indicate you are willing to put in whatever hours are necessary to finish the job. Do however mention any constraints you have eg. you would like to be home to pick your kids up from school at 3:30. Most employers are willing to work around your constraints if you show flexibility on your side as well.

28. Do you have any questions for me?
YES you do. Questions engage the Interviewer and show your interest. Ask questions that show you know something about the company or the job, that you are planning ahead, that you are anxious and willing to learn the ropes and that you are committed to the position. See Questions to Ask the




"Tell me about yourself."

And if you're not prepared to answer it clearly and briefly, it may be the end of your chance to get the job.

"The question is very common and employers can ask it in various different ways, but it's still the same question," said John Karras, director of career services for Keller Graduate School of Management of DeVry University, headquartered in Oakbrook Terrace, Ill.

"They might ask, why should I hire you rather than the next candidate I talk to? And what they're really saying is, I'm going to give you a little bit of time to tell me anything you want."

Karras, who has a bachelor's and master's degree in organizational communication and has been at DeVry since 1989, acknowledges that most job candidates hate this question, but it's really a friendly one: "They're allowing you to say anything you want - and I would love that opportunity in a job interview."

The career counselor, who previously was director of a state-funded dislocated worker program and also was an executive recruiter, emphasizes that you should be able to answer the question in "30 to 60 seconds."

In that time frame, he adds, you have to "concisely convey your interests, abilities, character, personality and what you're looking for."

When Karras coaches job applicants to prepare for that moment, he encourages them to use that short time to emphasize their "soft skills" in their brief opening statement. "List your personal points of marketability, your organizational and leadership skills, your dependability and flexibility - you as a person, rather than your job experience," he said.

But what will separate you from the others, the director adds, is "proof that you indeed have the skills. The proof will get you the job.

"If you say you have excellent time management skills, your next words should be: For example, I held a part-time job while taking college courses."

Ascertaining your soft skills is a necessary step to take so that you can use the time you have to your advantage. "Think back on your life experiences," advised Karras. "Do a brainstorming exercise and pinpoint your personal points of marketability."


If you're applying for a sales position, the director suggests the one soft skill you most likely would want to emphasize is your communication skill; an accounting job, that you are analytical and detail-oriented; and for most entry-level jobs, that you are absolutely dependable.

"Just give the top one or two skills in your reply - you can get to the others in the rest of the job interview," he said. "Know going in which they are."

When Karras was interviewed for his job at DeVry, the first question he was asked was, `What's your story?' "I said I have excellent time management skills and gave examples," he said. "And then I was given time to talk about the other soft skills I had listed. By the time I was done, I was sent to the next level. And got the job."

Here are some suggestions I have about what to say in that less than one-minute window of opportunity:

"I am kind to my parents."

"My dog loves me."

"I donate blood."

"I help people across the street."

And most important of all: "I'm someone who really needs a job!"

---
Sending u some of the basic questions which i perpared for my interview...just sit and think about them as technical interview is imp but still some how we ten to neglect the hr interview which is equally imp ...

cheers

It is not enough to have solid answers only for the above questions. You need to be prepared for the full spectrum of questions that may be presented. For further practice, make sure you go through the required mock interview (see the "Competitive Interview Prep" Section) and for further review, look at some of the following questions:

Tell me about yourself.
What do you want to do with your life?
Do you have any actual work experience?
How would you describe your ideal job?
Why did you choose this career?
When did you decide on this career?
What goals do you have in your career?
How do you plan to achieve these goals?
How do you evaluate success?
Describe a situation in which you were successful.
What do you think it takes to be successful in this career?
What accomplishments have given you the most satisfaction in your life?
If you had to live your life over again, what would you change?
Would your rather work with information or with people?
Are you a team player?
What motivates you?
Why should I hire you?
Are you a goal-oriented person?
Tell me about some of your recent goals and what you did to achieve them.
What are your short-term goals?
What is your long-range objective?
What do you see yourself doing five years from now?
Where do you want to be ten years from now?
Do you handle conflict well?
Have you ever had a conflict with a boss or professor? How did you resolve it?
What major problem have you had to deal with recently?
Do you handle pressure well?
What is your greatest strength?
What is your greatest weakness?
If I were to ask one of your professors to describe you, what would he or she say?
Why did you choose to attend your college?
What changes would you make at your college?
How has your education prepared you for your career?
What were your favorite classes? Why?
Do you enjoy doing independent research?
Who were your favorite professors? Why?
Why is your GPA not higher?
Do you have any plans for further education?
How much training do you think you'll need to become a productive employee?
What qualities do you feel a successful manager should have?
Why do you want to work in the _____ industry?
What do you know about our company?
Why are you interested in our company?
Do you have any location preferences?
How familiar are you with the community that we're located in?
Will you relocate? In the future?
Are you willing to travel? How much?
Is money important to you?
How much money do you need to make to be happy?
What kind of salary are you looking for?

Don't just read these questions--practice and rehearse the answers. Don't let the company interview be the first time you have actually formulated an answer in spoken words. It is not enough to think about them in your head--practice! Sit down with a friend, a significant other, or your roommate (an especially effective critic, given the amount of preparation to date) and go through all of the questions. Make the most of every single interview opportunity by being fully prepared!

Top Ten Critical Success Factors


With all the different questions being referenced, you may wonder what exactly the employer is looking for. And I will tell you. Following is the list of the top ten critical success factors that nearly every employer is seeking:

Positive attitude toward work
Proficiency in field of study
Communication skills (oral and written)
Interpersonal skills
Confidence
Critical thinking and problem solving skills
Flexibility
Self-motivation
Leadership
Teamwork

Show your competence in as many of the above critical success factors as possible and you will rise above the competition.

these questions are send to us by one of our friend megha

to learn more join today

your own savdeshi group

http://groups.yahoo.com/group/savdesh



www.brainbench.com (Free online C test)
www.findyourspot.com (aptitude test papers)
www.tektipsforum.com (u have to register to this site for help, it is a forum )
www.assesment.com (self test papers aptitude test maths)
www.tutorials.com (All subjects tutorials)
www.aspfree.com (asp free tutorials)
www.beginners.co.uk (for jobs,tutorials)
www.puzz.com (for puzzles)
www.planetfreshers.tk (freshers' stuff)
www.intelinfo.com (hunt for free tech books)
www.discoveryvip.com (its worth lookin at)
www.laynetworks.com (free computer science tutorials)
www.c4swimmers.esmartguy.com ( C freaks....its a go thru fire test for u)
www.aucse.com (job opportunities n papers)
www.magicalmethods.com (to hone ur calculating speed)
www.brainflower.com ( its awesome)
www.halfbakery.com (kool one)
www.allexperts.com (check it out)
www.timescomputing.com (great stuff for techies)
www.tangram.i-p.com (fantastic puzzles based on applets)
www.onesmartclick.com ( invaluable)
www.benchmarksglobal.com
www.talentedtechies.com (u got it right...)
www.nasscom.org (it'l help u to get a knowhow on IT trends)
www.vengy.com (papers n stuffs for freshers)
www.testpapers.tk (papers)
www.vyomworld.com( check out for job opportunities)
www.jobassist.com ( again for jobseekers)
www.ittestpapers.com
www.todaysfresher.com



-----------------------------------------------------------------------

Wish everyone a successful career !

Best,


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 future 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.

HR questions

Why do you enjoy working for this company?
What attracted you to this organization?
Can you describe the work environment here?
How do you describe the philosophy of the company or organization?
What do you consider to be the organization’s strengths and weaknesses?
Can you tell me more about my day-to-day responsibilities?
How soon are you looking to fill this position?
How do my skills compare with those of the other candidates you have interviewed?
I have really enjoyed meeting with you and your team, and I am very interested in the opportunity. I feel my skills and experience would be a good match for this position. What is the next step in your interview process?
Before I leave, is there anything else you need to know concerning my ability to do this job?
In your opinion, what is the most important contribution that this company expects from its employees?
Is there a structured career path at the company?
What are my prospects for advancement? If I do a good job, what is a logical next step?
Assuming I was hired and performed well for a period of time, what additional opportunities might this job lead to?
Do the most successful people in the company tend to come from one area of the company, such as sales or engineering, or do they rise from a cross section of functional areas?
I know that for the position for which I am interviewing, the company decided to recruit from outside the organization. How do you decide between recruiting from within and going outside?
How does this position relate to the bottom line?
What advice would you give to someone in my position?
What major problems are we facing right now in this department or position?
Can you give me a formal, written description of the position? I’m interested in reviewing in detail the major activities involved and what results are expected.
Does this job usually lead to other positions in the company? Which ones?
Can you please tell me a little bit about the people with whom I’ll be working most closely?
As I understand the position, the title as ________, the duties are _______, and the department is called ________. I would report directly to __________. Is that right?
Can you talk about the company’s commitment to equal opportunity and diversity?
Who are the company’s stars, and how was their status determined?
How are executives addressed by their subordinates?
What can you tell me about the prevailing management style?
If you hired me, what would be my first assignment?
Does the company have a mission statement? May I see iDoes the company have a mission statement? May I see it?

Networking concepts

What are the two types of transmission technology available?
(i) Broadcast and (ii) point-to-point

What is subnet?
A generic term for section of a large networks usually separated by a bridge or router.

Difference between the communication and transmission.
Transmission is a physical movement of information and concern issues like bit polarity, synchronisation, clock etc.
Communication means the meaning full exchange of information between two communication media.

What are the possible ways of data exchange?
(i) Simplex (ii) Half-duplex (iii) Full-duplex.

What is SAP?
Series of interface points that allow other computers to communicate with the other layers of network protocol stack.

What do you meant by "triple X" in Networks?
The function of PAD (Packet Assembler Disassembler) is described in a document known as X.3. The standard protocol has been defined between the terminal and the PAD, called X.28; another standard protocol exists between hte PAD and the network, called X.29. Together, these three recommendations are often called "triple X"

What is frame relay, in which layer it comes?
Frame relay is a packet switching technology. It will operate in the data link layer.

What is terminal emulation, in which layer it comes?
Telnet is also called as terminal emulation. It belongs to application layer.

What is Beaconing?
The process that allows a network to self-repair networks problems. The stations on the network notify the other stations on the ring when they are not receiving the transmissions. Beaconing is used in Token ring and FDDI networks.

What is redirector?
Redirector is software that intercepts file or prints I/O requests and translates them into network requests. This comes under presentation layer.

What is NETBIOS and NETBEUI?
NETBIOS is a programming interface that allows I/O requests to be sent to and received from a remote computer and it hides the networking hardware from applications.
NETBEUI is NetBIOS extended user interface. A transport protocol designed by microsoft and IBM for the use on small subnets.

What is RAID?
A method for providing fault tolerance by using multiple hard disk drives.

What is passive topology?
When the computers on the network simply listen and receive the signal, they are referred to as passive because they don’t amplify the signal in any way. Example for passive topology - linear bus.

What is Brouter?
Hybrid devices that combine the features of both bridges and routers.

What is cladding?
A layer of a glass surrounding the center fiber of glass inside a fiber-optic cable.

What is point-to-point protocol
A communications protocol used to connect computers to remote networking services including Internet service providers.

How Gateway is different from Routers?
A gateway operates at the upper levels of the OSI model and translates information between two completely different network architectures or data formats

What is attenuation?
The degeneration of a signal over distance on a network cable is called attenuation.

What is MAC address?
The address for a device as it is identified at the Media Access Control (MAC) layer in the network architecture. MAC address is usually stored in ROM on the network adapter card and is unique.

Difference between bit rate and baud rate.
Bit rate is the number of bits transmitted during one second whereas baud rate refers to the number of signal units per second that are required to represent those bits.
baud rate = bit rate / N
where N is no-of-bits represented by each signal shift.

What is Bandwidth?
Every line has an upper limit and a lower limit on the frequency of signals it can carry. This limited range is called the bandwidth.

What are the types of Transmission media?
Signals are usually transmitted over some transmission media that are broadly classified in to two categories.
Guided Media:
These are those that provide a conduit from one device to another that include twisted-pair, coaxial cable and fiber-optic cable. A signal traveling along any of these media is directed and is contained by the physical limits of the medium. Twisted-pair and coaxial cable use metallic that accept and transport signals in the form of electrical current. Optical fiber is a glass or plastic cable that accepts and transports signals in the form of light.
b) Unguided Media:
This is the wireless media that transport electromagnetic waves without using a physical conductor. Signals are broadcast either through air. This is done through radio communication, satellite communication and cellular telephony.

What is Project 802?
It is a project started by IEEE to set standards to enable intercommunication between equipment from a variety of manufacturers. It is a way for specifying functions of the physical layer, the data link layer and to some extent the network layer to allow for interconnectivity of major LAN
protocols.
It consists of the following:
802.1 is an internetworking standard for compatibility of different LANs and MANs across protocols.
802.2 Logical link control (LLC) is the upper sublayer of the data link layer which is non-architecture-specific, that is remains the same for all IEEE-defined LANs.
Media access control (MAC) is the lower sublayer of the data link layer that contains some distinct modules each carrying proprietary information specific to the LAN product being used. The modules are Ethernet LAN (802.3), Token ring LAN (802.4), Token bus LAN (802.5).
802.6 is distributed queue dual bus (DQDB) designed to be used in MANs.

What is Protocol Data Unit?
The data unit in the LLC level is called the protocol data unit (PDU). The PDU contains of four fields a destination service access point (DSAP), a source service access point (SSAP), a control field and an information field. DSAP, SSAP are addresses used by the LLC to identify the protocol stacks on the receiving and sending machines that are generating and using the data. The control field specifies whether the PDU frame is a information frame (I - frame) or a supervisory frame (S - frame) or a unnumbered frame (U - frame).

What are the different type of networking / internetworking devices?
Repeater:
Also called a regenerator, it is an electronic device that operates only at physical layer. It receives the signal in the network before it becomes weak, regenerates the original bit pattern and puts the refreshed copy back in to the link.
Bridges:
These operate both in the physical and data link layers of LANs of same type. They divide a larger network in to smaller segments. They contain logic that allow them to keep the traffic for each segment separate and thus are repeaters that relay a frame only the side of the segment containing the intended recipent and control congestion.
Routers:
They relay packets among multiple interconnected networks (i.e. LANs of different type). They operate in the physical, data link and network layers. They contain software that enable them to determine which of the several possible paths is the best for a particular transmission.
Gateways:
They relay packets among networks that have different protocols (e.g. between a LAN and a WAN). They accept a packet formatted for one protocol and convert it to a packet formatted for another protocol before forwarding it. They operate in all seven layers of the OSI model.

What is ICMP?
ICMP is Internet Control Message Protocol, a network layer protocol of the TCP/IP suite used by hosts and gateways to send notification of datagram problems back to the sender. It uses the echo test / reply to test whether a destination is reachable and responding. It also handles both control and error messages.

What are the data units at different layers of the TCP / IP protocol suite?
The data unit created at the application layer is called a message, at the transport layer the data unit created is called either a segment or an user datagram, at the network layer the data unit created is called the datagram, at the data link layer the datagram is encapsulated in to a frame and finally transmitted as signals along the transmission media.

What is difference between ARP and RARP?
The address resolution protocol (ARP) is used to associate the 32 bit IP address with the 48 bit physical address, used by a host or a router to find the physical address of another host on its network by sending a ARP query packet that includes the IP address of the receiver.
The reverse address resolution protocol (RARP) allows a host to discover its Internet address when it knows only its physical address.

What is the minimum and maximum length of the header in the TCP segment and IP datagram?
The header should have a minimum length of 20 bytes and can have a maximum length of 60 bytes.

What is the range of addresses in the classes of internet addresses?
Class A 0.0.0.0 - 127.255.255.255
Class B 128.0.0.0 - 191.255.255.255
Class C 192.0.0.0 - 223.255.255.255
Class D 224.0.0.0 - 239.255.255.255
Class E 240.0.0.0 - 247.255.255.255

What is the difference between TFTP and FTP application layer protocols?
The Trivial File Transfer Protocol (TFTP) allows a local host to obtain files from a remote host but does not provide reliability or security. It uses the fundamental packet delivery services offered by UDP.
The File Transfer Protocol (FTP) is the standard mechanism provided by TCP / IP for copying a file from one host to another. It uses the services offer by TCP and so is reliable and secure. It establishes two connections (virtual circuits) between the hosts, one for data transfer and another for control information.

What are major types of networks and explain?
Server-based network
Peer-to-peer network
Peer-to-peer network, computers can act as both servers sharing resources and as clients using the resources.
Server-based networks provide centralized control of network resources and rely on server computers to provide security and network administration

What are the important topologies for networks?
BUS topology:
In this each computer is directly connected to primary network cable in a single line.
Advantages:
Inexpensive, easy to install, simple to understand, easy to extend.

STAR topology:
In this all computers are connected using a central hub.
Advantages:
Can be inexpensive, easy to install and reconfigure and easy to trouble shoot physical problems.

RING topology:
In this all computers are connected in loop.
Advantages:
All computers have equal access to network media, installation can be simple, and signal does not degrade as much as in other topologies because each computer regenerates it.

What is mesh network?
A network in which there are multiple network links between computers to provide multiple paths for data to travel.

What is difference between baseband and broadband transmission?
In a baseband transmission, the entire bandwidth of the cable is consumed by a single signal. In broadband transmission, signals are sent on multiple frequencies, allowing multiple signals to be sent simultaneously.

Explain 5-4-3 rule?
In a Ethernet network, between any two points on the network ,there can be no more than five network segments or four repeaters, and of those five segments only three of segments can be populated.

What MAU?
In token Ring , hub is called Multistation Access Unit(MAU).

What is the difference between routable and non- routable protocols?
Routable protocols can work with a router and can be used to build large networks. Non-Routable protocols are designed to work on small, local networks and cannot be used with a router

Why should you care about the OSI Reference Model?
It provides a framework for discussing network operations and design.

What is logical link control?
One of two sublayers of the data link layer of OSI reference model, as defined by the IEEE 802 standard. This sublayer is responsible for maintaining the link between computers when they are sending data across the physical network connection.

What is virtual channel?
Virtual channel is normally a connection from one source to one destination, although multicast connections are also permitted. The other name for virtual channel is virtual circuit.

What is virtual path?
Along any transmission path from a given source to a given destination, a group of virtual circuits can be grouped together into what is called path.

What is packet filter?
Packet filter is a standard router equipped with some extra functionality. The extra functionality allows every incoming or outgoing packet to be inspected. Packets meeting some criterion are forwarded normally. Those that fail the test are dropped.

What is traffic shaping?
One of the main causes of congestion is that traffic is often busy. If hosts could be made to transmit at a uniform rate, congestion would be less common. Another open loop method to help manage congestion is forcing the packet to be transmitted at a more predictable rate. This is called traffic shaping.

What is multicast routing?
Sending a message to a group is called multicasting, and its routing algorithm is called multicast routing.

What is region?
When hierarchical routing is used, the routers are divided into what we will call regions, with each router knowing all the details about how to route packets to destinations within its own region, but knowing nothing about the internal structure of other regions.

What is silly window syndrome?
It is a problem that can ruin TCP performance. This problem occurs when data are passed to the sending TCP entity in large blocks, but an interactive application on the receiving side reads 1 byte at a time.

What are Digrams and Trigrams?
The most common two letter combinations are called as digrams. e.g. th, in, er, re and an. The most common three letter combinations are called as trigrams. e.g. the, ing, and, and ion.

Expand IDEA.
IDEA stands for International Data Encryption Algorithm.

What is wide-mouth frog?
Wide-mouth frog is the simplest known key distribution center (KDC) authentication protocol.

What is Mail Gateway?
It is a system that performs a protocol translation between different electronic mail delivery protocols.

What is IGP (Interior Gateway Protocol)?
It is any routing protocol used within an autonomous system.

What is EGP (Exterior Gateway Protocol)?
It is the protocol the routers in neighboring autonomous systems use to identify the set of networks that can be reached within or via each autonomous system.

What is autonomous system?
It is a collection of routers under the control of a single administrative authority and that uses a common Interior Gateway Protocol.

What is BGP (Border Gateway Protocol)?
It is a protocol used to advertise the set of networks that can be reached with in an autonomous system. BGP enables this information to be shared with the autonomous system. This is newer than EGP (Exterior Gateway Protocol).

What is Gateway-to-Gateway protocol?
It is a protocol formerly used to exchange routing information between Internet core routers.

What is NVT (Network Virtual Terminal)?
It is a set of rules defining a very simple virtual terminal interaction. The NVT is used in the start of a Telnet session.

What is a Multi-homed Host?
It is a host that has a multiple network interfaces and that requires multiple IP addresses is called as a Multi-homed Host.

What is Kerberos?
It is an authentication service developed at the Massachusetts Institute of Technology. Kerberos uses encryption to prevent intruders from discovering passwords and gaining unauthorized access to files.

What is OSPF?
It is an Internet routing protocol that scales well, can route traffic along multiple paths, and uses knowledge of an Internet's topology to make accurate routing decisions.

What is Proxy ARP?
It is using a router to answer ARP requests. This will be done when the originating host believes that a destination is local, when in fact is lies beyond router.


What is SLIP (Serial Line Interface Protocol)?
It is a very simple protocol used for transmission of IP datagrams across a serial line.

What is RIP (Routing Information Protocol)?
It is a simple protocol used to exchange information between the routers.

What is source route?
It is a sequence of IP addresses identifying the route a datagram must follow. A source route may optionally be included in an IP datagram header.

Common Interview Questions

C  Questions

Note : All the programs are tested under Turbo C/C++ compilers.  
It is assumed that,
Programs run under DOS environment,
The underlying machine is an x86 system,
Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed). 

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

void main()
{
int  const * p=5;
printf("%d",++(*p));
}
Answer:
Compiler error: Cannot modify a constant value. 
Explanation:    
p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".

main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
Answer:
             mmmm
                       aaaa
                       nnnn
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally  array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the  case of  C  it is same as s[i].

main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}
Answer: 
I hate U
Explanation:
For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value  represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.
Rule of Thumb: 
Never compare or at-least be cautious when using floating point numbers with relational operators (== , >, <, <=, >=,!= ) .  

main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}
Answer:
5 4 3 2 1
         Explanation:
When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively.  

main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++)>
printf(" %d ",*c);
  ++q;  }
for(j=0;j<5;j++){
printf(" %d ",*p);
++p;  }
}

Answer:
             2 2 2 2 2 2 3 4 6 5
         Explanation: 
Initially pointer c is assigned to both p and q. In the first loop, since only q is incremented and not c , the value 2 will be printed 5 times. In second loop p itself is incremented. So the values 2 3 4 6 5 will be printed. 
main()
{
extern int i;
i=20;
printf("%d",i);
}

Answer:  
Linker Error : Undefined symbol '_i'
Explanation: 
             extern storage class in the following declaration,
                       extern int i;
specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name i is available in any other program with memory space allocated for it. Hence a linker error has occurred .

main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
Answer:
             0 0 1 3 1
Explanation :
Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator has higher priority over the logical OR (||) operator. So the expression  ‘i++ && j++ && k++’ is executed first. The result of this expression is 0    (-1 && -1 && 0 = 0). Now the expression is 0 || 2 which evaluates to 1 (because OR operator always gives 1 except for ‘0 || 0’ combination- for which it gives 0). So the value of m is 1. The values of other variables are also incremented by 1.

main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}

Answer: 
             1 2
Explanation:
The sizeof() operator gives the number of bytes taken by its operand. P is a character pointer, which needs one byte for storing its value (a character). Hence sizeof(*p) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof(p) gives 2.

main()
{
int i=3;
switch(i)
{
   default:printf("zero");
   case 1: printf("one");
  break;
  case 2:printf("two");
 break;
 case 3: printf("three");
 break;
 }  
}
Answer :
three
Explanation :
The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.

main()
{
 printf("%x",-1<<4);
}
Answer: 
fff0
Explanation :
-1 is internally represented as all 1's. When left shifted four times the least significant 4 bits are filled with 0's.The %x format specifier specifies that the integer value be printed as a hexadecimal value.

main()
{
            char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
}
           Answer:
Compiler Error : Type mismatch in redeclaration of function display 
           Explanation :
In third line, when the function display is encountered, the compiler doesn't know anything about the function display. It assumes the arguments and return types to be integers, (which is the default type). When it sees the actual function display, the arguments and type contradicts with what it has assumed previously. Hence a compile time error occurs.

main()
{
int c=- -2;
printf("c=%d",c);
}
Answer:
             c=2;
           Explanation:
Here unary minus (or negation) operator is used twice. Same maths  rules applies, ie. minus * minus= plus.
Note: 
However you cannot give like --2. Because -- operator can  only be applied to variables as a decrement operator (eg., i--). 2 is a constant and not a variable.

#define int char
main()
{
int i=65;
printf("sizeof(i)=%d",sizeof(i));
}
Answer:
           sizeof(i)=1
Explanation:
Since the #define replaces the string  int by the macro char 

main()
{
int i=10;
i=!i>14;
Printf ("i=%d",i);
}
Answer:
i=0


  Explanation:
In the expression !i>14 , NOT (!) operator has more precedence than ‘ >’ symbol.  ! is a unary logical operator. !i (!10) is 0 (not of true is false).  0>14 is false (zero). 

#include
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
}
Answer:
77
Explanation:
p is pointing to character '\n'. str1 is pointing to character 'a' ++*p. "p is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10, which is then incremented to 11. The value of ++*p is 11. ++*str1, str1 is pointing to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is 98.
 Now performing (11 + 98 – 32), we get 77("M");
 So we get the output 77 :: "M" (Ascii is 77).

#include
main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8}  };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d----%d",*p,*q);
}
Answer:
SomeGarbageValue---1
Explanation:
p=&a[2][2][2]  you declare only two 2D arrays, but you are trying to access the third 2D(which you are not declared) it will print garbage values. *q=***a starting address of a is assigned integer pointer. Now q is pointing to starting address of a. If you print *q, it will print first element of 3D array.
#include
main()
{
struct xx
{
      int x=3;
      char name[]="hello";
 };
struct xx *s;
printf("%d",s->x);
printf("%s",s->name);
}
Answer:
Compiler Error
Explanation:
You should not initialize variables in declaration

#include
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}
Answer:
Compiler Error
Explanation:
The structure yy is nested within structure xx. Hence, the elements are of yy are to be accessed through the instance of structure xx, which needs an instance of yy to be known. If the instance is created after defining the structure the compiler will not know about the instance relative to xx. Hence for nested structure yy you have to declare member.

main()
{
printf("\nab");
printf("\bsi");
printf("\rha");
}
Answer:
hai
Explanation:
\n  - newline
\b  - backspace
\r  - linefeed

main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
Answer:
45545
Explanation:
The arguments in a function call are pushed into the stack from left to right. The evaluation is by popping out from the stack. and the  evaluation is from right to left, hence the result.

#define square(x) x*x
main()
{
int i;
i = 64/square(4);
printf("%d",i);
}
Answer:
64
Explanation:
the macro call square(4) will substituted by 4*4 so the expression becomes i = 64/4*4 . Since / and * has equal priority the expression will be evaluated as (64/4)*4 i.e. 16*4 = 64
  
main()
{
char *p="hai friends",*p1;
p1=p;
while(*p!='\0') ++*p++;
printf("%s   %s",p,p1);
}
Answer:
ibj!gsjfoet
Explanation:
++*p++ will be parse in the given order
*p that is value at the location currently pointed by p will be taken
++*p the retrieved value will be incremented 
when ; is encountered the location will be incremented that is p++ will be executed                                                                                                                                                                          
Hence, in the while loop initial value pointed by p is ‘h’, which is changed to ‘i’ by executing ++*p and pointer moves to point, ‘a’ which is similarly changed to ‘b’ and so on. Similarly blank space is converted to ‘!’. Thus, we obtain value in p becomes “ibj!gsjfoet” and since p reaches ‘\0’ and p1 points to p thus p1doesnot print anything. 

#include
#define a 10
main()
{
#define a 50
printf("%d",a);
}
Answer:
50
Explanation:
The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value will be taken.

#define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
}
Answer:
100
Explanation:
Preprocessor executes as a seperate pass before the execution of the compiler. So textual replacement of clrscr() to 100 occurs.The input  program to compiler looks like this :
main()
{
    100;
    printf("%d\n",100);
}
Note:
100; is an executable statement but with no action. So it doesn't give any problem

main()
{
41printf("%p",main);
}8Answer:
Some address will be printed.
Explanation:
  Function names are just addresses (just like array names are addresses).
main() is also a function. So the address of function main will be printed. %p in printf specifies that the argument is an address. They are printed as hexadecimal numbers.

27) main()
{
clrscr();
}
clrscr();
Answer:
No output/error
Explanation:
The first clrscr() occurs inside a function. So it becomes a function call. In the second clrscr(); is a function declaration (because it is not inside any function).

28) enum colors {BLACK,BLUE,GREEN}
 main()
{
  
 printf("%d..%d..%d",BLACK,BLUE,GREEN);
   
 return(1);
}
Answer:
0..1..2
Explanation:
enum assigns numbers starting from 0, if not explicitly defined.

29) void main()
{
 char far *farther,*farthest;
  
 printf("%d..%d",sizeof(farther),sizeof(farthest));
   
 }
Answer:
4..2  
Explanation:
  the second pointer is of char type and not a far pointer

30) main()
{
 int i=400,j=300;
 printf("%d..%d");
}
Answer:
400..300
Explanation:
printf takes the values of the first two assignments of the program. Any number of printf's may be given. All of them take only the first two values. If more number of assignments given in the program,then printf will take garbage values.

31) main()
{
 char *p;
 p="Hello";
 printf("%c\n",*&*p);
}
Answer:
Explanation:
* is a dereference operator & is a reference  operator. They can be    applied any number of times provided it is meaningful. Here  p points to  the first character in the string "Hello". *p dereferences it and so its value is H. Again  & references it to an address and * dereferences it to the value H.

32) main()
{
    int i=1;
    while (i<=5)
    {
       printf("%d",i);
       if (i>2)
 goto here;
       i++;
    }
}
fun()
{
   here:
     printf("PP");
}
Answer:
Compiler error: Undefined label 'here' in function main
Explanation:
Labels have functions scope, in other words the scope of the labels is limited to functions. The label 'here' is available in function fun() Hence it is not visible in function main.

33) main()
{
   static char names[5][20]={"pascal","ada","cobol","fortran","perl"};
    int i;
    char *t;
    t=names[3];
    names[3]=names[4];
    names[4]=t;
    for (i=0;i<=4;i++)
     printf("%s",names[i]);
}
Answer:
Compiler error: Lvalue required in function main
Explanation:
Array names are pointer constants. So it cannot be modified.

34) void main()
{
int i=5;
printf("%d",i++ + ++i);
}
Answer:
Output Cannot be predicted  exactly.
Explanation:
Side effects are involved in the evaluation of   i

35) void main()
{
int i=5;
printf("%d",i+++++i);
}
Answer:
Compiler Error 
Explanation:
The expression i+++++i is parsed as i ++ ++ + i which is an illegal combination of operators. 
   
36) #include
main()
{
int i=1,j=2;
switch(i)
 {
 case 1:  printf("GOOD");
   break;
 case j:  printf("BAD");
     break;
 }
}
Answer:
Compiler Error: Constant expression required in function main.
Explanation:
The case statement can have only constant expressions (this implies that we cannot use variable names directly so an error).
Note:
Enumerated types can be used in case statements. 

37) main()
{
int i;
printf("%d",scanf("%d",&i));  // value 10 is given as input here
}
Answer:
1
Explanation:
Scanf returns number of items successfully read and not 1/0.  Here 10 is given as input which should have been scanned successfully. So number of items read is 1. 

38) #define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}
Answer:
100 

39) main()
{
int i=0;
 
for(;i++;printf("%d",i)) ;
printf("%d",i);
}
Answer:
1
Explanation:
before entering into the for loop the checking condition is "evaluated". Here it evaluates to 0 (false) and comes out of the loop, and i is incremented (note the semicolon after the for loop).

40) #include
main()
{
  char s[]={'a','b','c','\n','c','\0'};
  char *p,*str,*str1;
  p=&s[3];
  str=p;
  str1=s;
  printf("%d",++*p + ++*str1-32);
}
Answer:
M
Explanation:
p is pointing to character '\n'.str1 is pointing to character 'a' ++*p meAnswer:"p is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10. then it is incremented to 11. the value of ++*p is 11. ++*str1 meAnswer:"str1 is pointing to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is 98. both 11 and 98 is added and result is subtracted from 32. 
i.e. (11+98-32)=77("M");
41) #include
main()
{
  struct xx
   {
      int x=3;
      char name[]="hello";
   };
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
}
Answer:
Compiler Error
Explanation:
Initialization should not be done for structure members inside the structure declaration

42) #include
main()
{
struct xx
 {
 int x;
 struct yy
  {
    char s;
    struct xx *p;
  };
             struct yy *q;
           };
           }
Answer:
Compiler Error
Explanation:
in the end of nested structure yy a member have to be declared.

43) main()
{
 extern int i;
 i=20;
 printf("%d",sizeof(i));
}
Answer:
Linker error: undefined symbol '_i'.
Explanation:
extern declaration specifies that the variable i is defined somewhere else. The compiler passes the external variable to be resolved by the linker. So compiler doesn't find an error. During linking the linker searches for the definition of i. Since it is not found the linker flags an error.

44) main()
{
printf("%d", out);
}
int out=100;
Answer:
Compiler error: undefined symbol out in function main.
Explanation:
The rule is that a variable is available for use from the point of declaration. Even though a is a global variable, it is not available for main. Hence an error.

45) main()
{
 extern out;
 printf("%d", out);
}
 int out=100;
Answer:
100
Explanation:
This is the correct way of writing the previous program.
     
46) main()
{
 show();
}
void show()
{
 printf("I'm the greatest");
}
Answer:
Compier error: Type mismatch in redeclaration of show.
Explanation:
When the compiler sees the function show it doesn't know anything about it. So the default return type (ie, int) is assumed. But when compiler sees the actual definition of show mismatch occurs since it is declared as void. Hence the error.
The solutions are as follows:
1. declare void show() in main() .
2. define show() before main().
3. declare extern void show() before the use of show().
 
47) main( )
{
  int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
  printf(“%u %u %u %d \n”,a,*a,**a,***a);
 printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);
  }
Answer:
100, 100, 100, 2
114, 104, 102, 3
Explanation:
The given array is a 3-D one. It can also be viewed as a 1-D array. 
                                                                                                                           
 
2 4 7 8 3 4 2 2 2 3 3 4  
   100  102  104  106 108   110  112  114  116   118   120   122

thus, for the first printf statement a, *a, **a  give address of  first element . since the indirection ***a gives the value. Hence, the first line of the output.
for the second printf a+1 increases in the third dimension thus points to value at 114, *a+1 increments in second dimension thus points to 104, **a +1 increments the first dimension thus points to 102 and ***a+1 first gets the value at first location and then increments it by 1. Hence, the output.

48) main( )
{
  int a[ ] = {10,20,30,40,50},j,*p;
  for(j=0; j<5;>
    {
printf(“%d” ,*a); 
a++;
    }
    p = a;
   for(j=0; j<5;>
      {
printf(“%d ” ,*p); 
p++;
      }
 }
Answer:
Compiler error: lvalue required.
Explanation:
Error is in line with statement a++. The operand must be an lvalue and may be of any of scalar type for the any operator, array name only when subscripted is an lvalue. Simply array name is a non-modifiable lvalue.

**49) main( )
{
 static int  a[ ]   = {0,1,2,3,4};
 int  *p[ ] = {a,a+1,a+2,a+3,a+4};
 int  **ptr =  p;
 ptr++;
 printf(“\n %d  %d  %d”, ptr-p, *ptr-a, **ptr); 
 *ptr++;
 printf(“\n %d  %d  %d”, ptr-p, *ptr-a, **ptr); 
 *++ptr;
 printf(“\n %d  %d  %d”, ptr-p, *ptr-a, **ptr); 
 ++*ptr;
printf(“\n %d  %d  %d”, ptr-p, *ptr-a, **ptr); 
}
Answer:
111
222
333
344
Explanation:
Let us consider the array and the two pointers with some address
a
 
0 1 2 3 4  
   100      102      104      106      108
    p
 
100 102 104 106 108  
     1000    1002    1004    1006    1008
    ptr
 
1000  
2000
After execution of the instruction ptr++ value in ptr becomes 1002, if scaling factor for integer is 2 bytes. Now ptr – p is value in ptr – starting location of array p, (1002 – 1000) / (scaling factor) = 1,  *ptr – a = value at address pointed by ptr – starting value of array a, 1002 has a value 102  so the value is (102 – 100)/(scaling factor) = 1,  **ptr is the value stored in the location pointed by  the pointer of ptr = value pointed by value pointed by 1002 = value pointed by 102 = 1. Hence the output of the firs printf is  1, 1, 1.
After execution of *ptr++ increments value of the value in ptr by scaling factor, so it becomes1004. Hence, the outputs for the second printf are ptr – p = 2, *ptr – a = 2, **ptr = 2. 
After execution of *++ptr increments value of the value in ptr by scaling factor, so it becomes1004. Hence, the outputs for the third printf are ptr – p = 3, *ptr – a = 3, **ptr = 3. 
After execution of ++*ptr value in ptr remains the same, the value pointed by the value is incremented by the scaling factor. So the value in array p at location 1006 changes from 106 10 108,. Hence, the outputs for the fourth printf are ptr – p = 1006 – 1000 = 3, *ptr – a = 108 – 100 = 4, **ptr = 4. 

50) main( )
{
 char  *q;
 int  j;
 for (j=0; j<3;>
 for (j=0; j<3;>
 for (j=0; j<3;>
}
Explanation:
Here we have only one pointer to type char and since we take input in the same pointer thus we keep writing over in the same location, each time shifting the pointer value by 1. Suppose the inputs are MOUSE,  TRACK and VIRTUAL. Then for the first input suppose the pointer starts at location 100 then the input one is stored as
 
M O U S E \0  
When the second input is given the pointer is incremented as j value becomes 1, so the input is filled in memory starting from 101.
 
M T R A C K \0  
The third input  starts filling from the location 102
 
M T V I R T U A L \0  
This is the final value stored .
The first printf prints the values at the position q, q+1 and q+2  = M T V
The second printf prints three strings starting from locations q, q+1, q+2
 i.e  MTVIRTUAL, TVIRTUAL and VIRTUAL.
   
51) main( )
{
 void *vp;
 char ch = ‘g’, *cp = “goofy”;
 int j = 20;
 vp = &ch;
 printf(“%c”, *(char *)vp);
 vp = &j;
 printf(“%d”,*(int *)vp);
 vp = cp;
 printf(“%s”,(char *)vp + 3);
}
Answer:
g20fy
Explanation:
Since a void pointer is used it can be type casted to any  other type pointer. vp = &ch  stores address of char ch and the next statement prints the value stored in vp after type casting it to the proper data type pointer. the output is ‘g’. Similarly  the output from second printf is ‘20’. The third printf statement type casts it to print the string from the 4th value hence the output is ‘fy’.

52) main ( )
{
 static char *s[ ]  = {“black”, “white”, “yellow”, “violet”};
 char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;
 p = ptr;
 **++p;
 printf(“%s”,*--*++p + 3);
}
Answer:
ck
Explanation:
In this problem we have an array of char pointers pointing to start of 4 strings. Then we have ptr which is a pointer to a pointer of type char and a variable p which is a pointer to a pointer to a pointer of type char. p hold the initial value of ptr, i.e. p = s+3. The next statement increment value in p by 1 , thus now value of p =  s+2. In the printf statement the expression is evaluated *++p causes gets value s+1 then the pre decrement is executed and we get s+1 – 1 = s . the indirection operator now gets the value from the array of s and adds 3 to the starting address. The string is printed starting from this position. Thus, the output is ‘ck’.

53) main()
{
 int  i, n;
 char *x = “girl”;
 n = strlen(x);
 *x = x[n];
 for(i=0; i
   {
printf(“%s\n”,x);
x++;
   }
 }
Answer:
(blank space)
irl
rl
l

Explanation:
Here a string (a pointer to char) is initialized with a value “girl”.  The strlen function returns the length of the string, thus n has a value 4. The next statement assigns value at the nth location (‘\0’) to the first location. Now the string becomes “\0irl” . Now the printf statement prints the string after each iteration it increments it starting position.  Loop starts from 0 to 4. The first time x[0] = ‘\0’ hence it prints nothing and pointer value is incremented. The second time it prints from x[1] i.e “irl” and the third time it prints “rl” and the last time it prints “l” and the loop terminates.

Search here for More Interview Questions ..