Wednesday, October 21, 2009

Wednesday, August 26, 2009

disorder

Why can't the confining upgrade grade the disorder?

Wednesday, February 18, 2009

Wednesday, February 11, 2009

Sunday, February 8, 2009

Permission Research (International)

Get free games, screensavers, software in exchange for your opinion on how to improve the Internet! Free membership! Leads are imported every Monday. Valid Signup Requirements: The user must complete the registration and remain a member for at least 15 days in order to make a qualified lead. International!

Tuesday, January 20, 2009

Technological Discoveries and Applications in India: Part II

Raja Bhoja (1018-60 of Dhar -Malwa) who was himself a great engineer and was the architect of Bhojsagar - (one of the largest artificial irrigation lakes of medieval India) was a great patron of engineering projects. Reputed to be a fine scholar, he was well educated in the sciences and the arts and was responsible for the commissioning of a university (Bhoj Shala) at Dhar and several monumental temples in the Malwa region, including one at Bhojpur which has a cast iron Shiva-Linga of very impressive proportions. Viewing town planning as an important aspect of government, he provided a detailed network of roads connecting villages and towns in his magnum opus, Somarangana Sutradhara.

In addition to a chapter on town planning, the Somarangana Sutradhara also included chapters on mechanical engineering, soil testing, orientation of buildings, the selection of building material, architectural styles, and the vertical and horizontal components of buildings.

The Somarangana Sutradhara also describes machines and mechanical devices such as chiming chronometers (putrika-nadiprabodhana), and in his Yuktikalpataru, Raja Bhoja also warned shipbuilders about using iron along the bottom of the vessels for this would render them vulnerable to magnetic rocks at sea.

However, state support for technological innovation was not always forthcoming and depended considerably on the attitude of individual rulers. By and large, arms manufacturing and the production of luxury goods received the maximum support from the rulers. Mughal rulers like Akbar and Aurangzeb invested heavily in the production of artillery and other weapons as did some of the Rajputs and the Deccan kings. Investments were also made in high quality manufactured goods that found favor in the courts such as fine textiles, carpets, lamps, glassware, marble and stone quarrying, jewelry, decorated metalware etc. Specialized manufacturing towns were promoted almost throughout the country.

Limitations of pre-industrial manufacturing

However, one of the limitations of Indian manufacturing prior to the industrial revolution was that although Indian artisans could produce goods of exceptional quality, much of Indian manufacturing (as was the case in much of the world) was highly labor intensive. Although Indian artisans used a variety of tools and implements in facilitating their manufactures, there was insufficient investment in augmenting and expanding the range of available labor-saving tools.

Yet, more than in any other nation, manufacturing in medieval India involved considerable specialization of labor. India had a very large pool of relatively cheap skilled labor trained in a variety of specialized tasks and manufacturing processes were optimized to take full advantage of these highly trained hands. Since most manufactured goods catered largely to the elite, demand was relatively limited and the available labor pool was more than sufficient to meet those needs. Hence, complacency ruled the day. India's great manufacturing strengths thus became a significant obstacle in transitioning towards the modern industrial era.

Nevertheless, in certain areas where demand growth was considerable, there were successful attempts at improving manufacturing techniques. The textile industry was one such industry where steady improvements in manufacturing technology took place.

Indian textiles commanded a worldwide market and prior to colonization, India's manually operated textile machines were amongst the best in the world and the early textile machines produced in newly industrialized Britain and Germany were modeled on the best of these machines.

The huge demand for Indian exports also gave a fillip to the ship-building and packaging industry and during the 18th century, the Wadias of Bombay were building ships as good as any in the world.

India and the Industrial Revolution

Nevertheless, there were powerful forces at work that inhibited the growth of science and technology in India and prevented Indian manufacturing from entering the industrial era on it's own terms.

Perhaps the most important of these factors was the relative prosperity that India enjoyed vis-a-vis the rest of the world. A mild climate meant that the peasantry and working class could survive relatively cheaply. And the huge trade surplus the country enjoyed enabled the nobility and the middle classes to live lives of relative luxury and comfort. There was little incentive to bring about revolutionary changes and the forces of parasitism and conservatism prevailed quite easily over more radical forces. Harry Verelst (Senior Officer of the East India Company) described Bengal before Plassey quite succintly: "The farmer was easy, the artisan encouraged, the merchant enriched and the prince satisfied".

But in Europe, virtually all classes had an interest in bringing about revolutionary changes that could improve their lives. Long and harsh winters meant that even the peasantry and working class needed more items of personal consumption just to survive, let alone live comfortably. The demand for cheap manufactured goods for mass consumption was initially far greater in Europe than in the warmer parts of the globe. The short days in the long and harsh winters created a much more compelling need for breakthrough inventions like the light bulb or electric heater or piped hot water and indoor toilets.

But need alone was an insufficient factor in securing technological breakthroughs. Europe also needed important social changes to create a climate where scientific study and technological innovation could flourish. For centuries, the catholic church in Europe had preached the idealogy of worldly renunciation and taught it's followers to accept their earthly suffering in exchange for a promise of redemption in the next world. Rational and scientific thinking was routinely condemned as sacriligious or heresy. It was then little wonder that Europe had slipped into a period of intense stagnation and became inordinately dependant on imports from the more developed nations of Asia.

But it was precisely this backwardness and internal oppression that lead to mass radicalization and calls for revolution or reform. The protestant movements were the first in a series of movements calling for greater democracy and radical improvements in social conditions for the masses. At the same time, the European intelligentsia was no longer willing to wait for redemption after death but wanted to enjoy the good life right here on earth. Secular and rational challenges to Christian orthodoxy grew and science and philosophy were gradually liberated from the strangulating influences of the church. The knowledge of the East was translated into the European languages and found it's way into university curriculums. Scientific research and investigation began to thrive and technological innovations followed. All the social ingredients for the industrial revolution were beginning to fall into place.

But at first, Europe still lacked a vital ingredient for the industrial revolution to take off and succeed - and that was capital. For centuries, Europe had to fund it's negative trade balance (vis-a-vis Asia) by exporting gold, silver and other precious metals. To make matters worse, exports from India (which made up an important share of European imports) were heavily marked up by various intermediaries in the Middle East and later by the Venetians. By the 15th century, this burden was becoming almost impossible for the royal houses of Western Europe to bear. It was in response to this crisis that voyages to discover a new route to India were funded, and eventually led to the creation of the East India Companies. {The pillage and plunder of the Americas (and later Africa as well) played a significant role in financing these voyages.}

While this made imports from India more affordable, it did not eliminate the negative trade balance. European banks were initially in little position to fund the new inventions that were waiting to find industrial sponsors. Colonization provided the answer. Europe thus embarked on a complex transition where within it's borders it followed a path of progress and radical reform, but externally, it raped and pillaged without mercy.

This occurred at a time when the rest of the world was largely ill-equipped at dealing with such a wily and complex enemy. In much of the world, large sections of society were moving in the opposite direction - and particularly so in the Islamic world. Madrasahs resisted numerous attempts at introducing anything resembling science and reason in the curriculum. This was also true in India. In spite of repeated attempts by Akbar to introduce a secular curriculum in the nation's Madrasahs, the conservative clergy successfully resisted all attempts at change. Similiar processes were at work in many of the Buddhist monasteries and the Hindu Gurukuls who had succumbed to the influence of orthodox Vedantism. In extreme versions of the Vedantic world-view the real world was more an illusion, and hence all efforts at changing it or transforming it were deemed unimportant.

Even in schools that escaped Vedantic influences, and where science and logic remained a part of the curriculum, religious instruction often took precedence. In addition, Brahminical notions of purity created a needless divide between the mental and physical creating obstacles to experimentation and transfer of theoretical knowledge to practical applications. The fixation on astrology and other such superstitions also served to distract sections of the intelligentsia from more scientific pursuits.

So just as Europe was preparing itself to meet the challenges of the industrial revolution, significant sections of society in Africa and Asia were becoming more resistant to studying science. This made the process of colonization much easier as those who resisted colonization were technologically outmatched and outwitted.

Once colonization had taken hold of a nations economy, educational options became further limited. Often, the few who were keen to pursue a career in the sciences could only do so under the auspices of their colonial masters. But for the colonial powers, teaching science and technology to the colonized was not necessarily a benevolent act. The western educated individual played an important role in the colonial process - either as a manager or engineer in a company that produced cheap raw materials (or industrial goods) for export from the colony to the master nation, or as a representative of an import agency that imported expensive manufactured goods and machinery into the colony.

