Escolar Documentos
Profissional Documentos
Cultura Documentos
A reference source providing full length study material and project material for ICSE
students.
if you find settlements along the banks of the river, then fishing is an
occupation of that area.
if you find large settlements, esp near the metalled roads, the
occupation can also be industries, trade, services.
16. What is the brown line in grid square ............. called? What does the
figure written aong this line indicate?
(if it is a brown line , then it is a contour. Second part of the question imagine you see figure 280 m ... then it means 280 m above sea level.)
Ans: The brown line that we find in grid square is Contour line. The line 280
m joins places 280 m above sea-level on the map.
17. What are the brown lines seen in such abundance? What do they
indicate?
(same answer as question 16)
ans: They are contour lines. They indicate lines joining places having the
same height above sea-level. Closeness of the contours indicates
mountainous topography.
17. What is a causeway? Why are there so many causeways in the map?
Ans: Causeways are land raised across streams for use as metalled road or
paths. The numerous streams crossing the metalled road are likely to flood
them.
18. Explain the term Depression in the map.
Ans: Depression is a shallow lowland in a sandy region often created by
deflation of wind.
19. Name the geographical feature represented by white patches in the
middle of the river.
Ans: The geographical feature in the middle of the river represented by
white patches is an island or rocks or stores.
20. What do the following represent in the map? i. Black broken lines ii.
Black curved lines.
i. Black broken lines indicate disappearing stream and black curved lines
indicate broken ground.
21. Name 4 methods by which relief is shown on the map.* Contour lines *
Layer Colouring/tinting * Spot height * Hill shading.
22. What is layer-tinting/colouring?
It is a method, where a colour scheme is used to show relief on the map.
23. What is cartography?
Cartography is an art and science of drawing maps, diagrams and charts.
POINTS TO REMEMBER:
16r therelative height of sand dune is 16 metres. (if 16r is written near the
symbol of sand
dunes)
8r the relative height of river bank is 8 metres (if 8r is written near the river
bank)
PLEASE NOTE: you must write the word RELATIVE HEIGHT/DEPTH
of .................................
COLOURS:
7 COLOURS are used on toposheets:
i. BLACK: Names, lines of latitudes and longitudes, broken grounds, river
banks, dry rivers, surveyed trees, heights and their numbering, railway
mines, telephone, telepgraph lines
ii. RED: Grid lines (eastings and northings) , their numbering, roads, cart
tracks, settlements, huts and other buildings.
iii. GREEN: Forested and wooded areas, scrubs, scattered trees, orchards
iv. BLUE: Water bodies containing water like wells, rivers, etc
v. YELLOW: cultivated areas
vi. BROWN: Contour lines, their numbering, form lines, all sand features
like sand dunes, sand hills, stony waste
vii. WHITE PATCHES: uncultivated and barren lands
DIRECTIONS
Directions are important for physical as well as urban features. the physical
features involve the directions of rivers, streams, and the urban cities from
one another.
When a question is asked regarding the banks of the river or direction of
the river, the following steps should be observed.
first of all, look at the spot heights to determine the slope of the land.
As you know, spot heighs are marked this way 265 289
see which spot heights are higher and where it is lower, and then you
will know which way or direction it slopes. the slope of the land may be
from north east to south west. and if you see a river , then it flows from
north-east to south-west.
Form lines are represented on a map as dashed lines and are never labeled
with representative elevations.
c. Shaded Relief. Relief shading indicates relief by a shadow effect
achieved by tone and color that results in the darkening of one side of
terrain features, such as hills and ridges. The darker the shading, the
steeper the slope. Shaded relief is sometimes used in conjunction with
contour lines to emphasize these features.
d. Hachures. Hachures are short, broken lines used to show relief.
Hachures are sometimes used with contour lines. They do not represent
exact elevations, but are mainly used to show large, rocky outcrop areas.
Hachures are used extensively on small-scale maps to show mountain
ranges, plateaus, and mountain peaks.
e. Contour Lines. Contour lines are the most common method of showing
relief and elevation on a standard topographic map. A contour line
represents an imaginary line on the ground, above or below sea level. All
points on the contour line are at the same elevation. The elevation
represented by contour lines is the vertical distance above or below sea
level.
(1) Index. Starting at zero elevation or mean sea level, every fifth contour
line is a heavier line. These are known as index contour lines. Normally,
each index contour line is numbered at some point. This number is the
elevation of that line.
(2) Intermediate. The contour lines falling between the index contour lines
are called intermediate contour lines. These lines are finer and do not have
their elevations given. There are normally four intermediate contour lines
between index contour lines.
(3) Supplementary. These contour lines resemble dashes. They show
changes in elevation of at least one-half the contour interval. These lines
are normally found where there is very little change in elevation, such as
on fairly level terrain.
Question .4. Give the category and select the odd one out :
(i) Goitre, dwarfism, acromegaly, cataract.
(ii) ADH, TSH, NADP, ACTH.
(iii) Steroids, cortisone, testosterone, adrenalin, prolactin.
(iv) Adrenal, liver, thyroid, ptutiary.
(v) Adrenalin, penicillin, insulin, thyroxine.
Answer :
Category
Odd one
Cataract
(ii) Hormones
NADP
(iii) Hormones
Steroids
Liver
(v) Hormones
Penicillin.
Secretions
Effect on Body
Oestrogen
Protruding eyes
Lachrymal
10
Gigantism
Answer :
1 Ovary.
2 Responsible for developing secondary sexual characters of females.
3 Secrete glucagons.
4 Glucagon helps to convert glycogen stored in liver to glucose.
5 Thyroid. 6 Thyroxin. 7 Tears. 8 Tears lubricate the eyes and prevent dust from entering in the eye. 9
Pitutiary gland. 10 Growth hormone (somatotropin).
Question .7. Complete the following table by filling in the blank space 1 to 8.
Name of Gland
Substance Produced
One important
function
1. .. .
2. .
3. .. .
Adrenalin
4. .. .
5. .. .
Thyroxine
6. .
7. .
LH
8. .
Answer :
1 Insulin.
Answer :
(i)
Diabetes mellius
Diabetes insipidus
Acromegaly
Myxedema
(ii)
Close
Answer :
(i) Islets of langerhans.
(ii) Insulin and glucagons.
(iii) Insulin lowers the blood glucose level. Glucagon increases the blood glucose level.
Question .11. Why people living in hilly regions usually suffer from simple goiter.
Answer :
The soil and water in hilly region is deficient in Iodine.
Close
Question .12. Name the hormones produced by the following glands. In each case state one
function of the hormone :
1. Thyroid.
2. Pancreas.
3. Adrenal medulla.
Answer :
1 Thyroid Thyroxine and calcitonin Thyroxine controls metabolic rates of carbohydrate, protein and fat.
2 Pnacrea Insulin and glucagon insulin decreases blood glucose level.
3 Adrenal medulla Adrenalin Increases heart beat and blood pressure.
Question .13. Give logic for why insulin is injected into the body of a highly diabetic patient and
not given orally ?
Answer :
Insulin is a protein. It is not given orally as it will be digested in the intestine. Thus it is injected directly into the blood.
Question .15. Given figure is the outline of the human body. Redraw the same and then place the
following organs in the correct position and label them :
Fig.
1 Thyroid gland; 2 Windpipe; 3 Diaphragm; 4 Right and left lungs; 5 Right and left
kidneys; 6 Adrenal glands.
(i) Name the hormone produced by the thyroid gland and state its function in the body.
(ii) What would a child suffer from if there was hyposecretion of this gland ?
(iii) What role does the diaphragm play in the inspiration of air. Explain briefly.
Answer :
Fig.
(i) Thyroxine. Function It controls cellular respiration / controls carbohydrate metabolism.
(ii) Cretinism.
(iii) During inhalation, the diaphragm flattens and the volume of thoracic cavity increases and during exhalation
diaphragm become dome-shaped thus decreasing the volume of thoracic cavity.
Question .16. Given below are the diagrammatic sketches of some endocrine glands. Observe the
figures and answer the following questions.
(iv) Fertilization is the product of fusion of egg nucleus and sperm nucleus.
(v) Fertilization of ova in human female occur in the vagina.
Answer :
Solution:
(i) T
(ii) F
(iii) F
(iv) T
(v) F.
Close
(iii) Placenta Transfers nutrients, oxygen and antibodies from maternal blood to foetal blood and remove metabolic
wastes. It also acts as an endocrine gland.
(iv) Acrosome Entry of sperm into egg is facilitated by release of certain lysosomal enzyme by the acrosome on
the head of sperm.
(v) Amniotic fluid Protects the developing embryo from shock and injuries.
(vi) Amnion Encloses the embryo by forming amniotic cavity which is filled with clean lymph like fluid which
cushions and protects the embryo from shock.
(vii) Seminiferous tubule It is lined internally by germinal epithelium. Some of these epithelial cells functions as
spermatogonia and give rise to sperms.
Answer :
Solution:
The time interval between implantation and birth is called gestation period.
Sperm
Ovum
(ii)
Prostate gland
(iii)
Cowpers gland
Implantation
Gestation
Question .12. Draw a diagram of human sperm and label the following parts :
head, middle piece, acrosome, mitochondria, tail.
Answer :
Question .13. The following diagram represents the ventral view of the female
reproductive system :
Fig.
(vi) Name the organs of the female body in which the foetus develops.
(vii) Name the parts homologous to penis of male.
(viii) What is ovulation ?
(ix) Which two hormones are secreted by ovary ?
(x) How does the human embryo developing in the uterus obtain its
nourishment ?
(xi) State the function of (1) Placenta and (2) amniotic fluid.
(xii) Differentiate between identical twins and fraternal twins.
Answer :
Solution:
(i) 1. Oviduct; 2. Funnel of oviduct; 3. Ureter; 4. vagina; 5. Ovary; 6. Uterus; 7. Urinary bladder; 8. Urethra.
(ii) The wall of uterus get thickened and richly supplied with blood capillaries to receive the zygote.
(iii) The wall of the uterus further thickens and gets intensely supplied with blood capillaries and the embryo is
attached to uterine wall after 7 days of fertilization.
(iv) The endometrium breaks down and causes discharge of blood and mucus resulting in menstruation.
(v) Graafian follicle.
(vi) Uterus.
(vii) Clitoris.
(viii) The process by which the matured ova discharges from the ovary.
(ix) Oestrogen and progesterone.
(x) The foetus gets nourishment from the mothers blood through the placenta.
(xi) (1) Placenta Exchange of digested food.
(2) Amniotic fluid Protects foetus from jerk/shocks.
(xii)
Identical twin
Fraternal twin
Question .14. Given below is the outline of the cross section of the male
reproductive system :
Fig.
(i) Copy the outline onto your answersheet in pencil and label the following parts
testis, epididymis, seminal vesicles, vas deferens.
(ii) Name the hormone produced by the testis.
(iii) Why are sperms produced in large numbers ?
(iv) State the function of the seminal vesicles.
Answer :
(i)
Fig.
(ii) Testosterone.
(iii) Low count of sperms causes infertility because large number of sperms go astray.
(iv) Seminal vesicles produce a secretion which serves as a medium for the movement of sperms towards the female
oviduct.
Question .15. The diagram given below is that of a developing human foetus in
the womb. Study the same and then answer the questions that follow :
Fig.
Answer :
(i) 1 Umbilical cord. 2 Placenta. 3 Amniotic fluid.
4 Cervix. 5 Uterine wall.
(ii) Gestation.
(iii) 280 days.
(iv) Provides diffusion for respiratory gases between mother and foetus, removes urea produced by foetus.
(v) Progesterone.
(vi) Absorbs shocks.
Question .16. The diagram given below is one of the system in the male human
body :
Fig.
(iv) The nerve which transmits impulses from the ear to the brain.
(v) The part of eye responsible for its shape.
(vi) Helps to change the focal length of the eye lens.
(vii) The opening through which light enters the eye.
(viii) The photosensitive pigment present in the rod cells in the retina.
(ix) The part of eye responsible for change in the size of the pupil.
(x) The ear ossicle in contact with oval window of inner ear.
(xi) Adjustment of eye in order to obtain a clear vision of objects at different
distances.
(xii) The cells of the retina that are sensitive to colour.
Answer :
(i) Hypermetropia.
(ii) Macula / fovca / yellow spot.
(iii) Eustachian tube.
(iv) Auditory nerve.
(v) Vitreous humour.
(vi) Ciliary muscles.
(vii) Pupil.
(viii) Rhodopsin.
(ix) Iris.
(x) Stapes.
(xi) Accomodation.
(xii) Cones.
Question .2. State true or false. Rewrite the wrong statements by changing the
words.
(i) Cones are photoreceptor cells that are sensitive to dim light.
(ii) Deafness is caused due to rupturing of pinna.
(iii) Cones are receptor cell in retina of eye sensitive to dim light.
Question .5. Pick the odd one and write the category.
(i) Semicircular canal, malleus, cochlea, utriculus, sacculus.
(ii) Myopia, hypermetropia, xerophthalmia, astigmatism.
Answer :
(i) Parts of inner ear. Malleus.
(ii) Disease of eye. Xerophthalmia.
Question .6. Mention two functions of the choroids coat in the eye.
Answer :
Choroids forms nutritive layer of eye. Contains iris. It prevents reflection of light inside the eye.
Answer :
(i) Myopia : It is also called short sightedness.
Symptom Near vision is clear and distant vision is blurred.
Cause Eye ball becomes too longer i.e. eye lens is too convex and hence focal length is shortened. The image of
distant object is formed in front of the retina.
(ii) Tympanum : Location It is located between external and middle ear.
Function Sound waves from outside cause tympanum to vibrate which are ultimately transmitted across the middle
ear and produce sound.
(iii) Yellow spot : Location At the back of the eye almost at the centre of the horizontal axis of the eye ball.
Importance Place the best focus of the rays of light that enters and a very clear image is seen in the normal eye.
Answer :
(i)
Choriod
Sclerotic
(ii)
Dynamic balance
Static balance
respect to gravity.
(iii)
Rod cells
Cone cells
Rhodopsin
Iodopsin
Myopia
Hypermetropia
(iv)
Yellow spot
Blind spot
1. Area of no vision.
(iii) Presbyopia.
(iv) Real, inverted and diminished.
(v) Rod and cone cells.
Question .15. Draw a labelled diagram of the inner ear. Name the parts of the inner
ear that is responsible for static balance in human beings.
Answer :
Fig.
The sensory cells in ear which are located in maculae of vestibule are responsible for static balance in human beings.
Question .16. The diagram given below represent the parts of the human ear :
Fig.
Fig.
Answer :
I. 1 Cochlea, 2 Auditory nerve, 3 Semicircular canals, 4 Ear ossicles,
5 Auditory canal, 6 Pinna, 7 Ear drum, 8 Oval window or fenestra ovalis,
9 Eustachian tube, 10 Malleus or hammer.
II. (i) Ear drum.
(ii) Cochlea.
(iii) Semicircular canal.
(iv) Auditory nerve.
(v) Eustachian tube.
Question .18. Given below is the diagram of a part of the human ear :
Fig.
Study the same and then answer the questions that follow :
(i) Give the biological term for Malleus, Incus and Stapes.
(ii) Name the parts labelled A, B and C in the diagram.
(iii) State the functions of the parts labelled A and B.
(iv) Name the audio receptor region present in the part labelled A.
Answer :
(i) Ossicles.
(ii) (A) Cochlea,
(B) Semi-circular canals,
(C) Vestibular apparatus.
(iii) (A) Hearing,
(B) Dynamic balancing.
(iv) Organ of Corti.
Biology
Q. 1. Structure that forms spindle fibres
Q. 2. Basic unit of heredity
Q. 3. No. of nucleosome in 1 dna.
Q. 4. Structure formed after graafian follicle.
Q. 5. Study of population
Rubp
2.
PGA
3.
W.H.O
4.
NADP
5.
RNA
2.
3.
4.
5.
no of genes of tiger is 47
Biology
Q. 1. Describe how cells are structural and functional unit of life?
Q. 2. Which is the smallest cells known so far?
Q. 3. What is cell membrane?
Q. 4. What is Cytoplasm?
Q. 5. Write the difference between plant and animal cell.
Q. 6. Write the difference between cell wall and cell membrane.
Q. 7. Why new cells are needed to be produced?
Q. 8. What are the stages of cell cycle?
Q. 9. Which stage is the longest stage?
Q. 10. What produces spindle fibers in a cell of animals?
Q. 11. What initiates cell division?
Q. 12. Name the phases of cell cycle?
Q. 13. Define Mitosis?
Q. 14. Describe a cell during-
1. Prophase
2. Metaphase
3. Anaphase
4. Telophase.
Q. 15. What is Cytokinesis?
Q. 16. Write the difference between cytokinesis in plant and animal cell.
Q. 17. What is the significance of mitosis?
Q. 18. What is the significance of Meiosis?
Q. 19. Write the difference between Meiosis and Mitosis.
Q. 20. Define cell cycle.
Q. 21. Define reductional division.
Q. 22. What is DNA?
Q. 23. What is DNA finger printing?
Answer :
(i) Receptor, dorsal root ganglion, associated neuron, ventral root ganglion, effector.
Medulla oblongata
Cerebellum
(ii)
Cerebrum
Spinal cord
(iii)
Cerebrum
Cerebellum
(iv)
Sensory neuron
Motor neuron
(v)
Sensory nerve
Motor nerve
Question .9. Write the category and the odd one out :
(i) Coughing, sneezing, blinking, eating.
(ii) Corpus luteum, corpus callosum, pons, cerebellum.
(iii) Pleura, pericardium, meninges, spinal cord.
fig.
Fig.
Question .13. The following diagram represents the human brain as seen in an external view.
Study the same and then answer the question that follow :
Fig.
Answer :
(i) F
(ii) T
(iii) F
(iv) F
(v) F
(vi) T
(vii) T.
(ii) Thylakoids,
(iii) Guard cell,
(iii) Grana.
Answer :
(i) Stoma : Location Epidermis of leaves. Function Exchange of gases for photosynthesis/respiration/loss of
water as water vapour during transpiration.
(ii) Thylakoids : Location Granum of chloroplast. Function Help in traping sun-light (photosynthesis).
(iii) Guard cell: Location Around stomata mostly under the surface of a dorsiventral leaf. Function Allow diffusion
of gases.
(iv) Grana: Location Inside chloroplast. Function Help in trapping sunlight.
2. Leaf arrangement : The arrangement of leaves on the stem are in such a way that maximum surface area is
exposed to sunlight.
3. Chloroplasts : Chloroplasts containing chlorophyll are concentrated in the upper surface of the leaf which helps in
trapping maximum radiant energy from the sunlight quickly.
(iv) Aim : To demonstrate that light is necessary for photosynthesis.
Requirements : A destarched potted plant, Gangons light screen.
Procedure :
1. Gangons light screen is fixed to one of the leaves of the potted plant (destchared) as shown in figure below.
2. The plant is then fixed in light at least for 6 hours.
3. The starch test is performed.
Fig. Ans. 20 (iv)/page 38 [evergreen]
Observation : We observe that the portion of screen that allows the light to fall on leaf gives positive starch test and
the portion covered with light screen gives negative starch test.
Inference : Light is necessary for photosynthesis.
Question .10. Complete the following process to show how the oxygen in the air
reaches a mesophyl cell of the leaf.
Oxygen in air Mesophyl cell.
Answer :
Oxygen in air stoma substomatal space Mesophyl cell.
Light Reaction
Dark Reaction
(ii)
Autotrophs
Heterotrophs
(iii)
Stroma of Chloroplast
Grana of Chloroplast
2. It is a non-green granular
matrix.
(iv)
Photosynthesis
Respiration
1. It is an anabolic process.
1. It is a catabolic process.
(v)
Chloroplast
Chlorophyll
2. It is living.
2. It is non-living.
Question .13. Enumerate the steps involved in testing a green leaf for the presence of
starch.
Answer :
Solution:
Step I The leaf is dipped in boiling water for a minute to kill the cells.
Step II The leaf is boiled in methylated spirit to remove chlorophyll.
Step III The leaf is put in normal water to make it soft.
Step IV Iodine solution is put which turns starch blue black.
Question .15. A healthy Croton plant bearing variegated leaves was kept in a dark
cupboard to destarch it, after which it was placed in sunlight for few hours. One of the
leaves was then plucked and an outline of the leaf marking the green and non-green
regions was drawn. The leaf was then tested for starch. Using the above information,
answer the following questions:
(i) State the aim of the above experiment.
(ii) Name the chemical used for testing the presence of starch.
(iii) Why is the leaf boiled in water and alcohol before testing for the presence of starch ?
(iv) What change is seen on the leaf after the starch test ?
(v) Give the chemical equation to represent the process of syarch formation in plants.
Answer :
(i) To prove that chlorophyll is necessary for photosynthesis.
(ii) Iodine solution.
(iii) Cells are killed by boiling and chlorophyll is dissolved in alcohol.
(iv) The green parts turn blue black and non-green parts turn brown.
(v)
Question .18. (i) Fill in the blank in the following equations for two chemical reactions :
Q.19. Draw a neat labeled diagram of the experimental set up to show that green
plants give out oxygen during photosynthesis.
Answer:
fig.
Attempt all questions from Section A and any four four questions from Section B. The
intended marks for each question are given in brackets []
Section A
Question 1:
(a) Why is a class called a factory of objects? [2]
Ans. A class is known as a factory of objects because objects are instantiated from
classes. Each object gets a copy of the instance variables present in the class. It is
like a factory producing objects.
(b) State the difference between a boolean literal and a character literal. [2]
Ans. i) A boolean literal can store one of two values true and false. A character
literal can store a single Unicode character.
ii) The memory required by a boolean literal depends on the implementation. The
memory required by a character literal is 2 bytes.
(c) What is the use and syntax of a ternary operator? [2]
Ans. The ternary operator is a decision making operator which can be used to
replace certain if else statement.
Syntax: condition ? expression1: expression2
(d) Write one word answer for the following: [2]
i) A method that converts a string to a primitive integer data type
ii) The default initial value of a boolean variable data type
Ans. i) Integer.parseInt()
ii) false
(e) State one similarity and one difference between while and for loop. [2]
Ans. A while loop contains only a condition while a for loop contains initialization,
condition and iteration.
Question 2:
(a) Write the function prototype for the function sum that takes an integer
variable (x) as its argument and returns a value of float data type. [2]
Ans.
1
2
3
int a; // varaible 1
4
5
6
7
8
9
10
11
}
}
x = 1;
if(n >
{
x =
y =
}
y = 1;
0)
x + 1;
y - 1;
What will be the value of x and y, if n assumes a value (i) 1 (ii) 0? [2]
Ans. i) 1 > 0 is true, so if block will be executed.
x=x+1=1+1=2
y=y1=11=0
ii) 0 > 0 is false, so if block will not be executed and therefore, the values of x and y
wont change.
x=1
y=1
(c) Analyze the following program segment and determine how many times
the body of loop will be executed (show the working). [2]
1
2
3
4
5
6
x = 5; y = 50;
while(x<=y)
{
y=y/x;
System.out.println(y);
}
Ans.
Iteration 1 :
5 <= 50 - true
printed
Iteration 2 :
5 <= 10 - true
2
printed
3
Iteration 3 :
5 <= 2 - false
1
y = y / x = 50 / 5 = 10
10 will be
y = y / x = 10 / 5 = 2
2 will be
switch(opn)
{
case 'a':
System.out.println("Platform Independent");
break;
case 'b':
System.out.println("Object Oriented");
case 'c':
System.out.println("Robust and Secure");
break;
default:
System.out.println("Wrong Input");
}
Object Oriented
Robust and Secure
As there is no break statement for case b, statements in case c will also be printed
when opn = b.
ii) Output will be
1
Wrong Input
Platform Independent
(g) Consider the following code and answer the questions that follow: [4]
1
2
3
class academic
{
int x, y;
4
5
6
void access()
{
7
8
9
10
int a, b;
int x,c;
for(x=10,c=20;c>10;c=c-2)
x++;
Ans.
1
2
3
4
5
6
7
int x, c;
x = 10;
c = 20;
do {
x++;
c = c - 2;
} while (c > 10);
Section B
Question 4
An electronics shop has announced the following seasonal discounts on the purchase of
certain items.
Discount on Laptop
Discount on Desktop PC
0 25000
0.0%
5.0%
25001 57000
5.0%
7.6%
57001 100000
7.5%
10.0%
10.0%
15.0%
Write a program based on the above criteria to input name, address, amount of
purchase and type of purchase (L for Laptop and D for Desktop) by a customer.
Compute and print the net amount to be paid by a customer along with his name and
address. [15]
(Hint: discount = (discount rate/100)* amount of purchase
Net amount = amount of purchase discount)
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
if (type.equals("L")) {
17
18
19
20
21
22
23
24
25
26
discountRate = 10.0;
}
} else if (type.equals("D")) {
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Sample Output:
1
2
3
4
5
6
7
Question 5:
Write a program to generate a triangle or an inverted triangle till n terms based upon
the users choice of triangle to be displayed. [15]
Example 1
Input: Type 1 for a triangle and
type 2 for an inverted triangle
1
Enter the number of terms
5
Output:
1
22
333
4444
55555
Example 2:
Input: Type 1 for a triangle and
type 2 for an inverted triangle
2
Enter the number of terms
6
Output:
666666
55555
4444
333
22
1
Ans.
1
import java.util.Scanner;
2
3
4
5
if (choice == 1) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(i + " ");
}
System.out.println();
}
} else if (choice == 2) {
for (int i = n; i >= 1; i--) {
for (int j = 1; j <= i; j++) {
System.out.print(i + " ");
}
System.out.println();
}
}
}
27
28
Question 6:
Write a program to input a sentence and print the number of characters found in the
longest word of the given sentence.
For example is S = India is my country then the output should be 7. [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
int currentWordLength = 0;
11
12
char ch = sentence.charAt(i);
13
14
15
16
17
18
19
20
21
22
23
24
Question 7:
Write a class to overload a function num_calc() as follows: [15]
i) void num_calc(int num, char ch) with one integer argument and one character
argument, computes the square of integer argument if choice ch is s otherwise finds
its cube.
ii) void num_calc(int a, int b, char ch) with two integer arguments and one character
argument. It computes the product of integer arguments if ch is p else adds the
integers.
iii) void num_calc(String s1, String s2) with two string arguments, which prints whether
the strings are equal or not.
Ans.
1
2
3
if (ch == 's') {
} else {
9
10
11
12
13
14
if (ch == 'p') {
15
int product = a * b;
16
17
} else {
18
int sum = a + b;
19
20
21
22
23
24
25
26
27
28
29
30
if (s1.equals(s2)) {
System.out.println("Strings are same");
} else {
System.out.println("Strings are different");
}
}
}
Question 8
Write a menu driven program to access a number from the user and check whether it is
a BUZZ number or to accept any two numbers and to print the GCD of them. [15]
a) A BUZZ number is the number which either ends with 7 is is divisible by 7.
b) GCD (Greatest Common Divisor) of two integers is calculated by continued division
method. Divide the larger number by the smaller; the remainder then divides the
previous divisor. The process is repeated till the remainder is zero. The divisor then
results the GCD.
Ans.
1
import java.util.Scanner;
2
3
4
5
if (lastDigit == 7 || remainder == 0) {
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
return true;
} else {
return false;
}
}
public int gcd(int a, int b) {
int dividend, divisor;
if (a > b) {
dividend = a;
divisor = b;
} else {
dividend = b;
divisor = a;
}
int gcd;
while (true) {
int remainder = dividend % divisor;
if (remainder == 0) {
gcd = divisor;
break;
}
dividend = divisor;
divisor = remainder;
}
return gcd;
}
public void menu() {
38
39
40
41
42
43
44
45
if (choice == 1) {
System.out.print("Enter a number: ");
46
47
48
49
50
51
52
53
if (isBuzzNumber(num)) {
System.out.println(num + " is a buzz number");
} else {
System.out.println(num + " is not a buzz number");
}
} else if (choice == 2) {
System.out.print("Enter two numbers: ");
int num1 = scanner.nextInt();
54
55
56
57
58
59
60
61
} else {
System.out.println("Invalid Choice");
}
}
62
63
64
65
66
67
Sample Output 1:
1
2
3
4
5
1. Buzz Number
2. GCD
Enter your choice: 1
Enter a number: 49
49 is a buzz number
Sample Output 2:
1
2
3
4
5
1.
2.
Enter
Enter
Buzz Number
GCD
your choice: 2
two numbers: 49 77
GCD: 7
Question 9
The annual examination results of 50 students in a class is tabulated as follows.
Roll no.
Subject A
Subject B
Subject C
Write a program to read the data, calculate and display the following:
a) Average mark obtained by each student.
b) Print the roll number and average marks of the students whose average mark is
above 80.
c) Print the roll number and average marks of the students whose average mark is
below 40.
Ans.
1
import java.util.Scanner;
2
3
4
5
6
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
A: ");
B: ");
C: ");
subjectC[i]) /3.0;
}
System.out.println("Roll No - Average");
for (int i = 0; i < 50; i++) {
System.out.println(rno[i] + " - " + average[i]);
}
System.out.println("Students with average greater than 80");
for (int i = 0; i < 50; i++) {
if (average[i] > 80) {
System.out.println(rno[i] + " - " + average[i]);
}
}
System.out.println("Students with average less than 40");
for (int i = 0; i < 50; i++) {
if (average[i] < 40) {
36
37
38
39
40
Sample Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
run:
Enter Roll No: 1
Enter marks in subject A: 100
Enter marks in subject B: 100
Enter marks in subject C: 97
Enter Roll No: 2
Enter marks in subject A: 10
Enter marks in subject B: 10
Enter marks in subject C: 10
Enter Roll No: 3
Enter marks in subject A: 50
Enter marks in subject B: 50
Enter marks in subject C: 50
...
Roll No - Average
1 - 99.0
2 - 10.0
3 - 50.0
...
Students with average greater than 80
1 - 99.0
Students with average less than 40
2 - 10.0
...
COMPUTER APPLICATIONS
(Theory)
Two Hours
Answers to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the Question Paper.
The time given at the head of the Paper is the time allowed for writing the answers.
This paper is divided into two Sections.
Attempt all questions from Section A and any four questions from Section B.
The intended marks for questions or parts of questions are given in bracket [ ]
SECTION A (40 Marks)
Question 1.
(a) Define the term Byte Code. [2]
Ans. The Java compiler compiles the source programs into an intermediate code called
the Java Byte Code which is interpreted by the Java Virtual Machine (JVM)
(b) What do you understand by type conversion? [2]
Ans. Type conversion or casting is the conversion of the data type of a literal from one
type to another. There are tow types of types of casting implicit casting and explicit
casting.
(c) Name two jump statements and their use. [2]
Ans. break and continue are the two jump statements in Java. break is used to force
early termination of a loop. continue is used to move to the next iteration of the loop
while skipping the remaining code in the current iteration.
(d) What is Exception ? Name two Exception Handling Blocks. [2]
Ans. An Exception is an error which occurs during the execution of a program. The
exception handling blocks are try, catch and finally.
(e) Write two advantages of using functions in a program. [2]
Ans. i) Function make code reusable.
ii) Functions improve modularity and facilitate easy debugging.
Question 2.
(a) State the purpose and return data type of the following String functions:
[2]
(i) indexOf ( )
(ii) compareTo ( )
Ans. i) indexOf() returns the index of the character or String passed as the parameter in
the string on which is invoked.
Return type is int.
ii) compareTo() lexicographically compares the String passed as an argument to the
String on which it is invoked.
Return type is int.
(b) What is the result stored in x, after evaluating the following expression [2]
1
int x = 5;
x = x++ * 2 + 3 * x;
Ans. x = 5 * 2 + 3 * -6
x = 10 18
x = -8
(c) Differentiate between static and non-static data members. [2]
Ans. i) static variables belong to the class and all object share a single instance of the
static variables. Non static variables belong to the objects. Each object has a copy of
these members.
ii) Static functions can access only static data members. Non static function can access
both static and non-static data members.
(d) Write the difference between length and length () functions. [2]
Ans. length is a property of an array which gives the size of the array. length () is a
function of the String class which returns the size of the String.
(e) Differentiate between private and protected visibility modifiers. [2]
Ans. private members are accessible only in the class in which they have been defined.
protected members are accessible in the class in which they have been defined as well
in the sub classes of that class.
Question 3
(a) What do you understand by data abstraction? Explain with an example.[2]
Ans. Abstraction refers to representing the essential features of a system without
considering all the details. Example: When we drive a car, we concentrate on how to
drive it without bothering ourselves on how the engine works and other things.
(b) What will be the output of the following code?
(i) [2]
1
int m=2;
int n=15;
3
4
5
6
Ans.
1
2
m=1
n=14
Note that there is no semicolon at the end of the loop. So, it is an empty loop and doest
affect the values of m and n.
(ii) [2]
1
2
3
m=(x=='a') ? 'A' : a;
System.out.println("m="+m);
Ans.
1
m=a
(c) Analyse the following program segment and determine how many times
tne
loop will be executed and what will be the output of the program segment. [2]
1
2
3
4
while (++i<6)
k*=i;
System.out.println(k);
3
4
5
6
<
<
<
<
6
6
6
6
-------------
k = 1 * 3 = 3
k = 3 * 4 = 15
k = 12 * 5 = 60
false
(d) Give the prototype of a function check which receives a character ch and
an integer n and returns true or false. [2]
Ans.
1
char ch = wd.charAt(wd.length()-2);
(g) What will the following functions return when executed? [2]
(j) Math.max(-17, -19)
(ii) Math.ceil(7.8)
Ans. i) -17
ii) 8.0
(h) (i) Why is an object called an instance of a class?
(ii) What is the use of the keyword import? [2]
Ans. i) An object is called an instance of a class because the objects contains a copy of
all the instance variables of the class.
ii) The import keyword is used to import classes from external packages.
SECTION B (60 Marks)
Attempt any four questions from this Section.
The answers in this Section should consist of the Programs in either Blue J environment
or any program environment with Java as the base.
Each program should be written using Variable descriptions/Mnemonic Codes such that
the logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.
Question 4.
Write a program to perform binary search on a list of integers given below, to search for
an element input by the user. If it is found display the element along with its position,
otherwise display the message Search element not found. [15]
5,7,9,11,15,20,30,45,89,97
Ans.
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
int left = 0;
11
12
21
22
23
24
25
} else {
System.out.println("Search element not found");
}
}
}
Sample Output 1:
1
2
Sample Output 2:
1
2
Question 5
Define a class Student described as below: [15]
Data members/instance variables : name,age,m1,m2,m3 (marks in 3 subjects),
maximum, average
Member methods :
(i) A parameterized constructor to initialize the data members.
(ii) To accept the details of a student.
(iii) To compute the average and the maximum out of three marks.
(iv) To display the name, age, marks in three subjects, maximum and average.
Write a main method to create an object of a class and call the above member methods.
Ans.
1
import java.util.Scanner;
2
3
4
5
6
String name;
int maximum;
int age;
double average;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
public Student() {
}
public Student(String
n, int a, int marks1, int marks2, intmarks3, int max, double avg) {
name = n;
age = a;
m1 = marks1;
m2 = marks2;
m3 = marks3;
maximum = max;
average = avg;
}
public void acceptDetails() {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter name: ");
name = scanner.next();
System.out.print("Enter age: ");
age = scanner.nextInt();
System.out.print("Enter marks1: ");
m1 = scanner.nextInt();
System.out.print("Enter marks2: ");
m2 = scanner.nextInt();
System.out.print("Enter marks3: ");
m3 = scanner.nextInt();
}
public void compute() {
average = (m1 + m2 + m3) / 3.0;
maximum = Math.max(m1, (Math.max(m2, m3)));
}
public void display() {
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Sample Output:
1
2
3
4
5
6
7
8
9
10
11
12
Question 6
Shasha Travels Pvt. Ltd. gives the following discount to its customers: [15]
Ticket amount Discount
Above Rs 70000 18%
Rs 55001 to Rs 70000 16%
Rs 35001 to Rs 55000 12%
Rs 25001 to Rs 35000 10%
less than Rs 25001 2%
Write a program to input the name and ticket amount for the customer and calculate
the discount amount and net amount to be paid. Display the output in the following
format for each customer :
1 SL. NO.
2 1
Name
-
Ticket charges
-
Discount
-
Net amount
-
(Assume that there are 15 customers, first customer is given the serial no (SlNo.) 1, next
customer 2 and so on.
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
int discountPercentage = 0;
14
15
Sample Output:
1
Enter sno: 3
2
Enter name: Sai
3 Enter ticket charges: 27000
4 Sl. No.
Name
Ticket Charges
5
3
27000
2700.0 24300.0
Discount
Net Amount
Question 7
Write a menu driven program to accept a number and check and display whether it is a
Prime Number or not OR an Automorphic Number or not. (Use switch-case statement).
[15]
(a) Prime number: A number is said to be a prime number if it is divisible only by 1 and
itself and not by any other number. Example: 3,5,7,11,13 etc.
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
if (n % i == 0) {
return true;
}
}
return false;
}
public boolean isAutomorphic(int n) {
15
16
17
int square = n * n;
String originalNumber = n + "";
String squareNumber = n + "";
String lastDigits = squareNumber.substring(squareNumber.length() 18
originalNumber.length(), squareNumber.length());
19
return lastDigits.equals(originalNumber);
20
}
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
} else {
System.out.println(num + " is not an automorphic
number");
45
46
47
48
49
50
51
}
break;
default:
System.out.println("Invalid choice");
}
}
52
53
54
55
56
Sample Output 1:
1
2
3
4
5
Enter 1
Enter 2
Enter
Enter
13 is
Sample Output 2:
1
2
3
4
5
Question 8.
Write a program to store 6 element in an array P, and 4 elements in an array Q and
produce a third array R, containing all elements of array P and Q. Display the resultant
array [15]
Example:
1
2
3
4
5
6
7
8
9
10
11
12
INPUT
P[]
4
6
1
2
3
10
Q []
19
23
7
8
OUTPUT
R []
4
6
1
2
3
10
19
23
7
8
Ans.
1
import java.util.Scanner;
2
3
4
5
6
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Sample Output:
1
2
3
Question 9
Write a program to input a string in uppercase and print the frequency of each
character. [15]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
P
R
T
U
W
1
3
1
1
1
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
char ch = input.charAt(i);
12
13
14
15
16
17
if (Character.isUpperCase(ch)) {
frequency[ch - 65]++;
}
}
System.out.println("Characters Frequency");
for (int i = 0; i < 26; i++) {
18
19
20
21
22
23
if (frequency[i] != 0) {
System.out.println((char) (i + 65) + "\t" + frequency[i]);
}
}
}
}
COMPUTER APPLCATIONS
(Theory)
Two Hours
Answers to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the Question Paper.
The time given at the head of the Paper is the time allowed for writing the answers.
This paper is divided into two Sections.
Attempt all questions from Section A and any four questions from Section B.
The intended marks for questions or parts of questions are given in bracket [ ]
SECTION A (40 Marks)
Question 1.
(a) What is the difference between an object and a class? [2]
Ans. 1. A class is a blueprint or a prototype of a real world object. It contains instance
variables and methods whereas an object is an instance of a class.
2. A class exists in the memory of a computer while an object does not.
3. There will be only one copy of a class whereas multiple objects can be instantiated
from the same class.
(b) What does the token keyword refer to in the context of Java? Give an
example for keyword. [2]
Ans. Keywords are reserved words which convey special meanings to the compiler and
cannot be used as identifiers. Example of keywords : class, public, void, int
(c) State the difference between entry controlled loop and exit controlled
loop. [2]
Ans. In an entry controlled loop, the loop condition is checked before executing the
body of the loop. While loop and for loop are the entry controlled loops in Java.
In exit controlled loops, the loop condition is checked after executing the body of the
loop. do-while loop is the exit controlled loop in Java.
(d) What are the two ways of invoking functions? [2]
Ans. If the function is static, it can be invoked by using the class name. If the function is
non-static, an object of that class should be created and the function should be invoked
using that object.
ComputerApplications
true
(a) Analyse the following program segment and determine how many times
the loop will be executed and what will be the output of the program segment
? [2]
1
2
3
4
5
6
7
8
int p = 200;
while(true)
{
if (p<100)
break;
p=p-20;
}
System.out.println(p);
Ans.p values changes as follows : 200, 180, 160, 140, 120, 100, 80. So, the loop
executes six times and value of p is 80.
(b) What will be the output of the following code? [2]
(i)
1
2
3
int k = 5, j = 9;
k += k++ ++j + k;
Ans.
1
2
k = 6
j = 10
Explanation:
k += k++ ++j + k
k = k + k++ ++j + k
k = 5 + 5 10 + 6
k=6
j = 10 as it has been incremented in the ++j operation.
(ii) [2]
1
double b = -15.6;
Ans.
1
a =16.0
class Age {
2
3
int age;
4
5
6
7
8
public Age() {
age = -1;
}
9
10
11
12
(d) Give the prototype of a function search which receives a sentence sentnc
and a word wrd and returns 1 or 0 ? [2]
Ans.
1 public boolean function ( sentence sentnc, word wrd )
or
1 public int function ( sentence sentnc, word wrd )
(f) Write a statement each to perform the following task on a string: [2]
(i) Find and display the position of the last space in a string s.
(ii) Convert a number stored in a string variable x to double data type
Ans. (i) System.out.println(s.lastIndexOf( );
(ii) Double.parseDouble(x)
(g) Name the keyword that: [2]
(i) informs that an error has occurred in an input/output operation.
(ii) distinguishes between instance variable and class variables.
Ans. (i) throw
(ii) static
import java.util.Scanner;
2
3
4
5
int bno;
int phno;
7
8
String name;
int days;
int charge;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (days <= 5) {
25
26
27
28
} else {
29
30
31
32
33
Question 5.
Write a program to input and sort the weight of ten people. Sort and display them in
descending order using the selection sort technique. [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
7
8
9
10
11
12
13
int highest = i;
if(weights[j]
Question 6.
Write a program to input a number and print whether the number is a special number or
not. (A number is said to be a special number, if the sum of the factorial of the digits of
the number is same as the original number). [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7}
{
8
9
10
11
12
13
14
15
16
17
18
if (sum == num) {
19
return true;
20
} else {
21
22
return false;
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if (isSpecial(num)) {
System.out.println("It is a special number");
} else {
System.out.println("It is not a special number");
}
}
}
Question 7
Write a program to accept a word and convert it into lowercase if it is in uppercase, and
display the new word by replacing only the vowels with the character following it. [15]
Example
Sample Input : computer
Sample Output : cpmpvtfr
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
char c = input.charAt(i);
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c =='u') {
answer = answer + (char) (c + 1);
} else {
answer = answer + c;
}
}
System.out.println(answer);
}
}
Question 8.
Design a class to overload a function compare ( ) as follows: [15]
(a) void compare (int, int) to compare two integer values and print the greater of the
two integers.
(b) void compare (char, char) to compare the numeric value of two character with
higher numeric value
(c) void compare (String, String) to compare the length of the two strings and print the
longer of the two.
Ans.
1
2
3
4
5
6
7
}
public void compare(char a, char b) {
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Question 9
Write a menu driven program to perform the following . (Use switch-case statement)
[15]
(a) To print the series 0, 3, 8, 15, 24 . n terms (value of n is to be an input by the
user).
(b) To find the sum of the series given below:
S = 1/2+ 3/4 + 5/6 + 7/8 19/20
Ans.
Series 1 : The ith term is i2-1.
import java.util.Scanner;
2
3
4
5
7
8
9
10
11
12
int term = i * i - 1;
System.out.print(term + " ");
}
}
public double series2(int n) {
13
double sum = 0;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
switch (choice) {
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
case 1:
series1(n);
break;
case 2:
double sum = series2(n);
System.out.println(sum);
break;
default:
System.out.println("Invalid choice");
}
}
public static void main(String[] args) {
Menu menu = new Menu();
menu.menu();
}
}
e) How many times will the following loop execute? What value will be
returned? [2]
1
2
3
4
5
6
int x = 2, y = 50;
do{
++x;
y-=x++;
}while(x<=10);
return y;
Ans. In the first iteration, ++x will change x from 2 to 3. y-=x++ will increase x to 4.
And y becomes 50-3=47.
In the second iteration, ++x will change x from 4 to 5. y-=x++ will increase x to 6. And
y becomes 47-5=42.
In the third iteration, ++x will change x from 6 to 7. y-=x++ will increase x to 8. And y
becomes 42-7=35.
In the fourth iteration, ++x will change x from 8 to 9. y-=x++ will increase x to 10. And
y becomes 35-9=24.
In the fifth iteration, ++x will change x from 10 to 11. y-=x++ will increase x to 12. And
y becomes 24-11=13.
Now the condition x<=10 fails.
So, the loop executes five times and the value of y that will be returned is 13.
f) What is the data type that the following library functions return? [2]
i) isWhitespace(char ch)
ii) Math.random()
Ans. i) boolean
ii) double
g) Write a Java expression for ut + ft2 [2]
Ans. u * t + 0.5 * f * Math.pow ( t, 2)
h) If int n[] ={1, 2, 3, 5, 7, 9, 13, 16} what are the values of x and y? [2]
1
2
x=Math.pow(n[4],n[2]);
y=Math.sqrt(n[5]+[7]);
int ctr=0;
for(int i=1;i<=5;i++)
3
4
for(int j=1;j<=5;j+=2)
++ctr;
Ans. Outer loop runs five times. For each iteration of the outer loop, the inner loop runs
3 times. So, the statement ++ctr executes 5*3=15 times and so the value of ctr will be
15.
j) Name the methods of Scanner class that: [2]
i) is used to input an integer data from standard input stream.
ii) is used to input a string data from standard input stream.
Ans. i) scanner.nextInt()
ii) scanner.next()
SECTION B (60 Marks )
Attempt any four questions from this Section.
The answers in this section should consist of the program in Blue J environment with
Java as the base. Each program should be written using Variable descriptions /
Mnemonics Codes such that the logic of the program is clearly depicted.
Flow-charts and Algorithms are not required.
Question 4:
Define a class called FruitJuice with the following description: [15]
Instance variables/data members:
int product_code stores the product code number
String flavour stores the flavor of the juice.(orange, apple, etc)
String pack_type stores the type of packaging (tetra-pack, bottle etc)
int pack_size stores package size (200ml, 400ml etc)
int product_price stores the price of the product
Member Methods:
FriuitJuice() default constructor to initialize integer data members
to zero and string data members to .
void input() to input and store the product code, flavor, pack type,
pack size and product price.
void discount() to reduce the product price by 10.
void display() to display the product code, flavor, pack type,
pack size and product price.
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
int product_code;
String flavour;
String pack_type;
int pack_size;
int product_price;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public FruitJuice() {
product_code = 0;
flavour = "";
pack_type = "";
pack_size = 0;
product_price = 0;
}
public void input() {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter product code: ");
product_code = scanner.nextInt();
System.out.print("Enter flavour: ");
flavour = scanner.next();
System.out.print("Enter pack type: ");
pack_type = scanner.next();
System.out.print("Enter pack size: ");
pack_size = scanner.nextInt();
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Question 5:
The International Standard Book Number (ISBN) is a unique numeric book identifier
which is printed on every book. The ISBN is based upon a 10-digit code. The ISBN is
legal if:
1xdigit1 + 2xdigit2 + 3xdigit3 + 4xdigit4 + 5xdigit5 + 6xdigit6 + 7xdigit7 + 8xdigit8 +
9xdigit9 + 10xdigit10 is divisible by 11.
Example: For an ISBN 1401601499
Sum=11 + 24 + 30 + 41 + 56 + 60 + 71 + 84 + 99 + 109 = 253
which is divisible by 11.
Write a program to:
(i) input the ISBN code as a 10-digit integer.
(ii) If the ISBN is not a 10-digit integer, output the message Illegal ISBN and terminate
the program.
(iii) If the number is 10-digit, extract the digits of the number and compute the sum as
explained above.
If the sum is divisible by 11, output the message, Legal ISBN. If the sum is not
divisible by 11, output the message, Illegal ISBN. [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
int sum = 0;
14
15
16
17
18
19
20
21
22
23
24
25
Question 6:
Write a program that encodes a word into Piglatin. To translate word into Piglatin word,
convert the word into uppercase and then place the first vowel of the original word as
the start of the new word along with the remaining alphabets. The alphabets present
before the vowel being shifted towards the end followed by AY.
Sample Input(1): London Sample Output(1): ONDONLAY
Sample Input(2): Olympics Sample Output(2): OLYMPICSAY [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
21
22
23
24
Question 7:
Write a program to input 10 integer elements in an array and sort them
In descending order using bubble sort technique. [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Question 8:
Design a class to overload a function series() as follows: [15]
(i) double series(double n) with one double argument and
returns the sum of the series.
sum = 1/1 + 1/2 + 1/3 + .. 1/n
(ii) double series(double a, double n) with two double arguments
and returns the sum of the series.
sum = 1/a2 + 4/a5 + 7/a8 + 10/a11 .. to n terms
Ans.
2
3
double sum = 0;
6
7
8
9
10
11
12
13
double sum = 0;
for (int i = 0; i < n; i++) {
14
15
16
17
18
Question 9:
Using the switch statement, write a menu driven program: [15]
(i) To check and display whether a number input by the user is
a composite number or not (A number is said to be a composite, if it
has one or more then one factors excluding 1 and the number itself).
Example: 4, 6, 8, 9
(ii) To find the smallest digit of an integer that is input:
Sample input: 6524
Sample output: Smallest digit is 2
For an incorrect choice, an appropriate error message should be displayed.
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if (n % i == 0) {
return true;
}
}
return false;
}
public static int smallestDigit(int number) {
int smallest = 9;
while (number > 0) {
46
47
48
49
50
51
52
53
54
this keyword
Leave a reply
this keyword is used to refer to the object on which a method was invoked.
Take a look at the following code which contains a single instance variable x and a
method setX().
1
2
3
int x;
4
5
6
7
8
2
3
4
5
6
7
The method setX() was called on the object myNumber1. Within setX(), the statement
this.x=3 will be executed. As we said in the beginning of this article, this refers to the
object on which a method was invoked. Here, we have invoked the method setX() on
the object myNumber1. So, this will refer to the object myNumber1. So,
this.x = 3 ;
will be interpreted as
myNumber1.x = 3
which will set x to 3.
We could written the above program without using this keyword in the following way.
1
2
3
int x;
4
5
6
7
8
2
3
int x = 3;
4
5
6
7
8
9
The method printX() will print 4 and not 3. This is because when we declare a variable in
a method with the same name as that of another instance variable, then when we refer
to that variable within the method, we get access to the variable defined in the method
and not the instance variable of the class. This is illustrated in the following diagram:
2
3
int x = 3;
4
5
6
7
8
9
10
4
3
To see why the second line printed 3, let us use the first line in this article this refers
to the object on which the method was invoked.
1
2
The method printX() was invoked on the object MyNumber1. So, this will refer to
myNumber1 and this.x will be myNumber1.x which is 3.
Normally, we use the this keyword in constructors and set methods so that we can use
the same name for instance variables and formal parameters.
Here is an example program with the keyword this used in a constructor and two set
methods.
1
2
3
int rollNumber;
int marks;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2012
COMPUTER APPLICATIONS
(Theory)
(Two Hours)
Answers to this Paper must be written on the paper provided separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the question paper.
The time given at the head of this Paper is the time allowed for writing.the answers.
This Paper is divided into two Sections.
Attempt all questions from Section A and any four questions from Section B. The intended marks for questions
or parts of questions are given in brackets [ ].
SECTION A (40 Marks)
Attempt all questions.
Question 1
(a) Give one example each of a primitive data type and a composite data type. [2]
Ans. Primitive Data Types byte, short, int, long, float, double, char, boolean
Composite Data Type Class, Array, Interface
(b) Give one point of difference between unary and binary operators. [2]
Ans. A unary operator requires a single operand whereas a binary operator requires two operands.
Examples of Unary Operators Increment ( ++ ) and Decrement ( ) Operators
Examples of Binary Operators +, -, *, /, %
(c) Differentiate between call by value or pass by value and call by reference or pass by reference. [2]
Ans. In call by value, a copy of the data item is passed to the method which is called whereas in call by
reference, a reference to the original data item is passed. No copy is made. Primitive types are passed by value
whereas reference types are passed by reference.
(d) Write a Java expression for (under root of 2as+u2) [2]
Ans. Math.sqrt ( 2 * a * s + Math.pow ( u, 2 ) )
( or )
Math.sqrt ( 2 * a * s + u * u )
(e) Name the types of error (syntax, runtime or logical error) in each case given below:
(i) Division by a variable that contains a value of zero.
(ii) Multiplication operator used when the operation should be division.
(iii) Missing semicolon. [2]
Ans.
(i) Runtime Error
(ii) Logical Error
(iii) Syntax Error
Question 2
(a)Create a class with one integer instance variable. Initialize the variable using:
(i) default constructor
(ii) parameterized constructor. [2]
Ans.
1
2
3
4
5
6
7
8
9
10
11
12
int x;
public Integer() {
x = 0;
}
public Integer(int num) {
x = num;
}
}
Ans. x = false
y = 63
(b) State the values of n and ch [2]
1
char c = 'A':
int n = c + 1;
int x=4;
x += (x++) + (++x) + x;
Ans.
2.0
3.0
Explanation : Math.min(Math.floor(x), y) = Math.min ( 2.0, 2.5 ) = 2.0
Math.max(Math.ceil(x), y)) = Math.max ( 3.0, 2.5 ) = 3.0
(e) State the output of the following program segment. [2]
1
String s = "Examination";
2
int n = s.length();
3 System.out.println(s.startsWith(s.substring(5, n)));
4 System.out.println(s.charAt(2) == s.charAt(6));
Ans.
false
true
Explanation : n = 11
s.startsWith(s.substring(5, n)) = s.startsWith ( nation ) = false
( s.charAt(2) == s.charAt(6) ) = ( a== a ) = true
(f) State the method that:
(i) Converts a string to a primitive float data type
(ii) Determines if the specified character is an uppercase character [2]
Ans. (i) Float.parseFloat(String)
(ii) Character.isUpperCase(char)
(g) State the data type and values of a and b after the following segment is executed.[2]
1
2
3
String s = "malayalam";
System.out.println(s.indexOf('m'));
System.out.println(s.lastIndexOf('m'));
Ans.
0
8
(i) Rewrite the following program segment using while instead of for statement [2]
1
int f = 1, i;
3
4
5
f *= i;
System.out.println(f);
}
Ans.
1
int f = 1, i = 1;
2
3
4
5
6
while (i <= 5) {
f *= i;
System.out.println(f);
i++;
}
(j) In the program given below, state the name and the value of the
(i) method argument or argument variable
(ii) class variable
(iii) local variable
(iv) instance variable [2]
1
class myClass {
2
3
static int x = 7;
int y = 2;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
void sampleMethod(int n) {
System.out.println(n);
System.out.println(y);
int a = 6;
System.out.println(a);
}
}
}
2
3
4
5
6
7
8
=
9
10
11
12
13
14
15
16
int acc_num;
String title;
String author;
public void input() throws IOException {
BufferedReader br
new BufferedReader(newInputStreamReader(System.in));
System.out.print("Enter accession number: ");
acc_num = Integer.parseInt(br.readLine());
System.out.print("Enter title: ");
title = br.readLine();
System.out.print("Enter author: ");
author = br.readLine();
}
17
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Question 5
Given below is a hypothetical table showing rates of Income Tax for male citizens below the age of 65 years:
Income Tax in
Nil
( TI 1,60,000 ) * 10%
Write a program to input the age, gender (male or female) and Taxable Income of a person.If the age is more
than 65 years or the gender is female, display wrong category*.
If the age is less than or equal to 65 years and the gender is male, compute and display the Income Tax payable
as per the table given above. [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
double tax;
} else {
20
21
22
23
24
25
Question 6
Write a program to accept a string. Convert the string to uppercase. Count and output the number of double
letter sequences that exist in the string.
Sample Input: SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE
Sample Output: 4 [ 15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Question 7
Design a class to overload a function polygon() as follows:
(i) void polygon(int n, char ch) : with one integer argument and one character type argument that draws a filled
square of side n using the character stored in ch.
(ii) void polygon(int x, int y) : with two integer arguments that draws a filled rectangle of length x and breadth
y, using the symbol @
(iii)void polygon( ) : with no argument that draws a filled triangle shown below.
Example:
(i) Input value of n=2, ch=O
Output:
OO
OO
(ii) Input value of x=2, y=5
Output:
@@@@@
@@@@@
(iii) Output:
*
**
*** [15]
Ans.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Question 8
Using the switch statement, writw a menu driven program to:
(i) Generate and display the first 10 terms of the Fibonacci series 0,1,1,2,3,5.The first two Fibonacci
numbers are 0 and 1, and each subsequent number is the sum of the previous two.
(ii)Find the sum of the digits of an integer that is input.
Sample Input: 15390
Sample Output: Sum of the digits=18
For an incorrect choice, an appropriate error message should be displayed [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int c = a
a =
int num =
while (num
19
20
21
22
23
24
25
26
27
28
Question 9
Write a program to accept the names of 10 cities in a single dimension string array and their STD (Subscribers
Trunk Dialing) codes in another single dimension integer array. Search for a name of a city input by the user in
the list. If found, display Search Successful and print the name of the city along with its STD code, or else
display the message Search Unsuccessful, No such city in the list. [15]
Ans.
1
import java.util.Scanner;
2
3
4
5
9
10
11
12
13
14
15
16
17
18
19
20
21
if (cities[i].equals(target)) {
System.out.println("Search successful");
System.out.println("City : " + cities[i]);
22
23
24
25
26
27
28
29
30
31
list");
if (!searchSuccessful) {
System.out.println("Search Unsuccessful, No such city in the
}
}
}
Milk 1 litre
Mix the freshly grated coconut with milk in a heavy bottom pan for about 15 20 minutes on
a slow flame.
Stir continuously with a spatula until all the milk is absorbed by the coconut.
Add the sugar and mix well to make a ball like mass of the entire mixture which has good
binding. At the right consistency, the mixture should not be sticky to touch.
Add 2 spoons of powdered sugar and cardamom powder at the end to the entire mixture after
removing it from the flame.
Grease a plate with ghee and spread the mixture in an even and thick layer on it while its still
warm. You can use the flat side of a katori (bowl) greased with ghee to evenly spread the mixture.