Download as pdf or txt
Download as pdf or txt
You are on page 1of 64

English Language Class 10

Work Sheet 1
Letter Writing Formats

Keeping in mind of the confusions that prevail among the students of class 9 and 10 about the formats
of Informal and Formal Letters, I have attached here 4 accepted formats suggested by the Council.

Format 1: Informal Letter 1


Format 2: Informal Letter 2
Format 3: Formal Letter 1
Format 4: Formal Letter 2

Students are suggested to choose ANY ONE format each for Informal and Formal letters to avoid
further confusions.

Assignment
1. Write a letter to your brother who is studying abroad about the current situation of the
complete lockdown in your country to fight against the Corona Virus scare.

2. Write a letter to your Principal about the way you are dealing with the present complete
lockdown situation in your country. Mention how you are protecting youself, your family and
the society around you and how you are creatively utilising your time at home.

NB:
a. Please be precise in your formal letter. Unwanted details are not encouraged.
b. Strictly adhere to the format you choose. Eg. The format of the date, space between the
line, salutations etc.
c. Subject line in the Formal Letter has been discouraged by the council.
d. Stick to One format for Formal and Informal letter for practice.
Class 10 English Literature
Thorough Revision of Syllabus covered in Class 9.
THE MERCHANT OF VENICE
(Shakespeare’s unabridged play by A.W. Verity)
Drama:
Act 1 – Scenes 1, 2 & 3
Act 2 – Scenes 1 to 9
Act 3 – Scene 1 ONLY. 1.

TREASURE TROVE - A collection of ICSE Poems and Short Stories


(Evergreen Publications)
POETRY:
(i) The Heart of the Tree – Henry Cuyler Bunner
(ii) The Cold Within–James Patrick Kinney
(iii) The Bangle Sellers – Sarojini Naidu
(iv) After Blenheim – Robert Southey
(v) Television – Roald Dahl
(vi) Daffodils – William Wordsworth

PROSE (Short Stories):


(i) Chief Seattle’s Speech
(ii) Old Man at the Bridge–Ernest Miller Hemingway
(iii) A Horse and Two Goats–R.K. Narayan
(iv) Hearts and Hands – O. Henry
(v) A Face in the Dark – Ruskin Bond
(vi) An Angel in Disguise– T.S. Arthur

Assignment
Write Summary of each Scene of Act 1 of the Play
Write summaries of any three Poems
Write summaries of any three Short Stories
Class 10 Mathematics: SHARES AND DIVIDEND

Important formulae:

1. Investment = number of shares x M.V. of one share


𝐼𝑛𝑣𝑒𝑠𝑡𝑚𝑒𝑛𝑡 𝑡𝑜𝑡𝑎𝑙 𝑑𝑖𝑣𝑖𝑑𝑒𝑛𝑑
2. Number of shares = or
𝑀.𝑉.𝑜𝑓 𝑜𝑛𝑒 𝑠ℎ𝑎𝑟𝑒 𝑑𝑖𝑣𝑖𝑑𝑒𝑛𝑑 𝑜𝑛 𝑜𝑛𝑒 𝑠ℎ𝑎𝑟𝑒

𝐼𝑛𝑐𝑜𝑚𝑒
3. Percentage return = x 100
𝐼𝑛𝑣𝑒𝑠𝑡𝑚𝑒𝑛𝑡

ASSIGNMENT
Question 1
How much money will be required to buy 400, ₹ 12.50 shares at a premium of ₹1?

Question 2
A man invests ₹ 7,770 in a company paying 5% dividend when a share of nominal value of ₹ 100 sells
at a premium of ₹ 5. Find:
(i) the number of shares bought;
(ii) annual income;
(iii) percentage income.

Question 3
A man has 300, ₹ 50 shares of a company paying 20% dividend. Find his net income after paying 3%
income tax.

Question 4
A man invests ₹ 8,800 in buying shares of a company of face value of rupees hundred each at a
premium of 10%. If he earns ₹ 1,200 at the end of the year as dividend, find:
(i) the number of shares he has in the company.
(ii) the dividend percent per share.

Question 5
By investing ₹ 7,500 in a company paying 10 percent dividend, an annual income of ₹ 500 is received.
What price is paid for each of ₹100 share?
Question 6
A man buys 75, ₹100 shares paying 9 percent dividend. He buys shares at such a price that he gets 12
percent of his money. At what price did he buy the shares?

Question 7
Mr. Sharma has 60 shares of nominal value ₹100 and sells them when they are at a premium of 60%.
He invests the proceeds in shares of nominal value ₹50, quoted at 4% discount, and paying 18%
dividend annually. Calculate:

(i) the sale proceeds


(ii) the number of shares he buys and
(iii) his annual dividend from the shares.

Question 8

Which is the better investment:


16% ₹100 shares at 80 or 20% ₹100 shares at ₹120?

Question 9
A man bought 360, ten-rupee shares of a company, paying 12% per annum. He sold the shares when
their price rose to ₹21 per share and invested the proceeds in five-rupee shares paying 4.5 percent
per annum at ₹3.50 per share. Find the annual change in his income.

Question 10
Ashwarya bought 496, ₹100 shares at ₹132 each, find:

(i) Investment made by her


(ii) Income of Ashwarya from these shares, if the rate of dividend is 7.5%.
(iii) How much extra must Ashwarya invest in order to increase her income by ₹7,200
CLASS 10 - PHYSICS
Work, Power and Energy

Work done by a constant force


• Work is said to be done only when the force is applied on a body makes the body move
• The amount of work done by a force is equal to the product of the force and the displacement of
the point of application of the force in the direction of force
W=F×S
where F is force and S is the displacement in the direction of the force. It is a scalar quantity

Note:
• The amount of work done by a force depends on, the magnitude and direction of the force &
displacement it produces, If a force acts on a body and the body does not move, no work is done
Expression of work
• Work done W = force × component of displacement in the direction of force,
W = F × S cos θ
• If the displacement is in the direction of the force i.e.,
θ=0 then cos θ = cos0 = 1,
as W = F × S cos θ
W = F × S cos 0
W=FxS
The work done is maximum and positive
Different conditions
• Condition for the work done by a force to be zero
o When there is no displacement i.e., S = 0 therefore W= 0
o When θ=90° , cos 90°=0 therefore W= 0

E.g. Work done by the force of gravity (weight) acting on the load when a person carries a load
keeping on his head
• If the displacement is in a direction opposite to the force,
i.e., θ =180°
W = F × × S cos 180° (cos 180° = -1)
W = – F × S,
Work done is negative
E.g. Work done by the force of friction
Work done by the force of gravity

When a body falls down or taken to a height h above the ground


• W=F× S
F = mg S=h
Therefore
mg h
W = mgh

Note:
The work done by the force of gravity is the same whether a
man comes down from a certain height (h) using a staircase or
along the slope or he comes down from the same height using
a lift or elevator.

1
Unit of Work
• S.I. unit of work is newton metre (Nm) or joule (J)
• 1 J is the amount of work done on an object when a force of 1N displaces it by 1m along the
line of action of force
• C.G.S unit of work is dyne centimetre or erg,
1 J = 10 7 erg

Power
Power is defined as the rate of doing work or the rate of transfer of energy
P = w/t
The S.I. unit of power is watt and its symbol is W,
1 watt = 1JouleperSec
or 1W = 1Js −1
1 H.P. = 746 W = 0.746 kW
The C.G.S unit of power is erg per second (erg s −1),
Factors on which power spent by a source depends on:
• The amount of work done by the source.
• The time taken by the source to do the said work.

Expression of the Power in terms of force and velocity


As Power = work/ time
But work = FxS
Therefore,
P = (FxS)/ t
P = f x (s/t)
But s/t = velocity (v)
Therefore,
P = Fxv

Difference between work and power


Work Power
W=F× S P = w/t
It does not depend on time It depends on the time in which work is done
S.I. unit of work is joule (J) S.I. unit of power is watt (W)

Energy
The energy possessed by an object is measured in terms of its capacity of doing work
Like work, energy is also a scalar quantity
o The unit of energy is, therefore, the same as that of work, that is, joule (J)
o 1 J is the energy required to do 1 joule of work
Unit of energy
The energy used in households, industries and commercial establishments are usually expressed in
kilowatt hour
1kW h = 1 kW × 1 h
= 1000 W × 3600 s
= 36,00,000 J

or 1kW h = 3.6 x 106 J

2
Difference between Energy and Power
Energy Power

It is the capacity to do work It is the energy spent by a body in 1 s.

It does not depend on time It depends on the time in which work is done

S.I. unit of work is joule (J) S.I. unit of power is watt (W)

WORKSHEET on the topic from the text book


To be done on Numerical exercise book
• Example from 1 to 10 from page no. 25 to 27.
• Exercise (2 A) questions 1 to 31 on page 27 and 28
• Numericals from 1 -16 on page No. 28 and 29.

ADDITIONAL-WORKSHEET
1. A train is travelling on a one-level track at a speed of 72 km/h. It is pulled by an engine which
exerts a force of 12,000 N. Calculate the power of the engine in kilowatts.
2. A railway engine pulls a train with a force of 6000 N over a distance of 200 m on a level track.
Calculate the work done in joules and ergs.
3. A wasp of mass 20 g flies vertically upwards at a speed of 50 cm/sec. What is the power
generated in its wings? [g = 10 ms−2]
4. A body is acted upon by a force.
i. State two conditions under which the work done could be zero.
ii. Give an example in which the force does no work on the body.
5. A world weightlifting record is held by Sergei Didyk of USSR. He lifted 261 kg to a height of 2.3
m in 4 s.
Find the
i. Weight lifted by Didyk
ii. Work done by him
iii. Power developed by him (Take g = 10 m/s2)
6. What should be the angle between force and displacement to get
(i) Minimum work
(ii) Maximum work
7. The work done by the heart is 1 joule per beat. Calculate the power of the heart if it beats 72
times in one minute.
8. What is the difference between kW and kWh?
9. i. Prove that 1 kWh = 3.6 MJ.
ii. What is the practical unit of power?

3
Different Forms of Energy
Energy is the ability to do work and work is defined as the transfer of energy.
Objects can have energy by virtue of their motion (kinetic energy), by virtue of their position
(potential energy), or by virtue of their mass.
Mechanical energy (potential energy or kinetic energy or a combination of both), electrical energy,
light energy, thermal energy, nuclear energy, sound energy etc are some of the forms of energy.
In this chapter, we will learn about various forms of energy in detail.

Mechanical Energy
The energy possessed by a body due to its state of rest or of motion is called the mechanical energy.
The two forms of mechanical energy are;
• Kinetic energy
• Potential energy

Kinetic Energy
• The kinetic energy of a body moving with a certain velocity is equal to the work done on it to
make it acquire that velocity,
• The kinetic energy possessed by an object of mass, m and moving with a uniform velocity,
Example: A fast moving stone has the capacity of breaking a window pane on striking it and thus it
has the kinetic energy.