So great was this contradiction in some nations that science and technology almost came to be associated with treachery and religious obscurantism became synonymous with patriotism. As a result the masses were often denied the opportunity to deal with an industrializing Europe on anything even remotely resembling equality.

Like other colonized nations, India was dragged into the industrial era on terms that were not of it's own choosing and many of the technological developments that have since taken place in India have been geared more towards the export market than bringing about all-round improvements in the quality of life for the Indian masses.

For that reason, it cannot yet be said that India has fully entered the modern industrial era. Only when India is able to harness the power of technology and modern industry towards improving the quality of life for the vast majority of it's people will that be the case. That will require not only major advances in the Indian education system but radical social changes that have yet to take place in a systematic way. Above all, the forces of religious fundamentalism, religious obscurantism and social backwardness will have to be pushed back and defeated. That is the real lesson of the Industrial Revolution that has yet to sink in completely in India.

Monday, January 12, 2009

Technological Discoveries and Applications in India:Part-I

The earliest evidence of technological progress in the Indian subcontinent is to be found in the remains of the Harappan civilization (4000-3000 BC). Archaeological remains point to the existence of well-planned urban centres that boasted of private and public dwellings laid out in orderly fashion along with roads and drainage systems complementing them. The drainage systems were particularly remarkable for the times since they were built underground and were constructed in a manner to allow for regular cleaning. Smaller drains from private homes connected to the larger public drains.




Larger private dwellings were invariably multi-storied and all homes were constructed from standardized fired bricks and provided for separate cooking areas and toilets. Storage facilities for grain and goods for trade were built as were public baths and other buildings intended for various public functions.




Urban centres were often planned near riverine or sea-ports. Accurate weights and measures were in use and ports such as Lothal were developed as export centres of early manufactured products from smelted copper and bronze. Kilns for smelting copper ingots and casting tools were in existence as were metal tools such as curved or circular saws, pierced needles and most significantly, bronze drills with twisted grooves. The drill enabled the production of items with unparalleled precision for the times and could be regarded as an ancient precursor of the modern machine tool.






There is also evidence of planned irrigation systems and it appears that fire and flood control measures to protect farms and villages were also in place. Artisans made use of the wheel and clay pottery was decorated in a variety of colors and designs. Cotton was grown and used to produce textiles.Urban centres in the Harappan region traded with each other as well as with counterparts in Babylon, the Persian Gulf, Egypt and possibly the Mediteranean. The span of the Harappan civilization was quite extensive, and included much of modern Sindh, Gujarat, Rajasthan, Haryana, Punjab and Western UP.But prior to it's disappearance, there is also evidence of considerable social decay and disintegration. Excavations from the later phases of the Harappan civilization suggest that population pressures led to greater anarchy in building construction. Urban dwellings became smaller and settlements became more haphazard indicating a breakdown of social mores and structures that promoted urban regulations and enforced construction codes.




Social Conditions and Technological Progress


It is quite possible that the decline in civil society extended to other areas such as agricultural planning and maintenance of irrigations systems making the civilization more vulnerable to natural disasters such droughts, floods, fires or earthquakes - thus contributing to the eventual extinction of that vibrant civilization. This suggests that technological progress cannot be divorced from social conditions that may either encourage the progress of technology or conversely cause civilizations that may be (in relative terms) quite advanced to stagnate and even decline.




For instance, 3000 years after Harappa, we find anecdotal evidence of impressive urban settlements constructed during the Mauryan period. Greek travellers have left behind admiring descriptions of Patliputra - the Mauryan capital. But social strife brought a precipitous end to the grand civilization. The growth of a parasitic, exploitative and socially oppressive elite led to massive social upheavals. In the course of the civil wars, fires and looting destroyed virtually all of the wood-based dwellings including grand palaces and public buildings.




Thus, an entire tradition of wood-based urban construction - (which may have taken several centuries to develop) was destroyed. But it also led to a greater emphasis on the use of more lasting construction materials. The very social conditions that destroyed technological progress in one direction gave birth to technological progress in another. Sculptural finds from the Mauryan period indicate that Mauryan sculptors of that time had achieved a high degree of proficiency in working with stone. They must have had tools and implements that enabled them to create smoothly modelled and highly polished representations of human and animal figures. Later civilizations in India employed these skills not only for the purposes of sculpting but for creating entire monuments constructed from a variety of hard building materials. For instance, various methods for preparing cements were developed, and by the 7th century, cement of highly durable quality came into use in the construction of important monuments that survive to this day.




The Impetus for Metallurgy


Monumental architecture required considerable advances in the technology of lifting, loading and transportation of construction materials, building construction ramps, scaffolding, and related tools and implements. As in ancient Egypt or Babylon, appropriate techniques also had to be developed and implemented in India. But more importantly, stone-based construction presupposes the existence of hard metal based tools and implements for cutting and shaping stone. The discovery of iron thus played an essential role in the development of monumental architecture in India which may have in turn given a further impetus to the development of metallurgical skills.




As early as the 4th C. BC, Kautilya's Arthashastra had a section outlining the processes for metal extraction and alloying. Later Sanskrit texts talk about assessing metal purity and describe techniques for achieving metal purity. Various alloying techniques were in use and some may have had their origin in the Harappan or Vedic periods. (For instance, there are references in the Vedic literature that suggest that copper vessels were coated with tin so as to prevent milk from going sour.)


A combination of scholarly investigation and broad dissemination of practical techniques propelled the development of metallurgical skills. The fifth century Iron Pillar of Delhi is a remarkable example of those skills. Standing over 23 feet high it consists of a single piece of iron and has weathered over 1500 monsoons without showing any signs of rust. The pillar is made of wrought iron with an iron content of 99.72 % and appears to have been protected from rust by the application of a thin coating of manganese dioxide.




By the 12th century, construction engineers were using iron girders and beams on a scale unknown in any other part of the world. The most significant use of iron beams was in the temples of Puri and Konarak. The Puri temple contains 239 iron beams and one of the beams in Konarak is 35 feet long. All are 99.64 percent iron and were produced in a similiar manner to the Delhi iron pillar.





During the middle ages, India acquired a reputation for producing very high quality steel and was also able to extract zinc from it's ore by the 14th century. Bidari (an alloy of copper, lead and tin developed in the Deccan) was also extensively used.Unsurprisingly, developments in metallurgy also had their impact on artillery production. According to A. Rahman (Science in Medieval India), by the 16th century, the heaviest guns in the world were being cast in India and a variety of weapons were being manufactured in the subcontinent. The Jaigarh cannon factory was one of India's best and before the crucial battle of 1857, the Jaipur Rajputs laid claim to owning Asia's largest cannon. Yet, none of the Rajput cannons were ever used to confront the British who succeeded in conquering the sub-continent without ever having to fight against the country's best equipped armies, thus demonstrating that technological progress is not an end in itself.


Social Needs and Technological Applications




More often than not, social needs (as arising from geographic, climactic or living conditions) have been the primary impetus for technological progress in society. The long dry months that most regions of India had to deal with led to numerous innovations in water-management techniques. Irrigation canals, wells of different types, storage tanks and a variety of water-harvesting techniques were developed throughout the sub-continent. The Harappans were not alone in creating water-management solutions. Irrigation works of enormous size were undertaken time and time again. The reservoirs at Girnar in Kathiawar (built in the 3rd C. BC) had an embankment over 100 ft thick at the base. The artificial lake at Bhojpur (near Bhopal) commisioned by Raja Bhoj in the 11th C covered 250 sq. miles. In the South, also in the 11th C., an artificial lake fed by the Kaveri river had a 16-mile long embankment with stone sluices and irrigation channels. Rajput kings built artificial lakes throughout the desert state of Rajasthan, but irrigation schemes were essential to agricultural prosperity even in Kashmir, Bengal and the delta regions of the South.




The need for accurate prediction of the monsoons spurred developments in astronomy while the intense heat of the summer led to innovations in architecture. In Rajasthan and Gujarat step-wells were built deep into the ground - sometimes descending as much as a hundred feet and large scale observatories were built in Benaras, Mathura and Ujjain to facilitate advances in the astronomical sciences. Bengal became known for it's fine muslins that were light and airy to wear in the warm and humid climate of the state. Techniques for pickling and preserving fruits, vegetables, fish and meats were developed throughout the country to prevent or delay spoilage. Manually operated cooling devices were also invented. The Arthashatra mentions the variyantra (probably a revolving water spray for cooling the air). Technology thus arose in response to compelling material needs.




Scientific Rationalism and Technological Efficacy


