Professional Documents
Culture Documents
Class 10 Week 1 PDF
Class 10 Week 1 PDF
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.
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.
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:
𝐼𝑛𝑐𝑜𝑚𝑒
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:
Question 8
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:
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
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.
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
2
Difference between Energy and Power
Energy Power
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)
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
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
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.
(ii) At Point B C
Body has travelled a distance x
Therefore
Potential energy = mg (h-x)
Kinetic energy = ½ mv2
(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
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.
7
CLASS 10 - CHEMISTRY
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.
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.
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.
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.
Li - 3 2, 1 K, L
Na - 11 2, 8, 1 K, L, M
K - 19 2, 8, 8, 1 K, L, M, N
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
Size decreases along period due to which Nuclear Charge increases and tendency to gain electrons increases.
4. Nature of Oxides
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
5
6. Electron Affinity
It is the amount of energy released when electron is added to outermost shell of an atom.
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.
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.
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?
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
(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?
Q6. The position of three elements A, B and C in the Periodic Table are shown below
– Group 16 Group 17 - - - A - - B C
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.
Q13. Name the scientist who performed x-ray studies and confirmed atomic no. as
fundamental property.
Q16. Which group is called halogens, chalcogens, rare gases, alkali group, and alkaline
group?
Q20. Name the inert gas which forms certain compounds as an anomalous behaviour.
9
Class 10: Biology - Cell Cycle and Cell Division
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.
3. Give reasons.
i-Mitosis is called eqational division .
ii-cell division is a must for all living organisms.
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
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.
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.
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)
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
Grid Reference
73 2 cm
2 cm
• Vertical lines running from North to South.
23 24 25 26
Eastings →
Four Figure and Six Figure Reference
the left and top side of grid in ten equal parts and
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?
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.
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.
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 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?
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.
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
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 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.
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.
Enumeration A reference for a set of objects that represents a related set of choices.
There are two categories of types in Java: reference types and 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.
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
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.
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.
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 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.
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;
T v, w = n(), z;
6
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1
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 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
• 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:
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.
• 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.
void barking(){
}
void hungry(){
}
void sleeping(){
}
}
• 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
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.
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.
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.
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.
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.
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):
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;
}
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).
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.
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
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.
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.
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
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);
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.
class Record
{
int num;
String name;
}
In some other code we can create an object of our new class Record, set its fields, and call the method tryObject.
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:
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
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;
}
}
16
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1
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.
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.
1. Number of parameters.
For example: This is a valid case of overloading
add(int, int)
add(int, 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:
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; }
}
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.
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
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*/
23
CLASS 10: COMPUTER APPLICATIONS – Java Programming UNIT 1
Computer Applications
Class 10 ASSIGNMENT
Chapter – Methods
24
CLASS 10 ECONOMICS APPLICATIONS
CLASS 10 ECONOMICS APPLICATIONS