Work-energy Theorem
Work done on a body is equal to the increase in its kinetic energy.
Work done = Increase in the kinetic energy

Let u be the initial velocity of a body of mass m and v be the final velocity when acted upon by the
force F. Also it gains an acceleration a after travelling a displacement s.

Work done
W=FxS
As F = ma
Therefore, W = m x as

By Newtons third equation of motion


V2 = u2 + 2as
as = (v2-u2)/2
substituting it in W =mxas
W = m (v2-u2)/2
W = (½)mv2 – (½)mu2
W = final kinetic Energy – initial kinetic energy
Hence, Work Done = increase in the Kinetic Energy
Note:
If body is at rest i.e. initial velocity u = 0 therefore, W = (½) mv2
Here,
Work done =Kinetic energy
Therefore, Kinetic Energy = (½) mv2
Relationship between kinetic energy and momentum
Momentum, p = (2mk)1/2

4
Forms of Kinetic Energy
• Translational kinetic energy: The kinetic energy of the body due to motion in straight line
• Rotational kinetic energy: The kinetic energy of the body due to rotational motion
• vibrational kinetic energy: The kinetic energy of the body due to vibrational motion
Potential energy
• The potential energy possessed by the object is the energy present in it by virtue of its
position or configuration
• It is denoted by the symbol U
Example: A body placed at a height above the ground.
Forms of potential energy
• Gravitational potential energy: The potential energy due to changed position
• Elastic potential energy: The potential energy due to changed configuration
Potential energy = work done on the object, of mass m, against gravity to raise it through a height h
Different Forms Of Energy
• Solar energy • Hydro energy • Wind energy
• Heat energy • Electrical energy • Sound energy
• Light energy • Nuclear energy • Magnetic energy
• Chemical or fuel energy • Geo thermal energy • Mechanical energy

Examples of Energy Conversion


• Thermoelectric (Heat → Electrical energy)
• Geothermal power (Heat→ Electrical energy)
• Heat engines, such as the internal combustion engine used in cars, or the steam engine (Heat →
Mechanical energy)
• Ocean thermal power (Heat → Electrical energy)
• Hydroelectric dams (Gravitational potential energy → Electrical energy)
• Electric generator (Kinetic energy or Mechanical work → Electrical energy)
• Fuel cells (Chemical energy → Electrical energy)
• Battery (electricity) (Chemical energy → Electrical energy)
• Fire (Chemical energy → Heat and Light)
• Electric lamp (Electrical energy → Heat and Light)
• Microphone (Sound → Electrical energy)
• Wave power (Mechanical energy → Electrical energy)
• Windmills (Wind energy → Electrical energy or Mechanical energy)
• Piezoelectrics (Strain → Electrical energy)
• Friction (Kinetic energy → Heat)
• Electric heater (Electric energy → Heat)
• Photosynthesis (Electromagnetic radiation → Chemical energy)
• ATP hydrolysis (Chemical energy in adenosine triphosphate → mechanical energy)
Additional examples
1. Chemical energy in the coal is converted into thermal energy in the exhaust gases of
combustion
2. Thermal energy of the exhaust gases converted into thermal energy of steam through heat
exchange
3. Thermal energy of steam converted to mechanical energy in the turbine
4. Mechanical energy of the turbine converted to electrical energy by the generator, which is the
ultimate output

5
ASSIGNMENT on the topic ‘Energy Conversion’ from the Text Book
To be done on Numerical exercise book
• Example from 1 to 14 from page no. 37 to 40.
• Exercise (2 B) questions 1 to 30 on page 40 and 41.
• Numericals from 1 -23 on page No. 41 and 42.

CONSERVATION OF ENERGY IN A FREELY FALLING BODY


Let us assume that body is falling down in absence of air friction

An object of mass m is falling freely from point A as shown in the diagram.


The mechanical energy of the object
A
(i) At Point A
Body is at rest
Potential energy = mgh
x
Kinetic energy = o
Mechanical energy = P.E. + k.E, B
Mech.Energy = mgh + 0 h
Mech Energy at point A= mgh y

(ii) At Point B C
Body has travelled a distance x
Therefore
Potential energy = mg (h-x)
Kinetic energy = ½ mv2

By Newtons third equation of motion


v2 = u2 +2as
But, u =0,s = h-x and a = g
v2 = 2g (h-x)
therefore, K.E. = ½ m 2g (h-x)
So.
Mechanical energy = P.E. + K.E
Mech. Energy = mg (h-x) + ½ m 2g (h-x)
Mech. Energy at point B = mgh

(iii) At Point C
Body is about to touch the ground ( lets consider h =0)
Potential energy = 0
Kinetic energy = ½ mv2
Again by, v2 = u2 +2as
v2 = 2gh
kinetic energy = ½ mv2
Kinetic Energy = ½ m 2gh
Kinetic Energy = mgh
Therefore, mechanical energy = 0+ mgh
Mechanical Energy at c = mgh

It is clear that mechanical energy remains conserve at all three points A, B and C.

6
Conservation of Mechanical Energy in a Simple Pendulum

Let us assume that body is falling down in absence of air friction

The pendulum reaches greatest kinetic energy and least potential energy when in the vertical position,
because it will have the greatest speed and be nearest the Earth at this point. On the other hand, it will
have its least kinetic energy and greatest potential energy at the extrem%e positions of its swing, because
it has zero speed and is farthest from Earth at these points.

ASSIGNMENT on the topic ‘Energy Conservation’ from the text book


To be done on Numerical exercise book

• Example from 1 to 3 on page no. 45 and 46.


• Exercise (2 C) questions 1 to 9 on page 46 and 47.
• Numericals from 1 -9 on page No. 47.

7
CLASS 10 - CHEMISTRY

Mendeleev's Classification of Elements


Periodic table
is a chart of elements prepared in such a way that element having similar properties
occur in same vertical groups.
According to Mendeleev's periodic law, Properties of elements are periodic functions of
their atomic masses.

1
H
Hydrogen

7 9 11 12 14 16 19
Li Be B C N O F
Lithium Beryllium Boron Carbon Nitrogen Oxygen Fluorine

23 24 27 28 31 32 35.5
NA Mg Al Si P S C1
Sodium Magnesium Aluminum Silicon Phosphorus Sulphur Chlorine

39 40 48
K Ca Ti
Potassium Calcium Titanium

1
In this, there are seven periods and eight groups. Out of 8 groups, seven are of normal elements and one of
transition elements.
He left gaps in his table for unknown elements
He thought that when these elements would be discovered later on, they could be placed in the table without
disturbing other elements.

Merits of Mendeleev’s Periodic law are as follows


1.He grouped the elements on the basis of atomic mass.
2. He left gaps for undiscovered elements like Gallium, Scandium germanium. Also, he left a full group
vacant for undiscovered inert gases.
3. He could predict proportions of several elements on basis of their position in periodic table like Ga, Sc,
etc.
4.He could predict errors in atomic weights of some elements like gold, platinum, etc.
Anomalies in Mendeleev’s Periodic law are as follows -
1. Position of isotopes could not be explained.
2. Wrong order of atomic masses could not be explained.
For example:- As Ar atomic mass 40 come first and K with low atomic mass (30)
should come later but k should be placed first.

Modern Periodic Table (Prepared By Bohr)


According to Bohr’s
Modern Periodic table,
properties of elements are
periodic functions of their
atomic numbers.
So, when elements are arranged
according to increasing atomic
numbers, there is periodicity in
electronic configuration that leads to
periodicity in their chemical
properties.
It consists of horizontal rows
(Periods)
Vertical column (Groups)

There are 7 period and 12 groups in this long form of periodic table.
Ist period has 2 elements
IInd period has 8 elements
IIIrd period has 8 elements
IVth period has 18 elements
Vth period has 18 elements
VIth period has 32 elements
VIIth period has rest of elements
Note - The number of valence electrons in atom of elements decides which elements will be first in period
and which will be last.

2
In group:-
1 to 2 gp and 13 to 17 contain normal elements
3 to 12gp – transition elements.
57 to 71 - lanthanides
89 to 103 - Actinides.

Left hand side – metals.


Right hand side – nonmetals.

Note- Hydrogen element has been placed at top of Ist group. Electronic configuration of H is similar to alkali
metal as both have 1 valence electron.

Valance electron of gp I element -- 1


Valance electron of gp 2 element -- 2
Valance electron of gp 13 element -- 3
Valance electron of gp 14 element -- 4
Valance electron of gp 15 element -- 5
Valance electron of gp 16 element --6
Valance electron of gp 17 element -- 7
Valance electron of gp 18 element -- 8

3
Characteristics of periods and groups are as follows:
1. Atomic size is defined as the size of an atom or distance from nucleus to outermost shell of
an atom.
ALONG GROUP - IT INCREASES.
For example:- Consider 1st gp
Li - 3 2,1 K,L
Na- 11 2,8,1 K, L, M
K- 19 2, 8, 8, 1 K,L, M, N
As we move down the gp. , every time a new shell is
being added due to which size of an atom increases.
Atomic Period decreases.
For example:- consider 3rd period

Na Mg Ar Si

2, 8, 1 2, 8, 2 2, 8, 3 2, 8, 4
We see, every time a new electron is added to the same shell due to which nuclear charge increases and size
decreases.

2. Ionization energy - It is the amount of


energy required to remove loosely bound
electrons from outermost shell of an atom.

ALONG GROUP - IT DECREASES.


For example:- consider 1st gp

Li - 3 2, 1 K, L

Na - 11 2, 8, 1 K, L, M

K - 19 2, 8, 8, 1 K, L, M, N

As we move down, every time a new shell


is being added due to which nuclear charge decreases and size increases. Less energy is required
to remove an electron.
ALONG PERIOD - IT INCREASES.

Na Mg Al Si
As we more along period, every time a new electron is added to same
shell due to which nuclear charge increases and size decreases. That
means nuclear has more attraction for electron and large amount of 2, 8, 1 2, 8, 2 2, 8, 3 2, 8, 4
energy is required.

4
3. Metallic Character: it is the tendency to lose electrons.
Along Group – it increases
Size increases i.e. valence electrons become more away from nucleus due to which nuclear charge decreases
and metallic character increases.
For example -

Li Na K Rb Cs Fr

(least metallic) (most mettalic)

ALONG PERIODS - ITS DECREASES


From
Na Mg Al Si P S Cl

Metallic character decreases

Non-metallic character increases

Size decreases along period due to which Nuclear Charge increases and tendency to gain electrons increases.

4. Nature of Oxides

ALONG GROUP - BASIC OXIDES INCREASE.


Along Period basic nature of oxides decreases and acidic nature of oxides increases.

5. Chemical Reactivity
Along group - it decreases (in case of non metals)
It increases (in case of metals)

F Decreases Na Increases

Cl K

Br Rb

I Cs

Fr

ALONG PERIOD IT DECREASES AND THEN INCREASES

