Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour

Kerala State Board New Syllabus Plus Two Economics Notes Part I Chapter 2 Theory of Consumer Behaviour.

Kerala Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour

Introduction

Those who purchase and use goods for their satisfaction are known as consumers. They want satisfying power of a commodity is known as a utility.

ആമുഖം: തന്റെ ആവശ്യങ്ങളെ തൃപ്തിപ്പെടുത്തുന്നതിനുവേണ്ടി സാധനങ്ങളും സേവന ങ്ങളും വാങ്ങുകയും ഉപയോഗിക്കു കയും ചെയ്യുന്ന വ്യക്തികളെ ഉപഭോക്താക്കൾ എന്ന് പറയുന്നു. ഉപഭോക്താവിന്റെ ആവശ്യങ്ങളെ തൃപ്തിപ്പെടുത്താനുള്ള സാധ നങ്ങളുടെ കഴിവിനെയാണ് ഉപയുക്തത എന്ന് പറയുന്നത്.

A) Consumption Bundle: Normally, a consumer purchases numerous goods and services. However, for simplicity, let us assume that the consumer purchases only two goods namely good 1 and good 2. Consumption bundle can be defined as the combination of quantities of two goods that a consumer can purchase with his limited income.

ഉപഭോഗ ബണ്ടിൽ: ഒരു ഉപഭോക്താവ് സാധാരണയായി പല സാധനങ്ങളും വാങ്ങുന്നു. എന്നാൽ വിശകലനത്തിന്റെ എളു പ്പത്തിനുവേണ്ടി ഉപഭോക്താവ് രണ്ട് സാധനങ്ങൾ മാത്രമെ വാങ്ങുന്നുള്ളു എന്നു കരുതുക. അവയെ സാധനം – 1, സാധ നം – 2 എന്നു വിളിക്കാം. രണ്ടു സാധനങ്ങളുടെ അളവുക ളുടെ സംയോഗത്തെ (combination) ഉപഭോഗ ബണ്ടിൽ എന്നു പറയുന്നു.

B) The Consumer’s Budget:
The consumer may not be in a position to purchase all goods and services at the required quantity. The consumption bundle of a consumer depends on the income of the consumer and the prices of the respective goods he wish to purchase from the market. It means that the consumer can purchase only those consumption bundles which are less than or equal to his level of income and the prices of goods he can afford to pay. Thus, a consumer’s budget indicates the available income of the consumer with which he can purchase various goods and services.

ഉപഭോക്താവിന്റെ ബഡ്ജറ്റ്: ഉപഭോക്താവിന് അയാൾ ആഗ ഹിക്കുന്ന അളവിൽ വിപണിയിൽ നിന്ന് സാധനങ്ങൾ വാങ്ങാൻ കഴിയുകയില്ല. കാരണം ഉപഭോക്താവിന്റെ ഉപഭോഗബണ്ടിലു കൾ സാധനങ്ങളുടെ വിലയേയും അയാളുടെ വരുമാന ത്തേയും ആശ്രയിച്ചിരിക്കുന്നു. അതായത്, ഉപഭോക്താവിന്റെ വരുമാനവും സാധന- സേവനങ്ങളുടെ വിലയും അനുസരിച്ച് അയാളുടെ വരുമാനത്തിന്റെ തുല്യമോ താഴെയൊ വരുന്ന ഉപ ഭോഗ ബണ്ടിലുകൾ മാത്രമെ അയാൾക്കു വാങ്ങാൻ കഴിയൂ.

C) Budget Set: It includes all bundles that are on or below the budget line.
ബജറ്റ് സെറ്റ്: ബജറ്റ് ലൈനിലോ അതിന് താഴെയോ ഉള്ള ബണ്ടിലുകൾ ബജറ്റ് സെറ്റിൽ ഉൾപ്പെടുന്നു.

D) Budget Line: Where P1 is the price of good 1 and P2 is the price of good 2.
ബജറ്റ് ലൈൻ: P1 എന്നത് ഒന്നാമത്തെ വസ്തുവിന്റെ വില യും P2 എന്നത് രണ്ടാമത്തെ വസ്തുവിന്റെ വിലയുമാണ്.

Preferences of the Consumer

The consumer opt the most appropriate consumption bundle from the budget set. Which bundle he would choose depends upon his tastes and preferences. A consumer ranks two consumption bundles as per his preference and then may choose one bundle or may be indifferent between the bundles.

ഉപഭോക്താവിന്റെ മുൻഗണനകൾ : ഒരു ഉപഭോക്താവ് അയാൾക്ക് ആവശ്യമുള്ള ഉപഭോഗ ബണ്ടിലുകൾ തെരഞ്ഞെടുക്കുന്നത് ലഭ്യ മായിട്ടുള്ള ബജറ്റ് സെറ്റിൽ നിന്നാണ്. അയാൾ ഏതു ബണ്ടിൽ തെരഞ്ഞെടുക്കുന്നു എന്നത് അയാളുടെ അഭിരുചിയും മുൻഗ ണനാക്രമവും അനുസരിച്ചായിരിക്കും. ഉപഭോക്താവ് ആദ്യം രണ്ടു ബണ്ടിലുകൽ തമ്മിൽ താരതമ്യം ചെയ്യുന്നു. അതിനുശേഷം ഏതെങ്കിലും ഒരു ബണ്ടിൽ തെരഞ്ഞെടുക്കുകയോ 2 ബണ്ടിലി നോടും നിസംഗത പുലർത്തുകയോ ചെയ്യാം.

Monotonic Preferences

If a consumer prefers to have a bundle which has more goods compared to other bundles then it is known as monotonic preference.

ഏകതാനമായ മുൻഗണനകൾ: കുറഞ്ഞ അളവുള്ള ബണ്ടിലി നേക്കാൾ കൂടുതൽ അളവുള്ള ബണ്ടിലിനോടുള്ള ഉപഭോക്താ വിന്റെ താല്പര്യത്തെ ഏകതാനമായ മുൻഗണന എന്നു വിളി ക്കുന്നു.

Indifference Curve and Indifference Map

Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour 1
The concept of indifference curve was initially developed by Edge Worth. Later on, it was modified by JR Hicsk and RGD Allen in 1939.

Indifference curve is a graphical representation of locus of points of two consumer goods which gives him the same amount of satisfaction. If two consumption bundles give the equal amount of satisfaction to the consumer, we can say that he is indifferent among the consumption bundles. The group of indifference curves available to the consumer is known as indifference map.

നിസ്സംഗതാ വകം: രണ്ടു ഉപഭോഗ ബണ്ടിലുകളും ഉപഭോക്താ വിന് തുല്യ സംതൃപ്തിയാണ് നൽകുന്നതെന്ന് കരുതുക. അതാ യത് ഈ രണ്ടു ബണ്ടിലുകൾക്കിടയിൽ ഉപഭോക്താവ് നിസ്സംഗൻ (indifferent) ആയിരിക്കും .

ഉപഭോക്താക്കൾ നിസ്സംഗരായിരിക്കുന്നതും എന്നാൽ തുല്യ സംതൃപ്തി നൽകുന്നതുമായ ഉപഭോഗ ബണ്ടിലുകളെ ഒരുമിച്ച് യോജിപ്പിച്ചുകൊണ്ട് വരയ്ക്കുന്ന വകത്തെയാണ് നിസ്സംഗതാ വകം എന്ന് പറയുന്നത്. ഉപഭോക്താവിന്റെ താല്പര്യം കാണി ക്കുന്ന നിസ്സംഗതാ വക്രങ്ങളുടെ കൂട്ടത്തെ നിസ്സംഗതാ ഭൂപടം എന്ന് പറയുന്നു.

Properties of Indifference Curve

The following are some of the major properties of indifference curve.

  1. Indifference curve slopes downward from left to right.
  2. Indifference curves are convex to the origin.
  3. Indifference curves never intersect each other.
  4. Higher indifference curves show higher levels of satisfaction.
  5. The slope of the indifference curve is negative.
  6. Indifference curves are not necessarily parallel to each other.

നിസ്സംഗതാ വക്രത്തിന്റെ സവിശേഷതകൾ

  1. നിസ്സംഗതാ വകം ഇടത്തുനിന്ന് വലത്തോട്ട് താഴേയ്ക്കു ചരി ഞഞ്ഞിരിക്കും.
  2. നിസ്സംഗതാ വകം ഉന്മധ്യമാണ്. അതിന് കോൺവെക്സ് ആക തിയാണുള്ളത്.
  3. നിസ്സംഗതാ വക്രങ്ങൾ ഒരിക്കലും പരസ്പരം ചോദിക്കില്ല.
  4. ഉയർന്ന നിസ്സംഗതാ വകങ്ങൾ ഉയർന്ന സംതൃപ്തിയെ സൂചി പ്പിക്കുന്നു.
  5. നിസ്സംഗതാ വകത്തിന്റെ ചെരിവ് നെഗറ്റീവ് ആണ്.
  6. നിസ്സംഗതാ വക്രങ്ങൾ സമാന്തരം ആയിക്കൊള്ളണമെന്നില്ല.

Budget Line

Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour 2
The equation of a budget line P1X1 + P2X2 = m
(P1 = Price of good 1, x1 = Quantity of good 1, P2 = Price of good 2, X2 = Quantity of good 2)
Horizontal intercept m/P1
Vertical intercept m/P2
Slope of the budget line \(-\frac{P_{1}}{P_{2}}\)
Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour 3

ഒരു ബജറ്റ് ലൈനിന്റെ സമവാക്യം
P1X1 + P2X2 = m
P1 = ഒന്നാമത്തെ വസ്തുവിന്റെ വില
P2 = രണ്ടാമത്ത വസ്തുവിന്റെ വില
X1 = ഒന്നാമത്തെ വസ്തുവിന്റെ അളവ്
X2 = രണ്ടാമത്ത വസ്തുവിന്റെ അളവ്
m = ഉപഭോക്താവിന്റെ വരുമാനം

Consumer’s Equilibrium

At the point E the budget line is tangent with indifference curve. It shows the consumer equilibrium.
Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour 4

ഉപഭോക്താവിന്റെ സന്തുലിതാവസ്ഥ: Point E എന്നത് ബജറ്റ് ലൈനും നിസ്സംഗതാ വകവും തമ്മിൽ tangent ആവുന്ന Point നെ കാണിക്കുന്നു. ഇത് ഉപഭോക്താവിന്റെ സന്തുലിതാ വസ്ഥ എന്ന് അറിയപ്പെടുന്നു.

Demand and its Determinants

Demand is the desire for a commodity supported by ability to pay and willingness to pay.
Demand for a commodity is determined by various factors such as

  1. Price of the commodity
  2. Price of related commodities
  3. Income of the consumer
  4. Taste and preference of the consumer

ചോദനവും അതിനെ നിർണ്ണയിക്കുന്ന ഘടകങ്ങളും: ഒരു ഉപ് ഭോക്താവിന് ഒരു സാധനം വാങ്ങാനുള്ള ആഗ്രഹത്തെയാണ് സാധാരണയായി ചോദനം അഥവാ ഡിമാന്റ് എന്ന്പ റയാറുള്ളത്. എന്നാൽ സാമ്പത്തികശാസ്ത്രത്തിൽ ആഗ്രഹം മാത്രമായാൽ ഡിമാന്റ് ആവുകയില്ല. ആഗ്രഹത്തോടൊപ്പംതന്നെ വില കൊടു ക്കാനുള്ള കഴിവും സന്നദ്ധതയും ഉണ്ടാകണം. ചുരുക്കത്തിൽ, ഒരു സാധനം വില കൊടുത്ത് വാങ്ങാനുള്ള കഴിവും സന്നദ്ധ തയും കൂടിച്ചേർന്നുള്ള ആഗ്രഹത്തെ ചോദനം എന്നു പറയുന്നു.

ചോദനത്തെ നിർണ്ണയിക്കുന്ന ഘടകങ്ങൾ

  1. സാധനത്തിന്റെ വില
  2. ബന്ധപ്പെട്ട സാധനങ്ങളുടെ വില
  3. ഉപഭോക്താവിന്റെ വരുമാനം
  4. ഉപഭോക്താവിന്റെ അഭിരുചിയും താല്പര്യങ്ങളും

Law of Demand

When other things remaining constant, an increase in price leads to fall in demand and decrease in price leads to rise in demand. This is known as law of demand.

ചോദന നിയമം: ഒരു സാധനത്തിന്റെ വിലയും ചോദനത്തിന്റെ അളവും തമ്മിലുള്ള വിപരീത ബന്ധത്തെ സൂചിപ്പിക്കുന്ന ഒന്നാണ് ചോദന നിയമം. മറ്റു ഘടകങ്ങളിൽ മാറ്റമില്ലെങ്കിൽ (സ്ഥിരമായി നിൽക്കുകയാണെങ്കിൽ) ഒരു സാധനത്തിന്റെ വില കൂടിയാൽ ചോദനം കുറയുകയും വില കുറഞ്ഞാൽ ചോദനം കൂടുകയും ചെയ്യുന്നതിനെയാണ് ചോദനനിയമം എന്ന് പറയുന്നത്.

Changes in demand

i) Expansion and contraction of demand: An increase in demand due to fall in price is known as expansion of demand. A decrease in demand due to rise in price is known as contraction of demand.

ii) Increase and decrease in demand : A rise in demand due to change in other factors is known as increase in demand. A fall in demand due to change in other factors is known as decrease in demand.
Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour 5

ചോദനത്തിലെ മാറ്റങ്ങൾ

i) ചോദനത്തിന്റെ സങ്കോചവും വികാസവും: ഒരു സാധന ത്തിന്റെ വില കൂടിയാൽ അതിന്റെ ചോദനം കുറയുന്നു. ഇതിന്റെ ഫലമായി ചോദനവകം മുകളിലേക്ക് നീങ്ങുന്നു. ഇങ്ങനെ, വില വർധിക്കുന്നതുമൂലം ചോദനത്തിന്റെ അള വിലുണ്ടാകുന്ന കുറവിനെ ചോദനത്തിന്റെ സങ്കോചം എന്നു പറയുന്നു. ചോദനവകത്തിലൂടെ താഴേക്കുള്ള മാറ്റം ഒരു സാധനത്തിന്റെ വില കുറഞ്ഞാൽ അതിന്റെ ചോദനം കൂടു ന്നു. അപ്പോൾ ചോദനവകം താഴേക്കു നീങ്ങുന്നു. ഇങ്ങനെ വില കുറയുന്നതുമൂലം ചോദനത്തിന്റെ അളവിലുണ്ടാകുന്ന വർദ്ധനവിനെ ചോദനത്തിന്റെ വികാസം എന്നു പറയുന്നു.

ii) ചോദന വർദ്ധനവും ചോദന ക്ഷയവും: വിലയേതര ഘടക ങ്ങളിലെ അനുകൂലമായ മാറ്റംമൂലം ചോദനം വർധിക്കു കയും ചോദ ന വകം വല തുഭാഗ ത്തേക്ക് മാറുകയും ചെയ്യുന്നു. ഇതിനെയാണ് ചോദനത്തിന്റെ വർദ്ധനവ് എന്നു പറയുന്നത്. ചോദനത്തെ നിർണ്ണയിക്കുന്ന വിലയേതര ഘട കങ്ങളിലെ പ്രതികൂലമായ മാറ്റം മൂലം ചോദനം കുറയു കയും ചോദനവകം ഇടത്തേയ്ക്ക് (താഴേയ്ക്ക്) മാറുകയും ചെയ്യുന്നു. ഇതിനെയാണ് ചോദനക്കുറവ് (ചോദന ക്ഷയം) എന്നുപറയുന്നത്.

Price Elasticity of Demand

The law of demand explains only about the direction of relationship between price and quantity of commodity demanded. It does not explain how much change happens in demand due to a unit change in price. Price elasticity is a measure used to explain the extent of change in quantity demanded as a result of change in price. It measures the degree of responsiveness of change in quantity demanded as a result of change in price. Thus elasticity of demand (ed) is expressed as
Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour 6
Where, eD = elasticity of demand, p = initial price, q = initial quantity, Δq = change in quantity and ΔP = change in price.