But technological progress also requires a favorable social milieu. A foundation of scientific knowledge, rational thinking and practical experimentation can be essential to the process of making technological discoveries (although the application of already known technologies can occur more easily). As mentioned in the essay: Development of Philosophical Thought and Scientific Method in Ancient India numerous technological inventions occurred in parallel with developments in rational philosophy and advances in mathematics and natural sciences.


This is not to say that Indian society was entirely rational. In all ancient societies (and even modern ones), superstitions, religious beliefs, reliance on astrology, numerology or the advice of 'seers', palmists and fortune-tellers have impinged on the scientific process and consequently hindered the progress of technology. In the civilizations of ancient Egypt, Babylon and India - we see numerous instances of scientifically accurate statements and practical truths mixed up with religious myths and popular superstitions. This was especially true in the science of medicine. Genuine cures were listed with unscientific practices without clear distinction. But during the rational period in India the emphasis on the scientific method led to a much greater level of veracity with respect to the efficacy of different medicines and medical procedures.




The more accurately the Indian medical practitioner was able to observe reality, understand bodily functions and test the efficacy of popular medical techniques, the more successful were the prescribed cures. Dissection of corpses and careful monitoring of different diseases was an important component in the study and practice of medicine. With greater success in treatment came greater confidence and allowed medical practitioners to conduct surgical procedures using a variety of surgical tools - albeit primitive in comparison to modern surgical equipment.




Procedures for inducing unconsciousness or numbing body parts that were to be operated on were required and developed. Tools for excision, incision, puncturing, probing, organ or part extraction, fluid drainage, bloodletting, suturing and cauterization were developed. Various types of bandages and ointments were used as were basic procedures for ensuring cleanliness and limiting contamination. The caesarian section was known, bone-setting reached a high degree of skill, and plastic surgery developed far beyond anything known elsewhere at the time. Indian surgeons also became proficient at the repair of noses, ears and lips lost or injured in battle or by judicially mandated mutilation. By the 1st C. AD the foundations of this rather evolved medical system were in place and by the 4th C. - much of this knowledge was standardized and available in the classical textbooks of Charaka and Susruta.




While all ancient societies cherished and admired the skills of the medical practitioner, it was the more determined adoption of the scientific approach that enabled Indian medicine to make a quantum leap over the older medical systems of the time.


{Progress in medicine also led to developments in chemistry and chemical technologies. The manufacture of alkaline substances, medicinal powders, ointments and liquids was systematized, as were chemical processes relating to the manufacture of glass. Advances in food processing (such as manufacture of sugar, condiments and edible oils) took place as did the manufacture of personal hygiene products and beauty aids (such as shampoos, deodorizers, perfumes and cosmetics).}




Cultural Mores and Technological Innovation


Cultural preferences also impelled technological innovations. During the rational period, considerable attention was paid to human psychological processes. The analysis of moods and emotions led to elaborate theories on the role of color and design in inducing psychological well-being. Treatises on art and architecture emphasized the importance of color. As a result, the use of color in decorating household artifacts, textiles, furniture, and public and private dwellings became widely prevalent and a matter of conscious choice.




Discoveries concerning the manufacture and application of natural and artificial dyes quickly followed. Block printing, tie and dye, and other textile-dyeing techniques were popularized. The use of mordents in color-fast dyeing of textiles became known as did the knowledge of lacquers that could be applied to wood or leather. Paints that could be used on different building materials were developed and elaborate techniques were employed to prevent fading and loss of color during the heavy monsoons. (It is remarkable that paintings in the Ajanta caves have survived almost 1500 years, but what is even more noteworthy is how the paint on some of the exterior sections of Ellora's temples has survived 1200 years. The richness of color in well-preserved Indian miniatures continues to amaze and astonish. It may be noted that for many centuries, color-fast dyes made up an important component of India's exports, and export of these to ancient Rome has been documented in Roman records)




State Support of Technology


A notable aspect of technological progress in India was it's dependence on state support. Without the support of a technologically inclined nobility, without grants from the royal treasuries, many of the technological developments that took place in the field of water-management, construction and metallurgy simply would not have taken place. Progress in astronomy also benefited from active state support.

Thursday, January 8, 2009

The Bhagavad Gita

The Bhagavad Gita is an excerpt from the Mahabharata, the world's longest poem. Many consider it to be the most important of all the texts of the Upanishad period. It was composed some time between 300 BC and AD 300.

The deity said, you have grieved for those who deserve no grief . . . Learned men grieve not for the living nor the dead. Never did I not exist, nor you, nor these rulers of men; nor will any one of us ever hereafter cease to be. As in this body, infancy and youth and old age come to the embodied self, so does the acquisition of another body; a sensible man is not deceived about that. The contacts of the senses, O son of Kunti! which produce cold and heat, pleasure and pain, are not permanent, they are ever coming and going. Bear them, O descendant of Bharata! For, O chief of men! that sensible man whom they (pain and pleasure being alike to him) afflict not, he merits immortality. There is no existence for that which is unreal; there is no non-existence for that which is real. And the correct conclusion about both is perceived by those who perceive the truth. Know that to be indestructible which pervades all this . . . He who thinks it [1] to be the killer and he who thinks it to be killed, both know nothing. It kills not, is not killed. It is not born, nor does it ever die, nor, having existed, does it exist no more. Unborn, everlasting, unchangeable, and primeval, it is not killed when the body is killed. O son of Pritha! how can that man who knows it thus to be indestructible, everlasting, unborn, and inexhaustible, how and whom can he kill, whom can he cause to be killed? As a man, casting off old clothes, puts on others and new ones, so the embodied self, casting off old bodies, goes to others and new ones . . . It is everlasting, all-pervading, stable, firm, and eternal. It is said to be unperceived, to be unthinkable, to be unchangeable. Therefore, knowing it to be such, you ought not to grieve. But even if you think that it is constantly born and constantly dies, still, O you of mighty arms! you ought not to grieve thus. For to one that is born, death is certain; and to one that dies, birth is certain . . . This embodied self, O descendant of Bharata! within every one's body is ever indestructible. Therefore you ought not to grieve for any being. Having regard to your own duty also, you ought not to falter, for there is nothing better for a Kshatriya[2] than a righteous battle. Happy those Kshatriyas, O son of Pritha! who can find such a battle . . . an open door to heaven! But if you will not fight this righteous battle, then you will have abandoned your own duty and your fame, and you will incur sin . . . Your business is with action alone, not by any means with fruit. Let not the fruit of action be your motive to action. Let not your attachment be fixed on inaction. Having recourse to devotion . . . perform actions, casting off all attachment, and being equable in success or ill-success; such equability is called devotion . . . The wise who have obtained devotion cast off the fruit of action, and released from the shackles of repeated births, repair to that seat where there is no unhappiness . . . The man who, casting off all desires, lives free from attachments, who is free from egoism and from the feeling that this or that is mine, obtains tranquility. This, O son of Pritha! is the Brahmic state. Attaining to this, one is never deluded, and remaining in it in one's last moments, one attains the Brahmic bliss. [3] . . .

I have passed through many births, O Arjuna! and you also. I know them all, but you, O terror of your foes! do not know them. Even though I am unborn and inexhaustible in my essence; even though I am lord of all beings, still I am born by means of my delusive power. Whensoever, O descendant of Bharata! piety languishes, and impiety is in the ascendant, I create myself. I am born age after age, for the protection of the good, for the destruction of evil-doers, and the establishment of piety . . . The fourfold division of castes was created by me according to the appointment of qualities and duties . . . The duties of Brahmins, Kshatriyas, and Vaisyas, and of Sudras, too, O terror of your foes! are distinguished according to the qualities born of nature. Tranquility, restraint of the senses, penance, purity, forgiveness, straightforwardness, also knowledge, experience, and belief in a future world, this is the natural duty of Brahmins. Valor, glory, courage, dexterity, not slinking away from battle, gifts, exercise of lordly power, this is the natural duty of Kshatriyas. Agriculture, tending cattle, trade, this is the natural duty of Vaisyas. And the natural duty of Sudras, too, consists in service. Every man intent on his own respective duties obtains perfection. Listen, now, how one intent on one's own duty obtains perfection. Worshiping, by the performance of his own duty, him from whom all things proceed, and by whom all this is permeated, a man obtains perfection. One's duty, though defective, is better than another's duty well performed. Performing the duty prescribed by nature, one does not incur sin. O son of Kunti! one should not abandon a natural duty though tainted with evil; for all actions are enveloped by evil, as fire by smoke. One who is self-restrained, whose understanding is unattached everywhere, from whom affections have departed, obtains the supreme perfection of freedom from action by renunciation. Learn from me, only in brief, O son of Kunti! how one who has obtained perfection attains the Brahman, which is the highest culmination of knowledge. A man possessed of a pure understanding, controlling his self by courage, discarding sound and other objects of sense, casting off affection and aversion, who frequents clean places, who eats little, whose speech, body, and mind are restrained, who is always intent on meditation and mental abstraction, and has recourse to unconcern, who, abandoning egoism, stubbornness, arrogance, desire, anger, and all belongings, has no thought that this or that is mine, and who is tranquil, becomes fit for assimilation with the Brahman.
[1] The atman or Brahman, that is, the individual soul and Being or Ultimate Reality.
[2] A member of the warrior caste.
[3] Release from the cycles of birth and death by achieving oneness with Brahman.