5
6. Electron Affinity
It is the amount of energy released when electron is added to outermost shell of an atom.

Along Group – It decreases.

For example:- consider 1st gp

Li - 3 2, 1 K, L

Na - 11 2, 8, 1 K, L, M

K - 19 2, 8, 8, 1 K, L, M, N
As we move down, every time a new shell is being added due to which nuclear charge decreases and size
increases. Less energy is released to remove an electron.
Along Period it increases.

Na Mg Al Si

2, 8, 1 2, 8, 2 2, 8, 3 2, 8, 4
As we move along period every time a new electron is added to same shell due to which nuclear charge
increases and size decreases. That means nuclear has more attraction for electrons and a large amount of
energy is released.

7. Electronegativity
Definition
Electronegativity is a measure of the tendency of an atom to attract a bonding pair of electrons.
(The Pauling scale is the most commonly used. Fluorine (the most electronegative element) is assigned a
value of 4.0, and values range down to cesium and francium which are the least electronegative at 0.7)

6
Advantages of Long form of Periodic table are as follows
1.Easy to remember and reproduce.
2.Based on atomic number which is a more fundamental property.
3.Position of isotopes has been solved.

Properties of the Halogens


These reactive nonmetals have seven valence electrons. As a group, halogens exhibit highly variable
physical properties. Halogens range from solid (I2) to liquid (Br2) to gaseous (F2 and Cl2) at room
temperature. As pure elements, they form diatomic molecules with atoms joined by non-polar covalent
bonds.

The chemical properties are more uniform. The halogens have very high electro-negativities. Fluorine has
the highest electronegativity of all elements. The halogens

Halogens are particularly reactive with the alkali metals and alkaline earths, forming stable ionic crystals.

Summary of Common Properties


• They have very high electronegativity.
• They have seven valence electrons (one short of a stable octet).
• They are highly reactive, especially with alkali metals and alkaline earths. Halogens are the most reactive
nonmetals.
• Because they are so reactive, elemental halogens are toxic and potentially lethal. Toxicity decreases with
heavier halogens until you get to astatine, which is dangerous because of its radioactivity.
• The state of matter at STP changes as you move down the group. Fluorine and chlorine are gases, while
bromine is a liquid and iodine and astatine are solids. It is expected that element 117 will also be a solid under
ordinary conditions. The boiling point increases moving down the group because the Van der Waals force is
greater with increases size and atomic mass.

Alkali Metal Properties


The alkali metals exhibit many of the physical properties common to metals, although their densities are
lower than those of other metals. Alkali metals have one electron in their outer shell, which is loosely bound.
This gives them the largest atomic radii of the elements in their respective periods. Their low ionization
energies result in their metallic properties and high reactivity. An alkali metal can easily lose its valence
electron to form the univalent cation. Alkali metals have low electronegativity. They react readily
with nonmetals, particularly halogens.

Summary of Common Properties


• Lower densities than other metals
• One loosely bound valence electron
• Largest atomic radii in their periods
• Low ionization energies
• Low electronegativity
• Highly reactive

7
ASSIGNMENT
Q1. Which of the following statements is not a correct statement about the trends
when going from left to right across the periods of periodic table?

(a) The elements become less metallic in nature.


(b) The number of valence electrons increases.
(c) The atoms lose their electrons more easily.
(d) The oxides become more acidic.

Q2. Element X forms a chloride with the formula XCl2 , which is a solid with a high
melting point. X would most likely be in the same group of the Periodic Table as

(a) Na
(b) Mg
(c) AI
(d) Si

Q3. Which element has?

(a) Two shells, both of which are completely filled with electrons?
(b) The electronic configuration 2, 8, 2?
(c) A total of three shells, with four electrons in its valence shell?
(d) A total of two shells, with three electrons in its valence shell?

Q4. (a) What property do all elements in the same column of the Periodic Table as
boron have in common?

(b) What property do all elements in the same column of the Periodic Table as
fluorine have in common?

Q5. An atom has electronic configuration 2, 8, 7.

(a) What is the atomic number of this element?


(b) To which of the following elements would it be chemically similar? (Atomic numbers are
given in parentheses.) N(7) F(9) P(15) Ar(18)

Q6. The position of three elements A, B and C in the Periodic Table are shown below
– Group 16 Group 17 - - - A - - B C

(a) State whether A is a metal or non-metal.


(b) State whether C is more reactive or less reactive than A.
(c) Will C be larger or smaller in size than B?
(d) Which type of ion, cation or anion, will be formed by element A?

8
Q7. Nitrogen (atomic number 7) and phosphorus (atomic number 15) belong to group 15
of the Periodic Table. Write the electronic configuration of these two elements. Which
of these will be more electronegative? Why?

Q8. How does the electronic configuration of an atom relate to its position in the Modern
Periodic Table?

Q9. In the Modern Periodic Table, calcium (atomic number 20) is surrounded by elements
with atomic numbers 12, 19, 21 and 38. Which of these have physical and chemical
properties resembling calcium?

Q10. Compare and contrast the arrangement of elements in Mendeleev’s Periodic Table and
the Modern Periodic Table.

Q11. Write electronic configuration of calcium.

Q12. Define Modern periodic law.

Q13. Name the scientist who performed x-ray studies and confirmed atomic no. as
fundamental property.

Q14. Predict the position of element sodium and fluorine.

Q15. Out of Cl, S, K, F, Na which belong to same group?

Q16. Which group is called halogens, chalcogens, rare gases, alkali group, and alkaline
group?

Q17. Which is most electronegative and electropositive element of periodic table?

Q18. Name two radioactive elements.

Q19. Why inert gases are called inert?

Q20. Name the inert gas which forms certain compounds as an anomalous behaviour.

9
Class 10: Biology - Cell Cycle and Cell Division

1. Cells –These are the structural and functional unit of life.

2. Cytokinesis- It is the division of the cytoplasm.

3. Chromosomes-Chromosomes are the carrier of heredity. Cell has a definite


number of chromosomes in it and it is a characteristic of a species. The
shape and size of a chromosome is best seen at metaphase. During the cell
division, chromatin material recognizes to form chromosomes.

4. Crossing-over- It is the process of exchange of genetic material between the


non-sisters chromatids of the homologous chromosomes. It occurs during
meiosis.

5. Karyokinesis-It is the division of nucleus.

6. -Mitosis- It is the cell division of a cell into two identical daughter cells with
each cell having the same number of chromosomes as in parent cell. It
occurs in the somatic(body) cells. Thus, is also called as equational cell
division.

7. Meosis-It is the kind of cell division that occurs in reproductive cells to


produce the gametes. The number of chromosomes is reduced to half. Thus,
it is also called reductional division. It occurs in reproductive cells or germ
cells.

8. Synapsis. During meiosis, the pairing of homologous chromosomes takes


place which is called synapsis and the pair is called bivalent.

9. Sat-Chromosomes. Sometimes, a few chromosomes have a secondary


constriction. The part of the chromosomes beyond the secondary constriction
is called satellite .Such chromosomes are called sat chromosomes.

10.Based on the position of centromere, the chromosomes are of four types


telocentric –centromere is at the tip of the chromosome, acrocentric-
centromere is near to one end of the chromatids where one arm is longer,
submetacentric-centromere is slightly away from the centre of the
chromatids, metacentric-centromere is in the centre of the chromatid.
ASSIGNMENT
Self evaluation test.
1. Name the following:
i-The process of exchange of genetic material between non sister cromatids.
ii-Division of cytoplasm.
iii-The stage of mitosis where chromosomes are seen upon the equator.

2. Choose the correct alternative and complete the following ;


i-Meiosis is called _____ division. Equational, reduction.
ii- __________ is the stage of mitosis in which nuclear membrane reappears.
Metaphase, telophase.
iii-During cytokinesis________ is formed in the plant cell to separate the two
daughter nuclei. Cell plate, constriction.

3. Give reasons.
i-Mitosis is called eqational division .
ii-cell division is a must for all living organisms.

4-State the difference between the following.


i-Autosomes and sex chromosomes.
ii-Cromatin and cromatid
iii-Genes and DNA

5-Draw all the stages of mitosis in an animal cell.