ചോദനത്തിന്റെ വില ഇലാസ്തികത: ചോദന നിയമമനുസരിച്ച് വിലയും ചോദനവും തമ്മിലുള്ള ബന്ധം വിപരീതമാണ്. അതാ യത്, വില കൂടുമ്പോൾ ചോദനം കുറയും; വില കുറയുമ്പോൾ ചോദനം കൂടും. വിലയും ചോദനവും തമ്മിലുള്ള ബന്ധത്തിന്റെ ദിശയെക്കുറിച്ച് മാത്രമാണ് ചോദനനിയമം പറയുന്നത്. വിലയിലെ മാറ്റത്തിനനുസരിച്ച് ചോദനത്തിന്റെ അളവിൽ എത്രകണ്ട് മാറ്റം ഉണ്ടാവുമെന്നതിനെക്കുറിച്ച് ചോദനനിയമം പറയുന്നില്ല. വിലയി ലുണ്ടാകുന്ന മാറ്റമനുസരിച്ച് ചോദനത്തിലുണ്ടാകുന്ന മാറ്റത്തിന്റെ
തോതിനെയാണ് വില ഇലാസ്തികത എന്ന് പറയുന്നത്. ഒരു സാധനത്തിന്റെ വിലയിലുണ്ടാകുന്ന മാറ്റത്തിനനുസരിച്ച് അതി ന്റെ ചോദനത്തിലു ണ്ടാ കുന്ന, പതികരണ ത്തിന്റെ (responsiveness) തോതിനെ ചോദനത്തിന്റെ വില ഇലാസ്തിക (ed) എന്നുപറയുന്നു.
Plus Two Microeconomics Notes Chapter 2 Theory of Consumer Behaviour 7
p = ആദ്യ വില
q = ആദ്യ അളവ്
Δq = അളവിലുള്ള മാറ്റം
Δp = വിലയിലുള്ള മാറ്റം

Methods of Measuring Elasticity

There are three methods for measuring elasticity.
They are:

  1. Percentage method
  2. Point method
  3. Expenditure method

ഇലാസ്തികത അളക്കുന്ന രീതികൾ: ചോദനത്തിന്റെ ഇലാസ്തി കത അളക്കാൻ പ്രധാനമായും 3 രീതികൾ ഉപയോഗിക്കാറുണ്ട്. അവ താഴെ പറയുന്നവയാണ്.

  1. ശതമാന രീതി
  2. പോയിന്റ് രീതി
  3. ചെലവ് രീതി

Plus Two Microeconomics Notes Chapter 1 Introduction

Kerala State Board New Syllabus Plus Two Economics Notes Part I Chapter 1 Introduction.

Kerala Plus Two Microeconomics Notes Chapter 1 Introduction

Introduction
(ആമുഖം)

The term economics is derived from the Greek word ‘Oikonomia’ which means ‘household management’. Economics emerged as a major discipline with the publication of Adam Smith’s famous book ‘An Enquiry into the Nature and Causes of the Wealth of Nations’ in 1776. Alfred Marshall, Lionel Robbins, J.M. Keynes, David Ricardo, Samuelson, etc., were the other famous economists who contributed to the development of economics.

‘ഗൃഹഭരണം’ എന്നർത്ഥമുള്ള ‘ഓയിക്കോണമിയ്’ എന്ന ഗ്രീക്ക് പദ ത്തിൽ നിന്നാണ് സാമ്പത്തിക ശാസ്ത്രം എന്ന പദം ഉത്ഭവിച്ചത്. ആദം സ്മിത്തിന്റെ ‘An Enquiry into the Nature and Causes of the Wealth of Nations’ (1776) ഗ്രന്ഥം പ്രസിദ്ധീകരിച്ചതോ ടെ യാണ് സാമ്പത്തിക ശാസ്ത്രം എന്ന ശാസ്ത്രശാഖയ്ക്ക്. പ്രചാരം ലഭിച്ചത്. സാമ്പത്തിക ശാസ്ത്രത്തിന്റെ പിതാവായ ആദം സ്മിത്തിന് പുറമെ, ആൽഫ്രഡ് മാർഷൽ, ഡേവിഡ് റിക്കാർഡോ, ജെ.എസ്. മിൽ, ജെ.എം. കെയിൻസ്, സാമുവൽസൻ തുടങ്ങി യവർ സാമ്പത്തിക ശാസ്ത്രത്തിന്റെ വളർച്ചയ്ക്ക് ഗണ്യമായ സംഭാ വനകൾ നൽകിയിട്ടുണ്ട്.

Central Problems of an Economy
(ഒരു സമ്പദ്വ്യവസ്ഥയുടെ കാതലായ പ്രശ്നങ്ങൾ)

Production, exchange and consumption are the basic economic activities. Resources are scarce and they have alternative uses. Unlimited wants and limited resources give rise to central economic problems. The central problems of an economy are:

ഉല്പാദനം, വിനിമയം, ഉപഭോഗം എന്നിവയാണ് അടിസ്ഥാന സാമ്പത്തിക പ്രവർത്തനങ്ങൾ. വിഭവങ്ങൾ ദുർലഭവും അതി നാൽ അവ തെരഞ്ഞെടുക്കലും അനിവാര്യമാണ്. മനുഷ്യന്റെ അപരിമിതമായ ആവശ്യങ്ങളും എന്നാൽ പരിമിതമായ വിഭവ ങ്ങളും ചില പ്രശ്നങ്ങളിലേക്ക് സമ്പദ്വ്യവസ്ഥയെ നയിക്കുന്നു. ഒരു സമ്പദ്വ്യവസ്ഥ അഭിമുഖീകരിക്കുന്ന അടിസ്ഥാന സാമ്പ ത്തിക പ്രശ്നങ്ങൾ ചുവടെ പറയുന്നവയാണ്.

i) What to produce and in what quantities.
എന്ത് ഉല്പാദിപ്പിക്കണം? എത്രമാത്രം?

ii) How to produce?
എങ്ങനെ ഉല്പാദിപ്പിക്കണം?

iii) For whom to produce
ആർക്കുവേണ്ടി ഉല്പാദിപ്പിക്കണം?

Production Possibility Curve
(ഉല്പാദന സാധ്യതാ വക്രം)

Production Possibility Curve (PPC) is a graphical representation of all possible combinations of two goods or services that can be produced in an economy with given level of resources and technology. It is also known as production possibility frontier (PPF). The shape of PPC is concave to the origin.

ലഭ്യമായ വിഭവങ്ങളും സാങ്കേതികവിദ്യയും പൂർണ്ണമായും വിനി യോഗിച്ചുകൊണ്ട് ഒരു സമ്പദ്വ്യവസ്ഥയ്ക്ക് ഉല്പാദിപ്പിക്കുവാൻ കഴിയുന്ന 2 സാധനങ്ങളുടെ സംയോഗങ്ങളെ യോജിപ്പിച്ചു കൊണ്ട് വരയ്ക്കുന്ന രേഖാചിത്രമാണ് ഉല്പാദന സാധ്യതാ വക്രം. ഇതിനെ ഉല്പാദന സാധ്യതാ പരിധി എന്നും വിളിക്കുന്നു. ഉല്പാ ദന സാധ്യതാ വകത്തിന്റെ ആകൃതി ഒറിജിനുമായി കോൺകേവ് ആകൃതിയിലായിരിക്കും.

Economic Systems
(സമ്പദ്വ്യവസ്ഥകൾ)

i. Economic systems are classified into Capitalist economy, Socialist system and Mixed economy.

ലോകരാജ്യങ്ങളിൽ മൂന്നുതരം സമ്പദ്വ്യവസ്ഥകളാണ് കാണപ്പെ ടുന്നത്. അവ മുതലാളിത്തം, സോഷ്യലിസം, മിശ്ര സമ്പദ്വ്യവസ്ഥ എന്നിവയാണ്.

ii. Capitalist economy/Market economy: Under this economy all the economic problems that is, what to produce, how to produce and for whom to produce will be solved through market mechanism. All the means of production are owned and operated by private individuals.

മുതലാളിത്ത കമ്പോള സമ്പദ്വ്യവസ്ഥ : അടിസ്ഥാന സാമ്പത്തിക പ്രശ്നങ്ങളായ എന്ത്ഉ ല്പാദിപ്പിക്കണം, എങ്ങനെ ഉല്പാദിപ്പി ക്കണം, ആർക്കുവേണ്ടി ഉല്പാദിപ്പിക്കണം എന്ന് തീരുമാനിക്കു ന്നത് കമ്പോളമാണെങ്കിൽ അത്തരം സമ്പദ്വ്യവസ്ഥകൾ കമ്പോള സമ്പദ്വ്യവസ്ഥ എന്ന് അറിയപ്പെടുന്നു. ഇവിടെ ഉല്പാദനഘട കങ്ങളുടെ ഉടമസ്ഥാവകാശം കൈയാളുന്നതും അതുപയോഗിച്ച് ഉല്പാദനം നടത്തുകയും ചെയ്യുന്നത് സ്വകാര്യ വ്യക്തികളാണ്.

iii. Socialist system: In a socialist system all means of production are owned and operated by the government or society.

സോഷ്യലിസ്റ്റ് സമ്പദ് വ്യവസ്ഥ : എല്ലാ ഉല്പാദനഘടകങ്ങളും കൈവശം വയ്ക്കുകയും കൈകാര്യം ചെയ്യുകയും ചെയ്യുന്നത് ഗവൺമെന്റ് ആണെങ്കിൽ അതിനെ സോഷ്യലിസ്റ്റ് സമ്പദ്വ്യവസ്ഥ എന്ന് പറയുന്നു.

Mixed economy: In a mixed economy, the public and the private sector jointly operate.

മിശ്രസമ്പദ്വ്യവസ്ഥ: സ്വകാര്യമേഖലയ്ക്കും പൊതുമേഖലയ്ക്കും സമ്പദ്വ്യവസ്ഥയുടെ ധർമ്മം ഒരുപോലെ നിർവഹിക്കാനുള്ള പങ്കുണ്ടെങ്കിൽ അതിനെ മിശ്ര സമ്പദ്വ്യവസ്ഥ എന്ന് പറയുന്നു.

Organisation of Economic Activities
(സാമ്പത്തിക പ്രവർത്തനങ്ങളുടെ സംഘാടനം)

Basic problems of an economy can be solved through the free interaction of individuals or firms in the market or through central planning. Different economic systems adopt different ways.

സമ്പദ്വ്യവസ്ഥയുടെ കാതലായ പ്രശ്നങ്ങൾ വിവിധ സമ്പദ്വ്യവ സ്ഥകൾ വിവിധ രീതിയിലാണ് പരിഹരിക്കുന്നത്.

i. Capitalist economy solve the basic problems through market mechanism.
കമ്പോള സമ്പദ്വ്യവസ്ഥയിൽ മുഖ്യ സാമ്പത്തിക പ്രശ്നങ്ങൾ പരിഹരിക്കുന്നത് വില സംവിധാനം ഉപയോഗിച്ചാണ്.

ii. Socialist economy solve the basic problems through central planning. സോഷ്യലിസ്റ്റ് സമ്പദ്വ്യവസ്ഥയിൽ കേന്ദ്രീകൃത ആസൂത്രണ ത്തിലൂടെയാണ് സാമ്പത്തിക പ്രശ്നങ്ങൾ പരിഹരിക്കുന്നത്.

iii. Mixed economy solve the basic problems through a combination of market mechanism and central planning.
മിശ്ര സമ്പദ്വ്യവസ്ഥയിൽ കേന്ദ്രീകൃത ആസൂത്രണവും വില സംവിധാനവും ഒരുപോലെ ഉപയോഗിച്ചാണ് സാമ്പത്തിക പ്രശ്നങ്ങൾ പരിഹരിക്കുന്നത്.

Positive and Normative Economics
(വാസ്തവിക സാമ്പത്തിക ശാസ്ത്രവും പ്രാമാണിക സാമ്പത്തിക ശാസ്ത്രവും)

The economic statements that deal with facts are known as positive economics. They reveal what are the economic problems.

സാമ്പത്തിക ശാസ്ത്രത്തിൽ വസ്തുതകളെക്കുറിച്ചുള്ള വിശകല നമാണ് വാസ്തവിക സാമ്പത്തികശാസ്ത്രം എന്നതുകൊണ്ട് ഉദ്ദേ ശിക്കുന്നത്. സാമ്പത്തിക പ്രശ്നങ്ങൾ എന്താണെന്ന് ഇവ വ്യക്ത മക്കുന്നു.

Normative economic statements are value judgements. They discuss how the economy should be.

സാമ്പത്തികശാസ്ത്രത്തിൽ അഭിപ്രായങ്ങളെക്കുറിച്ചുള്ള വിശക ലനമാണ് പ്രാമാണിക സാമ്പത്തികശാസ്ത്രം. ഒര സമ്പദ്വ്യവസ്ഥ എങ്ങനെ ആയിരിക്കണം എന്ന് ഇത് ചർച്ചചെയ്യുന്നു.

Microeconomics and Macroeconomics
(സൂക്ഷ്മസാമ്പത്തിക ശാസ്ത്രവും സ്ഥലസാമ്പത്തിക ശാസ്ത്രവും)

The subject matter of economics has been classified into microeconomics and macroeconomics. Microeconomics is the study of the behaviour of small units of an economy. Microeconomics is also known as price theory. Macroeconomics is the study of the economy as a whole. It studies the entire economy and its aggregates. Macroeconomics is also known as income theory.

സാമ്പത്തിക ശാസ്ത്രത്തെ സൂക്ഷ്മ സാമ്പത്തിക ശാസ്ത്രം, സ്ഥല സാമ്പത്തിക ശാസ്ത്രം എന്നിങ്ങനെ രണ്ട് ശാഖകളായി തരംതിരിച്ചിട്ടുണ്ട്. സമ്പദ് വ്യവസ്ഥയിലെ ചെറിയ യൂണിറ്റുകളെ ക്കുറിച്ച് പഠിക്കുന്ന പഠനശാഖയാണ് സൂക്ഷ്മ സാമ്പത്തിക ശാസ്ത്രം. സൂക്ഷ്മ സാമ്പത്തിക ശാസ്ത്രത്തെ വില സിദ്ധാന്തം എന്നും വിളിക്കുന്നു. സമ്പദ്വ്യവസ്ഥയെക്കുറിച്ച് മൊത്തത്തിൽ അപഗ്രഥനം നടത്തുന്ന പഠനശാഖയാണ് സ്ഥല സാമ്പത്തിക ശാസ് തം. സ്ഥല സാമ്പത്തിക ശാസ് ത ത്ത വരുമാന സിദ്ധാന്തം എന്നും വിളിക്കാറുണ്ട്.

Plus Two Chapter Wise Previous Questions and Answers Kerala

HSE Kerala Board Syllabus HSSLive Plus Two Chapter Wise Previous Questions and Answers Pdf Free Download in both English Medium and Malayalam Medium are part of Plus Two Kerala SCERT. Here HSSLive.Guru has given Higher Secondary Kerala Plus Two Chapter Wise Previous Year Important Questions and Answers based on CBSE NCERT syllabus.

BoardSCERT, Kerala
Text BookNCERT Based
ClassPlus Two
SubjectAll Subjects
ChapterPlus Two Chapter Wise Previous Questions
CategoryKerala Plus Two

Kerala Plus Two Chapter Wise Previous Year Questions and Answers

We hope the given HSE Kerala Board Syllabus HSSLive Plus Two Chapter Wise Previous Questions and Answers Pdf Free Download in both English Medium and Malayalam Medium will help you. If you have any query regarding Higher Secondary Kerala Plus Two Chapter Wise Previous Year Important Questions and Answers based on CBSE NCERT syllabus, drop a comment below and we will get back to you at the earliest.