Monday, December 22, 2008

The Vedas

The most ancient sacred literature of Hinduism is called the Vedas. This collection of hymns, poems, and ceremonial formulas represent the beliefs of several Aryan tribes. Initially the Vedas were considered so sacred that they were only transmitted orally from one generation of brâhmans to the next. The passages of the Vedas were eventually written in Sanskrit, we believe, near the end of the third century BC, and primarily consist of four collections called the Rig-Veda, the Sama-Veda, the Yajur-Veda, and the Atharva-Veda. Collectively, these are referred to as the Samhitas.


The first three Samhitas were used in the Vedic period by the priestly class as ritual handbooks. Containing 1,028 poetic hymns, the Rig-Veda was used by the hotri who called on the gods by reciting the hymns aloud. The hymns vary in style and length, and praise a pantheon of gods. Although Indra, the god of war and weather, is the most frequently mentioned, there appears to be no hierarchy. Agni, the god of fire, is the second most prominently mentioned deity. The Sama-Veda consisted of various portions taken from the Rig-Veda and were utilized by the udgatri chanters. The Yajur-Vedas was used by the adhvaryu priests. This work contains specific sacrificial formulas which were recited during that form of ceremony.


The final Veda, the Atharva-Veda, is attributed to a sage, or rishi, named Atharvan, and consists of a number of hymns and magical incantations. Some scholars believe that this scripture may have originated with the original pre-Aryan culture of indigenous peoples, and because it deviated form the other Vedas, it was not at first readily accepted. Eventually it too was adopted as a ritual handbook by the Brahmans, the higest class of priests.


Although the Rig-Veda is still considered the most important of these ancient texts, it was still never very popular. Much of this comes from the fact of its composition by and for a religious aristocracy. In contrast, the Atharva-Veda, compiled perhaps as late as 500 BC, frequently refers to many lesser functional gods considered useful in the daily lives and simple rituals of the ordinary Aryan that did not need the mediation of priests.

Monday, December 15, 2008

The Vedic Age: Part-II

Between 800 and 400 BC, significant changes began to occur in the lives of religious peoples in all of the civilized parts of the world. Independent thinkers, discontented with the traditional explanations of the cosmic order, and specifically man's place within that cosmos, began to develop new, more simple and rational, doctrines. Scholars frequently refer to this period as the Axial Age. There is, however, no solid explanation why such dramatic religious changes would occur throughout the world during the same period.

Prominent among the rising sages were the Greek philosophers led by Socrates. In Persia, Zarathustra extracted the elements of the supernatural from religion and created a new faith, Zoroastrianism. In China, Confucius devoted himself to teaching moral persuasion and good government, which would become the mainstay of Chinese thought. The Hebrew prophets formulated a monotheistic religious tradition notably different from the polytheistic religions of Greece, China, Mesopotamia, and India. While all of this was happening in the rest of the world, kshatriya ascetics, throughout India, began to challenge the proliferation of brahmin ritual that personified the Aryan religion of the Vedic Age.

During this time, the Vedas were still held in high regard, but this new generation of seekers sought a more enlightened meaning to life. This period is commonly referred to as the Vedantic Age. The collection of teachings generated by the ascetics who meditated on the mysteries of human existence became known as the Upanishads, and the seekers who produced the writings were called Upanishads, which literally means "sitting near" the gurus. Over a hundred Upanishads have survived, but only a dozen, or so, are considered authentic. To lend credibility to the teachings, they were invariably compiled as appendages to the Vedas. Vedanta, then, means the "end of the Vedas." In this respect, the Vedas are considered the foundation of the faith while the Upanishads are considered the vehicle whereby the devotee may attain enlightenment as to the nature of god and man's role in the cosmos.

Scholars continue to debate over the beginning of Hinduism. Some insists that this tradition began with the Indus civilization and its proto-Shiva personified by the horned god. Others point to the development of the Aryan religion of the Vedic Age as the genesis of the Hindu tradition. Still others point to the Vedantic Age, with the development of karma (deed), and the doctrine of samsara or the transmigration of birth and rebirth, as the fundamental beginning. Unfortunately, unlike many other religions, Hinduism can not be attributed to the teachings of any single individual. This sort of ambiguity naturally lends itself to debate and speculation.

Although we are unable to accurately date the beginning of Hinduism, we can point to the Vedantic Age as the period in Indian history where the Hindu religious tradition began to solidify. The principles of karma and samsara directly appealed to a populace caught in the stranglehold of the rigidity of the caste system. In this respect, one's deeds in the present life would directly effect their future as the soul passes form life to life.

Interestingly, the Upanishads, nor the thinkers reponsible for the new orthodoxy of the Hindu religion, ever directly challenged the Vedic beliefs, the existing gods, or the practice of sacrifice. Instead, a quiet transformation gradually occurred that formulated a new system of thought that became the cornerstone of Hinduism. Increasingly, the common people directed their faith toward lesser deities that filled their specific needs. Rising to the top of the nonexistent hierarchy of the gods, the religious practices, although still based in the Vedic scripture, decidedly shifted from Indra and Varuna to the two current sects of Hinduism which worship Vishnu and Shiva.

Friday, December 12, 2008

The Vedic Age: Part-I

What little we know of the Vedic Age comes from the Rig-Veda. By the time the oral tradition of the Aryan religion was comitted to Sanskrit, however, some of the gods mentioned had already begun to lose their importance. Nevertheless, The Rig-Veda represented a blend of beliefs held by several Aryan tribes.

Each of the gods, of the Vedic Period, had a primary function, or Vrata. Usually these functions were closely connected to the forces of nature such as light, fire, and heaven which in turn followed the cosmic order (rta) of the universe. The demons of darkness and chaos, headquartered under the earth, arrayed their power against the righteousness of the gods. In this dualistic approach, the demons sought to disrupt the system of nature, therefore practicing anrta. During a later period, rta gave way to the concept of dharma, which could be translated as "virtue."

Although the deities of the Rig-Veda are not organized hierarchically, each could, in its own right, be looked upon as the supreme god. Nevertheless, Indra, the god of war and weather, receives the most attention in the ancient Vedic text, and is frequently referred to as the eka deva, or "one god." According to the Rig-Veda (6.7), creation began once Indra slew Vritra, the serpent demon, who had locked up the waters necessary for human existence in mountain caves. With the waters now released, he then placed the sun in the sky thus establishing the cosmic order (rta) under the god Varuna.

Varuna, then, sits in the palace of heaven and oversees the world below. As the guardian of the moral order, both earthly and cosmic, Varuna punishes the sinner with disease, or for all time by condemning them to the House of Clay following death. Aryans who practiced right deeds, or performed the proper ritual would forever celebrate happiness after death. Varuna is aided in his efforts by many spies who fly through the cosmos at his command.

Less important than Indra, but still held in high regard among the numerous deities of the Aryan religion, was Agni, the fire god. Agni descends from the darkened clouds as lightning, shines on the world as the sun, and manifests in the flame of the sacrifice. Through the sacrificial offering, Agni served as the intermediary between the gods and man, and the correct performance of this important ritual could beneficially reward the devotee. Rituals based on the fire sacrifice could be as personal as dumping clarified butter in the family hearth, to the production of soma juice. As part of the sacrificial ritual, parts of the soma plant were pressed between stones, mixed with milk, and filtered through a sheepskin. An hallucinogen, soma consumed during sacrifices supposedly produced a sense of superhuman strength and visions of the gods. Soma would later become the moon god.