CLASS 10 - HISTORY
CHAPTER 1 - THE LEGISLATURE IN INDIA – NOTES
The Parliament of India (Bhārat ki Sansad) is the supreme legislative body of the Republic of India. It is a
bicameral legislature composed of the President of India and the two houses: the Rajya Sabha (Council of
States) and the Lok Sabha (House of the People). The President in his role as head of legislature has full
powers to summon and prorogue either house of Parliament or to dissolve Lok Sabha. The president can
exercise these powers only upon the advice of the Prime Minister and his Union Council of Ministers.
Those elected or nominated (by the President) to either house of Parliament are referred to as Members
of Parliament (MP). The Members of Parliament, Lok Sabha are directly elected by the Indian public voting
in Single-member districts and the Members of Parliament, Rajya Sabha are elected by the members of all
State Legislative Assembly by proportional representation. The Parliament has a sanctioned strength of
543 in Lok Sabha and 245 in Rajya Sabha including the 12 nominees from the expertise of different fields of
science, culture, art and history. The Parliament meets at Sansad Bhavan in New Delhi.
Parliament
The Sansad Bhavan (Parliament House) is located in New Delhi. It was designed by Edwin Lutyens and
Herbert Baker, who were responsible for planning and construction of New Delhi by British government.
The construction of buildings took six years and the opening ceremony was performed on 18 January 1927
by the then Viceroy and Governor-General of India, Lord Irwin.
COMPOSITION
President of India
The President of India, the head of state, is a component of Parliament. Under Article 60 and Article 111,
the President's responsibility is to ensure that laws passed by the Parliament are in accordance with the
constitutional mandate and that the stipulated procedure is followed before according his/her approval to
the bills. The President of India is elected by the elected members of Parliament of India consists of two
houses called the Lok Sabha and the Rajya Sabha with the President of India acting as their head. and the
state legislatures and serves for a term of 5 years.
Lok Sabha
Lok Sabha (House of the People) or the lower house has 543 members. 543 members are directly elected
by citizens of India on the basis of universal adult franchise representing Parliamentary constituencies
across the country. Between 1952 and 2020, 2 additional members of the Anglo-Indian community were
also nominated by the President of India on the advice of Government of India, which was abolished in
January 2020 by the 104th Constitutional Amendment Act, 2019.[11] Every citizen of India who is over 18
years of age, irrespective of gender, caste, religion, or race and is otherwise not disqualified, is eligible to
vote for the Lok Sabha. The Constitution provides that the maximum strength of the House be 552
members. It has a term of five years. To be eligible for membership in the Lok Sabha, a person must be a
citizen of India and must be 25 years of age or older, mentally sound, should not be bankrupt, and should
not be criminally convicted. The total elective membership is distributed among the states in such a way
that the ratio between the number of seats allotted to each state and the population of the state is, so far
as practicable, the same for all states.[12]
Speaker of the Lok Sabha
The Speaker is the presiding officer of the Lok Sabha. He has been vested with several powers to maintain
discipline in the House and ensure its dignity. It is his duty to see that the meeting is properly conducted
and the rights and privileges of the members protected. The various functions of the Speaker are stated
below.
1. Presides over Meetings:
The Speaker presides over the meetings of the Lok Sabha. He adjourns the House. He has power to
suspend its meeting in the absence of quo (The quorum is one-tenth of the members of the House.)
The Speaker presides over the joint sitting of the Lok Sabha and Rajya Sabha. (In case of disagreement
between the two Houses of the Parliament on non-Money Bills, a joint sitting of the two Houses is
convened.)
2. Maintains Discipline:
It is the duty of the Speaker to maintain order and discipline in the Lok Sabha. He would not allow any
member to behave with indignity or to use unparliamentarily language. He can reprimand any member for
using unparliamentarily or defamatory language. He can order for expunging such language from the
proceedings of the House.
If any member defies the order of the Speaker, the latter can order him to withdraw from the House. He
can also suspend the indiscipline member from the remaining part of the session of the House.
3. Determines Agenda:
The order of business is prepared by the Speaker in consultation with the leader of the House. He allots
time for debates and selects members to take part in debates. The members are asked to express their
views within time limit, fixed by the Speaker.
It is within the power of the Speaker to admit or not to admit questions, resolutions and motions. Any
question or motion can be disallowed by him.
4. Certifies a Money Bill:
He has power to certify that a bill is a Money Bill or it is not a Money Bill. This authority of the Speaker to
certify a Money Bill cannot be questioned anywhere.
5. Interprets Rules:
He interprets the Rules of Procedure of the House and gives his rulings. His ruling is final.
6. Determines a Defect
According to the 52nd Constitutional Amendment Act, 1985, the Speaker will determine whether a
member of the Lok Sabha is to be disqualified on the ground of defection.
7. Heads Parliamentary Committees:
The Speaker is the head of several parliamentary committees. He appoints the Chairman of several
committees. He himself is also the ex-officio Chairman of several committees of Lok Sabha like the
Business Advisory Committee, Rules Committee and the General Purpose Committee. He may issue
instructions and directions to these committees for their guidance.
8. Protects Rights of Members
It is the duty of the Speaker to protect the rights and privileges of the members of the House.
As the Speaker is the custodian of the rights and privileges of its members, he would punish any members
of the House or outsiders for the breach of these privileges.
9. Represents the Lok Sabha:
He is the spokesman of the Lok Sabha and he represents it in all ceremonial functions.
10. Communication Link:
The Speaker is the main channel of communication between the President and the Lok Sabha.
11. Casting Vote:
Normally, the Speaker does not take part in voting in the House. But in case of a tie, he exercises his right
of casting vote. His casting vote would decide the issue. In such a case his vote would normally go in favour
of the party to which he belongs. Further, when a resolution for the removal of the Speaker is put to vote
in the House, he has the right to cast his vote.
12. Miscellaneous Functions:
(a) The Speaker keeps control over the Secretariat the Lok Sabha. (b) It is his duty to execute the decisions
of the Lok Sabha and exercise other powers which may be given to him subject to dissolution. One third of
the members retire every second year, and are replaced by newly elected members. Each member is
elected for a term of six years.[13] Its members are indirectly elected by members of legislative bodies of
the states. The Rajya Sabha can have a maximum of 250 members. It currently has a sanctioned strength of
245 members, of which 233 are elected from States and Union Territories and 12 are nominated by the
President. The number of members from a state depends on its population. The minimum age for a person
to become a member of Rajya Sabha is 30 years.
Session of Parliament
The period during which the House meets to conduct its business is called a session. The Constitution
empowers the President to summon each House at such intervals that there should not be more than a
six-month gap between the two sessions. Hence the Parliament must meet at least twice a year. In India,
the Parliament conducts three sessions each year:
• Budget session: February to May
• Monsoon session: July to September
• Winter session: November to December
Lawmaking procedure
Legislative proposals are brought before either house of the Parliament in the form of a bill. A bill is the
draft of a legislative proposal, which, when passed by both houses of Parliament and assented to by the
President, becomes an Act of Parliament. Money bills must originate in the Lok Sabha. The Council of
States can only make recommendations over the bills to the House, within a period of fourteen days.
Parliamentary committees
Parliamentary committees are formed to deliberate specific matters at length. The public is directly or
indirectly associated and studies are conducted to help committees arrive at the conclusions.
Parliamentary committees are of two kinds: Ad hoc committees and the Standing committees.
Standing committees are permanent committees constituted from time to time in pursuance of the
provisions of an act of Parliament or rules of procedure and conduct of business in Parliament. The work of
these committees is of a continuing nature. Ad hoc committees are appointed for a specific purpose and
they cease to exist when they finish the task assigned to them and submits a report.
P.S. Please refer to the prescribed text of the Chapter for detailed notes and explanations while
answering the questions.
SHORT ANSWER QUESTIONS

1. India has a ‘Dual Polity’. What does the term mean?


2. State two features which demonstrate the unitary bias of the Indian Constitution.
3. What is the composition of the Indian Parliament?
4. What is mean by the ‘Residuary Powers’ of the Parliament?
5. Explain the term ‘Quorum’. What is the Quorum of the Lok Sabha?
6. Who administers the Oath of Affirmation to Members of Parliament?
7. What is the procedure for election of the Lok Sabha members?
8. How are members of the Rajya Sabha elected?
9. State any one subject wherein the LS and the RS enjoy co-equal powers in the legislation of laws.
10. Mention any two judicial powers of the Union Parliament.
11. State two ways by which the Parliament exercises control over the Executive.
12. What is the objective of an Adjournment Motion?
13. Who has the sole right to impeach the President and on what grounds?
14. Mention two circumstances when a Member of Parliament can be disqualified.
15. Why have seats been reserved for the Scheduled Castes and Tribes in the Lok Sabha?
16. State one exclusive power of the Rajya Sabha.
17. Mention one special feature of the Office of the Speaker of the Lok Sabha.
18. Is there any provision for a joint sitting of both Houses in case of Money Bills? If not, why?

STRUCTURED QUESTION

Question 1.
The Indian Parliament is composed of the Lok Sabha, Rajya Sabha and the President.
In this context, answer the following:
(a) What is the maximum strength of the Lok Sabha provided by the Constitution?
(b) How Many members does the President nominate to the Lok Sabha?
(c) How are members of the Lok Sabha elected?
(d) The two Houses of the Parliament enjoy co-equal powers in many spheres.
(e) Explain it by giving any three examples.
(f) State four functions of the Speaker of the Lok Sabha.
Question 2.
Keeping in view the powers of the Union Parliament, answer the following questions:
(a) Mention three ways by which the Union parliament exercises control over the Executive.
(b) Mention three Judicial powers of Parliament.
(c) Give reasons to justify why the Lok Sabha is considered to be more powerful than the Rajya Sabha.
Class 10: Geography
Chapter I: Interpretation of Topographical Maps

Introduction to Topographical Maps


Topographical maps combine natural features and man-made features on a single sheet with the help
of colours and conventional symbols. The term topography indicates relief features like mountains, hills,
ridges, valleys and coastal plains. Man-made features are referred to as artificial features and include roads,
railways, embankments, settlements and reservoirs. They comprise the cultural landscape as well.

A topographical map shows the physical environment and man's interaction with it to create the
cultural landscape. The purpose of a topographical map is to present a picture of the ground as it existed
during the survey. Topographical, or survey, maps in India are produced by the Survey of India, the oldest
scientific organisation under the Department of Science and Technology. It was established in 1767 with
Major James Runnel as the first Surveyor General of Bengal.

Topographical maps were originally made for the British army in India and were known as Ordnance
Survey sheets. These maps helped the British army to evolve precise strategies for their military campaigns.

These maps portray a small area; they are very detailed and are used by urban and regional planners
for creating infrastructural projects; by industrialists for location of plants; by film directors to study a
region before shooting a film; by government planners for implementation of developmental schemes, to
create new tourist circuits, for construction of roads and railways.

Scale
Scale is the ratio between the distance of any two points on the map and the corresponding distance
between the same two points on actual ground. It is expressed as follows:

Scale
Scale is expressed in three ways: (1) statement of scale, (ii) representative fraction, (iii) linear scale.

Statement of Scale
Stated in words, a scale becomes a statement scale. This scale is also known as a verbal scale. The
statement scale on topographical sheets such as 45 D/10 and 45 D/7 is 1 cm to 500 m or 2 cm to 1 km.

2 cm to 1 km means a distance of 2 cm on the map is equal to 1 km on actual ground.

To calculate distances on a topographical map, for example, a distance of 2.5 cm on the topographical map
will be equivalent to = 1.25 km.

Representative Fraction
Representative fraction (RF) is also called numerical fraction as the numerator is always 1. RF is a
ratio between distance on the map and the same distance on actual ground where the numerator is 1.

RF is expressed as 1:50,000 on a topographic map.

Thus, an RF of 1:50,000 means 1 cm on the map is equivalent to 50,000 cm on actual ground. (See
Figure 1).
RF =

Linear Scale
The linear scale is also called graphical or plain scale. A convenient length is divided into primary
divisions to show distance in kilometre and the first primary division on the left is subdivided into secondary
divisions to read distance in meters. The zero mark is on the right of the secondary division. Distance can
be read directly in kilometres using this scale.

At the base of the topographical sheet, all the scales (statement, RF and linear) are printed. (See figure 1)

Figure 1. Three types of scale

Measurement of Distances and Area


A pair of dividers should be used for measuring distances. The length measured can be read by
placing paper the divider on a ruler for accurate measurement.

The distance in centimetres has to be divided by 2 to convert to actual distance in kilometres as the
scale of the topographical map is 2 cm to a kilometre.

Straight Distance
For example, say you have to find out the shortest distance between Panthawada to Kuchawada
(See figure 2)
First find out the
midpoints of both
settlements by estimation.
Join the mid points with a
straight line. Measure
using a ruler. Convert the
distance measured in
centimetres into
kilometres by dividing by
2.

Distance between
Panthawada and
Kuchawada

= (11.9.cm)/2 = 5.95 km
Figure 2. Extract of a topographical map
Counting the Grid Squares
This is a very simple method. Each grid square has a side of 2 cm which is equivalent to 1 km on actual
ground.
2 cm (1 km on actual ground)

2 cm B C
A

D E F

I
G H

Therefore, the area of each grid square is 1 km x 1 km = 1 km2.

Grid Reference

The grid reference states the location of a place on the


76 2 cm
topographical maps with the help of northings and eastings.

• Horizontal lines running from east to west in topographical 75 2 cm


map are Northings.
• Northings are referred after eastings, northings increase in 74 2 cm
value northwards

73 2 cm

2 cm
• Vertical lines running from North to South.

• Eastings are given first in Grid reference.