HSSLive Plus Two

Plus Two Computer Science Notes Chapter 12 ICT and Society

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 12 ICT and Society.

Kerala Plus Two Computer Science Notes Chapter 12 ICT and Society

ICT Services

e-Governance

The integration of computers and communication technology for the benefit of government functions to the public is termed as E-Governance by this Govt can serve the public in a convenient, efficient and transparent manner.

A) Types of interactions in e-Governance
e-Governance facilitates interaction between different stakeholders in governance Government to Govemment(G2G)
Government to Citizens(G2C)
Government to Business(G2B)
Government to Employees(G2E)

B) E-Governance Infrastructure
a) State Data Centre(SDC) : It is used for providing e-Governance to Government agencies(G2G), Citizens(G2C), Business persons(G2B) by National e-Governance Plan(NeGP). The services are

b) Kerala State Wide Area Network(KSWAN): It is envisaged to be the core common network infrastructure for e-Govemance and the State Information Infrastructure^!I), connecting Thiruvananthapuram, Kochi and Calicut. It’ acts as the backbone of SI I.

c) Common Service Centre(CSC): These are the web-enabled points of the government, private and social sector services. They provide services such as Agriculture, Health, Banking, Educational, Entertainment, Commercial, Transport services for the rural citizens of India. In Kerala Akshaya centers are working as CSC.

Akshaya centres : These were launched in 2002 in the Malappuram Dist. In Kerala by the project of Kerala State Information Technology Mission(KSITM). Its aim is to provide services such as e-grants, e filing, e district, e ticketing, ration card application, Voters Id application, insurance and Banking to the peoples of Kerala.

C) Benefits of E-governance
Its main aim is to provide better service to the people at any time and place with high speed. In the modem world it is very helpful and convenient to the people.

  • It enables automation of Govt, services
  • It ensures the participation of citizens hence strengthen the democracy
  • It ensures more transparency hence eliminates corruption
  • It enhances responsibilities of various Govt. Departments
  • Its proper implementation saves time and money of the people by avoiding unnecessary visits to offices.

D) Challenges to E-Governance

  • Due to lack of e-Literacy, there is a difficulty to access the service of E-Governance.
  • High security measures are required because of possibility of cyber attack.
  • Implementation and maintenance requires huge amount and planning
  • Some people refuses to give personal information due to anxiety
  • Various Departments’ integration is needed for the efficiency and effectiveness of e- Govemance

E) Useful E-Governance websites

Address of websitePurpose / Service
vAvw.dhsekerala.gov.inThe official web site of Higher Secondary Education, Kerala
www.incometaxindia.gov.inIncome Tax Dept.
www.keralamvd.gov.inMotor Vehicles Dept, of Kerala
www.rti.gov. inWeb site of Right to Information Act
www.itmission.kerala.gov.inDept of IT mission, Kerala
www.spark.gov.inKerala Govt. Employees Service and Payroll Management
www.ceo.kerala.gov.inOfficial Web site of Election commission

E-business(electronic Business)

Providing services or running business through internet is called E business.

A) e-commerce and e-business : Both are different. E-commerce means Electronic commerce. It includes exchange of goods or services through internet that involves exchange of money whereas e-Business includes activities to run a business.

B) Electronic Payment System(EPS) : It is also called plastic money that is electronically exchanging money between two individuals or firms(buyers and sellers) in an online environment.

C) E-banking (Electronic Banking) : Through electronic channel doing all the banking activities at any time and place through the internet.

D) Advantages of e-business

  • It overcomes geographical limitations
  • It reduces the operational cost
  • It minimizes the time and cost
  • It remains open all the time
  • We can locate the product faster from a wider range of choices

E) Challenges to E-business

  • Peoples are unaware of IT applications and its uses
  • Most peoples don’t have plastic money(credit/debit card) and net banking
  • It requires high-security measurements otherwise you may lose money
  • We can’t touch or smell products through online
  • Some companies may not have proper Goods delivery service

F) Useful e-Business websites

Address of website Purpose I Service
www.irctc.in Web site of Indian Railway and Tounsm Corporation Ltd. to reserve and cancel train tickets ançi room booking
www. amazon corn Us based markeung company headquarters in Washington
www.ebay.in Largest online shopping site in India
www.Iicindia.com Website of Life Insurance Corporation of India
www.airindia.com Website of Air India to book/cancel air tickets
www.makemytrip.com website for reserving and canceling tickets for journey and room booking
www.keralartc.com Website of KSRTC to book bus tickets

E-Learning

It is the use of electronic media(lt includes text, audio, video, image, animation, etc), educational technology(lt includes Satellite TV, CD ROM, Computer Based Learning, etc) and information and communication technologies(ICT- ilt uses intranet/extranet and web-based learning) in education.

A) e-Learning tools

  • Electronic books reader (e-Books) With the help of a tablet or portable computer or any other device we can read digital files by using a s/w is called electronic books reader.
  • e-text The electronic format of textual data is called e-Text.
  • Online chat Real-time exchange of text or audio or video messages between two or more person over the Internet.
  • e-Content The data or information such as text, audio, video, presentations, images, animations etc, are stored in electronic format.
  • Educational TV channels TV channels dedicated only for the e-Leaming purpose : Eg. VICTORS (Virtual Class room Technology on Edusat for Rural Schools OR Versatile ICT Enabled Resources for Students)

B) Advantages of E-Learning :

  • It can offer variety courses to large number of students from distant location.
  • It saves journey time and money, instructor fees, etc.
  • People can enjoy e Learning with lower cost
  • It enables people to do courses conducted by national or international institutions.

C) Challenges to e Learning

  • Face to face contact between student and teachers is not possible
  • Proper interaction is limited lack of infrastructure facilities
  • Its implementation requires computer and high speed Internet
  • Pupil may not get proper motivation
  • It does not provide a real lab facility

D) Useful e Learning websites

Information Security

The most valuable to a company (An enterprise ora Bank, etc) is their data base hence it must be protected from the accidental or unauthorised access by unauthorised persons

Intellectual Property Right

Some people spend lots of money,time body and mental power to create some products such as a classical movie, album, artistic work, discoveries, invention , software, etc. These type of Intellectual properties must be protected from unauthorized access by law. This is called Intellectual Property Right (IPR).

Intellectual property is divided into two categories

  • Industrial Property
  • Copyright

A) Industrial property: It .ensures the protection of industrial inventions, designs, Agricultural products etc from unauthorized copying or creation or use. In India this is done by Controller of Patents Designs and Trademarks.

Patents : A person or organization invented a product or a creation can be protected from unauthorized copying or creation without the permission of the creator by law. This right is called Patent. In India the validity of the right is up to 20 years. After this anybody can use freely.

Trademark : This is a unique, simple and memorable sign to promote a brand and hence increase the business and goodwill of a company. It must be registered. The period of registration is for 10 years and can be renewed. The registered trademark under Controller General of Patents Design and Trademarks cannot use or copy by anybody else.

Industrial designs : A product or article is designed so beautifully to attract the customers. This type of designs is called industrial design. This is a prototype and used as a model for large scale production.

Geographical indications: Some products are well known by the place of its origin. Kozhikkodan Halwa, Marayoor Sharkkara (Jaggery), Thirupathi Ladoo, etc are the examples.

B) Copyright: The trade mark is ©, copy right is the property right that arises automatically when a person creates a new work by his own and by Law it prevents the others from the unauthorized or intentional copying of this without the permission of the creator for 60 years after the death of the author.

Infringement (Violation)

Unauthorized copying or use of Intellectual property rights such as Patents, Copy rights and Trademarks are called intellectual property lnfringement(violation). It is a punishable offence.

Patent Infringement: It prevents others from the unauthorized or intentional copying or use of Patent without the permission of the creator. Piracy: It is the unauthorized copying, distribution and use of a creation without the permission of the creator. It is against the copy right act and hence the person committed deserve the punishment.

Trademark Infringement: It prevents others from the unauthorized or intentional copying or use of Trademark without the permission of the creator.

Copy right Infringement: It prevents others from the unauthorized or intentional copying or use of Copy right without the permission of the creator.

Cyberspace

EarlierTraditional communication services such as postal service(Snail mail) are used for communication. It is a low speed and not reliable service. In order to increase the speed Telegram Services were used. Its speed was high but it has lot of limitations and expensive too. Later telephones were used for voice communication. Nowadays telephone system and computer system are integrated and create’a virtual(un real) environment. This is called cyber space. The result for this integration is that tremendous speed and it is very cheap. The various departments of Govt, are providing speed, reliable and convenient online service hence increase the productivity. Online shopping, Online banking, Online debate, Online Auction etc. are the various services offered by the Internet.

Through this one can transfer funds from our account to another account, hence one can pay bills such as telephone, electricity, purchase tickets(Flight, Train, Cinema, etc). As much as Cyber Space helps us that much as it gives us troubles.

Cyber Crimes

Just like normal crimes (theft, trespassing private area, destroy, etc,) Cyber crimes (Virus, Trojan Horse, Phishing, Denial of Service, Pornography etc) also increased significantly . Due to cyber crime, the victims lose money, reputation,etc and some of them commit suicide.

A) Cyber crimes against individuals

i) Identity theft: The various information such as personal details(name, Date of Birth, Address, Phone number etc), Credit / Debit Card details(Card number, PIN, Expiry Date, CW, etc), Bank details, etc. are the identity of a person. Stealing this information by acting as the authorized person without the permission of a person is called Identity theft. The misuse of this information is a punishable offence.

ii) Harassment : Commenting badly about a particular person’s gender, colour, race, religion, nationality, in Social Media is considered as harassment. This is done with the help of Internet is called Cyber stalking (Nuisance). This is a kind of torturing and it may lead to spoil friend ship, career, self image and confidence. Sometimes may lead to a big tragedy of a whole family or a group of persons.

iii) Impersonation and cheating : Fake accounts are created in Social Medias and act as the original one for the purpose of cheating or misleading others. Eg: Fake accounts in Social Medias (Facebook,Twitter,etc), fake sms, fake emails etc.

iv) Violation of privacy: Trespassing into another person’s life and try to spoil the life. It is a punishable offence. Hidden camera is used to capture the video or picture and black mailing them.

v) Dissemination of obscene material: With the help of hidden camera capture unwanted video or picture. Distribute or publish this obscene clips on Internet without the consent of the victims may mislead the people specifically the younger ones.

B) Cyber crimes against property
Stealing credit card details, hacking passwords of social media accounts or mail account or Net banking, uploading latest movies etc, are considered as cyber crimes against property.

i) Credit card fraud

ii) Intellectual property theft Copying a person’s creation and present as a new creation is called plagiarism. This can be identified some tools (programs) available in the Internet

iii) Internet time theft : This is deals with the misuse of WiFi Internet facility. If it is not protected by good password there is a chance of misuse our devices (Modem/Router) to access Internet without our consent by unauthorized persons. Hence our money and volume of data(Package) will lose and we may face the consequences if others make any crimes.

C) Cyber crimes against government
The cyber crimes against Govt, websites is increased significantly. For example in 2015 the website of Registration Department of Kerala is hacked and destroys data from 2012 onwards,

i) Cyber terrorism : It is deals with the attacks against very sensitive computer networks like computer controlled atomic energy power plants, air traffic controls, Gas line controls, telecom, Metro rail controls, Satellites etc.. This is a very serious matter and may lead to huge loss (money and life of citizens). So Govt, is very conscious and give tight security mechanism for their services.

ii) Website defacement : It means spoil or hacking websites and posting bad comments about the Govt.

iii) Attacks against e-governance websites : Its main target is a Web server. Due to this attack the Web server / computer forced to restart and this results refusal of service to the genuine users. If we want to access a website first you have to type the web site address in the URL and press Enter key, the browser requests that page from the web server. Dos attacks send huge number of requests to the web server until it collapses due to the load and stops functioning.

Cyberethics

Guidelines for using computers over internet

  • Emails may contain Viruses so do not open any unwanted emails
  • Download files from reputed sources(sites)
  • Avoid clicking on pop up Advt.
  • Most of the Viruses spread due to the use of USB drives so use cautiously.
  • Use firewall in your computer
  • Use anti virus and update regularly
  • Use spam blocking software
  • Take backups in a regulartime intervals
  • Use strong passwords, i.e a mixture of characters (a-z& A-Z), numbers and special characters.
  • Do not use bad or rude language in social media and emails.
  • Un tick‘Remember Me’before log in.

Cyber laws

It ensures the use of computers and Internet by the people safely and legally. It consists of rules and regulations like Indian Penal Code(IPC) to stop crimes and forthe smooth functions of Cyber world. Two Acts are IT Act 2000 and IT Act Amended in 2008.

Information Technology Act 2000(amended in 2008)

IT Act 2000 controls the use of Computer(client), Server, Computer Networks, data and Information in Electronic format and provides legal infrastructure for E-commerce, in India.

This is developed to promote IT industry, control e-commerce, also ensures the smooth functioning of E-Governance and it prevents cyber crimes.

The person those who violate this will be prosecuted. In India IT bill introduced in the May 2000 Parliament Session and it is known as Information Technology Act 2000. Some exclusions and inclusions are introduced in December 2008.

Cyber Forensics

Critical evidence of a particular crime is available in electronic format with the help of computer forensics. It helps to identify the criminal with help of blood, skin or hair samples collected from the crime site. DNA, polygraph, finger prints are another effective tool to identify the accused person is the criminal or not.

Info mania

Right information at the right time is considered as the key to success. The information must be gathered, stored, managed and processed well. Info mania is the excessive desire(lnfatuation) for acquiring knowledge from various modern sources like Internet, Email, Social media, Instant Message Application(WhatsApp) and Smart Phones. Due to this the person may neglect daily routine such as family, friends, food, sleep etc. hence they get tired. They give first preference to Internet than others. They create their own Cyber World and no interaction to the surroundings and the family.

Plus Two Computer Science Notes Chapter 11 Advances in Computing

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 11 Advances in Computing.

Kerala Plus Two Computer Science Notes Chapter 11 Advances in Computing

Distributed Computing Paradigms

Very large program is sub divided into smaller ones and distributed these small ones to free computers over network. Hence ensures the use of computers effectively. The term paradigm means a pattern ora model in the study of any subject of complexity. Advanced computing paradigms helps to process information for many sectors of our society. It includes parallel computing, cluster computing, grid computing, cloud computing, etc.

Distributed Computing

Definition: Distributed computing is a method of computing in which large problems can be divided into smaller ones and this smaller ones are distributed among several computers. The solution for the smaller ones are computed separately and simultaneously. Finally the results are assembled to get the desired overall solution.

Advantages

  • Economical: Reduces the computing cost hence it is economical
  • Speed: The work load of the entire system is less hence the speed is high.
  • Reliability : When one computer in the network fails the entire work will not be blocked, i.e. the other computers will do the work properly.
  • Scalability: We can add computers according to the work load.

Disadvantages

  • Complexities: The proper division ofthe problems and reassembling ofthe result is a major complex task
  • Sectary Security measurements to be taken to keep track of the sent data packets otherwise it can be used for illegal purpose.
  • Network reliance: Some occasions in case of network failure, the entire system may become unstable.

Parallel computing

In Serial computation the problem is divided into series of instructions and these instructions are executed sequentially, i.e. one after another. Here, only one instruction is executed at a time. But in mp: ng more than one instruction is execute simultaneously at a time.

Serial computingParallel computing
A single processor is usedMultiple processors are used with shared memory
A problem is divided into a series of instructionsA problem is divided into smaller ones that can be solved simultaneously
Instructions executed sequentiallyInstructions executed simultaneously
One instruction is executed on a single processor at any momentMore than one instruction is executed on multiple processors at any moment of time.

AADITYA is the fastest super computer used by Indian Institute of Tropical meteorology.

Grid computing