The cosmic order of the Aryan universe remained fairly simple. The heavens served as the residence of the major gods and the souls of the righteous. The region between heaven and earth was called the antariksa. This region, where the birds flew and the clouds crossed the sky, was also home to the demigods. Below the earth, in the darkness of the House of Clay, dwelled the spirits of the unrighteousness and the demons that sought to disrupt rta. The concept of birth and rebirth had not yet become part of the Indian cosmology that would later be indicative of all Indian religion.

Religion during the Vedic Age revolved around the sacrifice. Within the home, the patriarch of the family daily sacrificed at the domestic hearth while the brahmans performed great rituals slaughtering numerous animals to the gods. In each case, the idea was to communicate with the gods who would descend from the heavens granting the devotees health, happiness, and success. Over time, these rituals became so complex that the brahmans, who knew the correct ritual, became indispensable.

Wednesday, December 10, 2008

The Pre-Vedic age

Very little is known about the religion of the Indus civilization because no written records exit. There is, however, an assumption that parts of the Harappan tradition were held in common by ancient religions of the Middle East as well as the later Hinduism. Prominent among the evidence discovered are the many seals discovered at the sites along the Indus River, as well as in Mesopotamia. Some of these seals clearly indicate the sacredness of the bull which later became a common tradition in Hinduism. Other features are the horned god. These seals have two faces in profile, and one facing forward. The figure is surrounded by a tiger, an elephant, a rhinoceros, and a buffalo. His legs are bent with his feet pressed together in a yoga position which has led some to believe that this god is most likely a proto-Shiva. Shiva is the three-faced Hindu god of death, destruction, and fertility.




Some of these sites have also yielded terra-cotta figurines. Similar, in many respects, to evidence discovered in Egypt and Iran, some of these figurines are of broad-hipped pregnant-looking females. Representative of the Great Mother or nature, these types of deities, as well as the bull, are common among early agricultural societies of Eurasia.




Excavations of Indus cities have not revealed any buildings that can positively be identified as temples. No large statues or monumental sculptures, similar to those found in Egypt, have been discovered. This lack of temples and statuary has resulted in the belief that the focus of religious life was primarily centered in the home. Anthropologists are relatively certain that the peoples of the Indus civilization emphasized ritual purity. Much of this is evidenced by the presence of drainable baths in most of the residences, as well as a great bath or pool surrounded by a pillared hall with small cell-like rooms. Scholars have surmised that washing and bathing were integral to the preservation of purity and that cleanliness was considered necessary to ward off evil spirits.




Similar to the culture of Egypt, it appears that the Indus religion recognized some type of life after death. Unlike later Indians, who practiced cremation, this civilization carefully buried their dead with their heads facing north and the feet pointing south. Included in the graves were pottery jars containing food and weapons for use in the afterlife.

Tuesday, December 2, 2008

An Overview of Ancient India.

Archaeological excavations have brought to light the remains of a highly developed urban civilisation in ancient India that stretched across approximately 1520 kilometres, extending from the area on the upper Sutlaj in contemporary Punjab to Lothal in Gujarat. Historians are of the view that this civilisation flourished in the third millennium before the birth of Christ.




It is known by the name of the two of its great cities - Harappa and Mohenjodaro situated on the left and the right bank respectively of the river Ravi in Punjab. The two cities were built on a similar plan - houses constructed with standard burnt bricks arranged in squares, along roads intersecting at right angles. The houses varied in size but were all based on the same plan - a small courtyard surrounded by rooms with entrances in side alleys, often multistoried with no windows opening out to the street. The houses had bathrooms and the drains flowing out were connected to covered sewers with soak-pits. This unique sewage system is amongst the most impressive achievements of the Indus people and sets them apart from all other ancient civilisations.




By about 1500 B.C. an important change began to occur in the northern half of the Indian sub-continent. The Harappa culture in the Indus Valley had declined by about 1750 B.C, and the stage was being set for a second and more continuous urbanisation in the Ganges Valley.





The earliest literary source that sheds light on India's past is the Rig Veda. It is difficult to date this work with any accuracy on the basis of tradition and ambiguous astronomical information contained in the hymns. It is most likely that Rig Veda was composed between 1,500 B.C. and 1,000 B.C.The people who composed these evocative hymns to nature and celebrated life exuberantly referred to themselves as Aryas usually anglicised as Aryan meaning 'superior'.




The 6th Century B.C. was a period of great ferment in India. The kingdom of Magadh -one of the 16 great janapadas - polities - had established paramountcy over other kingdoms of the Ganges Valley. This was the time when Buddhism and Jainism emerged as popular protestant movements to pose a serious challenge to Brahmanic orthodoxy. The fluid political situation, made it possible for Chandragupta Maurya (reign - 322 - 298 B.C.) to oust the oppressive ruler of Magadh and found his own dynasty.




The most famous of the Mauryas is Ashoka the Great (reign - 273 - 232 B.C.). He extended the boundaries of his empire considerably - stretching from Kashmir and Peshawar in the North and Northwest to Mysore in the South and Orissa in the East - but his fame rests not so much on military conquests as on his celebrated renunciation of war. After witnessing the carnage at the battle field of Kalinga (269 B.C.) in Orissa, Ashoka resolved to dedicate himself to Dhamma - or righteousness.




Ashoka died around 232 B.C. and the empire began to disintegrate under weak successors. Pushyamitra Shunga, a Brahmin general usurped the throne after slaying the last Maurya king and presided over a loosely federal polity. In subsequent centuries India suffered a series of invasions, and in the absence of a strong central authority, often fell under the spell of foreign rulers - Indo Bactrians, the Sakas and others.


For the next four hundred years, India remained politically disunited and weak. It was repeatedly raided and plundered by foreigners. Stability was restored by the Guptas. Exploits of Samudra Gupta (reign - 335 - 380 A.D.) - an illustrious ruler of this line - are recorded on a stone inscription at Allahabad.


It was Chandra Gupta II (reign - 380 - 412 A.D.) - Samudra Gupta's successor - who finally defeated the Sakas and re-established a strong central authority. His reign registered the high watermark in Indian culture. His accomplishments in war and peace were glorious enough for him to claim the title Vikramaditya - the resplendent, great and good king of legends. Fa-hien, a Chinese traveller who was in India from 399 - 414 A.D. has left an interesting account of contemporary India. This age of peace and prosperity witnessed an unprecedented flowering of art, literature and the sciences.




Kalidas, the famous Sanskrit poet and dramatist, author of Abhijnana Shankuntalam, Kumarsambhavam and Meghadutam is believed to have adorned the Gupta court. Mathematicians like Aryabhatta and astronomers like Varahmihir lived during this period. The dazzling wall paintings of Ajanta too are traced back to this era. This period also saw the beginning of Hindu temple architecture.




The twilight of the Gupta Empire saw the setting in of decay. Powerful feudal governors in the provinces declared their independence. Trade and commerce suffered and social evils crept in. There was only a brief afterglow in the time of Harshavardhan (reign - 604 - 647 A.D.) - of Kannauj - who is famous for his philanthrophy and patronage of Buddhism. Himself an accomplished writer, he encouraged eminent dramatists like Bana. A Chinese traveller Huen-tsang visited India from (629 - 645 A.D.) during the rule of Harshavardhan. His account gives us an opportunity to note the changes that had taken place in the lives of the Indian people since the days of the Guptas.




In the Deccan, the Cholas ruled over what today are the districts of Thanjavur and Tiruchirapally. In the 2nd Century B.C. a Chola prince conquered Sri Lanka. The Pandyas reigned around present day Tirunelvelli and Madurai. A Pandyan king sent an ambassador to the court of the Roman emperor Augustus in first Century B.C. The territory under the Cheras was what constitutes the present day central and northern Kerala.


Pallavas of Kanchi rose to prominence in the 4th Century A.D. and ruled unchallenged for about four hundred years. The Nayanar and Alvar saint poets belong to this period. The gemlike shore temples at Mahabalipuram date to this period.

The Cholas overthrew the Pallavas in the 9th Century and regained political primacy in south India. The exquisitely crafted Chola bronzes - the resplendent Natraja - the Dancing Shiva - have introduced the world to the glory of the Cholas. The tide of political fortunes turned once again in the 13th Century to make the Pandyas dominant. Their kingdom became a great centre of international trade. Art, literature and culture flourished under generous patronage. The 15th Century saw the decline of the Pandyas.


Foreign invasions had little impact on the life in southern India and this region remained unaffected by political upheavals that convulsed the north.

Tuesday, November 25, 2008

Networking Questions with answers:Part-III

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

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

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

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

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

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

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

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

49. Expand IDEA.
IDEA stands for International Data Encryption Algorithm.

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

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

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

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

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