• Easting increase in value eastwards.

23 24 25 26

Eastings →
Four Figure and Six Figure Reference

The four figure grid reference states the

location of a place on the topographical maps

with the help of Eastings and Northings. To

locate Four-figure grid, the two-digit number of

the easting is mentioned first and then the two

digits of the northings.

For example: In the figure below, the location

of Grid “B1” is 2375 (Easting and northing).

The six-figure reference of house in the

figure is 255756, for six-figure reference divide

the left and top side of grid in ten equal parts and

draw line intersecting the feature.

Questions are based on materials available in chapter 1. All questions are compulsory.
1. Define map and write down elements of a map?

2. Define Cartography?

3. Distinguish between Eastings and Northings with diagram.

4. Explain classification of maps on the basis of their size and purpose.

5. Write short notes on thematic maps.

6. Suggest any one title for thematic maps.

7. Calculate the distance of Point A to B, if the map distance is 23.4 cm and R.F is 1:25000

8. Please refer to the topographical map no 45 D/7 in your book (map for specimen paper) and answer
the following:
a. State the six-figure reference of Village: Arniwada, Bantawada and Sangla.

b. State the four-figure reference of Village Hebatpur and point 269.


Class 10 Commercial Studies
Notes and Assignments
Chapter 1
Assignment

Question 1 What do you understand by stakeholders?

Question 2 Difference between internal stakeholders and external stakeholders.

Question 3. What is the difference between stakeholders and customers.

Hint: Any 3-4 difference

Question 4. What are the expectations of the following stakeholders from a business enterprise?

a. Employers

b. Employees

c. Supplier

d. Creditors

e. Competitors

f. Government

g. Society.

h. Customers.

(Write any 4 expectations)


CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

CLASS
A class is a definition template for structuring and creating objects with the same attributes and methods.

One major difference between objects and class is in the way attributes and methods are treated in objects and
classes. A class is a definition about objects; the attributes and methods in a class are thus declarations that do not
contain values. However, objects are created instances of a class. Each has its own attributes and methods. The
values of the set of attributes describe the state of the objects.

The main Method

The static features of a class are a way of getting around the object-oriented requirement that data must live inside
objects and methods must be called on objects. Ideally, an object-oriented program would be a federation of
objects of many different classes that make method calls on one another, creating new objects as needed
and allowing old ones to be garbage-collected when no longer needed. This image is fine once the application
is up and running, but how does the process get started? If objects are constructed by other objects invoking new,
how does the first object get created?

In Java, everything starts with the main method.

main is not called on any individual object.

It is static, so it is just called. Within main, objects can be created and non-static calls can be made, so the
object interactions quickly become highly object-oriented.

Signature of main() Method

The controlling class of every Java application must contain a main() method having one of the following
signatures (this author prefers the first signature as being the most descriptive of an array of String references
which is what is passed in as an argument).

public static void main(String[] args)


public static void main(String args[])

public

The keyword public indicates that the method can be called by any object.

static

The keyword static indicates that the method is a class method, which can be called without the requirement to
instantiate an object of the class. This is used by the Java interpreter to launch the program by invoking the main
method of the class identified in the command to start the program.

void

The keyword void indicates that the method doesn't return any value.

args

The formal parameter args is an array of type String, which contains arguments entered at the command line.
Note that the args parameter MUST BE SPECIFIED whether or not the user is required to enter a command-
line argument and whether or not the code in the program actually makes use of the argument.

1
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

PRIMITIVE TYPES

The Java programming language allows the creation of objects that will ultimately participate in message
communication. We have seen that objects may have diverse behaviour and that it is more convenient to specify
objects via classification, that is, class constructs

There are eight primitive types in Java; each is a reserved keyword. They describe variables that contain single
values of the appropriate format and size; Primitive types are always the specified precision, regardless of the
underlying hardware precisions (e.g., 32- or 64-bit).

The primitive types byte, short, int and long defined in the Java language allow for the representation of discrete
integer values of widths 8, 16, 32, and 64 bits, respectively. These in turn correspond to the representation of
numeric ranges –128 to 127, –32768 to 32767, –2147483648 to 2147483647, and –9223372036854775808 to
9223372036854775807, respectively.

The primitive types float and double allow for the representation of single and double precision floating-point
real values with representational widths of 32 and 64 bits, respectively. The adopted IEEE 754 standard includes
both positive and negative sign-magnitude numbers, both positive and negative zeros and infinities, and unique
not-a-number representations.

Values of type float are of the form: s·m·2e, where s is either +1 or –1, m is a positive integer less than 224, and e
is an integer between –149 and 104. Similarly, values of type double have the similar form s·m·2e, but m is a
positive integer less than 253, and e is an integer between –1075 and 970.

Primitive types byte, short, int, long, float, and double are all signed. Type char is unsigned.

Finally, the primitive types char and boolean allow for 16-bit multi-byte characters and false/true boolean values,
respectively.

Primitive types
Type Detail Storage Range
boolean true or false 1 bit Not applicable
char Unicode character 2 bytes \u0000 to \uFFFF
byte integer 1 byte –128 to 127
short integer 2 bytes –32768 to 32767
int integer 4 bytes –2147483648 to 2147483647
long integer 8 bytes –263 to 263 –1
float floating point 4 bytes 1.4e–45 to 3.4e+38
double floating point 8 bytes 5e–324 to 1.8e+308

VARIABLE DEFINITIONS
Variable definitions in Java take the form below, where the type name T precedes the variable name v:

T v;

Typing in a programming language allows the values for a variable to be anticipated. As such, appropriate storage
may be set aside for these values. There is another subtle advantage of typing in programming languages: the
values associated with the variable also imply what operations are valid and applicable. For example,
multiplication and division applies to numeric values but not to character values. Thus, the language compiler
may flag multiplication and division of character values as erroneous.

All variables in Java are typed, allowing the compiler to verify during compilation that operations on the object
associated with the variable are legitimate.

2
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

REFERENCE DATA TYPES

Reference types hold references to objects and provide a means to access those objects stored somewhere in
memory. The memory locations are irrelevant to programmers. All reference types are a subclass of type
java.lang.Object.

Five Reference types


Reference
Brief description
types

Annotation Provides a way to associate metadata (data about data) with program elements.

Array Provides a fixed-size data structure that stores data elements of the same type.

Designed to provide inheritance, polymorphism, and encapsulation. Usually models something


Class in the real world and consists of a set of values that holds data and a set of methods that operates
on the data.

Enumeration A reference for a set of objects that represents a related set of choices.

Interface Provides a public API and is "implemented" by Java classes.

COMPARING REFERENCE TYPES TO PRIMITIVE TYPES

There are two categories of types in Java: reference types and primitive types.

Reference types Primitive types

Unlimited number of reference types, as Consists of Boolean and numeric types: char, byte, short, int, long,
they are user-defined. float, and double.

Memory location stores a reference to the


Memory location stores actual data held by the primitive type.
data.

When a reference type is assigned to


When a value of a primitive is assigned to another variable of the
another reference type, both will point to
same type, a copy is made.
the same object.

When an object is passed into a method, the When a primitive is passed into a method, only a copy of the
called method can change the contents of primitive is passed. The called method does not have access to the
the object passed to it but not the address of original primitive value and therefore cannot change it. The called
the object. method can change the copied value.

3
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

EXPRESSIONS, STATEMENTS, AND CONTROL-FLOW MECHANISMS


A method definition consists of the method signature and its implementation body. As an object responds to
messages by executing code in the method body to affect changes in its state, assignment is a very common
operation. v = E;

Assignment consists of a left-hand variable that will contains or “holds” the value specified via the right-hand
expression. It may be a literal value such as 3, a variable that holds the intended value such as number, or an
operator with appropriate operands, such as x+4, or even r.f or y*p(5). In the same way that + is an operator, .
and () are also operators. The last expression involves nested expressions: the result of p(5) is used in
multiplication.

EXPRESSION STATEMENTS
The simplest and most common statements in Java are expression statements, which consist of an assignment
expression, method invocation or instance creation followed by a semicolon. The following are expression
statements:

int a, b;
T c;
a = 1; // assignment expressions
a++;
c = new T();
new T(); // instance creation
c.m(); // method invocation

CONTROL-FLOW STATEMENTS
Apart from the simple statements, there are control-flow statements that affect the execution order of statements.
These statements are commonly grouped under conditional and iterative statements.

(a) Conditional Statements


Conditional statements allow for conditions to be attached to a statement as to whether it will be executed. The
most basic form is the if statement. In the code fragment below, the statement S is executed only if the boolean
condition E evaluates to true:
if (E)
S;
A slight variation is the if-else statement which allows for an either-or choice. If the boolean condition E
evaluates to is true and S is executed, then R would not. If S is not executed, then R would be:
if (E)
S;
else
R;

Apart from one-way and two-way branches in flow-control, the switch statement allows for multi-way
selection:

switch (E) {
c1: S1;
break;
c2: S2;
break;
c3: S3;
c4: S4;
break;
default: Sd;
}
4
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Generally, the switch statement allows for the execution of a choice of statements depending on the expression
E: S1 when E evaluates to the constant c1, S2 when c2, …, etc., the mappings given by each switch limb. The
break statement causes flow-control to leave the switch statement immediately. In the case of the execution of
statement S3 when E evaluates to c3, the absence of a break statement causes execution to continue to S4 instead.
The default limb is used when the evaluated value of E does not match any constant values in the limbs.

(b) Iterative Statements


Iterative statements allow for constituent statements to be executed repeatedly. In the most basic way, the body
of the while-statement below is repeatedly executed when the boolean condition E is true. The loop terminates
when E is false, after which execution proceeds to the next statement:

while (E)
S;

The while-statement is known as a pretest loop since the constituent S is only executed if the condition E evaluates
to is true. Thus, if E was false in the first instance, the statement S is never executed

On the other hand, the do-while statement is a posttest loop. R is first executed and subsequently while the boolean
expression F evaluates to true, R is executed again. Again, the loop terminates when F evaluates to false. Thus,
this control flow construct will execute R at least once.

do {
R;
} while (F);

The break Keyword:

The break keyword is used to stop the entire loop. The break keyword must be used inside any loop or a switch
statement.

The break keyword will stop the execution of the innermost loop and start executing the next line of code after
the block.

The continue Keyword:


The continue keyword can be used in any of the loop control structures. It causes the loop to immediately jump
to the next iteration of the loop.
• In a for loop, the continue keyword causes flow of control to immediately jump to the update statement.
• In a while loop or do/while loop, flow of control immediately jumps to the Boolean expression.

Syntax: The syntax of a continue is a single statement inside any loop:


continue;

BLOCKS
A block, indicated by { }, may occur at any location where a statement is valid. It is considered the sequential
construct as the group of statements it surrounds is treated as a single statement or processing unit.

Thus, while the various control-flow constructs merely show a single statement as the constituent body, a block
may be used where such constructs should contain more than one statement. For example, factorial may be
computed by the following while-statement:

f = 1;
while (k > 1) {
f = f*k;
k--;
}

5
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Blocks allow for control-flow constructs to be nested within bigger constructs. In the code fragment below, the
nested if-else statement allows for the number of even numbers and sum of odd numbers in the range to be
computed.

even = 0; sumOfOdd = 0;
f = 1;
while (k > 1) {
f = f*k;
if (k % 2 == 0)
even++;
else
sumOfOdd = sumOfOdd + k;
k--;
}

LOCAL DECLARATIONS
In treating a statement sequence as a single statement, a block may also be thought of as a sub-machine which
fulfils a specific task. As such, the scope of local variable declarations is the rest of the block in which the
declaration occurs. This allows declarations and associated references to be localized, thereby aiding
maintainability.

while (k > 1) {
f = f*k;
if (k % 2 == 0) {
double d = 4.5;
....
even++;
} else {
long d = 23546;
...
sumOfOdd = sumOfOdd + k;
}
k--;
}
The code fragment above is legitimate because both local declarations of d have been confined to their respective
nested blocks – d is a double in the first block, while d is a long in the second.

With instance variables, a local declaration has the same form below, where T
is the declared type of variable v.

T v;

For notational convenience, declarations may have two variations:

• a list of variables with the same type separated by commas; and


• an initial value may be provided via an expression following an assignment operator

T v, w = n(), z;

MORE CONTROL-FLOW STATEMENTS


Three other control-flow statements are commonly used: for-statement, break and continue. The for-statement is
often used as a counter-controlled loop to iterate through a loop a fixed number of times, even though it does not
have explicit mechanisms for counter control. For example, the earlier factorial example could be re-coded as
follows:

6
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

for (f = 1; k > 1; k--)


f = f*k;

The generic form of the for-statement:

for (Q; R; S)
T;

is often easier thought of as a transformed while-statement, where Q, T, and S are the initializer, conditional and
re-initializer expressions:

Q;
while (R) {
T;
S;
}

The break-statement was encountered when the switch-statement was discussed. Its more generic function is to
transfer control out of the innermost switch, while, do or for-statement. This is why using the break-statement
ensures that only the statements associated with the case-limb are executed.

For the situation with the while, do or for-statements, the break-statement allows for a quick exit from the
iteration. In many situations, its use can result in a simpler program structure.

For example, the following two code fragments have similar effects.
finished = false; while (E)
while (E && !finished) { {
S; S;
if (F) { if (F)
U; {
finished = true; U;
} break;
if (!finished) }
T; T;
} }

Finally, the continue-statement transfers control to the beginning of the innermost iterative loop so as to reevaluate
the boolean condition for the next iteration. Unlike, the break-statement, control-flow does not exit from the loop.
As such, the following two code fragments have similar effects.

while (E) { skip = false;


S; while (E) {
if (F) { S;
U; if (F) {
continue; U;
} skip = true;
T; }
} if (!skip)
T;
else
skip = false;
}

While the differences between program structures in the above examples may seem mild for the break and
continue statements to be useful, it is more pronounced for program structures that are deeply nested.

7
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Java Basic Syntax:

• Object - Objects have states and behaviours. Example: A dog has states-colour, name, breed as well as
behaviours -wagging, barking, and eating. An object is an instance of a class.
• Class - A class can be defined as a template/ blue print that describe the behaviours/states that object of
its type support.
• Methods - A method is basically a behaviour. A class can contain many methods. It is in methods where
the logics are written, data is manipulated and all the actions are executed.
• Instant Variables - Each object has its unique set of instant variables. An object’s state is created by the
values assigned to these instant variables.

Java Identifiers:
All java components require names. Names used for classes, variables and methods are called identifiers.
In java there are several points to remember about identifiers. They are as follows:

• All identifiers should begin with a letter (A to Z or a to z ), currency character ($) or an underscore (-).
• After the first character identifiers can have any combination of characters.
• A key word cannot be used as an identifier.
• Most importantly identifiers are case sensitive.
• Examples of legal identifiers: age, $salary, _value, __1_value
• Examples of illegal identifiers : 123abc, -salary

About Java programs, it is very important to keep in mind the following points.
• Case Sensitivity - Java is case sensitive which means identifier Hello and hello would have different
meaning in Java.
• Class Names - For all class names the first letter should be in Upper Case.
If several words are used to form a name of the class each inner words first letter should be in Upper
Case.
Example class MyFirstJavaClass
• Method Names - All method names should start with a Lower Case letter.
If several words are used to form the name of the method, then each inner word's first letter should be in
Upper Case.
Example public void myMethodName()
• Program File Name - Name of the program file should exactly match the class name.
When saving the file you should save it using the class name (Remember java is case sensitive) and
append '.java' to the end of the name. (if the file name and the class name do not match your program
will not compile).
Example : Assume 'MyFirstJavaProgram' is the class name. Then the file should be saved as
'MyFirstJavaProgram.java'
• public static void main(String args[]) - java program processing starts from the main() method which
is a mandatory part of every java program..

Java Methods:
A Java method is a collection of statements that are grouped together to perform an operation. When you call
the System.out.println() method, for example, the system actually executes several statements in order to
display a message on the console.
In general, a method has the following syntax:

modifier returnValueType methodName(list of parameters) {


// Method body;
}

8
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

A method definition consists of a method header and a method body. Here are all the parts of a method:

• Modifiers: The modifier, which is optional, tells the compiler how to call the method. This defines the
access type of the method.
• Return Type: A method may return a value. The returnValueType is the data type of the value the
method returns. Some methods perform the desired operations without returning a value. In this case, the
returnValueType is the keyword void.
• Method Name: This is the actual name of the method. The method name and the parameter list together
constitute the method signature.
• Parameters: A parameter is like a placeholder. When a method is invoked, you pass a value to the
parameter. This value is referred to as actual parameter or argument. The parameter list refers to the
type, order, and number of the parameters of a method. Parameters are optional; that is, a method may
contain no parameters.
• Method Body: The method body contains a collection of statements that define what the method does.

Java Classes & Objects:

• Object - Objects have states and behaviours. Example: A dog has states-colour, name, breed as well as
behaviours -wagging, barking, eating. An object is an instance of a class.
• Class - A class can be defined as a template/ blue print that describe the behaviours/states that object of
its type support.

A sample of a class is given below:

public class Dog{


String breed;
int age;
String colour;

void barking(){
}

void hungry(){
}

void sleeping(){
}
}

A class can contain any of the following variable types.

• Local variables. Variables defined inside methods, constructors or blocks are called local variables. The
variable will be declared and initialized within the method and the variable will be destroyed when the
method has completed.
• Instance variables. Instance variables are variables within a class but outside any method. These
variables are instantiated when the class is loaded. Instance variables can be accessed from inside any
method, constructor or blocks of that particular class.
• Class variables. Class variables are variables declared with in a class, outside any method, with the
static keyword.

9
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

BASIC INPUT AND OUTPUT

Java provides several classes for basic input and output, a few of which are discussed in this chapter. The basic
classes can be used to read and write to files, sockets, and the console. They also provide for working with files
and directories and for serializing data. Java IO classes throw exceptions, including the IOException, which needs
to be handled.

Java IO classes also support formatting data, compressing and decompressing streams, encrypting and decrypting,
and communicating between threads using piped streams.

The new IO (NIO) APIs that were introduced in Java 1.4 provide additional IO capabilities, including buffering,
file locking, regular expression matching, scalable networking, and buffer management.

OBJECT DEFINITION
Building upon the primitive values supported by the language proper, other entities to be manipulated are user-
designed objects which are defined via class constructs. A class construct in Java consists of the class keyword
followed by the class name and braces { } which delimit the declaration of attributes and methods for its instances.

class Counter {
attribute and method declarations
}

Object attributes are, in turn, either nested component objects or primitive types used to represent the object. An
instance method manipulates the object by altering its attribute values. The number attribute and add() method in
the Counter class below are representative of an object’s state and operation, respectively:

class Counter {
int number;
void add() {
number = number +1;
}
}

The number attribute is also known as an instance variable because it occurs in every object or instance of the
Counter class. This further implies that an attribute in one instance is independent from that in another instance.
In the same vein, a method manipulates object attributes in the same instance. This occurs when a method is
invoked and the corresponding code in its body is executed. In our recent example, invoking the add() method of
an object will increment the corresponding number attribute.

METHOD
A message is valid if the receiver has a method that corresponds to the method named in the message and the
appropriate arguments, if any, are supplied with the message. Only valid messages are executed by the receiver.

Objects are defined by classes.


• Objects from the same class share the same definition of attributes and methods.
• Objects from the same class may not have the same attribute values.
• Objects from different classes do not share the same definition of attributes or methods.
• Objects created from the same class share the same definition of attributes and methods but their state may
differ.
• A method is a set of operations executed by an object upon the receipt of a message.
• A message has three components: an object identifier, a method name and arguments.
• A message-receiving object is a server to a message-sending object known as a client.

10
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

METHODS (FUNCTIONS)
A method is a set of code which is referred to by name and can be called (invoked) at any point in a program
simply by utilizing the method's name. Think of a method as a subprogram that acts on data and often returns a
value.

Each method has its own name. When that name is encountered in a program, the execution of the program
branches to the body of that method. When the method is finished, execution returns to the area of the program
code from which it was called, and the program continues on to the next line of code.

Java statements are grouped together in methods. Each method must be inside a class. Every method has a name,
which starts with a lowercase character and typically is a verb because it does something.

Methods are time savers, in that they allow for the repetition of sections of code without retyping the code. In
addition, methods can be saved and utilized again and again in newly developed programs.

You are using methods when you use: System.out.print( ) and System.out.println( ).

The implementation of a method consists of a block of statements surrounded by { }. Often, such methods would
modify the object’s attributes. In the case of the add() method of our Counter example, it increments the variable
number.

A block consists of declarations of any local variable, expressions and control-flow constructs.

THERE ARE TWO BASIC TYPES OF METHODS:

1. Built-in: Build-in methods are part of the compiler package, such as System.out.println( ) and
System.exit(0).

2. User-defined: User-defined methods are created by you, the programmer. These methods take-on names
that you assign to them and perform tasks that you create.

How to invoke (call) a method (method invocation):

When a method is invoked (called), a request is made to perform some action, such as setting a value, printing
statements, returning an answer, etc. The code to invoke the method contains the name of the method to be
executed and any needed data that the receiving method requires. The required data for a method are specified
in the method's parameter list.

Consider this method:

int number = Console.readInt("Enter a number"); //returns a value

The method name is "readInt" which is defined in the class "Console". Since the method is defined in the class
Console, the word Console becomes the calling object. This particular method returns an integer value which is
assigned to an integer variable named number.

You invoke (call) a method by writing down the calling object followed by a dot, then the name of the method,
and finally a set of parentheses that may (or may not) have information for the method.

Terms: call and return