It is a system in which millions of computers, smart phones, satellites, telescopes, cameras, sensors etc. are connected to each other as a cyber world in which computational power(resources, services, data) is readily available like electric power. Any information at any time at any place can be made available in our finger tips. This is used in disaster management, weather forecasting, market forecasting, bio information etc.

Cluster computing

Cluster means groups. Here a group of Internet-connected computers, storage devices, etc are linked together and work like a single computer. It provides computational power through parallel processing. Its cost is less and used for scientific applications.

Advantages

  • Price-performance ratio: The performance is high and the cost is less.
  • Availability: If one group of system fails the other group will do the work.
  • Scalability : Computers can be easily added according to the work load increases.

Disadvantages

  • programmability issues: Different computers uses different software and hardware hence the issues.
  • problem in finding fault: Fault detection is very difficult.

Cloud computing

It is an emerging computing technology. Here with the use of Internet arid central remote servers to maintain data and applications. Example for this is Email seivice, Office Software(word processor, spread sheets, presentations, data base etc), graphic software etc. The information is placed in a central remote server just like clouds in the sky hence the name cloud computing.

Cloud service models (3 major services)

  • Software as a Service(SaaS)
  • Platform as a Service(PaaS)
  • Infrastructure as a Service (laaS)

Artificial Intelligence

The first definition of Artificial Intelligence was established by Alan Turing. Turing strongly believed that a well designed computer could do every thing that a brain could, his statements are still visionary. “Al means the capability of a computer that can behave just like human beings can behave when both faced a common situation.”

Al was first coined by John MacCarthy in 1956. With the help of Al computer can solve the tasks such as playing chess, proving mathematical theorems, natural language processing, medical diagnosis etc.

Plus Two Computer Science Notes Chapter 11 Advances in Computing 1

Data is termed as a collection of mere symbols. While processing data we get information and knowledge is the organized information. It can be a piece of information that helps in decision making. The ability to draw useful inferences from the available knowledge is generally referred as intelligence. Wisdom is the maturity of mind that directs its intelligence to achieve desirable goals.

Turing Test approach to Al: The Turing test is a test of a machine’s ability to exhibit intelligent behaviour equivalent to, or indistinguishable from, that of a human. The test involves a human judge engages in natural language conversations with a human and a machine designed to generate performance indistinguishable from that of a human being. All participants are separated from one another. If the judge cannot reliably tell the machine from the human, the machine is said to have passed the test. The test does not check the ability to give the correct answer to questions; it checks how closely the answer resembles typical human answers. Turing predicted that by 2000 computer would pass the test. The computer would need to possess the following capabilities

  • Natural Language Processing (NLP): It enables the computer to communicate successfully in English. Speech recognition, synthesis, machine translation, hand written character recognition etc. are some of the practical applications.
  • Knowledge representation : To incorporate human knowledge
  • Automated reasoning : To use the knowledge to answerquestions and infer new knowledge,
  • Machine learning : To adapt to new circumstances and to detect and assume patterns.
  • Computer vision : The capability to observe objects.
  • Robotic activities : To make the robot a little smarter, intelligence must be incorporated.

Computational Intelligence

Earlier machines were used to do our work. But with the invention of digital computers, we use computers to solve time-consuming and complex tasks faced in real life. The main goal is to make the interaction of machines is more and man less. The study of man and machine interactions and control methods are known as Cybernetics.

Nowadays Artificial Intelligence is the study of how to make computers do things which people are doing better. Al is a combination of computer science, biology, medicine, robotics, etc.

Computational Intelligence paradigms

Computational Intelligence is the ability to make a computer to face and solve the real life problems just like a intelligent man do it. It includes Artificial Neural Networks(ANN), Evolutionary Computation (EC), Swarm Intelligence(SI) and Fuzzy Systems (FS).

A) Artificial Neural Networks(ANN): The brain is a complex, nonlinear and parallel computer with ability to perform tasks such as recognise pattern, perception and motor control. ANN is the method of simulate biological neural systems to learn, memorise and generalize like human beings. A human brain cortex consists of 10-500 billion neurons with 60 trillion synapses(a synapse is a structure that permits a neuron to pass an electrical)

B) Evolutionary Computation(EC) : It is the simulation of the natural evolution, i.e. survival of the fittest. In the surrounding we can see that the stronger must win and others will lose. EC applied for data mining, fault diagnosis, classification, scheduling etc.

C) Swarm Intelligence(SI): Swarm Intelligence is the study of behaviour of colonies or groups of social animals, birds, insects, ants etc. How they communicate and create and manage their own colonies beautifully.

D) Fuzzy Systems : Human beings use common sense while facing a problem, just like human beings fuzzy systems can also use common sense and behave like a human beings. Fuzzy systems is used to control gear transmission and raking systems, control lifts, home appliances, controlling traffic signals etc.

Application of Computational Intelligence

A) Biometrics : Biometrics refers to the unique characteristics of a human being to recognize an individual such as finger prints, face recognition, iris, retina etc. Biometrics are used to record attendance Eg. In banks employee login is restricted by using finger print reader.

B) Robotics : It is a branch of scientific study associated with the design, manufacturing and control the movements of the robots. Roboticss are used in all the areas. Some of them are discussed below.

C) Computer vision : The worid is changed from 2 dimensional images to 3 dimensional. 3D TVs are available in the market. Multiple cameras are used to capture the images and merge them to form 3D pictures. 3D scanners are used in the Medical field to diagnose the diseases

D) Natural Language Processing : It deals with how computers are communicate just like a human being communicate naturally. Natural languages are languages spoken by the people.’ To achieve this ability to communicate like a human being is a laborious task. NLP is further be classified into two, Natural Language Understanding (NLU) and Natural Language Generation (NLG)

  • NLU- The ability to understand the languages like English, Malayalam, etc,
  • NLG- It is deal with creation of output, i.e. generate words and giving reply.

E) Automatic Speech Recognition(ASR): To login some computers, laptops .tabs, smart phones etc, and to open some gates, doors etc you have say the password orally. The computer recognizes the speech and opens the device to them. Such devices are working based upon NLP technology and this system is called Automatic Speech Recognition(ASR) system. To implement this system the requirements are a mica or a telephone and convert the oral instruction into written text. Examples are Apple iOS, Google etc.

F) Optical Character Recognition(OCR) and Handwritten Character Recognition Systems.(HCR) : It is used to read text from a paper as an image and translate this image into a form that computer can manipulate. For example, if we want to enter the text contents of a book by typing using a key board will take more time. Instead of this by using OCR and HCR we can easily do this. OCR is expensive. HCR system reads handwritten texts and convert it into computer-readable form

G) Bioinformatics; It is a computer technology to the management of biological information. By the help of a computer analyse the finger prints, DNA, iris, retina etc and identifying the concerned person.

Three goals of bioinformatics.

  • Organise : Huge amount of data organized to access information easily and to add new information when it is produced
  • Develop tools : Develop new tools to analyse data efficiently.
  • Analysis: With the help of these tools analyse the data and produce results.

H) Geographical Information System :
A geosynchronous satellite moves at the same Revolutions per minute(RPM) as that of the earth in the same direction. Thus both the earth and the satellite complete one revolution exactly in the same time and hence the relative position of the ground station with respect to the satellite never changes. Geographic Information System(GIS) technology is developed from the digital cartography and Computer-Aided Design(CAD) data base management system. GiSasthe name implies capturing, storing for future reference, checking, and displaying data related to various positions on earth’s surface. GIS can be applied in many areas such as soil mapping, agricultural mapping, forest mapping, e-Governance, etc.

GIS is used in development planning like strategic rural and urban planning, infrastructure planning, precision agriculture planning, etc.

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP.

Kerala Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP

Overview of PHP (Formerly Personal Home Pages)

PHP stands for PHP Hypertext Preprocessor. Normally, it runs on a web server.

Benefits of using PHP

Client-side scripts(JavaScript) are run faster but it has some limitations. The limitations are we can view the source code hence it is less secure. On the other hand PHP is executed on the server and the result is sent back to the client(browser) so it is impossible to view the source code.

Benefits of PHP are given below

  • As PHP can be easily embedded into HTML moreover its easiness to convert a static web site into dynamic one.
  • It is compatible with almost all databases
  • It is platform independent can run on almost all OS (Windows, Linux, MAC)
  • It is simple and easy to learn
  • It uses very small amount of system resources
  • to run and faster.
  • PHP provides security to prevent malicious attacks.
  • Open source community supports PHP
  • It is a free s/w by all means hence can be used to develop all types of web sites

Basics of PHP

A) Setting up the development environment

Step 1

  • Install a PHP compatible web Server (Eg. Abyss Web Server For Windows)

Step 2

  • Install PHP interpreter.
    After installing the web server type http://localhost in the address bar the following screen will be available.
    Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 1

B) Writing and running the script

Take a note pad and type the code, PHP code should begin with <?php andend with ?>. Save this file in the root directory of the web server with extension php.

Step 1
Take a notepad and type (he following and save it as first.php on C:\Abyss Web ServeAhtdocs.
<?php
echO”My first PHP web page”;
?>

Step 2
Start the web server if it is off

Step 3
Type as “http://localhost/firstphp” in the address bar.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 2

C) Combining HTML and PHP
Both are closely related. We can write PHP code in between HTML code using <?php and ?>.
Eg:
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 3

D) Comments in PHP
We can make some text as a comment i.e. not as part of the program Single line(//) and multi line (starts with /* and ends with */)

<HTML>
<HEAD>
<TITLE>
My first php page </TITLE>
</HEAD>
<BODY>
<?php
/* This program is used to display a message “Welcome to php” */ echo “<H2>Welcome to php</H2>”; //shows a message?>
</BOD Y>
</HTML>

E) Output statements in PHP
i) echo and print are used to display all types of data but echo is used to produce multiple outputs. Parenthesis is optional,

eg:
echo “ first output”, “second output”;
or
echo (“ first output”, “second output”);
print “only one output”;
or
print (“only one output”);
The difference between echo and print

EchoPrint
Take more than one parameterOnly one parameter
Does not return any valueReturns TRUE or l on successful print and FALSE otherwise
Fasterslower

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 5

ii) var_dump()
This is used to display both data type and value of variables.
Syntax: var_dumpl(variablel, vanable2,etc…);

Eg:

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 6
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 7

Fundamentals of PHP

Variables

A variable name starts with $ symbol followed by the name of the variable. There is no need to declare a variable before using it. PHP automatically determines the data type based upon the value stored in it.
Syntax: $variable_name=value;

Rules for naming a variable in PHP

  • Begins with $ symbol followed by an alphabet or under score(a-zA-Zand _)
  • Digits(O-9)can be used after 2 characters.(Eg. $_1 ,$al ,$s12,etc)
  • Variable names are case sensitive.
  • Special characters cannot used except under score.

Data type

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 8

A) Core data types
Integer, Float/ Double and String, these data types are similar data types of C++. The size of integer or float is depending upon the OS.

  • Integer—Two types—ye and +ve.. PHPdoesnot support unsigned integer data type.
    Eg: 8172, -22, etc.
  • Float/ Double -:Numbers with decimal point.
    Eg: 81.72, 7E-1 0(7 * 1010 —Mantissa and Exponent method), 123E1 2(123*1012)
  • String: Combination of characters enclosed in quotes(single or double quotes) Eg: “BVM”,’HSS’, Computer Science’, etc.
  • Boolean: Used to store two values(states) TRUE or FALSE.
    Eg: values are yes/no, on/off, 1/0, true/false
    <?php
    Sx=false; Il assign the value FALSE to $x.
    $y=1; //assign the value TRUE to $y.

B) Special data types

  • Null-: Specialdata type with value NULL. This is the default value to a variable, if we do not set a value to it.
    $rn=null;
  • Array -: Array is a collection of elements. With the same name we can store many elements.
    Three types of array
    Indexed array-:
    Associated array-:
    Multi dimensional array-:
  • Object -; Similar in C++ and must be declared explicitly. At first a class is declared and then objects can be created using the command new.
  • Resources -: It is not an actual data type rather it is a special variable that hold references to file handler, data base object, etc.

Operators in PHP

Operators are the symbols used to perform an operation
a) Assignment operator(=)
The value of RHS is assigned to LHS variable. If $a=10 and $b=3 then $a=$b. This statement sets the value of $a and $b are same ,i.e. it sets a to 3.

b) Arithmetic operators
It is a binary operator. It is used to perform addition (+), subtraction(-), division(/), multiplication(*) ,modulus(%-givesthe remainder).
Eg. If $x=10 and $y=3then

$x+$y$x-$y$x*$y$x/$y$x%$y
137303.3331

c) Relational (Comparison) operators
It is used to perform comparison or relational operation between two values and returns either true or false.
Eg: If $X=10and $Y=3then

$X<$Y$X<=$Y$X>$Y$X>=$Y$X>==$Y$X!=$Y
falsefalsetruetruefalsetrue

d) Logical operators
Here (and , &&), (or, ||), xorare binary operators and not(!) is a unary operator. It is used to combine relational operations and it gives either true or false
If $X=true and $Y=false then

$x && $x$X && $Y$Y && $X$Y &&$Y
truefalseFalsefalse

Both operands must be true to get a true value in the case of && operation If $X=true and $Y=false then

$X and $X$X and $Y$Y and $X$Y and $Y
truefalseFalsefalse

Both operands must be true to get a true value in the case of ‘and’ operation If $X=true and $Y=false then

$X || $X$X || $YSY || $X$Y || $Y
truetruetruefalse

Either one of the operands must be true to get a true value in the case of || operation If $X=true and $Y=false then

$X or $X$X or $Y$Y or $X$Y or $Y
truetruetruefalse

Either one of the operands must be true to get a true value in the case of or operation If SX=true and $Y=false then

$X xor $X$X xor $Y$Y xor $X$Y xor $Y
truetruetruefalse

Either one of the operands must be true to get a true value in the case of xor operation If $X= true and $Y=false then

l$X!$Y
falsetrue

e) String addition operator(‘.’, ‘.=’)
This is also called concatenation operator. It joins(concatenates) two strings and forms a string.
They are and ‘.=’.
Eg:
$x= “BVM HSS
$y= “ Kalparamba”;
$z=$x.$y;

  • Here the variable z becomes “BVM HSS Kalparamba”.
    $x.=$y;
  • Here the variable $x becomes “BVM HSS Kalparamba”.

f) Combined operators.
It is also called short hands
If $X=1O and $Y= 3 then

Arithmetic Assignment ExpressionEquivalent Arithmetic ExpressionThe value of $X becomes
$X+=$Y$X=$X+$Y13
$X-=$Y$X=$X-$Y7
$X*=$Y$X=$X*$Y30
$X/=$Y$X=$X/$Y3.333
$X%=$Y$X=$X%$Y1

g) Increment and decrement operators.
1) pre increment (++variable)
Eg:
lf$x=10then
echo(++$x); -> It prints 10+1=11

2) post increment (variable++)
lf $x=10then
echo($x++); -> It prints 10 itself.

3) pre decrement—variable)
lf $x=10then
echo(—$x); It prints 10-1=9

4) post decrement(variable—)
lf $x=10then
echo($x—);-> It prints 10 itself.

h) Escape sequences
It Is a character preceded by a back slash(\)

OperatorDefinitionExampleOutput
\“To print”echo TPHPr“PHP’
\’To print1echo”X\ian”X’ian
\nNew lineecho “BVM \nHSS”BVM HSS
\tTo print tabecho”BVM\tHSS”BVM HSS
\rPrint carriage return
\$To printsecho”100\$”100$
\\To print \echo”\\n is used as newline”\n is used as new line

Control Structures in PHP

In general the execution of the program is sequential, we can change the normal execution by using the control structures.

simple if

Syntax:

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 9

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 10

The first expression evaluated and selects the statements with matched case value.

Loops in PHP

a) while loop
It is an entry controlled loop The syntax is given below
Loop variable initialised
while(expression)

{
Body of the loop;
Update loop variable;
}

b) do-while loop
This loop will execute at least once. The body of the loop will be executed until the expression becomes false,