55. 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).

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

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

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

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

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

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


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

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

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

The End!

Thursday, November 20, 2008

Networking Questions with answers:Part-II

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

22. What are the types of Transmission media?
Signals are usually transmitted over some transmission media that are broadly classified in to two categories.
a) 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.

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

24. 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).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

cont-

Wednesday, November 12, 2008

Networking Questions with answers.Part-I

These are some of the widely asked networking questions that I gathered from the net.

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

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

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

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

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

6. 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"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

cont-

Saturday, November 8, 2008

My day cont-part II The Thriller!

Uhh,cant believe you are still reading.Very well, go ahead, be my fan.

So where were we...yup at my workplace.
I hate this part of the day so bad.Makes me feel so exposed to the deadliest enemy ever-My professor!

I run for the lift ,but it was already on its way.I chase it down to the second floor,only to find that I'am already there at my destination.sigh
Second floor it is;the creepiest place of the electrical department of IIT.I sneak from behind the wall to get a glimpse of the end."High Voltage" it reads.Ye thats where I work, or lets assume I do.heh

The most jobless job I've ever been in, and I still remain undercover :P.Finding the corridor clear I pull off my earplugs,gather all the courage left inside and start walking towards the end,.chin down,hoping the devil doesnt catch me coming late red handed.
Phew that was close,I finally reach the end, but thats not just it.I have to cross the devils lair to reach my room-"My professors lobby".This is called living hell.

Do or die situation.The chances of my survival-1 outta 3.
1.I stay, I get caught when he comes out.
2.I walk past his lobby and he sees, I still get caught.
The punishment "where are the results??".And I would be made to sit and whine forever unless I showed him what he expects. God knows what the devil expects!
Man but I just love working here unless I get caught in his sight.heh
3.My only chance of survival!-To get to the other side unnoticed.

Hm..very bleak chance indeed.Just then this idea pops up in my mind.
I go to the other end of the lab where they store the components.Grab a big cylinder which looks like a fire extinguisher.Shit its heavy.I turn in over and it reads"14kOhm".
Never seen a resistor this big! Nevermind,when was the last time I handled one,heh,technology develops so rapidly I guess.
I held it in front and just hurried past the lobby.The professor did indeed see me and assumed that I was deeply involved in my work! Yipee.
Din lives to fight yet another day.lol
Everyone had arrived ahead of me.They always did.I could see cold stares piercing me,as I walked past each room,cursing me for having escaped yet again.I smirk back at them with an evil look and finally enter my room.




Sunday, November 2, 2008

INTERVIEW QUESTIONS & ANSWERS FROM C, C ++ part-VI

What is the handle class?

A handle is a class that maintains a pointer to an object that is programmatically accessible through the public interface of the handle class.

Explanation:In case of abstract classes, unless one manipulates the objects of these classes through pointers and references, the benefits of the virtual functions are lost. User code may become dependent on details of implementation classes because an abstract type cannot be allocated statistically or on the stack without its size being known. Using pointers or references implies that the burden of memory management falls on the user. Another limitation of abstract class object is of fixed size. Classes however are used to represent concepts that require varying amounts of storage to implement them.

A popular technique for dealing with these issues is to separate what is used as a single object in two parts: a handle providing the user interface and a representation holding all or most of the object’s state. The connection between the handle and the representation is typically a pointer in the handle. Often, handles have a bit more data than the simple representation pointer, but not much more. Hence the layout of the handle is typically stable, even when the representation changes and also that handles are small enough to move around relatively freely so that the user needn’t use the pointers and the references

What is a protocol class?

An abstract class is a protocol class if:-
It neither contains nor inherits from classes that contain member data, non-virtual functions, or private (or protected) members of any kind.It has a non-inline virtual destructor defined with an empty implementation,all member functions other than the destructor including inherited functions, are declared pure virtual functions and left undefined.

What is a container class? What are the types of container classes?

A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.

What is an orthogonal base class?

If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes operate in different dimensions and do not interfere with each other in any way. The same derived class may inherit such classes with no difficulty.

Define precondition and post-condition to a member function.

Precondition:-A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fails to hold.
For example, the interface invariants of stack class say nothing about pushing yet another element on a stack that is already full. We say that isful() is a precondition of the push operation.

Post-condition:-A post-condition is a condition that must be true on exit from a member function if the precondition was valid on entry to that function. A class is implemented correctly if post-conditions are never false.
For example, after pushing an element on the stack, we know that isempty() must necessarily hold. This is a post-condition of the push operation.

What is class invariant?

A class invariant is a condition that defines all valid states for an object. It is a logical condition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must be preserved under all operations of the class. In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class.

Differentiate between the message and method.

Message:- Objects communicate by sending messagesto each other.A message is sent to invoke a method.

Method:- Provides response to a message.It is an implementation of an operation.

What is a dangling pointer?

A dangling pointer arises when you use the address of an object after its lifetime is over.
This may occur in situations like returning addresses of the automatic variables from a function or using the address of the memory block after it is freed.

When does a name clash occur?

A name clash occurs when a name is defined in more than one place. For example., two different class libraries could give two different classes the same name. If you try to use many class libraries at the same time, there is a fair chance that you will be unable to compile or link the program because of name clashes.

Differentiate between a template class and class template?

Template class:-A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.

Class template:-A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.

What problem does the namespace feature solve?

Multiple providers of libraries might use common global identifiers causing a name collision when an application tries to link with two or more such libraries. The namespace feature surrounds a library’s external declarations with a unique namespace that eliminates the potential for those collisions.

This solution assumes that two library vendors don’t use the same namespace identifier, of course.

What is the Standard Template Library?

A library of container templates approved by the ANSI committee for inclusion in the standard C++ specification.
A programmer who then launches into a discussion of the generic programming model, iterators, allocators, algorithms, and such, has a higher than average understanding of the new technology that STL brings to C++ programming.

What is an explicit constructor?

A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction.

What is a mutable member?

One that can be modified by the class even when the object of the class or the member function doing the modification is const.

Understanding this requirement implies an understanding of C++ const, which many programmers do not have. I have seen large class designs that do not employ the const qualifier anywhere. Some of those designs are my own early C++ efforts. One author suggests that some programmers find const to be such a bother that it is easier to ignore const than to try to use it meaningfully. No wonder many programmers don’t understand the power and implications of const. Someone who claims to have enough interest in the language and its evolution to keep pace with the ANSI deliberations should not be ignorant of const, however.

When is a template a better solution than a base class?

When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the genericity) to the designer of the container or manager class.
Prior to templates, you had to use inheritance; your design might include a generic List container class and an application-specific Employee class. To put employees in a list, a ListedEmployee class is multiply derived (contrived) from the Employee and List classes. These solutions were unwieldy and error-prone. Templates solved that problem.

Explain the ISA and HASA class relationships. How would you implement each in a class design?

A specialized class “is” a specialization of another class and, therefore, has the ISA relationship with the other class. An Employee ISA Person. This relationship is best implemented with inheritance. Employee is derived from Person. A class may have an instance of another class. For example, an employee “has” a salary, therefore the Employee class has the HASA relationship with the Salary class. This relationship is best implemented by embedding an object of the Salary class in the Employee class.

The answer to this question reveals whether the applicant has an understanding of the fundamentals of object- oriented design, which is important to reliable class design.
There are other relationships. The USESA relationship is when one class uses the services of another. The Employee class uses an object (cout) of the ostream class to display the employee’s name on the screen, for example. But if the applicant gets ISA and HASA right, you don’t need to go any further.

What is a virtual destructor?

The simple answer is that a virtual destructor is one that is declared with the virtual attribute.
The behavior of a virtual destructor is what is important. If you destroy an object through a pointer or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be complete.

When should you use multiple inheritance?

There are three acceptable answers: “Never,” “Rarely,” and “When the problem domain cannot be accurately modeled any other way.” There are some famous C++ pundits and luminaries who disagree with that third answer, but I will accept it.

Let’s digress to consider this issue lest your interview turn into a religious debate. Consider an Asset class, Building class, Vehicle class, and CompanyCar class. All company cars are vehicles. Some company cars are assets because the organizations own them. Others might be leased. Not all assets are vehicles. Money accounts are assets. Real estate holdings are assets. Some real estate holdings are buildings. Not all buildings are assets. Ad infinitum. When you diagram these relationships, it becomes apparent that multiple inheritance is a likely and intuitive way to model this common problem domain. The applicant should understand, however, that multiple inheritance, like a chainsaw, is a useful tool that has its perils, needs respect, and is best avoided except when nothing else will do.