1. Call. When a method call is encountered in a program, the program remembers where it was and execution
goes to the method (calls the method). After a small amount of initialization, the statements in the method
are executed starting at the beginning.

11
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

2. Return. When the end of the method is reached or a return statement is executed, the method returns to
the where it was called from, and execution continues in the calling method from that point. A method
may return a value (eg, parseDouble) or not (showMessageDialog). The call-return terminology is almost
universal.

A method definition that occurs in a class construct is made up of two distinct portions:

1. the method signature header and its implementation code body surrounded by the braces { ... }.

2. The method signature portion, such as void add(), has the generic form below, where m is the method
name, T its return type, with Rn and pn being parameter types and names, respectively (n being the number
of parameters):

T m(R1 p1, R2 p2, ... Rn pn)

A method signature is part of the method declaration. It is the combination of the method name and the
parameter list.

The reason for the emphasis on just the method name and parameter list is because of overloading. It's the
ability to write methods that have the same name but accept different parameters. The Java compiler is
able to discern the difference between the methods through their method signatures.

We have seen that a method named m() is invoked to correspond to a message m sent to the object. Consequently,
the object may return a result to the message sender. The type of this value is denoted by T. If no result needs be
returned, the keyword void is used instead.

The formal parameters p1, p2…pn contain the additional values sent together with the message. They have
corresponding types R1, R2…Rn, and are used by the compiler to verify that the correct parameters are supplied
for each method invocation.

We use the term formal parameters to refer to the parameters in the definition of the method. In the
example, x and y are the formal parameters. You can remember to call them “formal” because they are part of
the method's definition, and you can think of a definition as being formal.

Any number of formal parameters may be specified, but the number of actual parameters in a message must
match those originally specified in the method signature.

We use the term actual parameters to refer to variables in the method call, in this case length and width. They are
called “actual” because they determine the actual values that are sent to the method.

// Method definition
public int mult(int x, int y)
{
return x * y;
}

// Where the method mult is used


int length = 10;
int width = 5;
int area = mult(length, width);

THERE ARE TWO TYPES OF METHODS”


1. Instance methods are associated with an object and use the instance variables of that object. This is
the default.
2. Static methods use no instance variables of any object of the class they are defined in. This starts with
static (also called class) methods because all applications start with the static method main, and many of
the early library methods that you use are static methods. Static methods are different than instance
methods because they don't have an extra object passed to them.

12
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

If you define a method to be static, you will be given a rude message by the compiler if you try to
access any instance variables. You can access static variables, but except for constants, this is unusual.
Static methods typically take all their data from parameters and compute something from those
parameters, with no reference to variables. This is typical of methods which do some kind of generic
calculation. A good example of this are the many utility methods in the predefined Math class. (See Math
and java.util.Random).

Qualifying a static call


From outside the defining class, an instance method is called by prefixing it with an object, which is then
passed as an implicit parameter to the instance method, eg, inputTF.setText("");
A static method is called by prefixing it with a class name, eg, Math.max(i,j);. Curiously, it can also be
qualified with an object, which will be ignored, but the class of the object will be used.

Example: Here is a typical static method.


class MyUtils {
...
//================================================= mean
public static double mean(int[] p) {
int sum = 0; // sum of all the elements
for (int i=0; i<p.length; i++) {
sum += p[i];
}
return ((double)sum) / p.length;
}//endmethod mean
...
}
The only data this method uses or changes is from parameters (or local variables of course).

Why declare a method static


The above mean() method would work just as well if it wasn't declared static, as long as it was called from within
the same class. If called from outside the class and it wasn't declared static, it would have to be qualified
(uselessly) with an object. Even when used within the class, there are good reasons to define a method as static
when it could be.

Documentation. Anyone seeing that a method is static will know how to call it (see below). Similarly, any
programmer looking at the code will know that a static method can't interact with instance variables, which makes
reading and debugging easier.

Efficiency. A compiler will usually produce slightly more efficient code because no implicit object parameter has
to be passed to the method.

CALLING STATIC METHODS


There are two cases.
1. Called from within the same class
Just write the static method name. Eg,

// Called from inside the MyUtils class


double avgAtt = mean(attendance);

2. Called from outside the class


If a method (static or instance) is called from another class, something must be given before the method
name to specify the class where the method is defined. For instance methods, this is the object that the
method will access. For static methods, the class name should be specified. Eg,

// Called from outside the MyUtils class.


double avgAtt = MyUtils.mean(attendance);

If an object is specified before it, the object value will be ignored and the class of the object will be used.
13
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

ACCESSING STATIC VARIABLES


Although a static method can't access instance variables, it can access static variables. A common use of static
variables is to define "constants". Examples from the Java library are Math.PI or Colour.RED. They are qualified
with the class name, so you know they are static. Any method, static or not, can access static variables. Instance
variables can be accessed only by instance methods.

ALTERNATE CALL
What's a little peculiar, and not recommended, is that an object of a class may be used instead of the class name
to access static methods. This is bad because it creates the impression that some instance variables in the object
are used, but this isn't the case.

What Pass-by-Value Means

Pass-by-value means that when you call a method, a copy of the value of each actual parameter is passed to the
method. You can change that copy inside the method, but this will have no effect on the actual parameter.

Unlike many other languages, Java has no mechanism for changing the value of an actual parameter.

In Java, we can pass a reference to an object (also called a "handle") as a parameter. We can then change
something inside the object; we just can't change what object the handle refers to. For primitives, the story is a
little different.
Some examples of passing different kinds of things to methods: primitives, objects, strings, and array.

1. Passing Primitive Types

Java has eight primitive data types: six number types, character and boolean. Consider the following example:
public static void tryPrimitives(int i, double f, char c, boolean test)
{
i += 10; //This is legal, but the new values
c = 'z'; //won't be seen outside tryPrimitives.
if(test)
test = false;
else
test = true;
f = 1.5;
}

RETURN VALUES

To change the values of variables inside methods:


a. One way to do it is simply to return the value that we have changed. In the simple example below, we take
two integers, a and b, as parameters and return a to the power of b.
public static int power(int a, int b)
{
int i;
int total = 1;
for(i = 0; i < b; i++)
total = total * a;
return total;
}

Now when we call the method power, number gets assigned the value that power returns.
int number = 2;
int exponent = 4;
number = power(number, exponent);

System.out.println("New value of number is " + number);

14
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Since methods should be designed to be simple and to do one thing, you will often find that returning a value is
enough.

A limitation of this approach is that you can send back only one value / object from a method.

If you want to change two or more things:

2. Passing Object References


We can manipulate the object in any way, but we cannot make the reference refer to a different object.
Suppose we have defined the following class:

class Record
{
int num;
String name;
}

Now we can pass a Record as a parameter to a method:

public static void tryObject(Record r)


{
r.num = 100;
r.name = "Fred";
}

In some other code we can create an object of our new class Record, set its fields, and call the method tryObject.

Record id = new Record();


id.num = 2;
id.name = "Barney";
tryObject(id);
System.out.println(id.name + " " + id.num);

The print statement prints out "Fred 100"; the object has been changed in this case.
Why? The reference to id is the parameter to the method, so the method cannot be used to change that reference;
i.e., it can't make id reference a different Record. But the method can use the reference to perform any allowed
operation on the Record that it already references.

Note: It is often not good programming style to change the values of instance variables outside an object.
Normally, the object would have a method to set the values of its instance variables.
We cannot however make the object parameter refer to a different object by reassigning the reference or calling
new on the reference. For example the following method would not work as expected:

public void createRecord(Record r, int n, String name)


{
r = new Record();
r.num = n;
r.name = name;
}

We can still encapsulate the initialization of the Record in a method, but we need to return the reference.
public Record createRecord(int n, String name)
{
Record r = new Record();
r.num = n;
r.name = name;
return r;
}
15
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Passing Reference Types into Methods

When an object is passed into a method as a variable:


• A copy of the reference variable is passed, not the actual object.
• The caller and the called methods have identical copies of the reference.
• The caller will also see any changes the called method makes to the object. Passing a copy of the object to
the called method will prevent it from making changes to the original object.
• The called method cannot change the address of the object, but it can change the contents of the object.

The following example illustrates passing reference types and primitive types into methods and the effects on
those types when changed by the called method:

void roomSetup( ) {

// Reference passing
Table table = new Table( );
table.setLength(72);
// Length will be changed
modTableLength(table);

// Primitive passing
// Value of chairs not changed
int chairs = 8;
modChairCount(chairs);
}

void modTableLength(Table t) {
t.setLength (36);
}

void modChairCount(int i) {
int i = 10;
}
}

PASS BY VALUE VS PASS BY REFERENCE


Most methods passed arguments when they are called. An argument may be a constant or a variable. For
example in the expression: Math.sqrt(x); The variable x is passed here.
Pass by Reference means the passing the address itself rather than passing the value and pass by value
means passing a copy of the value as an argument.
This is simple enough, however there is an important but simple principle at work here. If a variable is
passed, the method receives a copy of the variable's value. The value of the original variable cannot be changed
within the method. This seems reasonable because the method only has a copy of the value; it does not have
access to the original variable. This process is called pass by value.
However, if the variable passed is an object, then the effect is different. We often say things like, "this
method returns an object ...", or "this method is passed an object as an argument ..." But this is not quite true,
more precisely, we should say, something like "this method returns a reference to an object ..." or "this method is
passed a reference to an object as an argument ..."
Generally, objects are never passed to methods or returned by methods. It is always "a reference to an
object" that is passed or returned. In general, pass by value refers to passing a constant or a variable holding a
primitive data type to a method, and pass by reference refers to passing an object variable to a method. In both
cases a copy of the variable is passed to the method. It is a copy of the "value" for a primitive data type variable;
it is a copy of the "reference" for an object variable. So, a method receiving an object variable as an argument
receives a copy of the reference to the original object.
Here's the clincher: If the method uses that reference to make changes to the object, then the original
object is changed. This is reasonable because both the original reference and the copy of the reference "refer to"
to same thing as the original object. There is one exception: strings. Since String objects are immutable in Java,
a method that is passed a reference to a String object cannot change the original object.

16
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

To understand pass by reference let’s see the sample program below:

public class TestPassByReference {


public static void main(String[] args) {
// declare and initialize variables and objects
int i = 25;
String s = "Java is fun!";
StringBuffer sb = new StringBuffer("Hello, world");

// print variable i and objects s and sb


System.out.println(i); // print it (1)
System.out.println(s); // print it (2)
System.out.println(sb); // print it (3)

// attempt to change i, s, and sb using methods


iMethod(i);
sMethod(s);
sbMethod(sb);

// print variable i and objects s and sb (again)


System.out.println(i); // print it (7)
System.out.println(s); // print it (8)
System.out.println(sb); // print it (9)
}
public static void iMethod(int iTest) {
iTest = 9; // change it
System.out.println(iTest); // print it (4)
return;
}
public static void sMethod(String sTest) {
sTest = sTest.substring(8, 11); // change it
System.out.println(sTest); // print it (5)
return;
}
public static void sbMethod(StringBuffer sbTest) {
sbTest = sbTest.insert(7, "Java "); // change it
System.out.println(sbTest); // print it (6)
return;
}
}