do
{
Body of the loop;
Update loop variable;
}while(expression);

* for loop
The syntax of for loop is given below For(initialisation; testing; updation)

{
Body of the for loop;
}

continue and break in loops Continue is used to skip one iteration and continue the loop with next value. But break is used to terminate the execution of the current control structure such as for, for each, while, do while or switch.

Arrays in PHP

In PHP array is a collection of key and value pairs. Unlike C++, in PHP we can use either non negative integers or strings as keys.

Different types of arrays in PHP

  • Indexed arrays
  • Associate arrays
  • Multi dimensional arrays.

Indexed arrays-: The elements in an array can be distinguished as first or second or third etc. by the indices and the index of the first element is zero. In PHPthe function arrayO is used to create an array.
Syntax: $array_name=array(value1 ,value2, );
OR
$array_variable[key]=value;
Eg:$mark=array(60,70,80);
$course=amay(“Science”,”Commence”,”Humanities’);
OR
$mark[0]=60;
$mark[1]=70;
$mark[2]=80;
$course=”Science”;
$course=”Commerce”;
$course=”Humanities”;
Eg:
<!DOCTYPE HTML>
<html lang=”eii”>
<head>
<title>
We are learning PHP
</title>
</head>
<body bgcoior=”cyan”>
<?php
$course=amay(“Science”, “Commerce”,”Humanities’);
for($i=0;$i<3;$i++)
echo $course[$i].”,”;
?>
</body>
</html>
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 12

The function print_r can be used for printing an array.
Syntax: print_r(array_name);

Eg:
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 60

Associative arrays

Arrays with named keys and string indices are called associative jarrays.
Syntax: $varibale_name=array(key1=>value1, key2=>value2,etc);

Eg:
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 15
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 16

for each loops (Extension of for loop)

The number of elements in an array is not known in advance foreach loop is used. Two types

1) for ($array_variable_name as $value)
No need to specify the starting inde and ending index, the array pointer is moved one by one.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 17
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 18

b) foreach($array_variable_name as key=> $value)
Here the value of the current array element is assigned to $value and the key is assigned to $key.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 19
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 20

FunctionsinPHP

Two types user defined and built in functions.

User-defined functions

The key word function is used to declare a function in PHP.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 21
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 22
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 23

Built-in functions

a) Date() -:Returns date and time.
Syntax: date(format[, timestamp]);

FormatPurpose
dday of the month(0-31)
mmonth(1-12)
Yyear
Iday of the week(Eg.Monday)

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 24

b) String functions

  • chr()-: Returns a character corresponding to the ASCI I. Eg. chr(ascii value);
  • strlen()- Returns the number of characters in a string strlen(string);
  • strops()- Returns the position of the first occurrence of a string inside another string. strpos(main string, substring, start position);
  • strcmp()- Compares two stings, strcm p(stri ng 1 ,stri ng2);

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 25
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 26

Three tier architecture in PHP

Tier 1 (Front end Tool): Browser/ Client uses HTML or HTML embedded with JavaScript.
Tier 2 (Middle end Tool)- Web Server(Apache /Microsoft IIS)
Tier 3 (Back end Tool)-Database(MySQL/Oracle) This means end user uses Browser(Tier 1) and send requests to the Web Server(Tier 2). The Web Server retrieves data from the Data Base(Tier 3). For this activities user interface, application programs, data storage etc are separated into layers(Tiers)

PHP forms

This is used to collect information from the client and send it to the Web Server by pressing the submit button. The server receives the data and collects the appropriate data from the data base and send it back as a response.

PHP global variables

A variable declared as global then it can be accessed from any where in the program.

  • Superglobal arrays : This is a special variable – available to all programs.
SuperglobalPurpose
SGLOBALSGlobal scope variables available. .
$_SERVERInformation about the server
$_GETData passed using the HTTP GET method
$_POSTData passed using the HTTP POST method
$_REQUESTData passed via HTTP request
$_FILESData passed by an HTML file input
$_SESSIONCurrent session data specific to the user
$_COOKIEData stored on the browser.

A) PHP$GLOBALS
PHP stores all global variables in an arräy calied $GLOBALS[index].
Index is the name of the variable.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 27
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 28
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 29

B) PHP $_SERVER
This returns the paths and script locations.

CodeDescription
$_SERVER [‘PHP_SELF]Returns the currently executing file name
$_SERVER [‘SERVER_NAME’]Returns the host server name
$_SERVER [‘SCRIPT_NAME’]same as $_SERVER[‘PHP_SELF’]

Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 30
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 31

C) PHP $_REQUEST
When a user click a submit button, $_REQUEST gathers all data. $_REQUEST is an array that contains $_GET, $_POST and $_cookie superglobals.

D) PHP $_POST
When the user presses the submit button and the method=post then the data is passed to the server and we can access the data by using the variable $_POST[‘variable name’];

E) PHP S_GET
When the user presses the submit button and the method=get then the data is passed to the seÑer and we can access the data by using the variable $_GET[’vanable namel;

GET and POST comparison

The difference between GET and POST method is given below.

Get methodPost method
1. Faster1. Slower
2. To send small volume of data.2. To send large volume of data
3. Up to 2000 characters3. No limit
4. Less secure4. More secure
5. Data visible during submission5. Data not visible during submission
6. Page link can be book marked6. Page link can never be book marked.

Connecting PHP to database(MySQL)

Establishing connection to MySQL database

To access data from the data base, the PHP program first establish a connection to the data base server(MySQL) and then specify the data base to use.Consider the following

  • Open a connection to MySQL.
  • Secify the data base we want to open.
  • Retrieve data from or insert data in to dat base.
  • Close the connection.

Step 1
Open a connection to MySQL
For this rnysql_connect function is used. A link identifier is returned when connected successfully otherwise a NULL value.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 32
echo connected Successfully’;
mysql_dose($dbhandle);
?>

Note : In the above specify the password you given in MVSQL installation.

The out put is as given below.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 33

Step 2
Specify the data base you want to open
MySQL server may contain many data bases. mysql_select_db() is a function used to select particular data base. It return true if it finds the data base otherwise false.
Syntax: mysql_select_db($database);

Eg:
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 34
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 35

Step 3
Reading data from data base
Two steps

a) Execute the SQL query on the data base using the function mysql_query()
Syntax:
$result_set=mysql_query(query,connection);

b) Insert a row using the function mysql_fetch_array()
Sresult_set=mysql_query(query, connection);
$fetched_row=mysql_fetch_array($result_set);

Example 1 :
Let us do the following program The structure of a table is given to store the details of marks scored by students in an exam

DataTypeDescription
RegNoNumericUnique
namecharupto 30 characters
coursechar
marks of 6 subjectsnumericsix separate columns

Write SQL statements for the creation of the table and the following requirements.

Step 1.
For this take MySQL and do the following
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 36

a) Insert data into the fields(min 3 records)
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 37

b) Display the details of all students.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 38

Step 2:
Take a notepad and type the following then save it asform1.html

<html>
<body>
<form method-’post” action=”dbsample3.php”>
<center>RegisterNo:
<inputtype=”text” name=”regno”><br>
<input type=”submit” value=”Show Result”>
</center>
</form>
</body>
</html>

Step 3.
Take another notepad then type the following and save itasdbsampleS.php
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 41
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 42
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 43

Step 4.
Run the file forml .html and do the following
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 44

Example 2

Step 1.
Take a notepad and type the following. Save it as form2.html.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 45

Step 2
Take another notepad then type the following and save it as dbsample4.php
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 46
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 47
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 48

Step 3.
Run the file form2.html and do the following
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 49

Creating a new table using PHP

It is possible to create a new table using PHP.
Syntax: $SQL=”create table <table name> (column_name1 data type constraint,etc)”; $select_query=mysql_query($SQL);

Eg:
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 50
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 51
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 52

Inserting data into a table using PHP

It is also possible to insert values in to a table using PHP program

Syntax:
$SQL=”insert into <table name> values (valuel, value2,…);
$select_query=mysql_query($SQL);

Ex:
Step 1.
Take a notepad .then type the following and save it asform3.html
<html>
<body>
<form method-’post” action-’table2.php”>
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 54

Step 2.
Take another notepad and type the following then save it as table2.php.
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 55

Step 3.
Run the file form3.html and do the following
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 56
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 57

Updating data in a table using PHP

It is also possible to change or update values in a row by using PHP.
$SQL=”Update ctable_name> set ccolumn_name>= new_value where condition.
$select_query=mysql_query($SQL);

Ex:
If you want to change the amount deposited by Jose from 2000 to 3000. Do the following.

Step 1.
Take a notepad, then type the following and save it asform3.html
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 58
Plus Two Computer Science Notes Chapter 10 Server Side Scripting Using PHP 59

Plus Two Computer Science Notes Chapter 9 Structured Query Language

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 9 Structured Query Language.

Kerala Plus Two Computer Science Notes Chapter 9 Structured Query Language

SQL – Structured Query Language developed at IBM’s San Jose Research Lab.

The result of the compilation of DDL statements is a set of tables, which are stored in a special file called a data dictionary.

Creating a database in Mysql CREATE DATABASE <database_name>;
Eg:
mysql>CREATE DATABASE BVM;

Opening a database
USE command used to use a database
USE <database_name>;
Eg:
mysql>USE BVM;
The SHOW command is used to list the entire database in our system.
mysql>SHOW DATABASES;

Data Types

  • Char – It is used to store a fixed number of characters. It is declared as char(size).
  • Varchar – It is used to store characters but it uses only enough memory.
  • Dec or Decimal – It is used to store numbers
    with decimal points. It is declared as Dec (size, scale). We can store a total of size number of digits. .
  • Int or Integer- It is used to store numbers with¬out decimal point. It is declared as int. It has no argument. Eg: age int.
  • Smallest – Used to store small integers.
  • Date – It is used to store date. The format is yyyy- mm-dd. Eg: ‘1977-05-28’!
  • Time – It is used to store time. The format is

DDL commands (3 commands)

  • Create table
  • Alter table
  • Drop table

DML commands (4 commands)

  • Select
  • Insert
  • Delete
  • Update

DCL (Data Control Language) commands

1. Grant
2. Revoke

Rules for naming tables and columns

  • The name may contain alphabets(A-Z, a-z),digits(0-9), underscore (J and dollar ($) symbol
  • The name must contain at least one character.
  • Special characters cannot be used except _ and $
  • Cannot be a keyword
  • The name must be unique.

Constraints are used to ensure database integrity.

  • Not Null
  • Unique
  • Primary key
  • Default
  • Autojncrement

Order By:
Used to sort rows either in ascending (asc) or descending (desc) order.

Aggregate functions

  • Sum()- find the total of a column.
  • Avg()-find the average of a column.
  • Min()- find the smallest value of a column.
  • Max() – find the largest value of the column.
  • Count()-find the number of values in a column.

Group by clause is used to group the rows. Having clause is used with Group By to give conditions.

Plus Two Computer Science Notes Chapter 8 Database Management System

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 8 Database Management System.

Kerala Plus Two Computer Science Notes Chapter 8 Database Management System

DBMS means Data Base Management System. It is a fool used to store a large volume of data, retrieve and modify the data as and when required. DBMS consists of data and programs.

Advantages of DBMS

  • Data Redundancy
  • Inconsistency can be avoided
  • Data can be shared
  • Standards can be enforced
  • Security restrictions can be applied
  • Integrity can be maintained
  • Efficient data access
  • Crash recovery

Structure of DBMS

  • Fields – Smallest unit of data. Eg: Name, age, sex, …
  • Record – Collection of related fields.
  • File- Collection of records

Components of DBMS

a) Databases – It is the main component.
b) Data Definition Language (DDL) It is used to define the structure of a table.
c) Data Manipulation Language (DML) – It is used to add, retrieve, modify and delete records in a database.
d) Users – With the help of programs users interact with the DBMS.

Database Abstraction

  • Abstraction means hiding, it hides certain details of how data is stored and maintained.

Levels of Database Abstraction

  • Physical Level (Lowest Level) – It describes how the data is actually stored in the storage medium.
  • Logical Level (Next Higher Level) – It de¬scribes what data are stored in the database.
  • View Level (Highest level) – It is closest to the users. It is concerned with the way in which the individual users view the data.

Data Independence

It is the ability to modify the scheme definition in one level without affecting the scheme definition at the next higher level.

a) Physical Data Independence – It is the ability to modify the physical scheme without causing application programs to be rewritten.

b) Logical Data Independence – It is the ability to modify the logical scheme without causing ap-plication programs to be rewritten.

Users of Database

  • Database Administrator
  • Application Programmer
  • Naive users

Data models – It is a collection of tools for describ¬ing data, data relationships, data semantics, and consistency problem. 3 models.

  • Hierarchical model
  • Network model
  • Relational model

RDBMS – Relational Data Base Management System. It consists of a collection of relations as a database.

  • Relation means table.
  • Domain – A pool of possible values from which col¬umn values are drawn.
  • Tuple means rows.
  • Attributes means columns. ,
  • Cardinality – The number of rows.
  • Degree -The number of columns
  • View- A view is a virtual table derived from one or more base tables.
  • Key is used to identify or distinguish a tuple in a relation.
  • Candidate key- It is used to uniquely identify the row.
  • Primary key – It is a set of one or more attributes used to uniquely identify a row.
  • Alternate key -A candidate key other than the primary key.
  • Foreign key- A single attribute or a set of attributes, which is a candidate key in another table is called a foreign key.
  • Relational Algebra – It consists of a set of operations that takes one or two relations as input and produces a new relationship as a result.
    • Select operation (σ)
    • Project Operation (π)
    • Cartesian Product (-)
    • Union Operation (∪)
    • Intersection operation (∩)
    • Set difference operation (-)

Plus Two Computer Science Notes Chapter 7 Web Hosting

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 7 Web Hosting.

Kerala Plus Two Computer Science Notes Chapter 7 Web Hosting

Web hosting

Buying or renting storage space to store website in a web server and provide service(made available 24×7) to all the computers connected to the Internet. This is called web hosting. Such service providing companies are called web hosts. Programming languages used are PHP, ASP.NET, JSP.NET, etc.

Types of web hosting

Various types of web hosting services are available. We can choose the web hosting services according to our needs depends upon the storage space needed for hosting, the number of visitors expected to visit, etc.

  • Shared Hosting
  • Dedicated Hosting
  • Virtual Private Server (VPS)

Buying hosting space

We designed a website of our school and we decide our school website to be made available to all over the world, we have to place the website files on a web server for that we have to purchase hosting space(memory space) in a web server.

Following factors to be considered

  • Buying sufficient amount of memory space for storing ourwebsite files
  • If the web pages contain programming contents supporting technology must be consider
  • Based upon the programs select Windows hosting or Linux hosting

Domain Name System(DNS) Registration

Millions of websites are available over the Internet so that our website must be registered with a suitable name. Domain Name registration is used to identify a website over Internet. A domain name must be unique(i.e. no two website with same name is available). So you have to check the availability of domain name before you register it, for this www.whois.net website will help. If the domain name entered is available then we can register it by paying the Annual registration fees through online.

FTP (File Transfer Protocol) client software

When a client requests a website by entering website address. Then FTP client software helps to establish a connection between client computer and remote server computer. Unauthorised access is denied by using username and password hence secure our website files for that SSH(Secure Shell) FTP simply SFTP is used. Instead of http://, it uses ftp://.

By using FTP client s/w we can transfer(upload) the files from our computer to the web server by usrng the ‘drag and drop’ method. The popular FTP client software are FileZilla, CuteFTP, SmartFTP, etc.

Free hosting

The name implies it is free of cost service and the expense is meet by the advertisements. Some service providers allow limited facility such as limited storage space, ,do not £llow multimedia(audio and video) files.

A paid service website’s address is as follows
eg: www.bvmhsskalparamba.com

Usually two types of free web hosting services as follows
1) as a directory service.
Service provider’s website address/ our website address
eg: www.facebook.com / bvm hss kalparambu