What is the difference between a copy constructor and an overloaded assignment operator?

A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.

First, the applicant must know that a copy constructor is one that has only one argument of the same type as the constructor. The compiler invokes a copy constructor wherever it needs to make a copy of the object, for example to pass an argument by value. If you do not provide a copy constructor, the compiler creates a member- by-member copy constructor for you.

You can write overloaded assignment operators that take arguments of other classes, but that behavior is usually implemented with implicit conversion constructors. If you do not provide an overloaded assignment operator for the class, the compiler creates a default member- by-member assignment operator.

This discussion is a good place to get into why classes need copy constructors and overloaded assignment operators. If the applicant discusses these with respect to data member pointers that point to dynamically allocated resources, the applicant probably has a good grasp of the problem.

What is a conversion constructor?

A constructor that accepts one argument of a different type.
The compiler uses this idiom as one way to infer conversion rules for your class. A constructor with more than one argument and with default argument values can be interpreted by the compiler as a conversion constructor when the compiler is looking for an object of your constructor’s type and sees an object of the type of the constructor’s first argument.

What is a default constructor?

A constructor that has no arguments.
If you don’t code one, the compiler provides one if there are no other constructors. If you are going to instantiate an array of objects of the class, the class must have a default constructor.

What is your reaction to this line of code?

It’s not a good practice.
Many applicants will look at you like you are nuts. They’ve never heard of this usage, and it’s never occurred to them. That’s a very good answer. Perhaps they will try to explain the behavior of the statement. Ask them to contemplate its consequences. Two quite acceptable reactions are, “Don’t do it,” and “Don’t do it unless you really know what you are doing and you are a masochist.”
A good programmer will insist that you should absolutely never use the statement if the class is to be used by other programmers and instantiated as static, extern, or automatic objects. That much should be obvious.
The code has two built-in pitfalls. First, if it executes in a member function for an extern, static, or automatic object, the program will probably crash as soon as the delete statement executes. There is no portable way for an object to tell that it was instantiated on the heap, so the class cannot assert that its object is properly instantiated. Second, when an object commits suicide this way, the using program might not know about its demise. As far as the instantiating program is concerned, the object remains in scope and continues to exist even though the object did itself in. Subsequent dereferencing of the pointer can and usually does lead to disaster. I think that the language rules should disallow the idiom, but that’s another matter. In More Effective C++ (Addison-Wesley, 1996), Scott Meyers devotes one of his items to “delete this,” implying that there are valid applications for the idiom and advancing contrived code kludges to make it seem to work better. A programmer who has read this otherwise very good book might think that the practice is acceptable. Experience leads me to disagree.

How does throwing and catching exceptions differ from using setjmp and longjmp?

The throw operation calls the destructors for automatic objects instantiated since entry to the try block.

Exceptions are in the mainstream of C++ now, so most programmers, if they are familiar with setjmp and longjmp, should know the difference. Both idioms return a program from the nested depths of multiple function calls to a defined position higher in the program. The program stack is “unwound” so that the state of the program, with respect to function calls and pushed arguments, is restored as if the calls had not been made. C++ exception handling adds to that behavior the orderly calls to the destructors of automatic objects that were instantiated as the program proceeded from within the try block toward where the throw expression is evaluated.

Applicants might think you want to hear about the notational differences between the two idioms. Let them proceed to explain the syntax of try blocks, catch exception handlers, and throw expressions. Then ask them specifically what happens in a throw that does not happen in a longjmp.

One valid reason for not knowing about exception handling is that the applicant’s experience is exclusively with older C++ compilers that do not implement exception handling. I would prefer that they have at least heard of exception handling, though. Another marginally acceptable reason is that their former supervisors and designers did not mandate and specify the use of exception handling in programs. In that case get the names of those supervisors and designers so that you can decline their applications if they should come a’knocking.

It is not unusual for C and C++ programmers to be unfamiliar with setjmp/
longjmp. Those constructs are not particularly intuitive. A C programmer who has written recursive descent parsing algorithms will certainly be familiar with setjmp/longjmp. Others might not, and that’s acceptable. In that case, they won’t be able to discuss how setjmp/longjmp differs from C++ exception handling, but let the interview turn into a discussion of C++ exception handling in general. That conversation will reveal a lot about a programmer’s understanding of C++.

How many ways are there to initialize an int with a constant?

There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.
int foo = 123;
int bar (123);
It’s acceptable when a programmer does not know about the second notation, although they should certainly know about the first one. Many old-timer C programmers who made the switch to C++ never use the second idiom, although some wise heads of C++ profess to prefer it. If your applicant is quick with the right answer, that’s a good sign.

What are the differences between a C++ struct and C++ class?

The default member and base-class access specifiers are different.
This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifiers, member functions, overloaded operators, and so on. Some of them have even written books about C++. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specifier and private base-class inheritance. Getting this question wrong does not necessarily disqualify an applicant. Getting it right is a definite plus.

Saying, “I don’t know” is definitely the wrong answer. I advance an unusual position about this. C++ programmers should at least believe that they know the differences, even when they are wrong about them. Getting it wrong is, therefore, right. You can explain the true difference in the interview and advance the programmer’s knowledge. If they disagree vociferously, you have an opportunity to observe how they handle contentious debate when they are wrong and don’t know it yet.

Explain the scope resolution operator.

It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
The answer can get complicated. However, it should start with “::”. If the programmer is well into the design or use of classes that employ inheritance you might hear a lot about overriding member function overrides to explicitly call a function higher in the hierarchy. That’s good to know, but ask specifically about global scope resolution. You’re looking for a description of C++’s ability to override the particular C behavior where identifiers in the global scope are always hidden by like identifiers in a local scope.

How do you link a C++ program to C functions?

By using the extern “C” linkage specification around the C function declarations.
Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern “C” linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions.

Another acceptable answer is “I don’t know. We never had to do that.” Merely describing what a linker does indicates that the programmer does not understand the issue that underlies the question.



Hope it helped!

Saturday, October 25, 2008

INTERVIEW QUESTIONS & ANSWERS FROM C, C ++ part-V

How do I write code that reads data at memory location specified by segment and offset?

Use peekb( ) function. This function returns byte(s) read from specific segment and offset locations in memory. The following program illustrates use of this function. In this program from VDU memory we have read characters and its attributes of the first row. The information stored in file is then further read and displayed using peek( ) function.

#include
#include