Output of the program :


25
Java is fun!
Hello, world
9
fun
Hello, Java world
25
Java is fun!
Hello, Java world

TestPassByReference begins by declaring and initializing three variables: an int variable named i, a String object
variable named s, and a StringBuffer object variable named sb. The values are then printed. Then, each variable
is passed as an argument to a method. Within each method, the copy of the variable exists as a local variable. The
value of the variable — or the value of the object referred to by the variable, in the case of the String and
StringBuffer object variables” is changed and printed within each method. The print statements are numbered to

17
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

show the order of printing. Back in the main() method, the three values are printed again. Have a look at the
output and see if it is consistent with our previous discussion.

The pass-by-reference concept is illustrated by the object variables sb and sbTest. In the main() method, a
StringBuffer object is instantiated and initialized with "Hello, world" and a reference to it is assigned to the
StringBuffer object variable sb.

METHOD OVERLOADING
Method Overloading is a feature that allows a class to have more than one method having the same name, if their
argument lists are different. It is similar to constructor overloading in Java, that allows a class to have more than
one constructor having different argument lists.

Method overloading is an example of Static Polymorphism.

Points to Note:
1. Static Polymorphism is also known as compile time binding or early binding.
2. Static binding happens at compile time. Method overloading is an example of static binding where
binding of method call to its definition happens at Compile time.

Three ways to overload a method


In order to overload a method, the argument lists of the methods must differ in either of these:

1. Number of parameters.
For example: This is a valid case of overloading
add(int, int)
add(int, int, int)

2. Data type of parameters.


For example:
add(int, int)
add(int, float)

3. Sequence of Data type of parameters.


For example:
add(int, float)
add(float, int)

Invalid case of method overloading:


When we refer to argument list, we are not talking about return type of the method, for example if two methods
have same name, same parameters and have different return type, then this is not a valid method overloading
example. This will throw compilation error.

int add(int, int)


float add(int, int)

18
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

OBJECT INSTANTIATION

A class construct provides a description for objects of that class, and serves as a template for objects to be
created. However, no instances of the class is crested, except by calling the object allocator function new(). The
expression new Counter() returns a newly created instance of the Counter class. However, in order that this new
object may be referred to, it is assigned to an appropriate variable. Assuming the variable carpark in the fragment
below, a new Counter object may be created via new Counter(), and then assigned to the former:

Counter carpark;
...
carpark = new Counter();

Henceforth, the newly created object may be referred to via the variable carpark. Where more Counter objects are
needed, the object allocator function new() may be repeatedly invoked, and the resultant objects assigned to other
variables such as entrance and exitDoor:

Counter entrance, exitDoor;


...
entrance = new Counter();
exitDoor = new Counter();

Object Access and Message Passing


Since the attributes and methods of an object are considered its characteristics, these are accessed via the
qualification operator “.” with respect to an object proper. Thus, the counts of the various Counters carpark,
entrance and exitDoor are carpark.number, entrance.number and exitDoor.number, respectively. The total number
from these counters is:

carpark.number + entrance.number + exitDoor.number

Similarly, the initialize() method of Counters carpark, entrance and exitDoor may be invoked via:

carpark.initialize();
entrance.initialize();
exitDoor.initialize();

Representational Independence
While accessing object attributes directly is permissible, it is not ideal because it couples implementation code to
the current object representation. As such, any changes in object representation propagates to dependent code,
resulting in high software maintenance cost.
A common object-oriented programming practice is information hiding — to make object representations
inaccessible to clients so that modifications in (server) object representations do not propagate excessively. This
decoupling of dependencies reduces software maintenance cost.
Limiting access to object representations in Java is mainly achieved by the two main constraint specifiers private
and public. The former limits access of the following entity to within the class construct, while the latter makes
it accessible to any client code.
class Counter {
private int number = 0;
private int reused = 0;
public void add() {
number = number+1;
}
public void initialize() {
number = 0;
reused = reused+1;
}
}
19
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Since constraint specifiers in the above class definition hides the internal representation of Counter objects, the
resultant attributes are no longer accessible, and useless for interrogation. In this case, accessor methods
getNumber() and getReused() are required, as outlined in the following code fragment. They provide access to
internal details, but without dependency overheads. Representation independence is maintained by confining
access to private attributes to within the class construct.
class Counter {
private int number = 0;
private int reused = 0;
public void add() {
number = number+1;
}
public void initialize() {
number = 0;
reused = reused+1;
}
public int getNumber() { return number; }
public int getReused() { return reused; }
}

INITIALIZATION AND CONSTRUCTORS


Currently, object creation and initialization are seen as distinct operations. The abstraction in object-oriented
programming languages often allows these two operations to be combined implicitly. As such, constructors may
be seen as unique methods invoked implicitly when an object instance is created. Implicit initialization relieves
the programmer from performing this important function, but more importantly prevents uninitialized objects as
a result of absent-minded programmers. Carefully designed constructors allow for object invariants to be
maintained regardless of how they were created.

Apart from having the same name as the class, and not having a return result type, a constructor is not different
from a method. It has similar syntax for its parameters and implementation body.

RESULT RETURNED BY METHOD


Now that we have examined the statement constructs in Java, we return to see how a method may return a result
to its sender. A method in a class definition has the following general form, with the return-statement returning
control-flow back to the message sender:

T foo(gT g, hT h ...) {
// local definitions
// statements
return v;
}

The value returned v, must be of the type T as indicated in the method signature. If the sender does not require
any results, the keyword void should be used as the return type. In this case, the returning expression v would be
omitted in the return statement. The return-statement need not be the last statement in the block as implied in the
previous example. In a non-trivial structure, multiple return statements might be used as in the next example, but
the programmer must evaluate if the situation improves program structure and readability.

T foo(gT g, hT h ...) {
for (E; F; G)
if (H)
return v;
else if (J) {
b;
return w;
}
return x;
}
20
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Generally, these constructs are representative of what Java offers. The class construct is key in Java because it
allows for objects to be defined to model the problem domain. Below that, variables and methods are defined,
which correspond to data and code. Code abstraction result in hierarchical statement blocks (with optional local
variables) and control flow mechanisms. Figure illustrates this hierarchy.

21
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

The Mechanics of Creating


a Java Program
Java Program: a set of instructions
for the computer to follow. The
source code.

Data: data for the Java program

Java Compiler: translates the


program from Java to a language that
the computer can
understand. Compilers differ by make
of machine and operating systems.

Byte Code Program: the compiler


translates Java into a language called
byte-code. Byte code is the machine
language for a hypothetical computer
called the Java Virtual Machine.

Byte Code Interpreter: the


interpreter translates each instruction
of byte code into instructions that the
computer in use can execute.

Machine Language: is the language


the computer in use understands.

Reserved Words (Keywords) for Java


Here are the reserved words for Java ( keywords ). You may not redefine any of these
reserved words. These words ALWAYS appear in lowercase. You should not give methods
or variables the same name as any of these keywords.
abstract boolean break byte
case catch char class
const continue default do
double else extends final
finally float for future
generic goto if implements
import inner instanceof int
interface long native new
null operator outer package
private protected public rest
return short static super
switch synchronized this throw
throws transient try var
void volatile while

22
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Style Issues
Program Format: Notice the format style that we will be
using. The indentations keep the code
clearly visible and easy to read.
import java.io.*;
//printing a message on the screen
It is possible, in Java, to write all of your
//notice the format of the code
code on one line -- this is called free form
public class HelloClass
style. Free form style is extremely difficult
{
to debug at a later date and is nearly
public static void main (String[ ] args)
impossible for a programming team to
{
decipher. We will NOT be using free form
System.out.println ("Hello, Java world!");
style.
System.out.println ("I plan to be a Java expert!");
}
}
Case sensitivity: Java is very picky about your caps lock
key. The three lines of code at the left, at
first glance, may appear to all say the same
if (netpay > grosspay)
thing. The Java compiler, however, will only
execute the first line of code. Most Java
If (NetPay > GrossPay)
code is written in smaller case and ALL
reserved words (such as "if") MUST be
IF (NETPAY > GROSSPAY)
written in smaller case.
Comments: In Java, comments may be expressed in
different forms.
The comments beginning with // are single
import java.io.*;
line comments. They can appear on a line by
//printing another message on the screen
themselves, or they may follow other lines of
//notice the commented lines
code.
public class HelloAgainClass
The comments enclosed within /* and */ are
{
used for longer comments that wrap around a
public static void main (String[ ] args)
line.
{
System.out.println ("Hello!"); //first print
System.out.println ("I just love this Java!");
}
}
/*sometimes comments are longer statements that
wrap around to the next line on the screen*/

Blank Space: The compiler ignores extra blanks between


words and symbols.
import java.io.*;
Blank lines between lines of code are also
//notice the spacing in this code
ignored. Notice the blank line between the
public class HelloStillClass
two print statements.
{
public static void main (String[ ] args)
You cannot, however, embed blanks in
{
identifiers.
System.out.println ("Java rocks!");
The use of blanks improves readability.
System.out.println ("A real space cadet!");
}
}

23
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1

Computer Applications
Class 10 ASSIGNMENT
Chapter – Methods

Write short answers for the following …


1. Explain what is a method? Why it is used?
2. Name different parts of a method header.
3. Differentiate between actual and formal parameters.
4. Differentiate between void and non-void methods.
5. Which of the above mentioned method will use return?
6. In two separate statements write calls to methods void add() and int add(int a, int b).
7. Differentiate between call by value and call by reference w.r.t. methods.
8. How many values can be returned through return statement? What happens to the code that you write
after return statement?
9. Differentiate between called method and a calling method? Use your own example to explain the
difference.
10. Explain the meaning of the statement: ‘Methods resides in a class’.
11. What are overloaded methods? How do they differentiate with each other?

Write definitions of the methods for the following …


1. A method that returns Boolean for a given number. [ boolean isPrime (int num) ]
2. A method that returns int for a given number. [int reverse(int num) ]
3. A method that prints the sum of 10 int values accepted in the method using a for loop. [void printSum() ]
4. A method that returns either 0 or 1 after checking if the number is even or odd. [int isEvenOdd(int num) ]

Write JAVA programs for the following…


1. WAP in java to call ALL the methods mentioned above in a switch case after accepting user’s choice. [ class
Menu ]
2. WAP in java to demonstrate the usage of following overloaded methods.
a. void area( int s) // method that prints the area of a square
b. void area( int l, int b) // method that prints the area of a rectangle
c. void area( int r, double pi) // method that prints the area of a circle
[ class shape ]

24
CLASS 10 ECONOMICS APPLICATIONS
CLASS 10 ECONOMICS APPLICATIONS

You might also like