2) as a Sub domain
Our website address.service providers website address
eg: bvmhsskalparamba.facebook.com
Earlier web hosting services are expensive but nowadays it is cheaper hence reduced the need for free web hosting.

Example for free web hosting.
Plus Two Computer Science Notes Chapter 7 Web Hosting 1

Content Management System(CMS)

Do you heard about Data Base Management System(DBMS). DBMS is a software(collection of programs) used to create, alter, modify, delete and retrieve records of a Data Base. Similarly CMS is a collection of programs that is used to create, modify, update and publish website contents. CMS can be downloaded freely and is useful to design and manage attractive and interactive websites with the help of templates that are available in CMS. WordPress, j’oomla, etc are the examples of CMS.

Responsive web design

The home page is displayed differently according to the screen size of the browser window(different screen sized devices-mobile phone, palm top, tablet, lap top and desk top) we used. The website is designed dynamically(flexibly) that suit the screen size of different device introduced by Ethan Marcotte. Before this, companies have to design different websites for different screen sized devices. By responsive web design, companies have to design only one website that suitably displayed according to the screen size of the devices.

It is implemented by using flexible grid layout, images and media queries

  • Flexible grid layouts : It helps to set the size of the web page to fit the screen size of the device.
  • Flexible image and video : It helps to set the image or video dimension to fit the screen size of the device.
  • Media queries : There is an option(settings) to select the size of the web page to match our device, this can be done by using media queries inside the CSS file.

A well known Malayalam daily Malayala Manorama launched their responsive website.

Plus Two Computer Science Notes Chapter 6 Client-Side Scripting Using JavaScript

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 6 Client-Side Scripting Using JavaScript.

Kerala Plus Two Computer Science Notes Chapter 6 Client-Side Scripting Using JavaScript

JavaScript(Original name was Mocha) was developed by Brendan Eich for the Netscape Navigator browser later all the browsers support this.

Getting Started With Javascript

  • Scripts are small programs embedded in the HTML pages, to write scripts <SCRIPT> tag is used.

Two types of scripts

1. Client scripts -These are scripts executed by the browser(client) hence reduces network traffic and workload on the server.

2. Server scripts – These are scripts executed by the server and the results as a webpage returned to the client browser.

  • The languages that are used to write scripts are known as scripting languages. Eg: VB Script, Javascript etc.
  • Javascript and VB Script are the two client-side scripting languages.
  • Java script(developed by Brendan Eich for the Netscape browser) is a platform-independent scripting language. Means It does not require a particular browser. That is it runs on any browser hence it is mostly accepted scripting language. But VB Script(developed by Microsoft) is a platform-dependent scripting language. Means it requires a particular browser(MS Internet Explorer) to work which is why it is not widely accepted scripting language.
  • Attribute makes the tags meaningful Language attribute specifies the name of the scripting language used.
    Example:
    <SCRIPT Language=” JavaSCript”>
    </SCRIPT>
  • The identifiers are case sensitive (means Name and NAME both are treated as different)
  • CamelCase : An identifier does not use special characters such as space hence a single word is .formed using multiple words. Such a naming method is called CamelCase(without space between words and all the words first character is in upper case letter). These are two types

1) UpperCamelCase -. when the first character of each word is capitalised, Eg. Date Of Birth, JoinTime,etc
2) lowerCamelCase: when the first character of each word except the first word is capitalised. Eg. date of birth, join time, etc,…

  • To write anything on the screen the following function is used document.write(string);
    eg. document.write(“Welcome to BVM HSS, Kalparamba”);
    Note : Like C++ each and every statement in javascript must be end with semicolon(;).
  • To create a web page using javascript
  • <HTML>
    <HEAD><TITLE>JAVASCRIPT- WELCOMED TITLE></HEAD>
    <BODY>
    <SCRIPT Language=”JavaScript”>
    document.write(“welcome to my first javascript page”);
    </SCRIPT>
    </BODY>
    </HTML>
    Its output is as follows
    Plus Two Computer Science Notes Chapter 6 Client-Side Scripting Using JavaScript 1

Creating Functions In Javascript

  • Function : Group of instructions(codes) with a name, declared once can be executed any number of times. There are two types 1) built in and 2)user defined
  • To declare a function, the keyword function is used.
  • A function contains a function header and function body
  • Even though a function is defined within the body section, it will not be executed, if it is not called. Syntax: function <function name>()
{
Body of the function;
}
Eg: function print()
{
document.writefWelcometo JS”);
}
  • Here the function is the keyword.
  • the print is the name of the user-defined function
  • To execute(call) the above function namely print do as follows,
print();
Eg:
<HTML>
<HEAD><TITLE>JAVASCRIPT- functionc</ TITLE></HEAD>
<SCRIPT Language ”JavaScript”>
function print()
{
document.write(“welcome to my first javascript page using print function”);
}
</SCRIPT>
<BODY>
<SCRIPT Language*’JavaScript”> printO;
</SCRIPT>
</BODY>
</HTML>
Plus Two Computer Science Notes Chapter 6 Client-Side Scripting Using JavaScript 2

Datatypes In Javascript

Unlike C++ it uses only three basic data types

  1. Number: Any number(whole or fractional) with or without sign.
    Eg:+1977,-38.0003,-100,3.14157,etc
  2. String: It is a combination of characters enclosed within double quotes.
    Eg: “BVM”, “[email protected]”, etc
  3. Boolean : We can store either true or false.lt is case sensitive. That means can’t use TRUE OR FALSE

Variables In Javascript

For storing values you have to declare a variable, for that the keyword var is used. There is no need to specify the data type.
Syntax:
var<variable name1> [, <variable name2>, <variable name3>,etc…]
Here square bracket indicates optional.
Eg: varx,y,z;
x= 11;
y = “BVM”;
z = false; .

Here x is of number type, y is of string and z is of Boolean type.

typeof(): this function is used to return the data type, undefined : It is a special data type to represent variables that are not defined using var.

Operators In Javascript

  • Operators are the symbols used to perform an operation

Arithmetic operators

It is a binary operator. It is used to perform addition(+), subtraction^), division^, multiplication(*), modulus (%-gives the remainder) ,increment(++) and decrement—Operations.
Eg.
If x=10 and y=3 then

x+yx-yx*yx/yx%y
137303.3331

ifx=10then
document.write(++x); -> It prints 10+1=11 lfx=10then
document.write(x++); -> It prints 10 itself. Ifx=10then
document.write(—x); It prints 10-1=9 lfx=10then
document.write(x—);-> It prints 10 itself.

Assignment operators

If a = 10 and b = 3 then a = b. This statement sets the value of a and b are same, i.e. it sets a to 3.
It is also called short hands
lf X = 10 and Y = 3 then

Arithmetic Assignment ExpressionEquivalent Arithmetic ExpressionThe value of X becomes
X+=YX=X+Y13
X-=YX=X-Y7
X*=YX=X*Y30
X/=YX=X/Y3.333
X%=YX=X%Y1

Relational(Comparison) operators

It is used to perform comparison or relational operation between two values and returns eithertrue orfalse.
Eg:
lf X = 10 and Y = 3 then

X<YX<=YX>YX>=YX==<X!=Y
falsefalsetruetruefalsetrue

Logical operators

Here AND(&&), OR(||) are binary operators and NOT(!) is a unary operator. It is used to combine relational operations and it gives either true or false If X=true and Y=false then

X&&XX&&YY&&XY&& Y
truefalseFalsefalse

Both operands must be true to get a true value in the case of AND(&&) operation If X=true and Y=false then

X || XX || YY || XY || Y
truetruetruefalse

Either one of the operands must be true to get a true value in the case of OR(||) operation
If X= true and Y=false then

IX!Y
falsetrue

String addition operator(+)

This is also called concatenation operator. It joins(concatenates) two strings and forms a string.
Eg:
var x,y,z;
x = “BVM HSS
y = “Kalparamba”;
z = x+y;

  • Here the variable z becomes “BVM HSS Kalparamba”.

Note: If both the operands are numbers then addition operator(+) produces number as a result otherwise it produces string as a result. Consider the following.

Operand 1 data typeOperand 2 data typeOperationResultant data type
numbernumber+(addition)number
numbersiringstring
stringnumberstring
stringstringstring

Eg:

  • 8(number) + 3(number)=11 (Result is a number)
  • 8 (number)+“3”( string) = “83” (Result is a string)
  • “8” (string) + 3 (number) = “83”(Result is a string)
  • “8” (string) + “3″ (string) = “83” (Result is a string)

Control Structures In Javascript

In general the execution of the program is sequential, we can change the normal execution by using the control structures.

Simple if

Syntax:

if(test expression)
{
statements;
}

First the test expression is evaluated, if it is true then the statement block will be executed otherwise not.

if - else
Syntax:
if (test expression)
{
statement blockl;
}
else
{
statement block2;
}

First the test expression is evaluated, if it is true then the statement blockl will be executed other wise statement block2 will be evaluated.

Switch
It is a multiple branch statement. Its syntax is given below.
switch(expression)

{
case value1: statements;break;
case value2: statements;break;
case value3: statements;break;
case value4: statements;break;
case value5: statements;break;
.............
default : statements;
}

First expression evaluated and selects the statements with matched case value.

for loop

The syntax of for loop is given below For(initialisation; testing; updation)

{
Body of the for loop;
}

while loop

It is an entry controlled loop The syntax is given below
Loop variable initialised
while(expression)

{
Body of the loop;
Update loop variable;
}

Here the loop variable must be initialised out side the while loop. Then the expression is evaluated if it is true then only the body of the loop will be executed and the loop variable must be updated inside the body. The body of the loop will be executed until the expression becomes false.

Built In Functions (Methods)

1) alert() : This is used to display a message (dialogue box) on the screen.
eg: alert(“Welcome to JS”);

2) isNaN() : To check whether the given value is a number or not. It returns a Boolean value. If the value is not a numberfNaN) then this function returns a true value otherwise it returns a false value.
Eg.

  • isNaN(“BVM”); returns true
  • isNaN(8172); returns false
  • isNaN(“680121 ”); returns false
  • alert(isNaN(8172); displays a message box as false

3. toUpperCase() : This is used to convert the text to upper case.
Eg;
varx=”bvm”;
alert(x.toUpperCase());

4. toLowerCase() This is used to convert the text to lower case.
Eg:
varx-‘BVM”;
alert(x.toLowerCase());

5. charAt() : It returns the character at a particular position.
Syntax: variable.charAt(index);
The index of first character is 0 and the second is 1 and so on.
Eg:
varx-’HIGHER SECONDARY”;
alert(x.charAt(4));

Eg 2.
varx=”HIGHER SECONDARY”;
alert(“The characters @ first position is “+x.charAt(0));

6. length property : It returns the number of characters in a string.
Syntax: variable.length;
Eg.
varx=”HIGHER SECONDARY”;
alert (“The number of characters is “+ x.length);
Output is as follows(note that space is a character)

Accessing Values In A Textbox Using Javascript.

Name attribute of FORM, INPUT, etc is very important for accessing the values in a textbox.

Consider the following program to read a number and display it

<HTML>
<HEAD><TITLE>JAVASCRIPT- read a value from the console</TITLE>
<SCRIPT Language=”JavaScript”>
function print()
{
varnum;
num=document.frmprint.txtprint. value;
document.write(“The number you entered is “ + num);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM Name="frmprint">
<CENTER>
Enter a number
<INPUTType="text" name="txtprint">
<INPUT Type="button" value="Show" onClick= "printO">
</CENTER>
</FORM>
</BODY>
</HTML>

In the above code,

  • print() is the user defined function.
  • onClick is an event(lt is a user action). The function print() is executed when the user clicks the show button. Here code is executed as a response to an event.
  • frmprint is the name of the form.
  • txtprint is the name of the text.

Ways To Add Scripts To A Web Page.

Inside <BODY> section

  • Scripts can be placed inside the <BODY> section.

Inside <HEAD> section

  • Scripts can be placed inside the <HEAD> section. This method is widely accepted method

External (another) JavaScript file

We can write scripts in a file and save it as a separate file with the extension .js. The advantage is that this file can be used across multiple HTML files and can enhance the speed of page loading.

Plus Two Computer Science Notes Chapter 5 Web Designing Using HTML

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 5 Web Designing Using HTML.

Kerala Plus Two Computer Science Notes Chapter 5 Web Designing Using HTML

3 types of Lists in HTML

  1. Unordered List (<UL>) – Items are displayed with square, circle or disc in front
  2. Ordered List (<OL>) – Items are displayed with the following type values.
    Type = 1 for 1,2, 3, ………..
    Type = i for i, ii, iii, ………..
    Type = I for I, II, III, ………..
    Type = a for a, b, c, ………..
    Type =Afor A,B,C, ………..
  3. Definition List (<DL>) – It is formed by definitions.
    • <L/> – It is used to specify List items.
    • <DT> – It is used to specify Definition Term.
    • <DD> – Used to specify the description
    • <A> is used to provide hyperlinks. Two types of linking. Its attribute is HREF.

1) External link – Used to connect 2 different web . pages.
2) Internal link – Used to connect different locations of same page.

Concept of URL

URL means uniform Resource Locator.
Two type of URL
a) Relative URL – Here we explicitly give the web site address
Eg: <Ahref=http://www.hscap.kerala.gov.in>

b) Absolute URL – Here we implicitly give the web site address. The path is not specified here.
Eg: Consider the web pages index.html and school.htmi saved in the folder C:\BVM. The file indexs.html contains the following.

<A href=”school.htmr>. Here we did not specify the full path of the file school.html. But this implicitly points to the file stored in C:\BVM

Creating Graphical hyperlinks

It can be achieved by using the <img> tag inside the <a>tag.
Eg:
<A href=”school.html”><img src=”school.jpg”></A>

Creating E- mail linking
It can be achieved by using the key word mailto as a value to href attribute
Eg:
<A href=mailto:”[email protected]”> SPARK</A>

  • Insert music and videos
  • <embed> tag is used to add music or video to

Attributes

  • src- specifies the file to play
  • width – Specifies the width of the player
  • height-Specifies the height of the player
  • hidden – Used to specifies the player is visible or not
  • <noembed> – Used to specifies an alternate when the browser does not support the <embed> tag.

Attribute

  • src-Used to specify the image file
  • alt – Used to specify the alternate text Eg:
    <html>
    <head>
    </head>
    <body>
    Here is a tag embed to play music
    <embed src=”c:\alvis.wma” width=”500″ height=”500″ hidden=”true”> </embed>
    </body>
    </html>

<bgsound>tag
This tag is used to play back ground song or music Eg:
<html>
<head>
</head>
<body>
<bgsound src=”c:\alvis.wma” loop=”infinite”> </body>
</html>

  • <Tabie> is used to create a table.
  • <TR> is used to create a row.
  • <TH> is used to create heading cells.
  • <TD> is used to create data cells.

<Table> Attributes

  • Border – It specifies the thickness of the border lines.
  • Bordercolor- Color for border lines.
  • Align – Specifies the table alignment in the window.
  • Bgcolor – Specifies background colour.
  • Cellspacing- Specifies space between table cells.
  • Cellpadding – Specifies space between cell border and content.
  • Cols – Specifies number.of columns in the table.
  • Width – Specifies the table width.
  • Frame – Specifies the border lines around the table.
  • Rules – Specifies the rules (lines) and it over rides the border attribute.

Values are given below

  1. none- display no rules
  2. cols – display rules between columns only(vertical lines)
  3. rows – display rules between rows only(horizontal lines)
  4. groups- display rules between row group and column groups only
  5. all – rules between all rows and columns.

<TR> attributes

  • align – specifies the horizontal alignment. Its val- . ues are left, right, centre or justify.
  • Valign- Specifies the vertical alignment. Its values are top, middle, bottom or baseline.
  • Bgcolor – Used to set background color