main( )
{
char far *scr = 0xB8000000 ;
FILE *fp ;
int offset ;
char ch ;
if ( ( fp = fopen ( “scr.dat”, “wb” ) ) == NULL )
{
printf ( “\nUnable to open file” ) ;
exit( ) ;
}
// reads and writes to file
for ( offset = 0 ; offset < 160 ; offset++ ) fprintf ( fp, “%c”, peekb ( scr, offset ) ) ; fclose ( fp ) ; if ( ( fp = fopen ( “scr.dat”, “rb” ) ) == NULL ) { printf ( “\nUnable to open file” ) ; exit( ) ; } // reads and writes to file for ( offset = 0 ; offset < 160 ; offset++ ) { fscanf ( fp, “%c”, &ch ) ; printf ( “%c”, ch ) ; } fclose ( fp ) ; }

How do I write code to find an amount of free disk space available on current drive?

Use getdfree( ) function as shown in follow code.

#include
#include
#include
#include

main( )
{
int dr ; struct dfree disk ;
long freesp ;

dr = getdisk( ) ;
getdfree ( dr + 1 , &disk ) ;

if ( disk.df_sclus == 0xFFFF )
{
printf ( “\ngetdfree( ) function failed\n”);
exit ( 1 ) ;
}

freesp = ( long ) disk.df_avail
* ( long ) disk.df_bsec
* ( long ) disk.df_sclus ;
printf ( “\nThe current drive %c: has %ld bytes
available as free space\n”, ‘A’ + dr, freesp ) ;
}

The functions memcmp( ) and memicmp( )

#include
#include

main( )
{
char str1[] = “This string contains some
characters” ;
char str2[] = “this string contains” ;
int result ;

result = memcmp ( str1, str2, strlen ( str2 ) ) ;
printf ( “\nResult after comapring buffer using
memcmp( )” ) ;
show ( result ) ;

result = memicmp ( str1, str2, strlen ( str2 ) ) ;
printf ( “\nResult after comapring buffer using
memicmp( )” ) ;
show ( result ) ;
}

show ( int r )
{
if ( r == 0 )
printf ( “\nThe buffer str1 and str2 hold
identical data” ) ;
if ( r > 0 )
printf ( “\nThe buffer str1 is bigger than buffer
str2″ ) ;
if ( r < 0 ) printf ( “\nThe buffer str1 is less than buffer str2″ ) ; }

How do I write code to get the current drive as well as set the current drive?

The function getdisk( ) returns the drive number of current drive. The drive number 0 indicates ‘A’ as the current drive, 1 as ‘B’ and so on. The Setdisk( ) function sets the current drive. This function takes one argument which is an integer indicating the drive to be set. Following program demonstrates use of both the functions.

#include

main( )
{
int dno, maxdr ;

dno = getdisk( ) ;
printf ( “\nThe current drive is: %c\n”, 65 + dno
) ;

maxdr = setdisk ( 3 ) ;
dno = getdisk( ) ;
printf ( “\nNow the current drive is: %c\n”, 65 +
dno ) ;
}

How do I write code that would get error number and display error message if any standard error occurs?

Following code demonstrates this.

#include
#include
#include

main( )
{
char *errmsg ;
FILE *fp ;
fp = fopen ( “C:\file.txt”, “r” ) ;
if ( fp == NULL )
{
errmsg = strerror ( errno ) ;
printf ( “\n%s”, errmsg ) ;
}
}
Here, we are trying to open ‘file.txt’ file. However, if the file does not exist, then it would cause an error. As a result, a value (in this case 2) related to the error generated would get set in errno. errno is an external int variable declared in ’stdlib.h’ and also in ‘errno.h’. Next, we have called sterror( ) function which takes an error number and returns a pointer to standard error message related to the given error number.

How do I change the type of cursor and hide a cursor?

We can change the cursor type by using function _setcursortype( ). This function can change the cursor type to solid cursor and can even hide a cursor. Following code shows how to change the cursor type and hide cursor.

#include
main( )
{
/* Hide cursor */
_setcursortype ( _NOCURSOR ) ;

/* Change cursor to a solid cursor */
_setcursortype ( _SOLIDCURSOR ) ;

/* Change back to the normal cursor */
_setcursortype ( _NORMALCURSOR ) ;
}

How do I write code to retrieve current date and time from the system and display it as a string?

Use time( ) function to get current date and time and then ctime( ) function to display it as a string. This is shown in following code snippet.

#include

void main( )
{
time_t curtime ;
char ctm[50] ;

time ( &curtime ) ; //retrieves current time &
stores in curtime
printf ( “\nCurrent Date & Time: %s”, ctime (
&curtime ) ) ;
}

How do I know how many elements an array can hold?

The amount of memory an array can consume depends on the data type of an array. In DOS environment, the amount of memory an array can consume depends on the current memory model (i.e. Tiny, Small, Large, Huge, etc.). In general an array cannot consume more than 64 kb. Consider following program, which shows the maximum number of elements an array of type int, float and char can have in case of Small memory model.
main( )
{
int i[32767] ;
float f[16383] ;
char s[65535] ;
}

Why doesn’t the following statement work?

char str[ ] = “Hello” ;
strcat ( str, ‘!’ ) ;
Ans: The string function strcat( ) concatenates strings and not a character. The basic difference between a string and a character is that a string is a collection of characters, represented by an array of characters whereas a character is a single character. To make the above statement work writes the statement as shown below:
strcat ( str, “!” ) ;

Why doesn’t the following code give the desired result?

int x = 3000, y = 2000 ;
long int z = x * y ;
Ans: Here the multiplication is carried out between two ints x and y, and the result that would overflow would be truncated before being assigned to the variable z of type long int. However, to get the correct output, we should use an explicit cast to force long arithmetic as shown below:

long int z = ( long int ) x * y ;
Note that ( long int )( x * y ) would not give the desired effect

What will be the output of the following code?

void main ()
{ int i = 0 , a[3] ;
a[i] = i++;
printf (“%d”,a[i]) ;
}
Ans: The output for the above code would be a garbage value. In the statement a[i] = i++; the value of the variable i would get assigned first to a[i] i.e. a[0] and then the value of i would get incremented by 1. Since a[i] i.e. a[1] has not been initialized, a[i] will have a garbage value.

What is an adaptor class or Wrapper class?

A class that has no functionality of its own. Its member functions hide the use of a third party software component or an object with the non-compatible interface or a non- object- oriented implementation

What do you mean by Stack unwinding?

It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.

What is a mixin class?

A class that provides some but not all of the implementation for a virtual base class is often called mixin. Derivation done just for the purpose of redefining the virtual functions in the base classes is often called mixin inheritance. Mixin classes typically don’t share common bases.

What is a concrete class?

A concrete class is used to define a useful object that can be instantiated as an automatic variable on the program stack. The implementation of a concrete class is defined. The concrete class is not intended to be a base class and no attempt to minimize dependency on other classes in the implementation or behavior of the class.

What is cloning?

An object can carry out copying in two ways i.e. it can set itself to be a copy of another object, or it can return a copy of itself. The latter process is called cloning.

What is an opaque pointer?

A pointer is said to be opaque if the definition of the type to which it points to is not included in the current translation unit. A translation unit is the result of merging an implementation file with all its headers and header files.

What sorting algos have their best and worst case times equal ?

O(nlogn) for mergesort and heap sort

What is an abstract class?

A class which cannot be Instantiated.

Static binding occurs at Compile Time,Runtime?

Both at compile and runtime.

What will a read() function do?.

A method in Input Stream.It reads a single byte or an array of bytes.Returns no of bytes read or -1 if EOF(End of file)is reached

Differentiate between a deep copy and a shallow copy?

Deep copy involves using the contents of one object to create another instance of the same class. In a deep copy, the two objects may contain ht same information but the target object will have its own buffers and resources. the destruction of either object will not affect the remaining object. The overloaded assignment operator would create a deep copy of objects.
Shallow copy involves copying the contents of one object into another instance of the same class thus creating a mirror image. Owing to straight copying of references and pointers, the two objects will share the same externally contained contents of the other object to be unpredictable.

Using a copy constructor we simply copy the data values member by member. This method of copying is called shallow copy. If the object is a simple class, comprised of built in types and no pointers this would be acceptable. This function would use the values and the objects and its behavior would not be altered with a shallow copy, only the addresses of pointers that are members are copied and not the value the address is pointing to. The data values of the object would then be inadvertently altered by the function. When the function goes out of scope, the copy of the object with all its data is popped off the stack. If the object has any pointers a deep copy needs to be executed. With the deep copy of an object, memory is allocated for the object in free store and the elements pointed to are copied. A deep copy is used for objects that are returned from a function.

What is a smart pointer?

A smart pointer is an object that acts, looks and feels like a normal pointer but offers more functionality. In C++, smart pointers are implemented as template classes that encapsulate a pointer and override standard pointer operators. They have a number of advantages over regular pointers. They are guaranteed to be initialized as either null pointers or pointers to a heap object. Indirection through a null pointer is checked. No delete is ever necessary. Objects are automatically freed when the last pointer to them has gone away. One significant problem with these smart pointers is that unlike regular pointers, they don’t respect inheritance. Smart pointers are unattractive for polymorphic code. Given below is an example for the implementation of smart pointers.

Will the inline function be compiled as the inline function always? Justify.

An inline function is a request and not a command. Hence it won’t be compiled as an inline function always.

Explanation:Inline-expansion could fail if the inline function contains loops, the address of an inline function is used, or an inline function is called in a complex expression. The rules for inlining are compiler dependent.

What is reflexive association?

The ‘is-a’ is called a reflexive association because the reflexive association permits classes to bear the is-a association not only with their super-classes but also with themselves. It differs from a ’specializes-from’ as ’specializes-from’ is usually used to describe the association between a super-class and a sub-class.
For example:Printer is-a printer.

Differentiate between a deep copy and a shallow copy?

Deep copy involves using the contents of one object to create another instance of the same class. In a deep copy, the two objects may contain ht same information but the target object will have its own buffers and resources. the destruction of either object will not affect the remaining object. The overloaded assignment operator would create a deep copy of objects.

Shallow copy involves copying the contents of one object into another instance of the same class thus creating a mirror image. Owing to straight copying of references and pointers, the two objects will share the same externally contained contents of the other object to be unpredictable

What is a parameterized type?

A template is a parameterized construct or type containing generic code that can use or manipulate any type. It is called parameterized because an actual type is a parameter of the code body. Polymorphism may be achieved through parameterized types. This type of polymorphism is called parameteric polymorphism. Parameteric polymorphism is the mechanism by which the same code is used on different types passed as parameters.