<TH> and <TD> attributes

  • Align – specifies horizontal alignment. Its values are left, right, centre or justify.
  • Valign – Specifies vertical alignment. Its values are top, middle, bottom or baseline.
  • Bgcolor- Specifies border color for the cell.
  • Colspan – Specifies the number of columns span forthecell.
  • Rowspan – Specifies the number of rows span forthecell.

Frameset:

  • It is used to divide the window more than one pane. It has no body section.

<Frameset> attributes

  • cols – It is used to divide the window vertically.
  • rows – It is used to divide the window horizontally.
  • border-specifies the thickness of frame border.
  • bordercolor – specifies the color of frame border.

Frame:

  • It specifies the pages within a frameset.

<Frame> attributes

  • SRC – specifies the web page.
  • Scrolling – Scroll bar is needed or not its values are yes, no or auto.
  • Noresize – It stops the resizing of the frame.
  • Margin width and Marginheight – Sets margins
  • Name- Togivenameforthefratne.
  • Target – specifies the target.

<No frame>

  • It is used to give content when some browsers that do not support frameset.
  • Nesting of framesets Step 6: Finally execute the frame.html file
  • <Form> It is used to take data from the users and send to the server.
  • <Input> It is used to create input controls. Its type attribute determines the control type.

Main values of type attribute is given below.

  • Text – To create a text box.
  • Password – To create a password text box.
  • Checkbox – To create a check box.
  • Radio – To create a radio button.
  • Reset – To create a Reset button.
  • Submit – To create a submit button.
  • Button-To create a button
  • To create a group of radio button, then the name attribute must be same.
  • <Textarea> is used to create a multiline text box.
  • <Label> It is used to give labels.
  • <Select> It is used to create list box or combo box. The items must be given by using <option> tag. Attribute
  • Name – Specifies the name of the object to identify
  • Size – If it is 1, the object is combo box otherwise it is a list box
  • Multiple – Allows to select multiple items

<Form> attributes

  1. Action – Here we give the name of the program (including the path) stored in the Webserver.
  2. Method – There are 2 types of methods get and post.
    Get methodPost method
    1. Faster1. Slower
    2. To send a small volume of data2. To send a large volume of data
    3. Less secure3. More secure
    4. Data visible during submission4. Data not visible during submission
  3. Target – Specifies the target window for displaying the result. Values are given below.
    • blank – Opens in a new window
    • self-Opens in the same frame
    • parent – Opens in the parent frameset
    • top – Opens in the main browser window
    • name – Opens in the window with the specified name.
    • <Fieldset> tag

This tag is helpful to divide a form into different subsections and form groups. <legend> tag used to give a caption for the <fieldset> section.

Plus Two Computer Science Notes Chapter 4 Web Technology

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 4 Web Technology.

Kerala Plus Two Computer Science Notes Chapter 4 Web Technology

  • Website – It is a collection of web pages contained text and multimedia(image, audio, video, graphics, animation etc) files.
  • A webpage is created by HTML tags
  • The first web page of a website is known as the home page.
  • www means world wide web.
  • Portals-Rediff, Hotmail, Yahoo, etc are called portals from which the user can do multiple activities.

Communication On The Web

Following are the steps happened in between user’s ’ click and the page being displayed

  • The browser determines the URL selected.
  • The browser asks the DNS for URLS corresponding IP address (Numeric address)
  • The DNS returns the address to the browser.
  • The browser makes a TCP connection using the ‘ IP address.
  • Then it sends a GET request for the required file to the server.
  • The server collects the file and send it back to the browser.
  • The TCP connection is released.
  • The text and the images in the web pages are displayed in the browser.

Client to web server communication

This communication is earned out between client to the web server (shopping site). The technology used to protect data that are transferred from client to web server is HTTPS (HyperText Transfer Protocol Secure). This encrypts user name, password etc. and sent to the server. HTTPS works using Secure Sockets Layer (SSL) ensures privacy as well as prevents it from unauthorised access (changes) from other web sites.

Following are the steps ,

  • Browser requests a web page to the server.
  • The server returns its SSL certificate.
  • Browser checks the genuinity of the certificate by the authorised certification authority (Eg: Veri sign)
  • The certificate authority certifies whether it is valid or not.
  • If it is valid the browser encrypts the data and transmits. The certificate can be viewed by click on the lock symbol.

Web server to web server communication

This communication is usually carried out between web server (seller) to another web server (normally bank). Forthe safe transactions Digital certificate issued by third party web sites are used.

Payment gateway is a server (Computer) that acts as a bridge (interface) between merchant’s server and bank’s serverto transfer money.

Web Server Technologies

Webserver

A computer with high storage capacity, high speed and processing capabilities is called a web server.

Software ports

The computer is not a single unit. It consists of many components. The components are connected to the computer through various ports. Two types of ports Hardware and Software.
Hardware ports : Monitors are connected through VGA ports and the keyboard or mouse are connected through PS/2 ports.

Software ports: It is used to connect client computers to the server to access different types of services. For example HTTP, FTP, SMTP etc. Unique numbers are assigned to software ports to identify them. It is a 16 bit number followed by IP address.

Default Port No.Services
20 & 21
22
25
53
80
110
443
File Transfer Protocol (FTP)
Secure shell (SSH)
Simple Mail Transfer Protocol (SMTP)
Domain Name System (DNS)
service Hypertext Transfer Protocol (HTTP)
Post Office Protocol (POP3)
HTTP Secure (HTTPS)

DNS servers

A DNS server is a powerful computer with networking software. It consists of domain names and their corresponding IP addresses. A string address is used to represent a website, it is familiar to the humans. The string address is mapped back to the numeric address using a Domain Name System (DNS). It may consists of 3 or 4 parts. The first part is www., the second part is website name, the third top level domain and the fourth geographical top level domain. .

eg-http://wwwsiic.kerala.gov.in / results.html.

http:- http means hyper text transfer protocol. It is a protocol used to transfer hypertext,

www:- World Wide Web. With an email address we can open our mail box from anywhere in the world, nic.kerala It is a unique name. It is the official website name of National Informatic Centre,

gov:- It is the top level domain. It means that it is a government organisation’s website,

in:- It is the geographical top level domain. It represents the country, in is used for India. results.htmlIt represents the file name.

Web Designing

Any text editor can be used for web designing. Besides that many software tools are available in the market to make the web pages more attractive and interactive, some of the popular softwares are Adobe dream weaver, Microsoft Expression web, Blue fish, Bootstrap etc.

Static And Dynamic Web Pages

Some pages are displaying same content(same text, images,etc) every time. Its content are not changing. This type of web pages are called static page. Conventional wep pages display static pages and has some limitations.

Advanced tools are used to create web pages dynamic, that means pages are more attractive and interactive. For this JavaScript, VBScript, ASP, JSP, PHP, etc are used.

Following are the differences

Static web pagesDynamic web pages
Content and layout is fixedContent and layout is changed frequently
Never use databaseDatabase is used
Run by browserIt runs on the server and the result get back to the client(browser)
Easy to developNot at all easy

Scripts

Scripts are small programs embedded in the HTML pages.
<SCRIPT> tag is used to write scripts

The attributes used are

  • Type-To specify the scripting language
  • Src-Specify the source file

Two types of scripts
1. Client scripts – These are scripts executed by the browser.
Eg: VB Script, Javascript etc.

2. Server scripts – These are scripts executed by the server.
Eg: ASP, JSP, PHP, Perl, etc.

  • The languages that are used to write scripts are known as scripting languages.

Scripting Languages

a. JavaScript: Java script(developed by Brendan Eich for the Netscape browser) is a platform /ncfepencfentscripting language. Means It does not require a particular browser. That is it runs on any browser hence it is mostly accepted scripting language.

Ajax : It is a technology to take data from the server and filled in the text boxes without refreshing (without reloading the entire page) the web page. Ajax is Asynchronous JavaScript and Extensible Mark up Language (XML). XML is an Extensible Mark up Language, it allows to create our own new tags. This technology uses JavaScript to perform this function. When we turned off JavaScript features in the browser, the Ajax application will not work.

b. VB Script: VB Script(developed by Microsoft) is a platform dependent scripting language. Means it requires a particular browser(MS Internet Explorer) to work that is why it is not widely accepted scripting language.

c. PHP (PHP Hypertext Preprocessor)

  • It is an open-source, general-purpose scripting language.
  • It is a server-side scripting language
  • Introduced by Rasmus Lerdorf
  • A PHP file with extension .php
  • It supports database programming the default DBMS is MySQL
  • It is platform-independent
  • PHP interpreter in Linux is LAMP(Linux, Apache, MySQL, PHP)

d. Active Server Pages (ASP)

  • ASP introduced by Microsoft
  • ASP stands for Active Server Page.
  • ASP’s are web pages that are embedded with dynamic contents, such as text.HTML tags and scripts.
  • An ASP file uses .asp extension.
  • In ASP, the script execute in the server and the effect will be sent back to the client computer.
  • Here a real time communication exists between the client and server.
  • ASP applications are very small.
  • The only server used is Microsoft Internet Information Server(IIS), hence it is platform dependant

e. Java Server Pages (JSP)

  • JSP introduced by Sun Micro System
  • JSP stands for Java Server Page.
  • An JSP file uses .jsp extension
  • It is platform-independent
  • It uses Apache Tomcat web server
  • JSP binds with Servlets(Servlets are Java codes run in Server to serve the client requests). ’

Cascading Style Sheet (Css)

It is a style sheet language used for specifying common format like colour of the text, font, size, etc. other than the HML codes. That is CSS file used to separate HTML content from its style.

It can be written in 3 ways as follows

  • Inline CSSInthebodysectionoftheHTMLfile
  • Embedded CSS In the head section of the HTML file
  • Linked CSS A separate file(external file, eg. bvm.css) with extension .css and can be linked in the web page

Code reusability(just like a function in C++) is the main advantage of CSS and can be used in all the pages in a website

  • HTML – Hyper Text Markup Language. Used to Create webpage.
  • Website is a collection of web pages.
  • It was developed by Tim Berners – Lee in 1980 at CERN.
  • Lynx, a text only browser for unix.
  • Mosaic it is a graphical browser.
  • Netscape Navigator, Microsoft Internet Explorer, Opera, Ice Weasel, Mozilla Firefox etc. are different browsers.
  • Java, C# are programming languages used forweb applications.
  • HTML f i les a re saved with .htm or. htm I.
  • Web browser is a piece of software used to view web pages.
  • Structure of an HTML Document
    <HTML>
    <HEAD>
    <TITLE>
    give title to the web page here
    </TITLE>
    </HEAD>
    <BODY>
    This is the body section.
    </BODY>
    </HTML>
  • Tags are keywords used to define the HTMLdocu- ment. Two types of tags Empty and container. Con- tainer tag has both opening and closing tag. But empty tag has opening tag only, no closing tag.
    Eg: empty tag:- <hr>, <br> etc., container tag:- <html>, </html>, etc.
  • Attributes are parameters used for providing additional information within a tag.
  • An HTML document has 2 sections. Head section and body section.

Attributes of <HTML> tag

1. Dir- This attribute specifies the direction of text displayed on the webpage, values are ltr(left to right), rtl(right to left)
2.. Lang- This attribute specifies the language values areEn(English), Hi(Hfndi), Ar(Arabic),etc Eg: <HTML dir=”ltr” lang=”Hi”>

  • Title tag is given in the head section.
  • Web page contents are given in the body section.
  • Attributes of Body tag. Bgcolor, Background, Text, Link, ALink, VLink, LeftMargin and Topmargin
  • Heading Tags(6 tags)
    <H1 >,<H2>,<H3>,<H4>,<H5> and <H6>.
    <H1> provides big heading and <H6> provides smallest.
  • <HR> is used to draw horizontal line. Its attributes are size, width, noshade and color.
  • <BR> is used to break a line.
  • Six Heading tags are used in HTML <H1 > to <H6>.
  • <B> to make the content Bold.
  • <l> to make the content in Italics.
  • <U> to underline the content. .
  • <S> and <STRIKE> – These two are used for striking out the text
  • <BIG> To make the text size bigger than the normal text
  • <SMALL> To make the size smaller than the normal text.
  • <STRONG> The effect is same as <B> tag. That is to emphasize a block of text
  • <EM> -The effect is same as <i> tag
  • <SUB>- create a subscript
  • <SUP> create a superscript
  • <BLOCKQUOTE>
    It is used to give indentation(giving leading space to a line)
  • <Q> It is used to give text within double quotes
  • <PRE> (Pre formatted text) – This tag is Used to display the content as we entered in the text editor.
  • <ADDRESS> This tag is used td provide information of the author or owner.
  • <MARQUEE> This tag is used to scroll a text or image vertically or horizontally.

Attributes of <MARQUEE>

  • Height – Sets the height of the Marquee text
  • Width – Sets the width of the Marquee text
  • Direction – Specifies the scrolling direction of the text such as up, down, left or right
  • Behavior- Specifies the type such as Scroll, Slide(Scroll and stop), and altemate(to and fro). <marquee behavior=”scroll” scroll amount-‘100″> hello</marquee>
    <marquee behavioF”slide” scrollamount-‘100H> hello</marquee>
    <marquee behavior=”attemate” scrollamount= “100”>hello</marquee>
  • Scroll delay- Specifies the time delay in seconds between each jump.
  • scroll amount- Specifies the speed of the text
  • loop- This specifies the number of times the marquee scroll. Default infinite.
  • bg color-Specifies the background colour.
  • Hspace – Specifies horizontal space around the marquee
  • Vspace – Specifies vertical space around the marquee
  • <Div> – Used to define a section or a block of text with same format.

Attributes

  • align – Sets the horizontal alignment. Values are left, right, center and justify
  • Id – Used to give a unique name
  • Style – Specify a common style to the content for example
  • <Font> used to specify the font characteristics. Its attributes are size, face and color.

Special Characters

CharacterEntityDescription
&nbsp;Non-breakable space
&quot;Double quotes
&apos;Single quote
&&amp;Ampersand symbol
<&lt;Less than symbol
>&gt;Greater than symbol
© .&copy;Copyright symbol
TM&trade;Trademark symbol
®&reg;Registered symbol
  • <IMG> tag is used to insert an image. Its important attributes are align, height, width and alt.
  • Comments are given by using <!- and → symbols.

Plus Two Computer Science Notes Chapter 3 Data Structures and Operations

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 3 Data Structures and Operations.

Kerala Plus Two Computer Science Notes Chapter 3 Data Structures and Operations

It is a particular way of organizing similar or dissimilar logically related data items into a single unit.

Classification of data structures

Classified as simple and compound. Compound (mixture) data structure is further classified as linear and non-linear. A data structure is said to be linear if its elements form a sequence(it needs contiguous memory location) otherwise it is called a non-linear data structure needs random memory)

The examples of Linear data structures are stack, queue and linked list.
Plus Two Computer Science Notes Chapter 3 Data Structures and Operations 1

We know that memory is classified into two primary and secondary. Just like that data structures are classified as static and dynamic. Static data structure is associated with primary memory. The needed memory is allocated before the execution of the program and it is fixed through out the execution. Array is an example for this. In Dynamic data structure, memory is allocated during execution. Linked list is an example for this.

Operations on data structures

  • Traversing: Accessing or visiting or reading all elements of a data structure is called Traversal.
  • Searching: Searching is the process of finding elements in a data structure
  • Inserting : It is the process of adding new data at particular location is called insertion.
  • Deleting : It is the process of removing a particular element from the data structure
  • Sorting : Arranging elements in a particular order(ascending ordescending) is called sorting. Examples are bubble sort and selection sort.
  • Merging: This is the process of combining two sorted data structure and form a new one.

Stack

A stack is a linear structure in which items can be added or removed only at one end called top. Add an item into the stack is called push and deleting an item from the stack is called pop.

The data structure that follows LIFO principle is known as stack. Example. CD pack, idly utensils, etc. Implementation of stack In a stack the values can be added or removed by at the top end only.Stack can be implemented using array. Initially the value of‘top’is set to-1 to denote the stack is empty. Whenever a value is added to a stack top’ is incremented by 1. The index of first element is 0 and the last Is N-1.

Operations on stack

a) Push operation: It is the process of inserting (adding) a new data item into the stack. If the stack is full and we try to add a new item into the stack makes the stack over flow.

b) Pop operation: It is the process of deleting (removing) a data item from the stack. If the stack is empty and we try to delete an item from the stack makes the stack underflow.

Queue

The working principle of a Queue is First In First Out(FIFO) manner. A new data item is added at the rear and removed from the front of a Queue. Examples Queue in a Cinema theater, poling station etc. Implementation of Queue A new data item is added at the rear and removed from the front of a Queue.Queue can be implemented using array. Initially the value of front and rearisset to -1 to denote the queue is empty. Whenever a value is added to a queue the rear is incremented by 1. Similarly on each deletion the value of front will be incremented by, until it crosses the value of rear.

Operation on Queue

a) Insertion operation: It is the process of adding a new item into a queue at the rear end. If the queue is full and we try to add a new item into thequeue makes the queue overflow.

b) Deletion operation: It is the process of deleting (removing) a data item from the queue from the front. If the queu is empty and we try to delete an item from the queue makes the queue underflow.

Circular queue

As the name implies logically the shape of the circular queue is a shape of a circle. The linear queue has some limitations such as some occasions the capacity of the linear queue cannot be used fully. The limitation of linear queue can overcome by circular queue. Circular queue is a queue in which the two end points are connected

Linked List

Stack and queue are implemented by array and has the fixed storage capacity. That is these implementation are static. But linked list follows the dynamic data structure method. It grows and shrinks as and when the new items are added and removed respectively. Not only that an array requires contiguous memory but linked list not require contiguous memory rather it uses scattered memory and they linked by pointers. So an element in a linked list consists of data and an address it is called node. Here address is the link.

Linked list is a collection of nodes. The first node contains the data and address of next node. The second node contains the data and the address of next node and so on. The last node contains the last data and a null pointer.

Implementation of linked list
A node consists of data and address of the next node. The address is a pointer. To implement this self referential structure is used since structure consist s of different types of data.

Example
struct node

{
int data; 
node *link;
};

The special pointer start that points to the first node is created by as follows node ‘start;

Operations on linked list

a) Creation of linked list: Linked list can be implemented by self referential structure.
Step 1 : Create a node and obtain its address.
Step 2 : Store data and NULL in the node.
Step 3 : If it is the first node, store its address in Start.
Step 4 : If it is not the first node, store its address in the link part of the node.
Step 5 :’ Repeat the steps 1 to 4.

b) Traversing a linked list: Traversing is the process of reading all elements in a data structure.
Step 1 : Get the address of the first node and store it in the variable Temp.
Step 2 : Using the address jn Temp, get and store the data in Val.
Step 3 : The address of the next node store it in Temp.
Step 4: If the address of Temp is not null go to step 2, otherwise stop.

c) Insertion in a linked list Insertion is the process of adding new node to a data structure.
Step 1: Create a node and store its address in Temp.
Step 2 : Store the data and link part of this new node using Temp.
Step 3 : Get the address of the previous node (POS-1) and next node(POS+1) inthe pointers PreNode and PostNode respectively.
Step 4 : Copy the contents of Temp into the link part of node at position (POS-1). .
Step5 : Copy the contents of PostNode into the link part of new node that is pointed to by Temp.

d) Deletion from a linked list
It is the removal of a node from the data structure.
Step 1 : Get the address of the previous node (POS-1) and next node(POS+1) in the pointers PreNode and PostNode respectively.
Step 2 : Copy the contents of PostNode into the link part of node at position (POS-1).
Step 3: Free the node at position POS.

Plus Two Computer Science Notes Chapter 2 Concepts of Object-Oriented Programming

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 2 Concepts of Object-Oriented Programming.

Kerala Plus Two Computer Science Notes Chapter 2 Concepts of Object-Oriented Programming

  • The organizing principle of a program is referred to as paradigm:
  • A program in procedural language consists of a list of Instructions.

Following are the main reasons for increasing the procedural language complexity.

a) Data is undervalued: Here the importance is on doing things rather than the data. The data I have the least importance. That is, data is enclosed to all and there is a chance to access or destroy this data accidentally or intentionally by many functions on a program.

b) Adding new data requires modifications to all / many functions: A program may contain many functions and these functions may access different data used in different locations. If we add new data items, we will need to modify all the functions that access the data. This is a laborious task.

c) Creating new data types is difficult: In procedural languages, some built-in data types such as int, float, double and character are available. Extensibility is the ability to create new data types without major rewriting of codes in its basic, architecture. Some programming languages are extensible but procedural languages are not extensible.

d) Provides poor real-world modeling: Procedural programming paradigm treats data and functions are different hot a single unit. In this Real-life simulations are not possible.

Object-Oriented Programming (OOP) paradigm We see that there are many drawbacks in Procedural Programming Paradigm, OOP eliminates these problems. It wraps data and functions into a single unit. Such units are called objects.

Advantages of using OOP are:

  • OOP allows modularity(divide the large programs into smaller ones)
  • It is good for defining abstract data types.
  • It allows data abstraction. That is it hides or protects data.
  • It allows code reusability
  • Real-life entities can be easily created 0 It supports to create new data types.

Basic concepts of OOP

1) Objects: Objects are real-world entities with similar attributes(properties) and behavior. An object combines data and functions as a single unit. The functions inside the object is called member functions and data is called a member. Example: student, car, chair etc.

2) Classes: A class is a collection of objects with similar attributes. An object is an instance of the class.
Eg. Automobile class, Furniture class etc.

A class declared using the keyword class. Class is considered as the blueprint to create objects. A structure consists of only specifications regarding data but a class consists of specifications regarding both data and functions.

  • Passing message: Calling the member function of an object from another object is called a passing message.
  • Every object will have data structures called at-tributes and behaviors called operations.
  • The object with same data structure (attributes or characteristics) and operations (behavior) are grouped into a class.
  • Data abstraction refers to the act of representing essential features without including the background details.
  • Encapsulation is the mechanism that associates the code and the data it manipulates and keeps them safe from external interference and misuse.
  • The data types created by data abstraction is known as Abstract Data type(ADT).
  • Inheritance is the capability of one class of things to inherit properties from another class.
  • Polymorphism is the ability for a message or data to be processed in more than one form. This is achieved by function overloading, operator overloading, and dynamic binding.

There are two types of polymorphism
a) Compile time(early binding/static) polymorphism: It is the ability of the compiler to relate or bind a function call with the function definition during compilation time itself. Examples are Function overloading and operator overloading

Function overloading: Functions with the same name and different signatures(the number of parameters or data types are different).

Operator overloading: It gives new meaning to an existing C++ operator.

Eg: we know that + is used to add two numbers, Operator overloading assigns + to a new job such as it concatenates two strings into one string,

b) Run time (late binding/dynamic) polymorphism: It is the ability of the compiler to relate or bind a function call with the function definition during run time. It uses the concept of pointers and inheritance.

  • Modularity is the property of a system that has been decomposed into a set of unified and loosely coupled modules.

Plus Two Computer Science Notes Chapter 1 Structures and Pointers

Kerala State Board New Syllabus Plus Two Computer Science Notes Chapter 1 Structures and Pointers.

Kerala Plus Two Computer Science Notes Chapter 1 Structures and Pointers

a) Structure is a group of different types of logically related data referenced by a single name.
Eg.

  • The collection of details of a student that may contain various data with different data types.
Data Data Type
Student Id Integer
Name String
Data of Birth Date(int-int-int
Sex Character

b) General Form of the declaration is
struct structure tag

{
Data members;
} structure variables;
Or
structure_tag var1,var2,....
Eg:
struct date
{
int dd;
int mm;
int yyyy;
};

date d1, d2, d3;

Note In Turbo C++ IDE the memory size used by int data type is 2 Bytes but in Geany IDE it is 4 Bytes. But the data type short uses only 2 Bytes.

c) Dot operator is used to access a single member. Each element of structure can be initialized sepa¬rately ortogether.
Example

#include<iostream>
using namespace std;
int main()
{
struct sample
{
int scode;
char sname[25];
}st1 ={8172,"BVM Kalparambu”};
cout<<“The details of our school is “<<endl;
cout<<“Scool Code\t:”<<st1.scode<<endl;
cout<<“Scool Name\t:”<<st1.sname<<endl;
}

Example:

#include<iostream>
using namespace std;
int main()
{
struct student
{
int reg_no;
charname[40];
char sex;
short ce,pe,te,total;
}st1;
cout<<”Enter Reg No:”;
cin>>stl .reg_no;
cout<<”Enter Name:”;
cin>>stl .name;
cout<<Enter sex:”;
cin>>stl .sex;
cout<<”Enter ce,pe and te scores:”;
cin>>stl .ce>>stl .pe>>stl .te;
st1 .total=stl .ce+stl .pe+stl .te;
cout<<"\ηThe details of Studenti is given below”;
cout<<”Reg\t:”<<stl .reg_noc<endl;
cout<<"Name\t:”<<stl .namec<endl;
cout<<”Sex\t:”<<stl .sex<<endl;
cout<<”CE Score\t:”ccstl .ce<<endl;
cout<<”PE Score\t:”<<stl .pec<endl;
cout<<”TE Score\t:”<<stl .te<<endl;
cout<<”Total Score\t:”<<stl .total<<endl;
}

d) If a structure declaration contains another structure as one of the members, it is called nested structure.
Example:
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 1
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 2

The pointer is a variable which points to memory loca¬tion of some other variable
Syntax:
data_type *variable;
int *ptr1;- Here ptr1 is a pointer variable that stores the address of an integer(Normally hexa decimal number is used to store the address),

float *ptr2; – Here ptr2 is a pointer variable that stores- the address of a float.
struct date *ptr3; – Here ptr3 is a pointer that stores the address of date data type.

*The operators & and*.
Once a variable is declared, there are two types of values.
1. L-value(Location value)- Each and every byte in the memory has a unique address. L-value is the address of a variable. C++ provides an operator called address operator(&), to get the address of a variable.

Eg.

int n,*ptr1;
n=10;

ptr1=&n; Here the address of the variable is stored in the pointer variable ptr1.

2. R-value (Read value)- The value store in the location or the variable. Indirection or deference operator is used to get the content of a variable.

Eg.
int n,*ptr1;
n=10;
ptr1 =&n; Here the address of the variable is stored in the pointer variable ptr1.
cout<<n;
and
cout<<*ptr1;
Both are same and displayed 10.
Consider the following program and out put. The address may vary.
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 3
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 6

  • Memory Map means the process of dividing the memory into four regions for four different purposes
  • Memory allocation at the compile time is static and during the run time is dynamic.
  • The operator used fordynamic memory allocation is NEW and de allocation of such variables is by DELETE Syntax:

pointer_variable =new datatype;
Eg:
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 4

Memory space available for dynamic memory allocation I free store

Memory leak
If the memory allocated using new operator is not de-allocated using delete , that memory is left unused and not released for further allocation. Such memory blocks are called orphaned memory. On each execution the amount of orphaned block is increased. This situation is called memory leak.

The reasons for memory leak are given below.

  • Forgetting to use the operator delete to delete the allocated memory that has been allocated by new operator.
  • delete operator is not in the scope of program due to poor logic.
  • multiple allocation to a pointer variable.

Operations on pointers.

Arithmetic operations on pointers
Only two arithmetic operations are possible on
pointers, integer addition and integer subtraction.

int n,*ptr;
ptr=&η;

Suppose the address of the variable n is 1000. ptr++ or ptr=ptr+1 or ptr +=1 these all are equal.

It does not mean the address +1 (1000+1=1001.) Instead, it means 1000+(size of data type)=1000+4 =1004(ln Geany the integer data type used 4 bytes of memory instead of 2 Bytes).

Similarly the arithmetic operation subtraction, ptr—or ptr= ptr-1 or ptr-=1 these all are equal.
If the address is 1000. ptr—returns 1000-4=996.
ptr+5 returns 1000+(5×4)=1020,
ptr+10 returns 1000+(10×4)=1040.
if the address is 1000.
ptr-10 returns 1000-(10×4)=960.

Example:

#include<iostream>
using namespace std;
int main()
{
int n,*ptr;
ptr=&n;
cout<<“The address of the variable n is “<<ptr<<endl;
cout<<“The next address is “<<++ptr<<endl;
cout<<“The next address is “<<++ptr<<endl;
cout<<“Note that the address is increased not by 1”<<endl;
cout<<“ but by 4(size of int data type is 4)”<<endl;
}
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 8

Note that the address is represented by hexa decimal number.

Relational Operators on pointers.

Only two relational operations are possible on pointers, equality(==) and non equality(!=)

If ptr1 and ptr2 are two pointers, they may or may not contain the same or different address locations. This can be verified using the == and != operators as follows

ptr1 == ptr2 or ptr1 != ptr2.

Pointer and array

An array is a collection of elements with same data type and the elements are stored in contiguous(neighbouring) locations, int mark[10].; It is an array here we can store 10 elements and the OS allocates 10×4=40 Bytes. The important thing you have to remember is that the starting address of the array is the array name itself. That is ‘mark’ is the starting address of the array. mark[0] is the first element it is equivalent to ‘(mark). mark[1] is the second element it is equivalent to *(mark+1) etc.
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 9

Read the following statements and write the difference between them.
a) int*ptr=newint(10);
b) int *ptr=new int[10];
a) Here ptr is a pointer variable that creates a dynamic memory location to store an integer and stores the value 10 in it.
b) Here ptr is a pointer variable that creates contiguous dynamic memory locations to store 10 integer variables.

Pointer and string

A string is a character array. The name of the string is the base address.
charstr[40]; -Here stris a character array we can store up to 39 characters. The last character is a null character(\0).
char *sptr; – Here sptr is a string pointer. eg.
cin>>str; – To read a string in the variable str.lnput a #include<iostream>
string say “COMPUTER”;
cout<<str; It prints “COMPUTER”
int main()
sptr=str; – This means the content of the string str is copied into the pointer sptr. No need to use strcpy() function to copy a string into another.

The following statements are same and display sptr=str;
“COMPUTER”
1. cout<<str; }
2. cout<<sptr;
3. cout<<&str[0];

The following statements are same and display
‘C’.
1. cout<<str;
2. cout<<sptr;
3. cout<c&str[O];

The following statements are same and display
1. cout<cstr[O];
2. cout<<*sptr;

The following statements are same and display
“OMPUTER”
1. cout<<sptr+1;
2. cout<c&str[1];
Example

#indude<iostream>
using namespace std;
int mam()
{
char str[25],*sptr;
cout<<"Enter a string:;
cin>>str;
sptr=str;
cout<<&str(O]«endl;
cout<<sptr«endl; .
cout<<&str(1]c<endl;
cout<<sptr+1 <<endi;
cout<<&str<<endl;
cout<<&sptr<<endl;
}

Advantages of character pointer
No need to specify the size. int mm;
eg. char*sptr=”Computer”;

No need to use the strcpy() function to copy the strings instead assignment operator(=) can be used

eg.

#indude<iostream>
using namespace std;
int main()
{
char str[]="computer”;
char *sptr;
sptr=str;
cout<<strc<<endl;
cout<<sptr<<endl;
}

Optimal use of memory space.
Any character can be accessed by using the pointer arithmetic and makes access faster.
eg.
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 10
date *ptr;
ptr=new date;

This ptr allocates 4+4+4=12 Bytes of memory and the address is stored ¡n the pointer ptr. Instead of dot(.) operator arrow(->) operator is used to reference the elements.
eg:
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 11
Plus Two Computer Science Notes Chapter 1 Structures and Pointers 12

Self Referential Structures-: A structure contains an element that is a pointer to the same structure.
Eg:

struct date
{
int dd,mm,yyyy;
date *Ptr;
};