Академический Документы
Профессиональный Документы
Культура Документы
How many kgs of each should be blended to produce 100 kg of mixture worth Rs.90/kg,
given that the quntities of band c are equal
a)70,15,15
b)50,25,25
c)60,20,20
d)40,30,30
Ans: (b)
2.What is the maximum number of half-pint bottles of cream that can be filled with a 4gallon can of cream (2 pt. =1 qt. and 4 qt. =1 gal)
A.16
B.24
C.30
D.64
Ans: D
3.There are two circles, one circle is inscribed and another circle is circumscribed over a
square. What is the ratio of area of inner to outer
circle?
Ans: 1 : 2
4.In the following figure: A B C
D
EFG
H
I
Each of the digits 1, 2, 3, 4, 5, 6, 7, 8, and 9 is:
a)Represented by a different letter in the figure above.
b) Positioned in the figure above so that each of A + B + C,C + D +E,E + F + G, and G +
H + I is equal to 13.
Which digit does E represent?
Ans: E is 4
5.There are 12 boys and 15 girls, How many different dancing groups can be formed with
2 boys and 3 girls.
48Which of the following fractions is less than 1/3
(a) 22/62
(b) 15/46
(c) 2/3
(d) 1
Ans: (b)
6.One of Mr. Horton,his wife,their son,and Mr. Horton's mother is a doctor and another is
a lawyer.
a)If the doctor is younger than the lawyer, then the doctor and the lawyer are not blood
relatives.
b)If the doctor is a woman, then the doctor and the lawyer are blood relatives.
c)If the lawyer is a man, then the doctor is a man.
Whose occupation you know?
of the 33p. a gm. to 2 parts of the less expensive grade,how much will the shop save in
blending 100 gms.
A.Rs.90
B.Rs.1.00
C.Rs.3.00
D.Rs.8.00
Ans:C
15.There are 200 questions on a 3 hr examination.Among these questions are 50
mathematics problems.It is suggested that twice as much time be
spent on each maths problem as for each other question.How many minutes should be
spent on mathematics problems
A.36
B.72
C.60
D.100
Ans:B
16.In a group of 15,7 have studied Latin, 8 have studied Greek, and 3 have not studied
either.How many of these studied both Latin and Greek
A.0 B.3 C.4 D.5
Ans.B
17.If 13 = 13w/(1-w) ,then (2w)2 =
A.1/4
B.1/2
C.1
D.2
Ans:C
18. If a and b are positive integers and (a-b)/3.5 = 4/7, then
(A) b < a
(B) b > a
(C) b = a
(D) b >= a
Ans: A
18. In june a baseball team that played 60 games had won 30% of its game played. After
a phenomenal winning streak this team raised its average
to 50% .How many games must the team have won in a row to attain this average?
A. 12
B. 20
C. 24
D. 30
Ans: C
19. M men agree to purchase a gift for Rs. D. If three men drop out how much more will
each have to contribute towards the purchase of the gift/
A. D/(M-3)
B. MD/3
C. M/(D-3)
D. 3D/(M2-3M)
Ans: D
20. A company contracts to paint 3 houses. Mr.Brown can paint a house in 6 days while
Mr.Black would take 8 days and Mr.Blue 12 days. After 8
days Mr.Brown goes on vacation and Mr. Black begins to work for a period of 6 days.
How many days will it take Mr.Blue to complete the contract?
A. 7
B. 8
C. 11
D. 12
Ans:C
21. 2 hours after a freight train leaves Delhi a passenger train leaves the same station
travelling in the same direction at an average speed of
16 km/hr. After travelling 4 hrs the passenger train overtakes the freight train. The
average speed of the freight train was?
A. 30
B. 40
C.58
D. 60
Ans: B
22. If 9x-3y=12 and 3x-5y=7 then 6x-2y = ?
A.-5
B. 4
C. 2
D. 8
Ans: D
23. There are 5 red shoes, 4 green shoes. If one draw randomly a shoe what is the
probability of getting a red shoe
Ans: 5c1/ 9c1
24. What is the selling price of a car? If the cost of the car is Rs.60 and a profit of 10%
over selling price is earned
Ans: Rs 66/-
25. 1/3 of girls , 1/2 of boys go to canteen .What factor and total number of classmates go
to canteen.
Ans: Cannot be determined.
26. The price of a product is reduced by 30% . By what percentage should it be increased
to make it 100%
Ans: 42.857%
27. There is a square of side 6cm . A circle is inscribed inside the square. Find the ratio of
the area of circle to square.
Ans: 11/14
28. There are two candles of equal lengths and of different thickness. The thicker one
lasts of six hours. The thinner 2 hours less than the
thicker one. Ramesh lights the two candles at the same time. When he went to bed he saw
the thicker one is twice the length of the thinner one. How
long ago did Ramesh light the two candles .
Ans: 3 hours.
29. If M/N = 6/5,then 3M+2N = ?
Ans : (d)
37. If the total distance of a journey is 120 km .If one goes by 60 kmph and comes back
at 40kmph what is the average speed during the journey?
Ans: 48kmph
38. A school has 30% students from Maharashtra .Out of these 20% are Bombey
students. Find the total percentage of Bombay?
Ans: 6%
39. An equilateral triangle of sides 3 inch each is given. How many equilateral triangles
of side 1 inch can be formed from it?
Ans: 9
40. If A/B = 3/5,then 15A = ?
Ans : 9B
41. Each side of a rectangle is increased by 100% .By what percentage does the area
increase?
Ans : 300%
42. Perimeter of the back wheel = 9 feet, front wheel = 7 feet on a certain distance, the
front wheel gets 10 revolutions more than the back
wheel.What is the distance?
Ans : 315 feet.
43. Perimeter of front wheel =30, back wheel = 20. If front wheel revolves 240 times.
How many revolutions will the back wheel take?
Ans: 360 times
44. 20% of a 6 litre solution and 60% of 4 litre solution are mixed. What percentage of
the mixture of solution
Ans: 36%
45.City A's population is 68000, decreasing at a rate of 80 people per year. City B having
population 42000 is increasing at a rate of 120 people per year. In how many years both
the cities will have same population?
Ans: 130 years
Retrieved from "http://www.freshersonline.com/wiki/Aptitude_Questions_I"
2.
Hotel owner to teacher: u know that mohan came here with 3 girl friends. if
multiply their ages the result will be 2450. and the sum of their ages is equal to u'r age.
the eldest girl is elder than mohan can u tell me mohan age.
3.
One more quetion about 4 ships do it well ther are 7 conditions and 7th condition
will not be
satisfied.dont go for that consider the first 6 conditions
Interview questions:
5.
6.
7.
If it is HTML
8.
statements
While three friends Abe, Bob, Cort in a restaurant taking their snacks one lady
(a) attack (b) Release (c) condemn (d) None of the above
3.
(a) Spring (b) Winter (c) Summer (d) None of the above
4.
One skirt requires 3.75 yards of cloth. How many skirts you can make from 45
yards?
Ans: 12 skirts
5.
Ans: 0.0625
13.
One do llar is saved in one month. Then how much dollar is saved in one day?
If a train covers 600m in 0.5 seconds, how long it will cover in 10 seconds?
16.
The girl's age is twice that of boy, if the boy is four years old. After four years
Sister's age is twice than that of the brother. If the brother's age is six, what is
Two lemons cost 10 cents. Then one and a half dozen cost
Ans: 90 cents
19.
late in 1 day?
Ans: 2.9 seconds
20.
Opposite of Remote?
Statement: Normal children are active; Inference: All children are active;
Ans: 1/16
24.
In 6 seconds a light flashes once. In one hour how many times it will flash?
At 20% discount, a cycle is sold at a selling price of 2500 Rs. What is the
actual price?
Ans: Rs. 3125
26.
A invests $12000, B invests $8000, C invests $6000 and they got a profit of
1.
2.
3.
4.
Select a passive component from the following (four choices were there)
5.
6.
7.
8.
9.
10.
11.
TCS PAPER
Synonym and antonym
1.Harbinger forerunner, portent, indication
2.Cacophony dissonance, disharmony
3.Divulge reveal, disclose
4.Clutch grasp, grab, clasp, hold
5.Acronym short form, contraction, ellipsis
6.Illustrious memorable, wellknown, famous
7.Prolific productive, abundant
8.Divergent different, deviating, conflicting
9.Jaded world-weary, tired, lackluster, worn-out, exhausted, bored, fed up
10. Mien appearance, demeanor
11. Mitigate alleviate, ease, lessen, soften, allay, moderate
12. Ambitious determined, grand, striving
13. Aberration deviation, abnormality, eccentricity, oddness
14. Foray raid, sortie, incursion, attack, venture
15. Denounce condemn, accuse, criticize
VERBAL SECTION:Directions for questions 1-15:Find the synonyms of the following words.
Synonyms: (Ref: Barrons Synonyms and Antonyms)
Ponderous heavy, tedious, cumbersome
Mundane ordinary, dull, monotonous, dreary
Icon image, idol, emblem, symbol
Brackish salty, briny
Mollify placate, pacify, calm, appease, soothe
Depreciation reduction, decline
Equanimity composure, poise, calmness, self-control
Antonyms
1.Compose x disturb
2.Pristine
x sullied
3.Turbid
x limpid
4.Monetary x non-economical
5. Revere
x threaten
6.Hamper
x facilitate
7.Transient x permanence
8.Fascinate x mundane
9.Fickle
x loyal
10.Contraband x legal goods
11.Repellent x attractive
12.Slur
x grace
13.Protean x constant
14.Hidebound x broadminded
15.Precipitate x dilatory/contradictory
Sentence completion
A passage is given with multiple blanks. There was a passage abt Artists,abt Money mgmt,abt
Cleanliness
VERBAL REASONING
SYNONYMS:
1. CIRCUMSPECT
(i) CONDITION (ii) INSPECT (iii) CAUTIOUS (IV) RECKLESS
2. ABYSMAL - terrible
(i) SLIGHT (ii) DEEP (iii) ILLUSTRIOUS (iv) PROLIFIC
3. DILIGENT hardworking, industrious, meticulous, careful
(i) INTELLIGENT (ii)..(iii)(iv)
4.VEHEMENT
(i) PASSIONATE (ii) CONFESY (iii) NOISY (iv) MOQULIS
5) IMPETUS
(i) CONNECT
(ii) CRUCIAL
(iii) STIMULUS (iv) IMMEDIATE
6) ACRONYM
(i) ABBREVIATION (ii) SIMILAR
7) DISSEMINATE
(i) FORECAST (ii) SPREAD (iii) BRANSP
8) HARBINGER
(i) NAVAL (ii) UNCOMMON (iii) FORE RUNNER (iv) GLORY
ANTONYMS:
1) TRACTABLE
(i) OBJECTIONABLE (ii) ENJOYABLE (iii) ADAPTABLE (iv) OBSTINATE
2) COVERT
(i) MANIFEST (ii) INVISIBLE (iii) SCARED (iv) ALTER
3) PENSIVE
(i) REPENTENT (ii) SAD (iii) THOUGHTLESS
(iv) CARELESS
4) MITIGATE
(i) AGGRAVATE (ii) RELIEVE (iii) ELEMINATE
(iv) EXHUMAN
5) DIVERGENT
(i) CONTRARY
(ii) COMING TOGETHER
(iii) CONVERSANT
(iv) CONTROVERSY
6) DOGMATIC
(i) SCEPTICAL (ii) RESILIENT (iii) STUBBORN (iv) SUSPICIOUS
7) CLUTCH
(i) HOLD (ii) GRAB (iii) RELEASE
(iv) SPREAD
8) MOTLEY
(i) BULKY (ii) SPECKLED (iii) HOMOGENEOUS (iv) DIFFERENT
9) RELINQUISH
(i) PURSUE
(ii) VANQUISH (iii) DESTROY
(iv) DEVASTATE
10) TRANSIENT
(i) PERMANENT
(ii) REMOVED
TCS PAPER ON 1st APRIL
discretion = prudence
compunction = remorse (regret)
amiable = friendly
cajole = coax (wheedle sweet talk)
incentive
= provocation
1.
Momentary
transient
embrace
=
hug
(hold-cuddle)
2. Latitude
scope
latent
= potential 3.
Heap
to pile (collect)
confiscate
=
appropriate
(to
take charge)
4. Adhesive
tenacious
emancipate
= liberate5.
Veer
diverge (turn)
lament
=
mourn
6. Concur
agree (accept)
confiscate
=
appropriate
7. Subside
wane (drop)
obstinate
= stubborn 8.
Enounce
reject
acumen
=
exactness
9. Hover
linger (stay close)
metamorphosis
= transform
10.
Tranquil
serene (calm)
scrutiny
=
close
examination
11. Admonish
usurp (reprove)
annihilate
= to destroy
12.
Alienate
estrange (isolate)
whet
= sharpen
13.
Instigate
dissipate (dismiss)
behest
= request
14.
Belief
conviction
adage
=
proverb
15. Covet
crave (desire)
penitence
16.
Belated= to repeattoo late
lethargy
17.
Solicit= stupor (lazy)
beseech (seek)
volume
=
quantity
18. Brim
border
furtive
= stealthy (secret)
19.
Divulge
reveal
meager
= scanty
20.
Tamper
obstruct
cargo
= freight(load) 21.
Caprice
whim (impulse)
baffle
=
frustrate
22. To merit
to deserve
pretentious
23.
Stifle = ostentatious(affected)
suffocate
volatile = ever changing
(smother)
expedite
= hasten
24.
Lethargy
stupor (lazy)
surplus = excessive
affinity = strong liking
fluctuation = wavering
empirical = experimental
retrospective = review
fallible = liable to error
egregious = bad
truncate = shorten by cutting
decomposition = rotten
equivocate = lie, mislead
26] Assess
= determine the amount or
value
27] Cognizance = knowledge
28] Retrospective = review
29] Naive
= innocent , rustic
30] Equivocate = tallying on both sides
31] Postulate
= frame a theory
32] Latent
= potential
33] Fluctuate
= wavering
34] Eliminate = to reduce
35] Affinity
= strong liking
36] Expedite
= hasten
37] Console
= to show sympathy
38] Adversary = opposition
39] Affable
= lovable, approachable
40] Decomposable = rotten
41] Egregious
= especially bad
42] Conglomeration = group
43] Aberration
= deviation
44] Erudite
= wise, profound
45] Augury
= prediction
46] Credibility
= ability to common
belief, quality of being credible
1. Admonish= usurp
2. Alienate = estrange
3. Belief = conviction
4. Baffle = puzzle
5. Brim = edge
6. Covet = to desire
7. Caprice = whim
8. Concur = agree
9. Confiscate = appropriate
10. Cargo = load, luggage
11. Dispel = scatter
12. Divulge = reveal, make known, disclose
13. Discretion = prudence
14. Emancipate = liberate
15. Efface = obliterate
16. Embrace = hug, hold, cuddle
17. Furtive = stealthy
18. Hamper = obstruct
19. Heap = to pile
20. Hover = linger
Choose the word or phrase that is most nearly similar in meaning to the word in capital
letters.
11. RIFE
(1) direct (2) scant
(3) peaceful
12. APOCALYPTIC
(1) insular (2) complaisant
(4) grim
(3) crass
13. CAVIL
(1) starry (2) criticize
(3) cold
14. BLAND
(1) caustic (2) meager
(3) soft
(5) mature
(4) uncooked
(5) porous
(5) helpless
15 CORROBORATE
(1) confirm
(2) orate
(3) disturb
(4) apply
16. JAUNTY
(1) youthful (2) ruddy
(3) strong
(4) untravelled
(5) whisper
(5) sedate
17. BOISTEROUS
(1) successful (2) democratic (3) noisy
(4) ambitious
(5) lamentable
18.TENUOUS
(1) vital (2) thin (3) careful (4) dangerous (5) necessary
19. ALIMENTARY
(1) nourishing (2) prior
(3) exterior
20.DELETERIOUS
(1) delaying (2) experimental (3) harmful (4) graduating (5) glorious
Answers
11.(2)
14.(4)
17.(3)
20.(3)
12.(4)
15.(1)
18.(2)
13.(2)
16.(5)
19.(1)
The exam had three sets-X,Y,Z i got Z which was the toughest
section A was english,
there was paragraph making which i cud not do it was very tough, so i guessed the
answers and hoped atleast few hits the target the RC had a passage from pg 99 of barons,i
had practiced all the barrons RC aand it helped .
i wud recommend the same for all as if u hv practiced the RC it saves a lot of time and
TCS keeps repeating the RC from Barrons.Infact instead of remembering all th ewords
from barrons its better to remember all the RCs as u will get 6 marks without wasting ne
time whereas others may hv to waste 15-20 mins on RC
aptitute was easy,just do ne previous yr question,they repeat the same questions again and
again,infact just remember all the answers as i had done,i helps..............
And yes there were few wrong questions and u need not waste time on them
Critical reasoning was from 12th edition Barrons model test papers.......
1>>toll brigde prob
2>>red and brown marriage
3>>>All A's is B's......
THE interview from a cool affair......
1>First was tell me something abt urself:
ans>blah blah
Exercise 1:
The passage given below is followed by questions based on its content. Read
the passage & choose the best answer 4 the questions
The Death Car
It was cold night in September. The rain was drumming on the car roof as George &
Marie Winstion drove through the empty country roads towards the house of their
friends, the Harrissons, where they were going to attend a party to celebrate the
engagement of the Harrisons daughter, Lisa. As they drove, they listened to the local
radio station, which was playing classical music. They were about 5 miles from the
destination when the music on the radio was interrupted by a news announcement: The
Cheshire police have issued a serious warning after a man escaped from Colford Mental
Hospital earlier this evening. The man, John Downey, is murderer who killed 6 people
before he was captured 2 years ago. He is described as large, very strong & extremely
dangerous. People in the Cheshire area are warned to keep their doors & windows locked,
& to call the police immediately if they se anyone acting strangely. Marie shivered, A
crazy killer. And hes out there somewhere. Thats scary.Dont worry about it, said
her husband. Were nearly there now. Anyway, we have more important things to worry
about. This car is losing power for some reasonit must be that old problem with the
carburetor, If it gets any worse, well have to stay at the Harrisons tonight & get it fixed
before we travel back tomorrow, As he spoke, the car began to slow down, George
pressed the accelerator, but the engine only coughed. Finally they rolled to a halt, as the
engine died completely, Just as they stopped, George pulled the car off the road, & it
came to rest under a large tree. Blast! said George angrily. Now well have to walk in
the rain. But thatll take us an hour at least, said Marie. And I have my high-held
shoes & my nice clothes on. Theyll be ruined! Well, youll have to wait while I run to
the nearest house & call the Harissons. Someone can come out & picks us up, said
George. But George! Have you forgotten what the radio said? Theres a homicidal
maniac out there! You cant leave me alone here! Youll have to hide in the back of the
car. Lock all the doors & lie on the floor in the back, under this blanket. No-one will see
you, when I come back, Ill knock 3 times on the door. Then you can get up & open it.
Dont open it unless you here 3 knocks. George opened the door & slipped out into the
rain. He quickly disappeared into the blackness. Marie quickly locked the doors & settled
down under the blanket in the back for a long wait. She was frightened & worried, but
she was a strong-minded woman. She had not been waiting long, however, when she
heard a strange scratching noise. It seemed to be coming from the roof of the car. Marie
was terrified. She listened, holding her breath. Then she heard 3 slow knocks, one after
the other, also on the roof of the car. Was it her husband? Should she open the door?
Then she heard another knock, and another. This was not her husband. It was somebody-or something--else. She was shaking with fear. But she forced herself to lie still. The
knocking continued-- bump, bump, bump, bump Many hours later, as the sun rose, she
was still lying there. She had not slept for a moment. The knocking had never stopped, all
night long. She did not know what to do. Where was George? Why had he not come for
her?
Suddenly, she heard the sound of 3 or 4 vehicles, racing quickly down the road. All of
them pulled up around her, their tires screeching on the road. At last! Some one had
come! Marie sat up quickly & looked out the window.
The 3 vehicles were all police cars, & 2 still had their lights flashing. Several policemen
leap out. One of them rushed towards the car as Marie opened the door. He took her by
the hand.
Get out of the car & walk with me to the police vehicle. miss. Youre safe now. Look
straight ahead. Keep looking at police car. Dont look back. Just dont look back.
Something in the way he spoke filled Marie with cold horror. She could not help herself.
After 10 yards from the police car, she stopped, turned & looked back at the empty
vehicle.
George was hanging from the tree above the car, a rope tied around his neck. As the wind
blew his body back & forth, his feet were bumping gently on the roof of the car-- bump,
bump, bump, bump
1) What was the reason for the news announcement on the radio?
a) 6 people. Including John Downey, had been murdered?
b) A dangerous prisoner had escaped
c) The police were warning of accidents on the roads in the bad weather
d) Some people had bens en acting strangely in the Cheshire area
2) What did George think was causing trouble with the car?
a) The carburetor
b) The rain drumming on the roof
c) The accelerator
d) He had no idea
Exercise 2:
Each sentence below has 1 or 2 blanks each blank indicating that
something has been omitted. Beneath the sentence are some words. Choose the word
for each blank that best fits the meaning of the sentence as a whole
7) Athletes have so perfected their techniques in track and field events that the
_________ becomes _________ before record books
a) Announcement public
b) Meet.official
c) Time.authentic
d) Fantastic...common place
8) A________ child, she was soon bored in class; she already knew more mathematics
than her junior school teachers
a) Obdurate
b) Precocious
c) Recalcitrant
d) Contemporary
9) The subtle shades of meaning, & still subtler echoes of association, make language an
instrument which scarcely anything short of genius can wield with ____________ &
________________
a) Confidence----------aloofness
b) Definiteness---------certainty
c) Sincerity--------------hope
d) Eloquence------------ruthlessness
10) Unwilling to admit that they had been in error, the researchers tried to_______ tried
case with more data obtained from dubious sources
a) Ascertain
b) Buttress
c) Refute
d) Dispute
11) His one vice was gluttony & so it is not surprising that as he aged he became
increasingly_______________
a) Despondent
b) Corpulent
c) Carping
d) Lithe
Exercise 3:
Please read all the questions in the table below (12-21) as one continuous
passage. Tick the varb with right tense or the correct word to fill in the gaps in each
of the sentences.
Statement
12) A famous singer had been contracted to
sign at a Paris opera house & ticket
sales_______________ booming.
Options
a) is
b) are
c) were
d) have been
a) is selling
b) was selling
c) sold
d) had been sold
d) was taking
a) will not be
b) has not been
c) had not been
d) was not
a) are finding
b) were finding
c) had found
d) have found
a) groans
b) groaned
c) had groaned
d) were groaning
18) The environment turned from excitement
to frustration
a) will give
b) had given
c) gave
d) gives
a) Applauded
b) Applauds
c) Was applauding
d) Has applauded
a)shouts
b) was shouting
c) had shouted
d) shouted
a) breaks
b) broke
c) had broken
d) was breaking
Exercise 4:
From each group of sentences given below, indicate the sentence that
contains the error:
22) Group 1
a) Driving long distances causes sleepiness, & sleepiness causes serious accidents.
b) On a table at the rear of the room was a notebook, a pair of scissors, & a
biology textbook
23) Group 2
a) Simple cookbooks for inexperienced cooks have become quite popular in
recent years they are available at many bookstores
b) Some cookbooks, such as The Joy of cooking, have been classics for
generations
c) One popular cookbook is The Art of French Cooking, by Julia Child, a colorful
character who charmed television audiences for many years
d) The Art of French Cooking blends classic recipes with meticulous explanation;
ordinary cooks find the recipes manageable
24) Group 3
a) Around 50% of the forest are destroyed every year
b) The bus leaves tomorrow morning
c) A tiger is a dangerous animal
d) Can you please the sugar?
25) Group 4
a) There must be some mistake. I should have scored more marks
b) The number of trainees are hundred
c) 50% of the houses need repairs
d) The Commissioner, along with his family members was seen the party
26) Group 5
a) The scissors is very sharp
b) Congratulations are in order
c) One of the cases is open
d) She plays tennis well but shell never be a Steffi Graf
Exercise 5:
Please mark the correct statement from the pairs given below:
27) Pair 1
a) Repeated occurrences cannot be ignored
b) Repeated occurences cannot be ignored
28) Pair 2
a) We need to get a consensus on the decision
b) We need to get a concensus on the decision
29) Pair 3
a) Only authority personnel are allowed in this area
b) Only authorized personnel are allowed in this area
30) Pair 4
a) The actress decided to sue the sleazy tabloid for deformation of her character
b) The actress decided to sue the sleazy tabloid for defamation of her character
31) Pair 5
a) Everyone knows that Hogwarts in the Harry Potter series is a mythical school
b) Everyone knows that Hogwarts in the Harry Potter series is a legendary school
32) Pair 6
a) Most people think caffeine is not good for health
b) Most people think caffiene is not good for health
Exercise 6:
Select the best word/phrase/line to complete each sentence in the most
appropriate manner
c) Enthusiastic
d) Loud
35) Mr. Hughes has been asked to___________ this difficult project because of his
experience working for many years in Iran
a) undergo
b) understand
c) undervalue
d) undertake
36) Stop talking to those angry men, you are just adding fuel to the fire is the same
as________
a) Stop talking to those angry men, you are just coming in the way
b) Stop talking to those angry men, you are just making it worse
c) Stop talking to those angry men, you are just adding to the noise
d) Stop talking to those angry men, you are just talking too much
37) Sudhirs work is behind schedule I think he bit more than he could chew is the
same as________
a) Sudhir has taken too much of work
b) Sudhir takes very long breaks
c) Sudhir does not know how to do the work
d) Sudhir is a lazy person
38) There are many__________ to our rules, and I do not think thats fair.
a) examples
b) exceptions
c) instances
d) provisions
Exercise 7:
Choose the correct / most appropriate word/s to fill in the gap in the
sentences given below.
39) I didnt set _________ to do this but Im pleased with the result.
a) in
b) out
c) on
d) down
41) I am glad so many people have passed the test. In fact, there were_________ who
havent.
a) little
b) a little
c) few
d) a few
b) smoke
c) some smoking
d) smoking
TCS ENGLISH SAMPLE PAPER 23rd SEPTEMBER 2006 AT HYDERABAD
Word
Abysmal
Circumspect
Meaning
Adj. Bottomless Use : His arrogance is
exceeded only by his abysmal
ignorance
n. A word formed by the initial letters
of a multi-word name
v. warn strongly, reprove Use: He
admonished his listeners to change
their wicked ways
v. Investigation before acting,
Conciliation
acronym
admonish
Connotation
covert
Covetous
Deprecate
Diligence
Synonyms
Terrible, awful,
dreadful, appalling,
very bad,
Contraction, ellipsis,
Antonyms
Superb
Reprove, reprimand,
chide, rebuke, usurp
Approve
Cutious, prudent,
careful, guarded, wary,
judicious, vigilant,
reckless
Appeasement,
pacification,
propitiation
n. Suggested or implied meaning of an Nuance, suggestion,
expression. Use: Foreigners frequently implication, undertone,
are unaware of the connotations of the overtone, subtext,
words they use.
Adj. secret or hidden, not openly
Clandestine, concealed,
practiced or vowed n. a covering that
stealthy, underground,
serves to conceal or shelter something copse, wood, thicket
Use: Investigations of CIA reveal that
such covert operations can get out of
control
Adj. avaricious, eagerly desirous of
envious, jealous,
Use: The child was covetous by nature desirous, greedy
and wanted to take the toys belonging
to his classmates
v. express disapproval of, protest
Denounce, deplore,
against, belittle Use: A firm believer of condemn, censure,
old-fashioned courtesy, Miss Post,
denigrate, decry,
deprecated the modern tendency to
belittle.
address new acquaintances by their
first names.
n. care and perseverance in carrying
Hard-working,
out tasks. Use : Her employers were
assiduousness,
Incitement
Open
Generous,
temperate
Approve
Laziness,
carelessness,
illustrious
impetus
Intermittent
Latent
meticulousness,
conscientiousness,
painstakingness
Prudence, caution,
acumen, predilection,
sagacity, wariness,
volition
Disperse
negligence
Indiscretion
Attract
Broadcasting,
diffusion, propagation,
Arbitrary, doctrinal,
unbending, inflexible,
authoritarian,
Level, stratum, rank,
height
Imperfect, unsound,
mortal, weak, frail,
Flexible
Perfect
Forerunner, herald,
potent, omen,
Memorable, wellknown, famous
Momentum, thrust,
motivation
Inglorious,
shameful
inertia
Alternating, sporadic
Constant
Dormant, embryonic,
suppressed,
undeveloped,
Overt
Latitude
Manifestation
mitigate
motley
pensive
prolific
relinquish
solicit
tractable
veer
Vehement
Caprice
Leeway, freedom,
autonomy, liberty,
room, rope
Sign, demonstration,
expression, symptom,
Appease, alleviate,
allay, assuage, mollify,
extenuate, palliate
Aggrevate,
exacerbate
Assorted, diversed,
mixed, dissimilar,
Uniform,
homogenous,
monochrome
Brooding, pondering,
meditative,
contemplative
Productive, abundant,
fecund
Unproductive,
scarce
Surrender, renounce,
abandon, repudiate,
cede,
Vanquish,
retain,
Importune, implore,
crave, beseech,
Grant
Disobedient,
intractable
Turn, swerve
Fervent, passionate,
Apathetic
stifle
concur
lethargy
Furtive
efface
Pretentious
compunction
confiscate
a. 15%
b. .15%
Smother, asphyxiate,
choke, suffocate,
strangle, curb, restrain,
repress,
Agre, harmonize,
coincide, assent,
acquiesce
Stupor, indolence,
weariness
Let out
Surreptitious,
clandestine
open
Obliterate, eradicate,
Engrave
Ostentatious, pompous,
conceited
Down-toearth
Conflict,
resist
Get-up-andgo
c. 0.015%
d. 0.0015%
2.
a. x<w
b. y<w
c. x>w
d. y>w
3.
12 men can do a job in 4 hours .in wat time the same job can be done by
30 socks r there in a basket.60% are red and rest are blue. How many
draws should be taken from the basket to make sure that u have 2 blue and 1 red
a. 2
b. 3
c. 14
d. 20
5.
A husband and wife has 6 sons and each has 5 children each, How many
a. 16
b. 16
c. data not sufficient
8.
b. 20
c. 36
9.
miles east of city C. City E is north of City D by 12 miles .what is the shortest
distance from City A to City E
10.
An employer pays X,Y,Z a weekly wage of total 610. X gets 120% of Y, and
economics and science training.11 were in 2 different training programs .find how
many of them do not attend any training programfew questions were given with
some relationship like:
1 head is to cap as finger is to
Ring
Nail
Thumb
12.
In a certain code language RANGER was written as REGNAR .with the same
In a certain code if READ is written as SEADR then how is SING written with
If kanchan is son of Sunils sons son then how is Sunil related to Kanchan-
grandson
15.
a. Caution
b. Tresspasers will b prosecuted
c. Only one way
d. Keep left
16.
One more odd man out was asked few questions on profit and loss were
asked
Technical
1.
A sorting program is given .You need to print the output of every outer for
loop.
Main()
{
int n=8,I,j,k;
int a[7]={44,55,42,12,6,94,67};
for(I=0;I<n-1;I++)
{
k=I;
x=a[k];
for(j=I+1;j<n;j++)
{
if(a[j]<k)
{
k=j;
x=a[k];
a[k]=a[I];
a[I]=x;
}
}
}
2.
The precedence of operators are given, you have to find the value highest :
a) z[I+2]
b)*x
c)&x
d)&(&x)
e)
4.
number of characters from file. You got to complete the C program (15 marks)
# define IN 1
# define OUT -----main()
{
int nc=nw=nl= ------,state= ------.c;
while((----=getchar()!=EOF))
{
++ ----;
if (c= = \n)
++ ----;
if(c = = || c = = \n || c= =\t)
state= ----;
elseif(state = ----)
{
state= -----;
++ -----;
}
}
}
Test Pattern:
Paper1: 40 J2EE Questions (50 minutes)
Paper2: 40 JAVA Questions (50 minutes)
All questions are multiple-choice !
------------------------------------------------------------------J2EE PAPER:
------------------------------------------------------------------1. What exception is thrown when Servlet initialization fails ?
(a) IOException
(b) ServletException
(c) RemoteException
ANS: (b)
------------------------------------------------------------------2. How can a Servlet call a JSP error page ?
(a) This capability is not supported.
(b) When the servlet throws the exception, it will automatically be caught by the calling JSP
page.
(c) The servlet needs to forward the request to the specific error page URL. The exception is
passed along as an attribute named "javax.servlet.jsp.jspException".
(d) The servlet needs to redirect the response to the specific error page, saving the exception
off in a cookie.
ANS: (c)
------------------------------------------------------------------3. What is the key difference between using a <jsp:forward> and
HttpServletResponse.sendRedirect()?
(a) forward executes on the client while sendRedirect() executes on the server.
(b) forward executes on the server while sendRedirect() executes on the client.
(c) The two methods perform identically.
ANS: (b)
------------------------------------------------------------------4. Why beans are used in J2EE architecture in stead of writing all the code in JSPs ?
(a) Allows separation of roles between web developers and application developers
(b) Allows integration with Content Management tools
ANS: (a)
------------------------------------------------------------------5. Why DB connections are not written directly in JSPs ?
(a) Response is slow
(b) Not a standard J2EE architecture
(c) Load Balancing is not possible
(d) All the above
(e) Both (b) and (c)
ANS: I think answer is (e). I am not sure whether response from database is slow just
because we include the database access code in JSP page.
------------------------------------------------------------------6. How multiple EJB instances are managed ?
(a) Connection Pooling
(b) Caching of EJB instances
(c) EJB Passivation
(d) All the above
ANS: I think answer is (d)
------------------------------------------------------------------7. At what stage, the life cycle of a CMP bean can be assumed to be started ?
(a) before ejbCreate() method is executed
(b) after ejbCreate() method is executed
(c) in postCreate() method
(d) after executing ejbStore()
------------------------------------------------------------------8. Lot of Questions on "EJB Transactions" and how to manage them.
------------------------------------------------------------------9. In JSP, how can you know what HTTP method (GET or POST) is used by client request ?
(a) by using request.getMethod()
(b) by using request.setMethod()
(c) impossible to know
ANS: (a)
-------------------------------------------------------------------
Description :
The <jsp:plugin> tag is replaced by either anor tag, whichever is most appropriate for the
client Web browser (the tag is for browsers that use HTML 4.0).
The <jsp:params> element sends parameter names and values to an applet or Bean at
startup. The <jsp:fallback> element provides a message for the user if the plugin does not
start. If the plugin starts but the applet or Bean does not, the plugin usually displays a popup
window explaining the error to the user.
The <jsp:plugin> tag takes most of its attributes from the HTML tags (in HTML 4.0). You may
want to refer to the official HTML specifications in which these tags are introduced:
For HTML 3.2: http://www.w3.org/TR/REC-html32.html
For HTML 4.0: http://www.w3.org/TR/REC-html40/
Attributes :
type="bean|applet"
The type of object the plugin will execute. You must specify either bean or applet, as this
attribute has no default value.
code="classFileName"
The name of the Java class file that the plugin will execute. You must include the .class
extension in the name following code. The filename is relative to the directory named in the
codebase attribute.
codebase="classFileDirectoryName"
The absolute or relative path to the directory that contains the applet's code. If you do not
supply a value, the path of the JSP file that calls <jsp:plugin> is used.
name="instanceName"
A name for the Bean or applet instance, which makes it possible for applets or Beans called by
the same JSP file to communicate with each other.
archive="URIToArchive, ..."
A comma-separated list of paths that locate archive files to be preloaded with a class loader
located in the directory named in codebase. The archive files are loaded securely, often over a
network, and typically improve the applet's performance.
align="bottom|top|middle|left|right"
The positioning of the image displayed by the applet or Bean relative to the line in the JSP
result page that corresponds to the line in the JSP file containing the <jsp:plugin> tag. The
results of the different values are listed below:
bottom Aligns the bottom of the image with the baseline of the text line.
top Aligns the top of the image with the top of the text line.
middle Aligns the vertical center of the image with the baseline of the text line.
left Floats the image to the left margin and flows text along the image's right side.
right Floats the image to the right margin and flows text along the image's left side.
height="displayPixels" width="displayPixels"
The initial height and width, in pixels, of the image the applet or Bean displays, not counting
any windows or dialog boxes the applet or Bean brings up.
hspace="leftRightPixels" vspace="topBottomPixels"
The amount of space, in pixels, to the left and right (or top and bottom) of the image the
applet or Bean displays. Must be a small nonzero number.
jreversion="JREVersionNumber|1.1"
The version of the Java Runtime Environment (JRE) the applet or Bean requires. The default
value is 1.1.
nspluginurl="URLToPlugin"
The URL where the user can download the JRE plugin for Netscape Navigator. The value is a
full URL, with a protocol name, optional port number, and domain name.
iepluginurl="URLToPlugin"
The URL where the user can download the JRE plugin for Internet Explorer. The value is a full
URL, with a protocol name, optional port number, and domain name.
<jsp:params> [ <jsp:param name="parameterName" value="parameterValue" /> ]+
</jsp:params>
The parameters and values that you want to pass to the applet or Bean. To specify more than
one name and value, use multiple <jsp:param> tags within the <jsp:params> element.
Applets read parameters with the java.applet.Applet.getParameter method.
<jsp:fallback> text message for user </jsp:fallback>
A text message to display for the user if the plugin cannot be started.
Example:
The <jsp:plugin> directive takes care of generating all the HTML code necessary to embed
and activate a Java applet.
Consider the following example:
----------<html> <head> </head> <body>
<jsp:plugin type="applet" code="NewsTicker.class" name="newsticker" height="100"
width="100">
<jsp:params>
<jsp:param name="x" value="10"/>
<jsp:param name="y" value="25"/>
</jsp:params>
<jsp:fallback>Oops! Something bad happened and I can't display this applet</jsp:fallback>
</body>
</html>
----------The code above sets up the applet contained in "NewsTicker.class", and passes it a bunch of
name-value pairs of parameters. The <jsp:param> tag is used to pass these parameters to
the applet, while the <jsp:fallback> directive contains error text, in the event that the applet
cannot be found or displayed.
When JSP compiles and renders the page, the code above is automatically converted to its
HTML equivalent.
<html> <head> </head> <body>
</body>
</html>
-----------
*
*
*
*
*
*
*
*
*
*
Aptitude
1.
If m-4 is 7 more than n then m+9 is how much more than n+2
2.
If 10x coins are added to the no. of original coins he has (5y + 1) times
Find out the Simple Interest paid for a sum of $4000 at the rate of 8% per
A chart was there giving the speed of train after some minutes like
7.
8.
If the data is for 10 bogies and for every 2 bogies added speed decreases
The type of questions where Both stmt are necessary First one is
11.
12.
6a+4b=43
13.
3a+12b=63
14.
The house is big and lovely but since nobody uses it it is pretty much a
Elephant mean?
Sometime they irritate me because they are up with the lark whereas I like
method it is overriding?
2.
3.
4.
6.
String a=abc;
String b=abc;
If(a==b)
System.out.println(1);
Else
System.out.println(2);
If a.equals(b)
System.out.println(3);
Else
System.out.println(4);
7.
Find the output Code showing Call by reference and call by value was
9.
byte b=1
(b) 6miles
(c) 13 miles
(d) 18 miles
Ans. C
5. If z = 1, y = 2.......a = 26. Find the value of z + y + x + .......+a.
(a) 351
(b) 221
(c) 400
(d) 200
Ans. A
6. There are 30 socks in a bag. Out of these 60 % are green and the rest are blue. What is the
maximum number of times that socks have to be taken out so that atleast 1 blue pair is
found.
(a) 21
(b) 2
(c)18
(d) 20
Ans. D
7. How many two digit numbers have their square ending with 8.
(a) 13
(b) 12
(c) 0
(d) 11
Ans. C
8. How many numbers are there between 100 and 300 with 2 in the end and 2 in the
beginning.
(a) 10
(b) 9
(c) 11
(d) none of these
Ans. A
9. 0.000006 * 0.0000007 = ?
(a) 0.0000000042
(b) 0.000000000042
(c) 0.0000000000042
(d) 0.00000000000042
Ans. B
10. You have Rs 1000 with 8% p.a compounded every 6 months. What is the total interest
you get after 1 year.
(a) Rs.116.40
(b) Rs.345.60
(c) Rs.224.50
(d) Rs.160
Ans. A
11. If x + y =12,
x-y=2
Find x + 2y.
(a) 12
(b) 17
(c) 14
(d) none of these
Ans. B
12. With one gallon of petrol a person moves at a speed of 50 mph and covers 16 miles. 3/4th
of the distance is covered while moving at 60 mph. How many gallons does he need to cover
120 miles in 60 mph.
13. A tap drains at x speed while tap B is closed. When both taps are open they drain at y
speed. What is the speed of draining when only tap B is open
(a) x - y
(b) y-x
(c) x
(d) can't be determined
Ans. B
14. What is twenty percent of 25 % of 20.
(a) 2
(b)1
(c) 5
(d) 4
Ans. B
15. A rectangle has the dimensions 6ft * 4ft. How many squares of 0.5 inches will it need to
completely fill it.
(a) 32000
(b) 12824
(c) 13824
(d) 18324
Ans. C
Directions for questions 16-21: In each question,a series of letters satisfying a certain pattern
are given. Identify the pattern and then find the letter/letters that will come in place of the
blank/blanks.
16. a, c, e, g, _
(a) h
(b) i
(c) d
(d) j
Ans. B
17. a, e, i, m, q, u, _, _
(a) y, c
(b) b, f
(c) g, i
(d) none
Ans. A
18. ay , bz , cw , dx ,__
(a) gu
(b) ev
(c) fv
(d) eu
Ans. D
19. 1, 2, 3, 5, 7, 11, __
(a) 15
(b) 9
(c) 13
(d) 12
Ans. 13 , series of prime numbers
20. kp , lo , mn , __
(a) nm
(b) np
(c) op
(d) pq
Ans. A
21. abc , zyx , def , wvu , ___
(a) ghi
(b) tsr
(c) ihg
(d) str
Ans. A
22. How is my mother's sister's brother's wife's child related to me?
(a) brother
(b) uncle
(c) cousin
(d) nephew
Ans. A
23.What will my mother's husband's father-in-law's son's daughter to me?
(a) niece
(b) aunt
(c) sister
(d) none of these
Ans. D
24. A person travels 12 km in the southward direction and then travels 5 km to the right. He
then travels 5 km to the right and then travels 15 km towards the right and finally travels 5km
towards the east. How far is he from his starting place?
(a) 5km
(b) 3m
(c) 3.5km
(d) 4km
Ans. (b)
25. A person travels towards east from his house and travels a distance of 3 meters. He then
ran a distance of 7 meters southwards and then travels towards east a distance of 3 meter
Finally he travels southwards a distance of 10 meters.What is his vertical distance from his
house?
(a) 10
(b) 17
(c) 12
(d) none of these
Ans. B
26. The sum of three consecutive numbers is 132. Find the square of the largest number.
(a) 2026
(b) 640
(c) 900
(d) 2025
Ans. D
27. Father's age is five times his son's age. Four years back father was 9 times older than his
son.Find their present ages
(a) 30yrs, 6yrs
(b) 25yrs, 5yrs
(c) 40yrs, 8yrs
(d) none of these
Ans. C
28. If x + 5y = 6 ;
7x - 2y = 5
Find x - y
(a) 1
(b) 2
(c) 0
(d) none of these
Ans. C
29. If the equation x2 + 2(k+2)x + 9k = 0 has equal roots, find k?
(a) 1,4
(b) 1,5
(c) 2,5
(d) can't be determined
Ans. A
Directions for questions 30 to 35: Select the alternative that logically follows form the two
given statements.
30. All books are pages. All pages are boxes.
(a) All boxes are books
(b) All books are boxes
(c) No books are boxes
(d) Both (a) and (b) are correct
Ans. B
31. No apple is an orange. All bananas are oranges.
(a) All apples are oranges
(b) Some apples are oranges
(c) No apple is a banana
(d) None of the above
Ans. A
32. All pens are elephants. Some elephants are cats.
(a) Some pens are cats
(b) No pens are cats
(c) All pens are cats
(d) None of the above
Ans. D
33. All shares are debentures.No debentures are deposits.
(a) All shares are deposits
(b) Some shares are deposits
(c) No shares are deposits
(d) None of the above
Ans.C
34. Many fathers are brothers. All brothers are priests.
(a) No father is a priest
(b) Many fathers are not priests
(c) Many fathers are priests
(d) Both (b) and (c)
Ans. B
35. Some pens are pencils. All pencils are costly.
40. Two pipes A and B can fill a tank in 20 and 25 seconds respectively. Both are opened at
the same time and after 5 minutes the first one is closed.How much more time will it take for
the tank to be full?
coded as
(a) 35421
(b) 43512
(c) 35412
(d) 34521
Ans. A
Directions for questions 46-48:The questions are based on the following data In a class of 150
students 55 speak English;85 speak Telugu and 30 speak neither English nor Telugu
46. How many speak both English and Telugu?
(a) 10
(b) 15
(c) 20
(d) 12
Ans. C
49. Find the lowest of the three numbers in a GP whose sum is 38 and product 945.
(a) 12
(b) 18
(c) 4
(d) 8
Ans. D
50. A can do a piece of work in 24days. When he had worked for 4 days B joined him. If the
complete work is finished in 16 days form the beginning, in how many days can B alone finish
the work?
(a) 24 days
(b) 18 days
(c) 36 days
(d) None of the above
Ans. C
DSQ PAPER. - Aug-04
Technical aptitude test
1. the 2's complement number of 110010 is
ans; none of those
2.Truth table of a logic function
ans: displays all its input output possibilities
3.The process of varying one signal according to the pattern
provided by another signal is
ans:modulation
4.The octal equivalant of hexa number 123 is
ans:443
.Determine how many times the given loop is executed
5.m=3 while (m<18) do {m=m+2;m=m-1}
ans:15
6.m=1;a=30;while (m<>1) do {m=m+1;a=a-1;}
7.m=1;a=30;while (e*m-5<a) do {m=m+1;a=a-2}
ans:9
in questions 8 to 12 find the values of a and b at the end of the
xecution of the program segment
8.a=2;b=1;x=1;while(x<=4)do {a=a+b;x=x+1}
ans:(5,1)
9.a=1;b=2;x=1 while (x<=5)do {b=a+b;x=x+1;}
ans:(1,6)
10.a=0;b=0;x=1;while (x<=4){a=a+x;b=b-x;x=x+1;}
ans:(10,-10)
In questions 11-15 find the odd man out
11.address
12.cmos
13.lisp ( from 11-15 these are the answers dont confuse)
14.mouse
15.csh
16.The complexity of bublle sort is0(a),then kequals
ans:2
17.In BCD,the decimal number 516 is
ans:10101110
18. RS 232 is standards for
ans:physical layer
19. which of the following is not true of a DBMS
ans:maintain integrity
20.the method of access used for obtaining a record from a tape is
ans:sequential
21.Whichof the following is an universal gate
ans:nor
22.an ASCII text file containing 500 characters will have size approximately
ans:500bytes
23.which of the following is a vector
ans;force
24.The lowest attainable temperature
ans 0k
25.viscosity is most similar to
ans:friciton
26.The elapsed time between the submission of the job and getting
the output is
ans:seek time
27.the earliest calculating device still in use is
ans: abacus
28.an acronym for the organisation that publishes programming
langauge standards is
ans:ANSI
29.Qunatities used to bring fields to standards sixe are
ans:pixels
30.the base of a number system is called as
ans:radix
31.An 8kb computer will bave addresses ----ans:8191
32.Arranging data in a specific form is called
ans: sorting
33.A translator which reads an entire programme written in a high
level language and converts it into machine language code is
ans: interpreter
34.a data hierarchy in assending order is
ans:bit-byte -field-record-file-database
35.a computer generated output that lets programmer follow the execution
of the program line by line is
36.data items grouped togother for storage form a
37. the most dangerous aspect of computer virusesis their ability to
ans: change system memory
38.a distributed data processing configuration in which all
activities must pass through an centrally located computer is called a
ans: ring network
39.communication circuite that transmit data inboth directions but
not at the same time areoperating in
40.which of the following is not an application software
ans:unix
41.For which of the folowing computer application is real time
processing not essential
ans;
42.a data structure with one to many relationship is a
ans:tree
43. which of the following hardware components is most important to operation
of a database management system
ans:high speed,large capacity disk
44. computer viruses can spread from one system to another by means of
ans:all the above
45. afront end processor is ususally used in
ans: multi processing
46.a radioactive material of mass 16 grms in 10 years due to
radiation. how many years will it take for the material to attain a mass f
1 gm
ans:30
47.a block of ice floats on water in a beaker, as the ice melts,the water
level in the beaker will
ans:remain same
48.if va,vn,vs are velocities of sound in air,water, and steel then,
ans:vs>vn>va
49.in usual computer arthemetic, the value of the integer expression
22/5*2+8*2/6
ans:10
50.an operating system is
ans: all the above
REASONING ABILITY TEST (VERBAL AND GENERAL)
Questions 1to 10 are odd man out i am giving only answers you just remember
1.sphere
2.rhine
3.s
4.548
5.voluminous
6.graphologist
7.
8.nepal
9.egypt
10.squash
11.
12.
13.
14.
15.
16.
ans)blood-sap (4-S)
24. ------is to cardic as brain is to -----------ans)heart-nerves (2-P)
25. --------is to myopia as long sight is to ------ans)
26) ----- is to japan as rupee is to ----ans)YEN -INDIA (3-P)
27) ------is to christian as synage gue is to -----ans)church-Jaws
28) -----is to thermometer as velocity is to -----ans)Temperature-animeter
29) ------is to sentence as act is to------ans)paragraph -scene
30) ------ IS TO EARTH AS EARTH IS TO ---ANS)Moon -sun
31) -------is to london as yamuna is to -----ans)thames-delhi
32) -----is to india as alps is to----ans)himalayas -switzerland
33) ------ is to proton as cathode is to-----ans)electron -anode
34) ------is to a river isto branch is to -------ans)lake-tree
35) ------is to proofread as account is to ------ans)proof -audit
MATHEMATICS TEST
1. if a**2+b**2+c**2=1 then ab+bc+cd lies in the intrval
a. -1/2,1 b.-1,1 c.-1/2,2 d.-1,2
2.if x is root of 4*y**2+2*y-1=0, the its other root is given by
a.4x**2+2*x+1 b.x-1/2 c 2x-1 d.2-x
4. the perimetere of a square is 44m more than that of another and
187 sqm more in area then the side of the larger square is
ans:17m
5. the value of x which makes xi+2j+3k and -i+5j+k perpendicular is
ans:none of the above
6. the value of determiterment ---|matrix|
ans:6
7. the solution of the system of equations 2y-z=0,x+3y=-4,3x+4y=3 is
ans: x=5,y=3,z=6
8. the radius of the circle 4x**2+4y**2 =100
ans: 5
9. the ages of two brothers are now in the ratio 4:3 but fifteen
years ago, they were in the ratio 3:2the present age are
ans:45
10.if z is the arithemtic mean between x and y , then the value of x/(x-z)+y/(y-z)
is ans:2
11.the least integer n for which the sum 1+3+5+---+(2n+1) exceeds
9999 is ans:100
12. the number of subsets of a set s is 64, then s has
a: 8 b.6 c.4.d. 16 elements
13.if n is a natural numbers, the n(n+1)(N+5) IS
ans:a multiple of 6
14.a spere circumscribes a cylinder . then the ratio of the surface
area of the spere to the curved surface area of the cylinder is
ans:3:2
15.ax/b+b=bx/a+a,a//b. then x equals
ans:ab/(a+b)
16. if logs sqrt(5x)=1,then x equals
ans:
17. which of the following triplets cannot be sides o a ritht angled
triangle
ans: (p-q),(p+q),sqrt(p+q)
18.inwhat time will RS. 3200 amount to RS.3528 at 5% annum compound interest
ans:2 years
19.if the price of orange falls by 20 % one can buy 5 dozens more
for RS 300, THEN THE ORIGINAL price per dozen is
ans:15
20. the triangle formed by (0,0),(0,4,),(3,8) is
ans: right angled triangle
21. The area of parallegram (0,0),(0,4),(3,8) is
a.12 b.6 c.24 d.25
22. A man can do a piece of work in 9 days, a woman can do 3/4 as
much work as a man in one day and a boy in twice the time that a man
takes. How many days wil 2 men, 3 women and 5 boys together take to do the
work?
ans:4/3 days
23.The probability of getting at least one head in a single throw of
three coins is
ans:7/8
24.A problem is given to two student A and B WHOSE REspective
chances of solving it are 1/2 and 2/3 . IF BOTH OF THEM TRY TO SOLVE THE
PROBLEM INDEPENDENTLY, THE PROBability that the rpoblem will be solved is
ans:5/6
25.In a single throw of 3 dice, the chance of throwing a total of 15
is
ans:a.1/15b.5/216 c.1/3 d. 1/4
26.(3x-2)/(x-2)<=0,then
ans:2/3<=x<2
40 . P and Q are positive integers with their averagfe 15, find how
many different values can one take
ans:29
41.The hands of clock coincide after every 66 min of correct time.
How much does the clock gain or lose in a day.
ans:gains 11 min
42.Ifxto the power of 5=4 and x to the power of 4=5/y , then x equals
ans:4y/5
43.if x,y,z are natural numbers, and if 2x=y and y=3z, which of the
following numbers could be x+y+z
ans:44
44.The pipes can fill a cistern in 1.5 hours and 2 hours
respectively. A wste pipe can empty a full cistern in 3 hours. If the
cisternis empty and all three pipes are opened together, in how many min
will the cistern be half full
ans:36
45. The members a,b,12 forma geometric progression and the nos a,b,9
form an arithmetic progression. find the value of a+b
ans:9or 45
46.IN a group of 15,7 can speak spanish, 8 can speak french, and 3
can speak neither.How much of the group can speak both french andspanish
ans:2/3
47.Oranges are bought at 11 for Rs. 10 and sold at 10. for Rs. 11
the profit is
ans:21%
48.If x/y=2/3 then y**2/x**2 is equal to
ans:9/4
49. the cordinates of A,b,c are respectively (2,3) ,(4,4) AND
(0,-2). If abcd is a parallelgram. The coordinates of D are
ans:(-1,-3)
50. If nis odd which of the following statements is true
ans: 1.n is odd 2. n**2 is odd 3. n**2 is even
a.1 only b.2 only c. 3 only 4. 1&2 only<class Item>
void foo(Item x);
which is right way to call with integer argument I?
a. foo(i);
b. foo<int > (i);
c. foo<Item>(i);
d. foo(<int> i);
e. foo(<Item > i);
8.
9. void quiz(int w)
{
if(w>1)
{ quiz (w/2);
quiz(w/2);
}
printf(*);
}
how many asterisks are printed by the function call quiz(5)?
a. 3
b. 4
c. 7
d. 8
10. void test_a (int n)
{
printf(%d,n);
if(n>0)
test_a(n-2);
}
test_a(4)?
a.024
c. 0 2
d. 2 4
e. 4 2
f. 4 2 0
11. char string[8]=abcdefg;
*string=\0;
printf(%s,string);
a. compiler error
b. run-time error
c. no o/p, but no error
d. creates bcdefg
12. char string[8]=abcdefg
o/p :
printf(%s\n,string +3);
a. abcdefg
b. abc
c. defg
d. cdefg
13. main()
{ int I=-3, j=2,k=0,m;
m=++I&&++j||++k;
printf(\n%d%d%D, I,j,k,m);
a. 2 3 0 1
b. 2 3 1 1
c. 2 3 1 0
d. 2 3 0 0
14. main()
{
int I;
for(;;)
{
printf(%d,I++)
if(I>10)
break;
}
}
a. condition in a for-loop is mudt
b. no error
c. 2 ; shud be dropped
15.void goop ( int z[]);//prototype
int x[10];
which ois the correct way to call goop
a. goop(x);
b. goop(x[]);
c. goop(x[10]);
d. goop(&x);
e. goop(&x[]);
16. int a=3,b=17;
a=b%a;
b=++a+5;
printf(a,b);
a. 2 8
b. 2 7
c. 3 7
d. 2 8
e. none
18. how many time shello will be printed?
FILE *fp=fopen(test.txt,w)
Fprintf(fp,hello);
Fork();
a. 1
b. 2
c. 0
d. none
19. int a;
int b=0;
while(a)
{
{ a&=a-1;
b++;
}
a &b
a. 0 & 15
b. 1 & 16
c. 0 & 16
d. none
20. class A
{
public:
static int a;
A() {a=10};
};
int main()
{
A b;
Printf(%d,b.a);
Return 0;
}
will the program compile?
a yes
b. no
NUMERICAL ABILITY
1. A salesman marks an item 60% above the cost price & offers 2 successive discounts of 25%
& 15% on the marked price. His profit is:
a. 15% b 2% c 7.5% d. 10 e. none
2.Had it been sold at 55% loss, SP would have been Rs. 10.80. The C.P is;
a. Rs 26 b. 28 c. 36 d.24 e. none
3. If 18 men can build a wall 140 mtrs. In 42 days . In how many days can 15 men be able to
construct a similar wall 100 mtrs . long??
a. 36 b. 60 c. 60 d. 33 e. none
4. Successive discounts of 15% & 20% on any goods amount to a total discount of :
a. 50 % b. 35% c, 34% d.32 % e.none
5. In a km race A beats B by 40 m or 7 secs. As time (in secs) over the cource is:
a.180
d. 280
e. 168
f. 175
g. none
7. A widow & a son are to receive Rs 20000 and Rs 10,000 respectively frm inheritance of Rs.
70,000. The rest is 2 be divide so that the widow recives 3/2 times as much of it as the son.
a. 1.05
b. 1.15
c. 1.25
d. 1.35
Problem Solving (19-21)
19. if 0<st<1 , then which of the following can be true?
a. s<-1 & t>0
b. s<-1 & t<-1
c. s>-1& t<-1
d. s>1 & t<-1
e. s>1 & t>1
20. To reproduce an old photograph , a photographer charges x dollars to make negative ,
3x/5 dollars for each of the first 10 prints, & x/5 dollars for each print in excess of 10 prints .
If $45 is the total charge to make a negative & 20 prints from an old photograph, what is the
value sof x?
a. 3
b. 3,5
c. 4
d. 4.5
e. 5
21. A certain cake reciope states that the cake shud be baked ina pan 8 inches in diameter . If
Jules want to make a cake of the same depth but 12 inches in diameter , by what factor shud
he multiply the recipe ingredients?
a. 2 & half
b. 2 & one-fourth
c. 1 & half
d. 1 & 4/9
e. 1 & a/3
Data interpretation 2228
ANALYTICAL ABILITY
A farmer plants only 5 diff. Vegetables-beans, corn, kale, peas& squash. Every year the
farmer plants exactly 3 kinds of vegetables as follows:]
If the farmer plants corn, the farmer also plants beans that year.
If he plants kale 1 year, he does not plant it next year
In any year, farmer plants no more than one of the vegetable the farmer planted in the
previous year.
29. Which of the following is possible combinations plant in 2 successive years?
a. beans, corn, kale,; corn, peas, squash
b. beans,corn,peas; beans,corn,squash
c. beans, peas,squash; beans,corn.kale
d. corn,peas, squash; beans,kale,peas
e. kale, peas, squash; beans, corn,kale
30.if he plants beans, corn & kale in 1st year , which must be planted in 3rd year?
a. beans, corn, kale
b. peas, corn & kale
c. beans, kale , peas
d. beans, peas, squash
e. kale, peas , squash
In a game exactly 6 inverted cups stand side by side ina straight line & each exactly has 1 ball
hidden under it. The cups are numbered consecutively 1 thro 6. Each of the balls is painted a
single solid color. The colors of the balls are green, magenta, orange ,purple,red & yellow. The
balls have been hidden under following conditions:
The purple ball must be hidden under a lower-numbered cup than the original ball.
The red ball must be hidden under a cup immediately adjacent 2 the cup under which the
magenta ball is hidden
The green ball must be hidden under cup 5.
31. which of the following could be colors of balls from 1 to 6?
a. green, yellow, magenta,red, purple, orange
b. magenta, green , purple, red, orange, yellow
c. magenta, red , purple, yellow, green , orange
d. orange, yellow. Red, magenta, green, purple
e. red, purple, magenta, yellow, green, orange
32. if red ball is under cup4 ? howmany sequences are possibl;e
a. 0
b. 1
c. 2
d. 3
e. 4
33. which is true?
a. green ball is under lower-numbered than the yellow ball.
b. orange ball is under lower-numbered than the green ball.
c. purple ball is under lower-numbered than the green ball.
d. purple ball is under lower-numbered than the RED ball.
e. Red ball is under a lower- numbered cup than the yellow ball
34. If red & orange ball are kept 0ofadjacnet to each other, how many valid seqiuences sre
possible?
a. 1
b. 2
c. 3
d. 4
e. 5
35. If the magenta is bill is under cup, 1 balls of which ththf following colors must be under
cops immedistely adjacent to each ather??
a. gree & orange.
b. Green & yellow
c. Purple & tred
d. Purple & yellow
e. Red & yellow
State the assumption 36..39
36.
37. Karim is exactly twice as old as Rahim. Karims age 10 yrs. Ago was 2 times saleems
present age.
a. saleem is 5 yrs. Younger than rahim
b. rahim is twice as old as saleem
c. saleem is the same age as rahim
d. saleem is 10 yrs. Younger than rahim
38. X & Y are +ve integers. The sum of X&Y is less then their product
a. atleast one of X & Y is not 1
b. both X & Y are greater than 2
5. Given a size from 0-7 what would be the least window size.
C Language (Total 13 Questions)
1. main()
{
printf("%d",printf("HelloSoft"));
} Output?
2. case 1: case 2:
typedef Struct { typedef Struct {
int a; char p;
char b; int q;
int d; char k;
char e; int l;
}A; }A;
Assuming 'packing' is not enabled, which case will give an error of Sizeof(A) less.
3. main()
{
int i=3;
printf("%d %d %d",i++,i,++i);
}
4. main()
{
int i=10;
int j,k=5;
int a[10];
for(j=0;j<10;j++)
a[j]=(i+k)+(i*k);
}
Optimize the above code.
5. Write In Order Tree Traversal Pseudo-code.
6. main()
{
int *p=0x100;
int *q=0x100;
int k=p*q;
printf("%x\n",k);
} Output ?
7. Char* foo(Str...) {
char str[4];
strcpy(str,"HelloSoft");
return str;
} Output?
8. int a[10][20][30][40];
int *p
How to access an element of a using p?
9. main()
{
int i=10;
if(i>20)
if(i==10)
print("Hi");
else
printf("Bye");
} Output ?
10.main()
{
float f;
int i;
//something like this not remember these 4 questionsexactly
f=(float *)malloc(sizeof((float *)*4));
}
Some Question was asked not remenber .
To change any answer already marked, cancel the previous mark by placing
All questions have only one right answer. If more than one answer is
The duration of this test is strictly 60 minutes. In case you continue to answer
not be evaluated.
Directions : For each question in this section, select the best of the choices given
1.
#define OR ||
#define LE <=
#define GE >=
main( )
{
char ch = D;
if((ch GE 65 AND ch LE 90) OR (ch GE 97 AND ch LE 122))
printf(Alphabet);
else
printf(Not an alphabet);
}
a) No Alphabet b) Alphabet c) error d)None
2.
main( )
{
int n[25];
n[0] = 100;
n[24] = 200;
printf(%d %d, *n, *(n + 24) + *(n + 0));
}
a) 200 100 b) 100 300 c) 100 200 d) None
3.
main( )
{
int arr[ ] = { 0, 1, 2, 3, 4};
int i, *ptr;
for(ptr = arr + 4; ptr = arr; ptr--)
printf(%d, *ptr);
}
a) 0 1 2 3 4 b) 4 3 2 1 0 c) 1 2 3 4 0 d)None
4.
main( )
{
struct employee
{
char name[25];
int age;
float bs;
};
struct employee e;
e.name = Hacker;
e.age = 25;
printf(%s%d, e.name, e.age);
}
a) Hacker, 25 b) Error message c) 25 Hacker d) None
5.
#define NULL 0
main( )
{
struct node
{
struct node *previous;
int data;
struct node *next;
};
struct node *p, *q;
p = malloc(sizeof(struct node));
q = malloc(sizeof (struct node));
p->data = 75;
q->data = 90;
p->previous = NULL;
p->next = q;
q->previous = p;
q->next = NULL;
while(p!=NULL)
{
printf(%d\n, p->data);
p =p->next;
}
}
a) 90 b) 75 c) 90 d) None 75 90 90
6.
main( )
{
int i=3;
i=i++;
printf(%d,i));
}
a. 3 b. 4 c. undefined d. Error
7.
8.
9.
#define str(x) #x
main( )
{
printf(%c,abcdefgh[4]);
}
a. a b. e c. Error d. None
11.
main( )
{
printf(%d %d %d,sizeof(3),sizeof(3),sizeof(3));
}
a. 1 1 1 b. 2 2 2 c. 1 2 2 d. 1 1 1
Note: Assume size of int is 2 bytes.
12.
main( )
{
struct emp{
char n[20];
int age;}
struct emp e1={david,23};
struct emp e2=e1;
if(e1= = e2) printf(structures are equal);
}
13.
main( )
{
char a[ ];
a[0] = A;
printf(%c, a[0]);
}
a) Compilaltion Error
b) No output
c) A
d) None
14.
main( )
{
int x = 5;
printf(%d %d, x++, ++x);
return 0;
}
a) Error b) 6, 6 c) 5, 7 d) 7, 6
15.
main( )
{
int z = 4;
printf( %d, printf( %d %d , z, z));
}
a) 4 4 3 b) 4 4 5 c) 4 4 4 d) Error
16.
int i = 0;
main( )
{
printf(i = %d, i);
i++;
val( );
printf(After i=%d, i);
val( );
}
val( )
{
i =100;
printf(vals i=%d\n, i);
i++;
}
a) i =0 b) i=0 c) Error d) None of the above
main( )
{
int a[ ] = { 10, 20, 30, 40, 50};
int j;
for (j = 0; j < 5; j++)
{
printf( \n %d, * a);
a ++;
}
}
a) 0..5 b) 0..4 c) Error d) None of the above
18.
main( )
{
int a[5] = {2, 4, 6, 8, 10);
int i, b =5;
for(i=0; i<5; i++)
{
f(a[i], &b);
printf(\n %d %d, a[i], b);
}
}
f(int x, int *y)
{
x = *(y) +=2;
}
a) 2 7 b) 4 9 c) 7 2 d) Error
4 9 6 11 9 4
6 11 8 13 11 6
8 13 10 15 13 8
10 15 12 17 15 10
19.
main ( )
{
int n=20, i = 0;
while(n- - >0);
i = i +n;
}
main( )
{
int i = 0; char ch = A
do {
printf(%c, ch);
} while (i++ <5| | ++ch < =F);
}
The output of above program is
(a) ABCDEF (b) AAAAAA BCDEF (c) A will be displayed infinitely (d) None of the above
21.
Assume that a,b,c are integer variables. Values of a,b and c are 2,3 and 1
main( )
{
for(count = 4; sum + = - - count);
printf(%d, sum);
}
(a) Programs goes into an infinite loop
(b) 356653 will be displayed
(c) 354453 will be displayed
(d) None of the above
23.
main( )
{
char *x="New";
char *y="Dictionary";
char *t;
void swap (char * , char *);
swap (x,y);
printf("(%s, %s)",x,y);
char *t;
t=x;
x=y;
y=t;
printf("-(%s, %s)",x,y);
}
void swap (char *x,char *y)
{
char *t;
y=x;
x=y;
y=t;
}
a).(New,Dictionary)-(New,Dictionary)
b).(Dictionary,New)-(New,Dictionary
c).(New,Dictionary)-(Dictionary,New)
d).(Dictionary,New)-(Dictionary,New)
24.
main( )
{
static float a[ ] = { 13.24, 1.5}
float *j, *k;
j = a;
k = a + 2;
j = j * 2;
k = k/2;
printf(%f%f , *j, *k);
}
a) Error b) Some value c) No output d) None of the above
25.
main( )
{
static char s[ ] = Rendezvous;
printf(%d, *(s+ strlen(s)));
}
a) 0 b) Rendezvous c) 0 d) Error
SECTION B
Directions: For each question in this section, select the best of the answer choices
26.
The process of converting analog signal into digital signals so they can be
a. Utility software
b. Specific software
c. End-user software
d. Practical software
31.
32.
a. 8
b. 16
c. 32
d. 64
e. 256
33.
a. Assembler
b. Object
c. Computer
d. Machine
34.
a. Programmer skill
b. Language availability
c. Program compatibility with other software
d. All the above
35.
An integrated circuit is
a. A complicated circuit
b. An integrating device
c. Much costlier than single transistor
d. Fabricated in a single silicon chip
36.
a. Privacy of data
b. The simplicity of data
c. The validity of data
d. The security of data
37.
37. Which data communication method is used for sending data in both
39.
a. Additional Terminal
b. Advance Technologies
c. Applied Technologies
d. Advanced terminology
40.
together by sets of parallel electrical conducting lines. What are these lines called?
a. Conductors
b. Buses
c. Connectors
d. Connectivity
SECTION C
Directions : The following set of Questions is based on a brief premise and a set of rules.
For each question, select
Egg, Chicken, Mutton, Fish and Lamb are served each week according to thefollowing
restrictions.
41.
On which of the following pairs of days could the restaurants menu of entrees
be identical?
a. Friday and Sunday
b. Tuesday and Wednesday
c. Saturday and Sunday
d. Wednesday and Friday
e. Thursday and Friday
42.
Which of the following is a complete and accurate list of the days on which
Which word inside the brackets is always part of the word outside the
ABCDEFGH
How many minutes past 11a.m. is it, if two hours ago it was three times as
How many minutes before 12 noon is it, if one hour ago it was three times as
The recipe for a cake called for 2/3 cup of sugars. How many cakes did Jane
A new copy machine can run off 1,500 workbooks in 8 hours, while it takes an
older copy machine 12 hours to do the same job. What is the total number of hours
that it would take both copy machines working at the same time, but independently,
to run off the 1,500 workbooks?
a. 4.4
b. 4.6
c. 4.8
d. 5
e. 10
53.
Suppose half of the people on a bus exit at each stop and no additional
passengers board the bus. If on the third stop the next to last person exits the bus,
then how many people were on the bus?
a. 20
b. 16
c. 8
d. 6
e. 4
55.
A car traveled 75% of the way from town A to town B by traveling at T hours
at an average speed of V mph. The car travels at an average speed of S mph for the
remaining part of the trip. Which of the following expressions represents the average
speed for the entire trip?
a. .75V + .25S
b. .75T + .25S
c. VT / (3S)
d. 4VT / (T+S)/3
e. 4VS / (3S+V)
56.
If you had a piece of paper that was 0.001 inches thick, how tall a pile would it
When he was a child, Gopal wanted to buy his mother 3 red roses for her
birthday. He decided to start saving on the first day of the month. On the first day, he
put ONE paise in his piggybank; on the second day he put TWO paise, on the third
day he put THREE paise and so on.
a. 13th day of the Month
b. 19th day of the Month
c. 24th day of the Month
d. 30th day of the Month
e. 21st day of the Month
58.
Mary was both 13th highest and the 13th lowest in a spelling contest. How
t an international party all the Indian guest ate 2 sandwiches, each American
guest ate 4, each Australian ate 8, and all Russians guests ate 12. There had been a
total of 234 sandwiches served. The number of guests from each country was equal.
How many guests in total were in the party?
a. 12
b. 24
c. 36
d. 48
e. 9
60.
ABCDEFG
H
Which letter is immediately to the right of the letter three to the left of the letter
immediately to the right of the letter which is four to the right of the letter which
comes midway between the letters A and C?
a. F
b. G
c. E
d. D
InterWoven:
This company is in Bangalore and they conducted a telephonic interview to screen the people
at first level. This is the Technical interview conducted for 3+ years experienced in Java, J2EE.
__________________________________________________
1. Why do you want to leave current company ?
2. Explain MVC architecture and functionalities of various components ?
3. I have a file of very very large file size at client side, and I have a JSP page. Using this JSP
page, if I want to send the file to a servlet (this servlet will store it somewhere), what is the
best method to do it ?
4. What is the difference between normal beans and EJBs ?
5. How system level services in EJBs are managed ? And tell about Deployment Descriptor ?
6. What are various types of EJBs ?
T
1
2
3
Hardware questions
1.
Draw the state transition diagram for sequence detector for the sequence 011.
if the first bit detected is zero then SCRH should be asserted when the second bit is 1
the SCRH should remain asserted when the third bit is 1 the FOUND should be
asserted and the SCRH should be disasserted. No bits should be left.
2.
ts=0.5 and Th=0.7 (for the this is the setup time reqd and hold time reqd)
b.
3.
a. For each gate the delay time is 0.5 ns when will the glitch occur draw the glitch
waveform.
b. How the circuit should be modified to avoid glitch.
4.
describe the driving inverter? What inverter is weak and which has more
strength? why?
5.
6.
Vtp=Vtn=1V
7.
obtain expression for the output (the i/ps may not be in correct
order)
8.
9.
a.
10.
11.
12.
circuit is needed
13.
b).
c).
Software questions:
Totally 20 questions were asked
* Most of them from C and datastructures (in equal nos)
* few from c++
1.
_______numbers on an average
2.
3.
representation of numbers
1. binary search 2. Sequential search 3. Selection sort
4.
program to reverse a linked list all the variables 3 left pair of statements
{
t=____;
p=_____;
r=______;
}
return=______
5.
palindrome or not
6.
they gave one program and asked what it is (it is fibonacci series)
7.
int i=7;
int i=7;
swapping
10.
11.
12.
what is a language
* set of alphabet
* combination of alphabet
* strings of some alphabet
CATEGORY : JAVA - J2EE (3+ years experienced category)
About Company: NOVARTIS is a Swiss based MNC and world number one in Pharmaceutical. It
has a very good brand name. It's having around 80,000 employees. It's entering IT insustry
now to handle the large number of their in-house projects. As of now, the only development
center in India is in Mumbai.
The interviews are held for more than 3 years experience in JAVA, J2EE.
There are 3 rounds :
1. Technical Test (25 questions in 45 minutes time)
2. Group Discussion (30 minutes)
3. Technical & HR interview (30 minutes to 90 minutes)
I wrote here all the questions I remember. I think I almost covered most of them.
______________________
Technical Test
______________________
All are multiple choice questions.
1) Question on Static Methods, whether they can be overloaded or not
2) A java program on nested (inner) loops and it is asked what is the output of the program.
3) Once a Servlet is initialized, how do you get the initialization parameters ?
(a) Initialization parameters will not be stored
(b) They will be stored in instance variables
(c) using config.getInitParameters()
ANS: I think answer is (c)
4) A question on functionality of <forward> tag in JSP
5) If the cookies are disabled, how can you maintain the Session.
ANS: URL rewriting
6) If there are strict timelines and if you want to get high performance for JSP to DB access,
what method you suggest ?
(a) Moving application server in to same manchine as Database
(b) By storing results in Cache
(c) By implementing Connection Pooling
ANS: I think answer is (c)
7) A question on MVC architecture and the functionality of Controller and View.
8) Question on Design Pattern. (I don't remember it)
9) Which Design Pattern hides the complexities of all sub-systems ?
(I don't remember the options and also don't know answer.)
10) In CMP bean, which method executes only once in life time
(a) setEntityContext()
(b) create()
(c) remove()
(d) find()
ANS: I think answer is (b)
11) Which bean can be called as Multi-Threaded bean ?
(a) Entity beans
(b) Stateless Session beans
(c) Stateful Session beans
(d) Pooled Stateless Session beans
ANS: I think answer is (d)
12) A question on Threads in Java, whether we need to mention the word "Daemon" explicitly
to make a thread as Daemon.
13) A question on Transactions of EJB. I think the question is something similar to - "Which is
faster ?"
(a) TRANSACTION_UNREPEATABLE_READ
(b) TRANSACTION_REPEATABLE_READ
(c) TRANSACTION_COMMIT_READ
(d) TRANSACTION_UNCOMMIT_READ
(I don't know answer and also I am not sure of options. but the options are something similar
to this.)
14) Question on EJB Home Object, Remote Object and what functionalities will be performed
by each.
15) What is the difference between Server and Container
(a) A Container can have multiple Servers
(b) A Server can have multiple Containers
(c) A Server can have only one Container
ANS: I think answer is (b)
16) ejbStore() method is equivalent to
(a) SELECT
(b) INSERT
(c) UPDATE
(d) DELETE
ANS: I think answer is (c)
17) A question on where the garbage collection is done. I think the answer is : "finalize()"
method
18) A question properties of Primary key in Entity Beans (I don't remember the options
exactly.)
(a) Primary key consists of only basic data types in java
(b) Primary key can contain composite data types
Remarks on Technical Test : It's a bit difficult and lot of questions are on EJBs, JSPs and
Design Patterns.
Group Discussion
Topics:
1. Development of India
2. Qualities to become a successful manager
__________________________
Technical & HR Interview
__________________________
1) Tell about yourself ?
2) Explain your projects and what design patterns they follow !
3) Questions on Project management, Team management, Defect prevention, Quality
procedures (These, questions are in detail and on each aspect. This went on for around 1
hour.)
4) Tell something about your current company
5) Reasons for leaving current company.
6) Current salary & Expected salary !
6) Any Questions ?
Remarks on Technical & HR Interview : Be prepared well for projects you did and the Design
Patterns in J2EE. Also the Quality procedures.
Enter Your Comments
Test Paper :1
Paper Type
Posted By
: General - other
: admin
Electronics.
1.Fastest logic ..
Ans: ECL
2.202.141.65.62 type of IP address belong to which class.
Ans:class B
3.Mod K ring counter requres how many number of flipflops.
Ans:K
4.ftp is in application layer.
5.Problem related to Ternary operations.
Ans:3
6.Problem related to macro # define square x x*x.
Ans:11
7.Problem related to 5 pointers..refer Page.123 of C prog.,by Keringan and Ritchie.
8.Ideal op-amp CMRR.
Ans: infinity.
9.13-bit DAC MSB resistance 2kohms.LSB resistance ?
Ans: 2k * 2 to the power of 12.
so take care of all the things
section I and section II and sec III
Questions r not in sequence .................
1. forall(roar(x)=> lions(x)) what does it mean ?
ans all lions roar .
2. p<=>q read about this
3. when 2 dice r thrown atleast one of them shows 6 probability is
ans 11/36.
4.2's complement of a 2's complement number is
ans . same no.
5. internatioaal court is at ----------ans Hague.
6. Meaning of ambasador ?
uca ( u can ans)
7. automata DFA dia is given
ans most probably B. chec
8.criticall section
( uca )
9. No of page faults asked by giving the sequence 2 3 6 7 1 3 4 8 9 10 3 2 4 ( just for
example I have given this seq .) thro LRU.
ans 6 ( corect).
10.problem in scheduling RR , a sequence is given just like abovewith time slice of 1 and
completion period for a process is asked
ans . 11
11.A directory has write permission then a user can create a file.
12.Java is
a. compiled
b. interpreted.
c. OOP
d. mutithreaded.
e. all
ans e.
13. Bubble sort is given ., No of times it executes
ans . n(n-1)/2
14. The appriximate ratio for no of internal nodes to total no
of nodes in k-ary tree of depth n.
ans. 1/k
15. what is fidelity
satya u check
16 what is microprogram.
u check
17. joke :: laugh
ans. cracker : blast
18. question on deadlock
19. How do u remove a ghost in t.v
u check ( clue. ghost means shadow of pictures i.e
20. Queston about a familiy eric, koren, davis etc .
B) 0.25
C) 0.50
D) 1.0
Ans. B
11) How many students are both male and good?
A) 10
B) 16
C) 22
D) 48
Ans. C
12) Among average students, what is the ratio of male to female?
A) 1:2
B) 2:1
C) 3:2
D) 2:3
Ans. D
ANALYTICAL
Directions for Questions Nos: 13 to 17
Five executives of a multinational company met in Bombay:
Mr. Ram can speak Tamil and Hindi
Mr.Sham speaks Tamil and English
Mr. Raju converses in English and Hindi
Mr.Balu speaks Telugu and Tamil quite well.
Mr.Lalu can speak Hindi and Telugu
13) Which of the following can act as a interpreter when Mr.Raju and Mr.Balu wish to confer?
A) Mr.Ram Only
B) Mr.Sham Only.
C) Either Mr.Ram or Mr.Sham
D) Any of the other three executives.
Ans. D
14) Besides Mr. Lalu, which of the following can converse with Mr.Balu without an Interpreter?
A) Mr.Ram Only
B) Mr.Sham only
C) Mr.Ram and Mr.Sham
D) Mr.Raju Only
Ans. C
15) Which of the following cannot converse without interpreter?
A) Mr. Sham and Mr.Lalu.
B) Mr. Ram and Mr. Sham
C) Mr. Ram and Mr. Raju
D) Mr. Sham and Mr. Balu
Ans. A
16) If a sixth executive is brought in, for him to be understood by the maximum number of
original five, he should be fluent in?
A) English and Telugu
B) Hindi and Tamil
C) Telugu and Hindi
D) Hindi and English
Ans. B
17) Of the languages spoken the most common languages are
A) English and Tamil
B) English and Hindi
C) English and Telugu
statement of Laxman is false, hence his second statement is true, that is take the left road.
23) You find that your boat is stolen.You question three inhabitants of the island and they
reply as follows:
John says,I didnt do it. Mathew didnt do it
Matthew says,I didnt do it. Krishna didnt do it.
Krishna says,I didnt do it .I dont know who did it.
Who stole your boat?
A) John
B) Matthew
C) Krishna
D) None of them.
Ans. B
Matthew said he didnt know who did it, but he also said he didnt do it, which means he
knows who did it, which means his second statement is false, which means his first statement
is true
Directions for question nos 24-25: There are five trains A, B, C, D and E that run between the
following stations:
Bombay and Pune
Calcutta and Bombay
Pune and Goa
Goa and Bombay
Pune and Calcutta
Trains A and D do not go to Bombay, B&C do not go to Calcutta and C & D do not touch Goa.
24) Train E goes from to and vice-versa
A.Pune and Calcutta
B.Bombay to Goa
C.Bombay to Calcutta
D.Goa to Pune.
Ans. C
25) Which train runs between Calcutta and Pune?
A) A
B) B
C) C
D) D
Ans. D
COMPUTER AWARENESS
26) The device that can transform digital data into analog data is called a
a)transformer
b)network
c)carrier
d)modem
Ans. d
27) Following is true about the IP of a machine
a) It is 48-bit and will always be unique around the world.
b) It is 48-bit and is not necessarily be unique around the world.
c) It is 32-bit and will always be unique around the world.
d) It is 32-bit and is not necessarily be unique around the world.
Ans. c
28) A machine having 64MB memory runs a executable which is 300MB on disk. This is
achieved by:
a) Use of FAR pointers
b) Page swapping.
c) Save some variables on another machine on network.
d.) Cannot be run on the machine.
Ans. b
29) Which of the following is true about thread and process startup speed:
a.) The startup of a thread is faster than a process.
b.) The process startup is faster as it is directly controlled by the OS.
c.) They will be equal.
d.) Depends on OS that is used. Faster on Windows98 slower on NT.
Ans. a
30) What causes "Thrashing" of a program :
a.) The constant swapping of program due to page faults.
b.) The inability of a program to get assess to a network resource.
c.) A near overflow / underflow of a variable.
d.) Assessing a memory area not allocated to the process.
Ans. a
31) Turbo-C is a / an
a.) IDE and C compiler/linker.
b) C-compiler/linker
c) C .
d) code generator.
Ans. a
32) The path of creation of an executable is :
a.) coding, linking, compiling, parsing.
b.) coding, parsing, compiling, linking.
c.) coding, compiling, parsing, linking.
d.) coding, compiling, linking, parsing.
Ans. b
33) Memory leak in software is due to
a.) Heavy recursion used in logic.
b.) Using structures of large size
c.) Improper use of the CPU registers.
d.) Improper release of allocated memory .
Ans. d
34) A "stable sort" is different from "sort" in the following way
a) Stable sort handles multiple thread access.
b.) Stable sort maintains the order of equal entities as it was in original sequence.
c.) Stable sort will always sort using the fastest scheme available in the library.
d.) Stable sort can handle exceptional conditions like interrupts in software.
Ans. b
35) The classic way of checking whether a mathematical expression has matched paranthesis
will employ the following data structure :
a.) List.
b.) Directed Graph
c.) Threaded Binary tree.
d.) Stack.
Ans. d
36) The fastest sorting algorithm for a Random set of numbers is:
a.) Quick sort
b.) Shell sort
c.) Bubble sort
1.
Rs.1260 shared amonng A,B,C in the ratio 2:3:4.What is the C's Share?
There are 2 cups one half filled with tea and other half filled with coffee.If
1 tea spoon of tea is takebn and mixed with coffee cup & 1 tea spoon from
thecoffee mixture is taken is mixed with tea cup.Which has higher concentration?
Ans: Tea
3.
BGLQ:YDIN:VBGL:?
Ans: EJOT
5.
A Room has round table at one corner.The one edge of the table is 5 inch
from the wall and the other edge is 10 inch from the other end of the wall.What is
the diameter of the table.
6.
heading.
ST Microelectronics
there were two papers
1. separate for the hardware (electonics people)
2. and other for the software (comp).
Software paper
There were 3 sections the questions in these sections were mixed with 2-3 aptitude question,
questions on comp n/w & OS were 7-8, 1-2 on CSO, 1 que on controls, 1 on sampling theorem
some on Comp Arch. & digital logic & 7-8 on C.
section 1 contains 11 questions
section 2 contains 13 que
section 3 contains 13 que ( total = 37 que , marks= 50)
All the 3 sections was compulsary and u've to give a preference among the section 2 & sec 3
so that the weightage for the second one will get doubled. Negative marking was there.
here are some of the ques which i remember
1. which conversion is not possible
a. float to int
b. int to float
c. char to float
d. all are possible
Ans: d
critical section
wait(mutex)
ans. violation of mutual exclusion
22.an RLC ckt was given, fuctioning of ckt to be determined.
a: will act like FM
b: PM
c:AM
d: none of the above
23.
int i=0;
switch(i)
{
case 1: printf("hi");
case 0: printf("zero");
case 2: printf("world");
}
ans: zeroworld
24.which one is the declaration of static string
a: static string
b: 'static string'
c: "static string"
d:char sting[30]
25.a que on file handling in c
a: file cant be opened
b:msg.txt is copied to msg
c:only first string be copied
d:
26. which of the fuction will store a 100 char string in X
a: fread(x,100,....)
b. fread(100,x,.......)
c.gets(x)
d.read(x)
ST Microelectronics
there were two papers
1. separate for the hardware (electonics people)
2. and other for the software (comp).
Software paper
There were 3 sections the questions in these sections were mixed with 2-3 aptitude question,
questions on comp n/w & OS were 7-8, 1-2 on CSO, 1 que on controls, 1 on sampling theorem
some on Comp Arch. & digital logic & 7-8 on C.
section 1 contains 11 questions
section 2 contains 13 que
section 3 contains 13 que ( total = 37 que , marks= 50)
All the 3 sections was compulsary and u've to give a preference among the section 2 & sec 3
so that the weightage for the second one will get doubled. Negative marking was there.
here are some of the ques which i remember
60 questions 45 minutes
Reading Comprehension
Aptitude(Maths)
Synonyms
Antonyms
Find Grammatical Mistakes
Data Sufficiency
Synonyms
1.
Mandatory - compulsory
2.
affirmed - confirmed
3.
illicit - illegal
4.
capricious - whimsical
5.
alieviate - relieve,remove
Data Sufficiency
1.
1.
2.
3.
1.
statement 1 is enough
2.
statement 2 is enough
3.
4.
5.
data is insufficient
Answers
2.
y>0
y square 2 - 4 > 0
Answers:
1.statement 1 is enough
2.statement 2 is enough
3.statement 1 and statement 2 together is required
4.Statement 1 is enough and statement 2 is enough separately
5.data is insufficient
Aptitude
1.
Ans:1050
2.
Ans:24
3.
SI = 240
R=6
N=4
P=?
Ans:1000
4.
diff bet. simple interest and compound interest for 2 years = p(N/100)
1.
Sum of three nos is 98. The ratio between 1 and 2 is 2:3. The ratio between 2
innings (15 innnings), what should he score in the remaining three innings
(avg)?
4.
A man buys 1kg of sandalwood and 1kg of teakwood. He sells one for 10%
In a class of 250 students, on JAN 2 15% of the girls and 10% of the boys are
absent. If on 100% attendance there are 10 boys. Find the percentage present?
6.
Mandrake has to choose from 4 from 10 people. There are 3 girls, 5 boys , 2
8.
9.
Section 2 - Ananlytical
10.
One pblm on DI.Gulshan Kumar and Rakesh Roshan take a film. If they take a
art film it's 25 lacs or a multi starrer it's 75 lacs.They spend 28% on clothing ,11% on
lighting.Actor fee 22% for Multi starrer or 10 lacs for art film.Based on these data
some questions were asked.
Section 3 - Verbal
General GRE type q's.:Analogies,Reading Comprehension.
Section 4 - Visual reasoning.
Some figures were given and told to fill up the blanks.
Some figures were given and told to fill up the blanks. for the post of system trainee.
They need people to work in MAINFRAMES.The paper was ok, except a few questions others
were basic.They paper consisted of 4 sections. Quants,Anals,Verbal and Visual
Reasoning.They wnated us to attend all the sections, because they clearly stated that any
ommission, they will not value the papers and chances of getting shortlisted was little. After
the test they asked us to write a essay on any of these three topics.
My Family
My Career
What two things i would change if I was the prime minister of India.
INTERVIEW:
S->Ax|By
A->Ax|y
B->x|y
possible ans is xy|xy
2. In n*n matrix , there non zero numbers in diagonal and either side
of the diagonal. If represented in one dimensional array, assign the
values which are non zeros.
find relation with i,j iteration and linear arry
like a[2*(i-1)+j] this
3. In-order of the letters is given as below:If written in pre-order like given below: write the
post-order:
4. fun(n)
{
if(n<=2)
return (1);
else
return ((fun(n-1)*fun(n-2));
}
find the order of complexity of the programme.
possible answer ---- N(2^n)
5.
a=a XOR b;
b=a XOR b;
a= a XOR b;
7.
8.for a given CMOS the voltage is halved freqency doubled capacitance halved what is the
present CMOS power
9.if a row daminated two dimentional arry in the following which one is advantage
and why?
a) for(i=0;i<1000;i++)
for(j=0;j<1000;j++)
temp=temp+a[i][j];
b) for(j=0;j<1000;j++)
for(i=0;i<1000;i++)
temp=temp+a[i][j]
ans is 3*(sqrt(3))/2
11. If traverse in a chess board right and down from one corner to another corner how many
possible ways will be there
ans is 1,2,3
13.The fig shown in below is a SRAM (1K* 4 bits) ,how many of this SRAMS are reqired to
design 16K of one byte
14. suppose two persons entering into one room in the morning 5 to 6 A.M. what is the
probability they will enter in 10 minits gap.
I donot know this answer
15. In a binary tree what is the hight and lowest no of levels for N nodes.
I think the next rounds will be technical and HR interviews as usual...Please those coming
for attending sony make sure u are well prepared and thorough with all concepts,.. They will
be taking a few from a lot...
ALL THE BEST....
HR is also easy. It will last for some 2-3 minute and at the most 5 minutes. Just be what
you are.Don't be artificial.Express your own views.they give certain
situations and see how u handle the situation.
So finally I got through all these rounds and on September 21st evening at 4:30 I got my
result. U know friends this is my 5h company and I couldn't get through the written also
in all the 5 companies I previously attended. So dont worry friends. If u are not selected
in a company then a better company is waiting for.ALL THE BEST
Hi friends,Here are the some of the technical questions posed in the NALCO exam for
the post of Graduate engineering trainee on 28 oct. 2007 for Electrical branch. Out of 120
questions 60 technical questions, 60 non-tech questions and time duration was 2 and half
hours.
There were still more question but I couldnt remember all of them. The questions mostly
have taken from electrical handbook, gate papers. Almost all questions were come simple
basics.
Hi frends.........,
This is K.Rupa from BHOJ REDDY ENGG COLL for WOMEN, Hyderabad. We
attended Tata Chemical as an off-campous which held in TKR coll, Hyd. There r mainly
four stages in the selection procedure.
They are like
(1) Written Test( The test consist of 2 parts Aptitude and Technical which is purely
concept based ) Duration is 1hr( 30 min Aptitude & 30 min Technical ). Aptitude
contain-30 questions & Technical contain-50 questions.
(2) G.D
(3) Technical Interview.
(4) H.R
Aptitude section:
This basically contain 5 verbal ques'n( synonyms-3 & antonims-2 ). This are so easy to
be answered i got (1) FEIGN, (2)SPECIFIC, (3)TEMPLET sorry i dont remember this...,
(4) TEDUOUS, (5)this is also so simple...
After this there are 5 ques'n based on Data Interpretation. They r so easy no need to
worry about that later i got some 10 ques'ns based on algebra, like...
(1) cos 45= ?
(2) If a man covers 750km in 2hrs, then much dis can he cover in 5hrs 45 min
(3) Two trains problem, moving in opposite directions with some velocities 500 & 700
km/hr. The dis is 2400. then find the time taken for them to meet.
(4) There are many ques'n based on trains ...aprox 3-4 ques'n there are some ques'n based
on areas like area of the sphere, cube is so and so ..... then find edge later i got some 10
ques'ns based on...
i dont know exactly but the que'ns are like
(1) The distance b/w the two circle present on the scale ( on the scale there r some circles
of same size, separated by same distance )
(2) The scale contain some readings and some instrument is beside that, then what
fraction of scale is covered by instrument.
(3) Some weight of 80kg is placed at one end of the pully, then how much wt must be
added on the other side of the pully to make it balance.... the balanace is not placed
exactly at the center , this is dis dependent the rest of the questions are also easy.......to
say aptitude section is so easy
Technical section:
This is so hard one. in this there will be 50q to be answ in just 30 min. this section
basically include main concepts, there is no need to worry for the people who r studing
for GATE.
(1) Pecklet no. def
(2)They had some question from the stuff we study in +2 like ideal gas equation, vander
wals eqn etc.
It consists of 50 questions.All are technical no aptitude.All are not objective.Some are one
blanks.Here are some questions I remember.
1.What is function pointer in c?
2.#define MAX 100
main()
{
printf("MAX");
}
o/p is MAX
3.What is difference between declaration and defining function ?
4.How can u print command line arguments of main function in C?
main(int argc,char *argv[])
{
for(i=0;i<argc;i++)
{
printf("%c",argv[i]);
}
be prepare well this concept is available files in C
5.In UNIX some commands
how to remove a directory,
how will you show hidden files
GREP FUNCTION
what is the use of CAT COMMAND?
How will you set fILE AXIS PERMISSIONS
WC command
SPOOL OUT COMMAND
printer related command
6.Rdbms querrys like
Write a querry to enable primary key constraint for a table?
To predict the output of a subquerry?
7.What is preprocesor directive?
8.IN java they asked about wrapper classes concentrated mostly on boolean command?
9.Is boolean a wrapper?
10.Two questions regardind round command
round(-5.667)
round(5.667)
11.Three questions on osi reference model(networking layers)
12.what is TCP/IP? HOW IT WILL WORK?
13.WHAT IS SOCKET?
14.TO WHICH LAYER IN NETWORKING TCP/IP BELONG TO?
OUT OF 50 marks CUTOFF WILL BE AROUND 27?
AFTER WRITTEN TEST WE HAVE HR ROUND
1.tell me about ur self apart from ur resume?
2.If u r not 4m it bachground she is asking why r u changing ur field?
3.why dont you do higher studies?
4.Explain ur project
5.Is MBA degree necessary for a software engineer ?why?
6.she has given some case studies and assesing ur time management,attitide towards
work,team orientation skills
next is a technical round
They are asking questions which you haven't answered in written test?
1.diff between signed int and unsigned int?
2.on macros ,inline functions?
3.what are unions and where are they used?
4.Some questions on linked list like a list contains values 3 5 67 5 they asked logic to print
this list in reverse order?
5.Logic for bubble sort and asked to derive a generalized mathematical equation to find no of
iterations occuring?
6.polymorphism in depth askd me to predict output?
7.Virtual functions in c++ depth?
8.In SQL THEY ASKED ME ABOUT TRANSACTIONS AND ABOUT COMMIT TRANSACTION KEY
WORD FUNCTIONS?
Test is very simple any body can crack it. You need to have knowledge of HTML, Java
script,
Flash
script,
XML,
average
aptitude
capability.
1)Aptitude
Test:
30
marks.
-logical
reasoning
questions
such
as
-K,P,M,R,L
are
4
boats,
5
colors
are
given
-(Green, yellow, orange, white, tan), we need to paint 5 boats, certain conditions are
given, M should be after p, p must be tan, white must be before yellow, orange at 3rd
position.
Find
the
solution
of
questions
asked.
-A table is given with certain values, along X-axis grains along Y-axis P,Q,R,S,T,U,V
countries
are
given
we
need
to
answer
few
question.
-Same
sort
of
logical
&
confusing
questions
r
given.
-Blood relation: A man said to one lady, The brother of your only sister is my wifes
only
brother
what
is
d
relation
of
that
lady
with
him?
-3
figures
are
given.
You
need
to
find
the
5th
figure.
-A is sitting above B, B is above C, theres 2 persons between D & C , D is above all of
them.
Find
who
is
3rd
from
bottom.
-2 more questions are same as above.
2)Technical
Test:
30
marks.
-10 questions on HTML, just study all the HTML tags properly along with attributes,
such
as:
<br>,
<body
bgcolor=red>,
<ol>,
<gl>
etc.
-10
questions
on
java
scripting,
XML.
Study
the
syntax.
-10 questions on c++, OOPS concepts, unit of programming in oops is?
3)Logical
Question:
Just
to
check
way
of
thinking.
-A pan contains pure milk. If we taken out 20% of milk and add water. We did the same
procedure
2
more
times
then
what
kind
of
mixture
it
is?
-A circular cake is given we need to cut it in to 8 pieces in just 3 cuts how can we cut it?
-A clock is given it is showing 12 oclock noon. Tell how many times both minute &
hour hand touches each other in whole day? How to find out their time of meeting?
4)HR
-It was cool just be confidant. Just accept everything they r offering u.
Round
ROUND 1-Written
15 Questions on aptitutde
15 Questions on Vocab
15 Questions Technical(Java,VB.net,Asp.net)
Round 2-GD
Round 3-TI
Round 4-PI
Total Candidate Appeared:650 (Approx)
ShortListed After Written:104
ShortListed After GD:65
ShortListed After TI and PI :24
Written is easy if u have sound knowledge of Java, Asp.net. Apti Question were very easy.
English was bit tough for me but I Covered in Technical Section
Second Round was GD My topic was- What ails Indian sports? Is there any way to improve it.
Total there were 10 different topics.
Next was Technical Interview
Sir: Describe yourself
me:blah blah
Sir: What is your Favourite subject
me: java
sir: have u made any project in java
me: yes sir
sir : describe them
me: done
sir : are u comfortable with vb.net
me: yes sir i have made one project in vb.net n got 1st rank for that project in training
sir: what was your part in project
me: programming and Team Handling
sir: What was your backend
me: Sql Server
sir :Can you write a simple Query for me
me: i will try sir
sir: blah blah
me: explained
sir: tell me about your IIT Kanpur Project
me: Explained
sir: so can u make project in .net
me: yes sir
sir: ok any queries
me: Can i give my prefer any one Technology
sir: yes we work on .net n java so any one u choose
me :thank you sir
sir :ok
me: good day sir
sir :good day
Due to short time they didn't conducted PI .my interview was over at 12:30 and result came
on 7:30 Pm and luckily i was one of 24 who were finally selected. They prefer you if you come
from CS/IT Background. .Just be Confident and prepare 1 Language extremely well and it is
better if you know Java or VB.net or Asp.net
try to answer them in one line.I had questions like following:1q)What is the difference between a class and object?
2q)What is stored procedure? What are its advantages and disavantages?
3q)Which is better trigger or stored procedure?
4q)What is difference between data set and data reader?(.net)
5q)Write a querry for accesing unique rows from emp(Ename,Age) sorted by age?
6q)What is the difference between Function overloading, Function Overriding and Virtual
Functions?
7q)Difference between multiple and multilevel inheritence?
8q)Differnce between interfaces and abstract classes?
Sorry i don't remember remaining two. Like this he is concerntarting on OOPs, DBMS, .NET
Coming to the 2nd section. This consists of 20 questions. Questions on Aptitude. All the
qestions came from R.S.Agarwal. Questions like Ages, Time and work,distance....etc
Coming to the 3rd section. This consists of 20 questions. He had given all C programs and
asks us to point out the errors and outputs. All the questions are from Test ur C skills by
Yashwanth Kanithkar.
Thats all I'm still waiting fro the result...
ALL THE BEST
The written exam is very easy. A little bit of time management will definitely take you to next
round. There were three sections:I. Aptitude
II. Critical reasoning
III. Verbal ability
for critical reasoning u need 2 be focussed, concentated and apply ur full mind and nothing
else u need 2 have(ofcourse gud luck is must!!).
for verbal ability the questions involve word meanings, opposites.
Time management is ofcourse important to answer all the questions in time.
aptitude is the easy one. just refer to R.S. Agarwal .refer some basic concepts in
streams,tank problems,percentage,etc..
IMPORTANT:
NEGATIVE MARKING is there .So be carefull in answering.
u will be given rough sheet. Solve ur answers on rough sheet as neat as u can.
Before the written exam u will be given a form. U r required 2 write ur % and some other
personal details and also paste a photo.
If u take ur photo in formals(tie,coat), that will be best.
Fill ur % CAREFULLY.
sectional cutoff will be there. so answer every section carefully.
Well thats all about written exam. After sometime d results were announced and our college
students those cleared written were asked 2 report with 2 copies of RESUME .
INTERVIEW:
In the interview of ASSURGENT, some general technical questions are asked based on ur
resume e.g. my friend mentioned about robotics so she was asked questions abt robot etc.
Basically they r not interested in ur answering, they r checking ur confidence levels.
So solve them nicely on the paper as u can or explain them verbally how r u solving ur
problem.
usually HRs of ASSURGENT want us 2 be very POLITE and confident.
Hai,
On 01st JUL 2008 , CORDYS, a product based company came to UNIVERSITY OF
HYDERABAD, (Hyderabad, Andhra Pradesh).
I am selected into Cordys and I want to share my experience with placement procedure.
Total 52 students was there in beginning, & finally only two are selected. In first round 9
were shortlisted for Technical round out of which 4 were shortlisted for Final (HR)
round. Finally two of them got selected.
This was about 90 minutes for me. Questions were started only from Aptitude (what was
in written) and later from subjects such as DBMS, C, OS, CN, Software Engineering, JAVA,
and other general questions. First the interviewer posed questions to know whether I am
really interested for joining cordys or not.
1: They asked to write a program in any language which was asked in Written Aptitude
Paper (Question is not in
my mind, but it was completely logical as i can say), It took a long time to solved
finally.
2: He gave two tables, table 'A' consists of eid, prjtid table 'B' consists of prjtid ,
prjtname and ask to select those
students how work on a particular prjt name.
4. Asked on 'c' Linked List , circularly doubly linked list and practical examples for that.
6. OSqs, like Demand Paging, Virtual Memory Concepts, Deadlock concept with real-time
example, etc.
7 Some basic question related to Computer Network.
The overall question what they asked, i answered very comfortably, & with confidence.
HR (Near around 150 minutes)
Tell abt your self and family
Appreciable work u have done in your previous life.
Strengths, weakness, hobbies etc. What you planned to remove your weakness?
Priority related question, like which one u'll gv first priority after joining: CORDYS or
your FAMILY.
Some Technical question was asked in this round also.
1. Let us suppose you need to tell all the features of OOPS to your Grand-Father, who
4. Finally they asked a very twisted kind of question, like suppose there are two different
groups of two different
companies in front of you, and you are selected in both. Now you have to decide which
company you'll prefer
to join and why? Also the reason to cancel other one.
Lastly some questions related to my behaviours.
TISL Questions
These Questions are from friends who gone for the exams sother may not have answers
This time he has not given
the number series.
Apptitude:
part 1 : letter sevies.
part 2 : figures
part 3 : quantitave
Technical:
Most question are on Unix and some in C and some in
windows 3.1
all question in Unix are From Kernighan & pike
part 1
It consists of number series. In some institutes alphabetical series is given instead of
number series.
1. 19,24,20,25,21,26,? ans:22
2. 11,14,12,15,13,16,? ans: 14
3. 10,2,8,2,6,2,? a:4
4. 8,9,11,14,,18,23,? a:29
5. 25,25,22,22,19,19,? a:16
6. 14,2,12,4,10,6,? a:8
7. 7,16,9,15,11,14,? a:13
8. 40,42,39,44,38,46,? a:37
9. 3,18,4,24,5,30,? a:6
Part 2
The average salary of 3 workers is 95 Rs. per week. If one earns Rs.115
4.
During a given week A programer spends 1/4 of his time preparing flow
A man owns 2/3 of the market research beauro business and sells 3/4 of
If 12 file cabinets require 18 feet of wall space, how many feet of wall
From its total income, A sales company spent Rs.20,000 for advertising,
The cost of four dozen proof machine ribbons and five dozen accouting
machine ribbons was Rs.160/-. If one dozen accounting machine ribbons cost
Rs.20/-, what is the cost of a dozen proof machine ribbons? Ans.Rs.15
13.
If a clerk can process 80 cheques in half an hour, how many cheques can
In a library, there are two racks with 40 books per rack. On a given dya,
The average length of three tapes is 6800 feet. None of the tapes is less
A company rented a machine for Rs.700/- a month. Five years later the
Two computers each produced 48000 public utility bills in a day. One
computer printed bills at the rate of 9600an hour and the other at the rate of 7800
an hour. When the first computer finished its run, how many bills did the other
computer still have to print? Ans.9000
18.
If a salesman's average is a new order every other week, he will break the
office record of the year. However, after 28 weeks, he is six orders behind
schedule. In what proportion of the remaining weeks does he have to obtain a new
order to break the record? Ans.3/4
19.
Inspection of the first 800 cheques indicated that 100 of those 800 had errors and
were therefore the available immediately for data processing. On this basis, hwo
many cheques would be available immediately for data processing on that day?
Freshersworld.com
Ansns 140 Ans.14000
20.
A company figured it needed 37.8 sq.feet of carpot for its reception room.
To allow for waste, it decided to order 20% more material than needed. Fractional
parts of sq.feet cannot be ordered. At Rs.9/- a sq.feet, how much would the carpet
cost?Ans. a. Rs.324 b) Rs.405 c) Rs.410 d) Rs.414 e) Rs.685
21.
A tape manufacturer reduces the price of his heavy duty tape from Rs.30/-
to Rs.28/- a reel and the price of a regular tape from Rs.24/- to Rs.23/- a reel. A
computing centre normally spends Rs.1440/- a month for tapes and 3/4 of this is
for heavy duty tapes. How much will they save a month under the new prices?
Ans.Rs.87
22.
In a team of 12 persons, 1/3 are women and 2/3 are men. To obtain a team
The dimensions of a certain machine are 48" X 30" X 52". If the size of
the machine is increased proportionately until the sum of its dimensions equals
156", what will be the increase in the shortest side? Freshersworld.com
Ans. 6"
24.
In a certain company, 20% of the men and 40% of the women attended the
annual company picnic. If 35% of all the employees are man, what percent of all
the employees went to the picnic? Ans.33%
25.
SECTION I
1.
2.
analogy.
1. celebrate::marriage
ans.lament::bereavement
2. bouquet::flowers
ans.chain::link
3.
germ::disease
ans.war::destruction
SECTION II
1.
2.
40degrees.
3.
4.
Difference b/w the compound interest and simple interest for Rs.2500 for
7.
square.
ans 15
8.
9.
(This was the second last question) A bucket contains z drops. and it leaks
10.
6 pipes fill or empty the cistern. find the number of emptying pipes iff it
takes 18hrs to fill and 18 hrs to empty.... (don't remember the question exactly)
11.
12.
No: of spheres of radius 1 that can be got from sphere of radius (or
13.
(think the last but three question)Travelling at 3/4th the speed a man is 20
14.
There are 6 keys and 6 locks. then number of combinations to betried out
15.
16.
From 6 white balls and 7 black balls probability that 2 balls drawn at
17.
ans. 38
If a sales man gets successive gain of 15% and 20% then his actual gain?
18.
A string of pearls such that 1/3 is lost and of that 1/4th is missing,
19.
A man gets a gain of x%. but if he had sold at twice the cost price, what
20.
A clock was 7mts behind the actual time on 3 p.m. on wednesday and 8
mts ahead of actual time on (not sure) 4 p.m. friday. when will it show the correct
time?
21.
Boat moves upstream in 6 hrs and covers the same distance downstream in
22.
(this was the last question) no idea what it stands for........some kind of
23.
If x men working x hrs per day can do x units of work in x days, then y
men working y hrs/day would be able to complete how many units of work i y
days?
ans. y^3/x^2 (question in R.S. Agarwal)
24.
( this was a question in the first page of the section II booklet) a cone with
radius----- and height -----. a hemisphere covers the cone such that base of
hemisphere meets that of the cone. then the enclose volume.....(R.S. Agarwal
consists of similar questions)
25.
26.
27.
There was one more question on coins i.e. abt getting a change of 10ps
28.
find x and y there were 2 questions on train and one was like:
29.
A goods train starts and after 2 hrs a passenger train at 4km/hr starts and
overtakes the goods train after 4 hrs, then the speed of goods train?
30.
15hrs of boys work=6 hrs of women's work. 3/5 of the work is done by
31.
figure was given a square with four corners shaded and asked to find the
A simple flowchart whose steps are as follows. value of r and h are given,
2.
(second last question this was also easy) it was abt a set of people talking
4 languages and then qns were abt who could act as a translator to whom ........
3.
find out which statement in the objectives given could strengthen the argument or
4.
are given and then questions were asked, the statements were likeAll A B C D E F
are Q's All A's are B's -----(better leave this question for the last)
6.
7.
charges. and questions were to find out the minimum number of trips required,
the maximum charge, the second highest charge etc....
APTITUDE
1.
One pipe fills in 4 hrs and another in 5hrs when they both work alternately
how much time will be taken to fill the tank.
2.
LCM of 3 nos is 120 which of the following no must not be their HCF a.
Two trains from the points A and B moving in opposite direction , at the
point they meet the second train travels 120 kms more than the first. The speeds
are 50kmph and 60kmph respectively find the distance between A and B?
4.
One monkey climbs a poll at the rate of 6mts/min and fell down 3mts in
the alternately. Length of the poll is 60 mts , how much time it will take to reach
the top?
a. 31
5.
b.33
c.37
A number when multiplied by 7/18 instead of 7/8 and got the result 770
less than
original number?
6.
The volume and the radius of both cone and sphere are equal , then find
A and B started a business with 1500 and 2500 and got a profit 800 rs.
Half of the profit is shared equally the remaining is shared according to their
investment.
8.
The difference between the simple interest and compound interest for 2
years?
A:B =2:3 and B:C=5:6 then find A:B:C
9.
11.
The prime no., which is greater than 6 when divide by 6 will always gives
Mr X position in a class is 13th from first and 17th from last, and 8th
from the first and 13th from last in passed candidates list, then how many
candidates failed in the exam
14.
..
15.
A two digit number is 4 times to its sum of digits , when 9 is added to the
The length of the following rectangle is 4a and its breadth is 2a. Radius
of the two circles is a. Then find the ratio of total area of the rectangle to the
area not covered by the two circles with in the rectangle
17.
A person starts with the speed of u/1 kmph and returns with the speed of
Three circles with same radius r are drawn with centres as three vertices of
a triangle. What is the sum of areas of the intersections of these circles with the
triangle.
21.
X men work for X days to produce X products, then Y men can produce Y
The compound interest for first and second years is 200 and 220 on a
to orange.
25.
A man starts a work, after some time some one joins him..like
this
26.
Food is sufficient for 100men for 60days. For how many days the food is
27.
If 8men 8hrs per day works for 8days get 45/- then how many men
A person sold an item at a profit of 12% .If he sold it at a loss of 12% then
different)
30.
33.
In a school there are 1000 students in the year 1999. The number of
students increased by 20% in the year 2000. And it is increased by 15% in the
year 2001. But it is decreased by 18% in 2002. Then what is the strength in
2002.(numbers may differ)
REASONING
1.
a)
2.
3.
4.
5.
If 3rd day of a month is Monday. Then what is the 5th day after 21st of
that month?
6.
blood relation
1.
Maximum numbers that can be formed using all the 4 digits 6 4 8 1 without
40degrees.
3.
4.
Difference b/w the compound interest and simple interest for Rs.2500 for 2
6.
a square.ans 15
7.
A monkey climbs 6 mts and falls 3mts in alternate minutes.Then time taken
(This was the second last question) A bucket contains z drops. and it leaks x
6 pipes fill or empty the cistern. find the number of emptying pipes iff it takes
18hrs to fill and 18 hrs to empty.... (don't remember the question exactly)
10.
11.
No: of spheres of radius 1 that can be got from sphere of radius (or diameter
don't recall) 8
12.
(think the last but three question)Travelling at 3/4th the speed a man is 20
There are 6 keys and 6 locks. then number of combinations to be tried out to
From 6 white balls and 7 black balls probability that 2 balls drawn at random
If a sales man gets successive gain of 15% and 20% then his actual gain?
ans. 38
17.
A string of pearls such that 1/3 is lost and of that 1/4th is missing, remaining
18.
A man gets a gain of x%. but if he had sold at twice the cost price, what will
be his gain?(question not sure) a. 2x b.200-2x c.100+x (not sure of the options)
19.
A clock was 7mts behind the actual time on 3 p.m. on wednesday and 8 mts
20.
Boat moves upstream in 6 hrs and covers the same distance downstream in
(this was the last question) no idea what it stands for........ some kind of
notation like
S(P(M((D(a,b),2))):P(M(S(D(a,b),........options were
1. ab 2.(a-b)^2 3.(a+b)^2 4.none
22.
If x men working x hrs per day can do x units of work in x days, then y men
24.
There was one more question on coins i.e. abt getting a change of 10ps and
x/y+y/x=40/21(don't remember the exact value, believe this is the one) find
A goods train starts and after 2 hrs a passenger train at 4km/hr starts and
overtakes the goods train after 4 hrs, then the speed of goods train?
28.
15hrs of boys work=6 hrs of women's work. 3/5 of the work is done by
2.
There r 2 trains travelling at 100 MPH each. there is a 200Mile tunnel. the trains travel
in opposite directions. when the trains enter, a supersonic bee starts at the tunnel,
touches the other train, comes back touches the first train, turns again and touches
the other train and so on until the trains collide. Find the distance travelled by the bee.
3.
It is 12.00 o clock. Find how often the minute hand meets the hour hand.
4.
Find the maximum product using positive integers the sum of which is 100. Dont know
if i am sure with this one. sorry. i didnt do this.
5.
6.
2 maths geniuses meet after 20 yrs.one says i am married. and have 3 daughters. the
product of their ages is 72. the sum is the same as the house no. other says, but I
cant find it out. The other says. . simple. ok, my eldest daughter has just started the
piano classes.Find their ages.This one is there in previous question papers also.
7.
5 sea pirates have 100 gold coins and want to share it. They propose a plan. The
senior most one has to propose an idea, if at least 50 % agree, the coins r shared
accordingly. else the senior is killed and the next senior most is asked to present a
plan and so on .note, all the guys r very clever and very greedy and dont want to lose
the coins, and dont want to die. Form a way to share the money.
I didnt do this....no time
ANSWERS
1.
I worked it out like this.. before 2001, 2000 cannot be taken as MMDD becomes
0002.also anything after 14 century cant be considered as 1401 would mean 1041,
there r only a max of 31 days a month. so the century nos must be only 13(reverse
for 31)so the yr is 13xx. now 1399to 1391 is not possible as reverse means 99 to 19
but max no of months is 12. so 1390 becomes 09311390... but 9th month has only 30
days(lucky i remembered it).. so 1380 is the most recent palindrome ... which
beocomes 08311380.SOln is 08 31 1380.
2.
This one i really screwed up royally. it took me 25 minutes to solve.. i took the
average speeds, the distance travelled by the trains and the bee, took ratio of speeds
and distance, subtracting it from the tunnels length for every time the bee touched the
trains. phew lot of calculation.. and got the ans as 1000.But when i rechecked it a
thought struck me... so silly of me. The trains collide at the middle. ie)after 100 miles.
that means after 1 hour. so the bee travels for 1 hour touching each train till they
collide. its speed being 1000 mph, it travelled a 1000 miles..
3.
At 12.00 the minute and hour hand are together. but at 1.00 they are 5 mins apart. so
in 60 minutes the gain is 55 mins for the min hand. to be together it has to gain
another 5 more mins. so the time taken to gain 5 mins is 60*5/55==5.454 So the
time taken to meet again is 65.454 So the hands meet every 65.454 minutes
4.
1.
4.
5.
Temp=&count;
Sum=? &count;( It was actually given temp=? &count;
which is probably wrong)
printf("sum=%d count= %d temp=%d ",sum,count,*temp);
Ans. C (most expected answer ,check it)
6.
7.
In threaded binary for which traversal orders unused left and right links
are used?
8.
9.
10.
What is the protocol used for getting the physical address by supplying IP
address of a node ?
[i] ARP
[ii] RARP
[iii] BOOTP
[iv] DHCP Ans. [i]
11.
12.
13.
Opposite of HARBINGER .
Ans. Follower
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
25.
26.
One puzzle:(I cant exactly remember this question giving brief idea of this
27.
28.
Nine people six floor. Conditions are given.(This was a very long
30.
A problem regarding age of father and son(very easy problem u can solve
it).
31.
A problem regarding age of father and son(very easy problem u can solve
it).
32.
Point out error in the follwing sentence:I got the book in the office and
slipped it out.
[i]I got the book.
[ii] in the.
[iii]office and .
[iv] slipped it out.
Ans:[iv].
33.
1.
The highest Score in an innings was 3/11 of the total and the next highest
was 3/11of the reminder. If the scores differed by 9, find the total score.
a) 151
Ans: c
b) 161
c) 121
d) 101
e) 137
2.
35 and got his answer less than the correct one by 1206. Find the number to be
multiplied.
a) 37
b) 67
c) 87
d) 97
e) 107
Ans: 67
3.
A Problem like this not exactly the same but on same model.If the
manufacturer gains 10 %, the wholesale dealer 15 % and the retailer 25 % then the
cost of Production of a table, if the retail price is Rs.1265
a) 632.50 b) 800
c) 814
d)
834.24
Ans: b
4.
6.
9.
10.
11.
12.
than usual. In how much time does the man reach home usually??
Ans. 1hr 20min
Q The following truth table is given What is Y equal to??
Q. If there are 1024*1280 pixels on a screen and each pixel can have around 16 million colors
Find the memory required for this?
Ans. 4MB
Q. On a particular day A and B decide that they would either speak the truth or will lie. C asks
A whether he is speaking truth or lying? He answers and B listens to what he said. C then asks
B what A has said B says "A says that he is a liar"What is B speaking ?
(a) Truth
(b) Lie
(c) Truth when A lies
(d) Cannot be determined
Ans. (b)
Q. What is the angle between the two hands of a clock when time is 8:30Ans. 75(approx)
Q. A student is ranked 13th from right and 8th from left. How many students are there in
totality ?
Q. A man walks east and turns right and then from there to his left and then 45degrees to his
right.In which direction did he go
Ans. North west
Q. A student gets 70% in one subject, 80% in the other. To get an overall of 75% how much
should get in third subject.
Q. A man shows his friend a woman sitting in a park and says that she the daughter of
my grandmother's only son. What is the relation between the two
Ans. Daughter
Company : Paragon
1.Judy is now twice as old as Adam,but 6 years ago, she was 5 times as old as he was . How
old is judy now?
A) 10 B) 16 C) 20 D) 24 E) 32
2. if 3x=2(5-2x), then x = ?
A) 10/7 B) 0 C) 3/7 D) 1 E) 10/7
3. If a is equal to the sum of b and c, which of the following is equal to the difference of b and
c
A) a-b-c B) a-b+c C) a-c D) a-2c E) a-b-2c
4.if the sum of five consecutive even integers is t, then, in terms of t, what is the greatest of
these integers?
Quantitative
21. jen , ken and len devided a cash prize. Jen took 50% of the money and spent 3/5 of what
she took. Ken took 40% of the money and spent of what he took
Column A Column B
The amount that Jen
The amount that Ken
spent
spent
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information given
22. Elian types twice as fast as Delphin . Delphin charges 50% more per page than Eliane.
Column A Column B
Amount Eliane earns
Amount Delphine
in 9 hours
earns in 12 hours
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information given
. Column A Column B
a2
-a2
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information given
27. . Column A Column B
v20 /2
5/v5
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information given
28. The sides of a triangle are 3,4,and x
. Column A Column B
x
5
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information given
29. 56<5c<64
Column A Column B
12
c
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information given
30 . School A has 100 teachers and school B has 200 teachers.
Each school has more female teachers than male teachers.
. Column A Column B
The number of female
The number of female
teachers at School A
teachers at School B
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information given
31. (m+1)(m+2)(m+3)=270
. Column A Column B
m+2
10
A) Column A is greater
B) Column B is greater
C) Both are equal
D) The relationship cannot be determined from the information givenNIHILENT PAPER
PATTERN )N 31st JULY 2006 AT PUNE
HI
I AM RITESH
ON 31st JULY I HAVE APPERED FOR THE SELECTION PROCESS OF NIHILENT
TECHNOLOGY(PUNE) IN C-DAC CAMPUS.
SELECTION PROCESS CONSIST OF THREE STAGES.
1. WRITTEN TEST -> GRE PATTERN PAPER . THERE FOUR SECTION .
SENTENCE COMPLETION .ANTONYMS
COMPRENSION,LOGICAL REASONING,NUMERICAL ABILITY, VERY EASY. THERE 100 QUES.
WHICH
WE HAVE TO SOLVE IN 60 MINS. 60+ SHOULD BE THE CUT OFF.
GO THROUGH THE BARRONS THAT IS ENOUGH.
2. TECHNICAL IS QUITE TOUGH . THEY ASKED QUESTIONS FROM THE PROJECT WHAT I HAVE
DONE.C.C++,JAVA.ORACLE,OS.
3. HR IS JUST A FORMAL.
850 STUDENT APPERED FOR THE WRITTEN .300 SELECTED FOR THE TEHNICAL AND
FINALLY 178 ARE SELETED FOR THE JOB. I AM ONE OF THEM.
KEY IS CONFIDENCE .
AND YOUR KNOWLEDGE.
ALL THE BEST.
FOR YOUR FUTURE.
RITESH
SECTION-1
1)Five trays cost is 0.35 each and dozen----(ans:Rs13.75)
2)In a journey of 15 miles two third distance was traveled with 40 mph and remaining with 60
mph. How much time the journey takes...
(ans:20 min)
3)A man walks from 9.15 to 5.15 from Monday to Friday and 9.00 to 12.00 on Saturday. Each
day 0.45 min lunch. How much time he
walks in a week...
(ans: 39hrs15min).
4) 12 revolutions takes 1/8 th second time. In 20 seconds how many revolutions...
(ans:1920)
5) In 60 reams of paper 40 reams were utilized then what percent will remain...
(ans:33.33%)
6) A started at 9.00 am with 6 mph and B started at 9.30 am with 8mph in the same
direction. At what time they will meet...
(ans:11.00am)
7) In a storage stall of 5x3x2inch.How many blanks of size 2x1x1inch can be stored..
(ans:15)
8) In a company 3/5 of people know shorthand 1/4th know typing and 1/5 know both. What
fraction of people do not know both..
(ans:35%)
9) A man how many bikes of Rs 14000 can buy by selling 2100 bikes of Rs500/- of each
(ans: 75)
10) A company requires 11,500 strength. Present employees are 200 women , men and 6500
unmarried To reach the target how many women required to maintain the same ratio
(ans : 300)
11) What is the time required to punch 1500 cards of 50 column each at the rate of 10,000
punches per hour
(ans:7hr 30min)
Aptitude Questions
1.
2.
(c)16
3. (1/10)18 - (1/10)20 = ?
(a) 99/1020
(b) 99/10
Ans. (a)
4. Pipe A can fill in 20 minutes and Pipe B in 30 mins and Pipe C can empty the
same in 40 mins.If all of them work together, find the time taken to fill the tank
(a) 17 1/7 mins
(a)
(b) 20 mins
(c) 8 mins
Ans.
5. Thirty men take 20 days to complete a job working 9 hours a day.How many hour
a day should 40 men work to complete the job?
(a) 8 hrs (b) 7 1/2 hrs (c) 7 hrs
(d) 9 hrs
Ans. (b)
Ans. (c)
7. A boat travels 20 kms upstream in 6 hrs and 18 kms downstream in 4 hrs.Find the
speed of the boat in still water and the speed of the water current?
Ans. (b)
8. A goat is tied to one corner of a square plot of side 12m by a rope 7m long.Find
the area it can graze?
(a) 38.5 sq.m (b) 155 sq.m (c) 144 sq.m (d) 19.25 sq.mAns. (a)
9. Mr. Shah decided to walk down the escalator of a tube station. He found that if
he walks down 26 steps, he requires 30 seconds to reach the bottom. However, if
he steps down 34 stairs he would only require 18 seconds to get to the bottom. If
the time is measured from the moment the top step begins to descend to the time
he steps off the last step at the bottom, find out the height of the stair way in
steps?
Ans.46 steps.
10. The average age of 10 members of a committee is the same as it was 4
years ago, because an old member has been replaced by a young member. Find
how much younger is the new member ?
Ans.40 years.
11. Three containers A, B and C have volumes a, b, and c respectively; and
container A is full of water while the other two are empty. If from container A
water is poured into container B which becomes 1/3 full, and into container C
which becomes 1/2 full, how much water is left in container A?
12. ABCE is an isosceles trapezoid and ACDE is a rectangle. AB = 10 and
EC = 20. What is the length of AE?
Ans. AE = 10
13. In the given figure, PA and PB are tangents to the circle at A and B
respectively and the chord BC is parallel to tangent PA. If AC = 6 cm, and
length of the tangent AP is 9 cm, then what is the length of the chord BC?
Ans. BC = 4 cm.
14. Three cards are drawn at random from an ordinary pack of cards. Find
the probability that they will consist of a king, a queen and an ace.
Ans.
64/2210
15. A number of cats got together and decided to kill between them 999919
mice. Every cat killed an equal number of mice. Each cat killed more mice
than there were cats. How many cats do you think there were ?
Ans. 991.
16. If Log2 x - 5 Log x + 6 = 0, then what would the value / values of x be?
Ans. x = e2 or e3.
17. In june a baseball team that played 60 games had won 30% of its game
played. After a phenomenal winning streak this team raised its average to
50% .How many games must the team have won in a row to attain this average?
A. 12 B. 20 C. 24 D. 30
(Ans. C)
18. .Can you tender a one rupee note in such a manner that there shall be total 50
coins but none of them would be 2 paise coins.?
Ans. 45 one paisa coins, 2
five paise coins, 2 ten paise coins, and 1 twenty-five paise coins.
19. A monkey starts climbing up a tree 20ft. tall. Each hour, it hops 3ft. and slips back
2ft. How much time would it take the monkey to reach the top? Ans.18 hours.
20. What is the missing number in this series? 8 2 14 6 11 ? 14 6 18 12
Ans. 9
21. A certain type of mixture is prepared by mixing brand A at Rs.9 a kg. with brand
B at Rs.4 a kg. If the mixture is worth Rs.7 a kg., how many kgs. of brand A are
needed to make 40kgs. of the mixture?
Ans. Brand A needed is 24kgs.
22. A wizard named Nepo says "I am only three times my son's age. My
father is 40 years more than twice my age. Together the three of us are a mere
1240 years old." How old is Nepo?
Ans. 360 years old.
23. One dog tells the other that there are two dogs in front of me. The other
one also shouts that he too had two behind him. How many are they?
Ans.
Three
24. A man ate 100 bananas in five days, each day eating 6 more than the
previous day. How many bananas did he eat on the first day?
Ans. Eight.
25. If it takes five minutes to boil one egg, how long will it take to boil four eggs?
Ans. Five minutes.
26. The minute hand of a clock overtakes the hour hand at intervals of 64
minutes of correct time. How much a day does the clock gain or lose? Ans. 32
8/11 minutes.
27. Solve for x and y: 1/x - 1/y = 1/3, 1/x2 + 1/y2 = 5/9. Ans. x = 3/2 or -3
and y = 3 or -3/2.
28. Daal is now being sold at Rs. 20 a kg. During last month its rate was Rs.
16 per kg. By how much percent should a family reduce its consumption so as
to keep the expenditure fixed?
Ans. 20 %.
29. Find the least value of 3x + 4y if x2y3 = 6.
Ans. 10.
30. Can you find out what day of the week was January 12, 1979?Ans.
Friday.
31. A garrison of 3300 men has provisions for 32 days, when given at a rate
of 850 grams per head. At the end of 7 days a reinforcement arrives and it was
found that now the provisions will last 8 days less, when given at the rate of
825 grams per head. How, many more men can it feed?
Ans. 1700
men.
32. From 5 different green balls, four different blue balls and three different
red balls, how many combinations of balls can be chosen taking at least one
green and one blue ball?
33. Three pipes, A, B, & C are attached to a tank. A & B can fill it in 20 &
30 minutes respectively while C can empty it in 15 minutes. If A, B & C are
kept open successively for 1 minute each, how soon will the tank be filled?
Ans. 167 minutes.
34. A person walking 5/6 of his usual rate is 40 minutes late. What is his
usual time? Ans. 3 hours 20 minutes.
35. For a motorist there are three ways going from City A to City C. By way of bridge
the distance is 20 miles and toll is $0.75. A tunnel between the two cities is a
distance of 10 miles and toll is $1.00 for the vehicle and driver and $0.10 for each
passenger. A two-lane highway without toll goes east for 30 miles to city B and
then 20 miles in a northwest direction to City C.
1. . Which is the shortest route from B to C
(a) Directly on toll free highway to City C (b) The bridge
(c) The
Tunnel
(d) The bridge or the tunnel (e) The bridge only if traffic is heavy on the
toll free highway
Ans. (a)
2. The most economical way of going from City A to City B, in terms of toll
and distance is to use the
(a) tunnel
(b) bridge
(c) bridge or tunnel (d) toll free highway
(e) bridge and highway
Ans. (a)
3. Jim usually drives alone from City C to City A every working day. His
firm deducts a percentage of employee pay for lateness. Which factor
would most influence his choice of the bridge or the tunnel ?
(a) Whether his wife goes with him (b) scenic beauty on the route
(c) Traffic conditions on the road, bridge and tunnel
(d) saving $0.25 in tolls
(e) price of gasoline consumed in covering
additional 10 miles on the bridge
Ans. (a)
4. In choosing between the use of the bridge and the tunnel the chief factor(s)
would be:
I. Traffic and road conditions II. Number of passengers in
the car
III. Location of one's homes in the center or outskirts of one of the cities
IV. Desire to save $0.25
(a) I only
(b) II only
(e) I and II only
36. The letters A, B, C, D, E, F and G, not necessarily in that order, stand for
seven consecutive integers from 1 to 10, D is 3 less than A, B is the middle
term
F is as much less than B as C is greater than D, G is greater than F,
1.
The fifth integer is
(a) A (b) C (c) D (d) E (e) F
Ans. (a)
Ans. (a)
Ans. (a)
Ans.
party
(b) Justice party deputy and all his or hers staff members
(c) Justice party deputy and half of his Conservative staff members in the
chief of staff office
(d) The Conservative deputy and all of his or her staff members belonging
to Conservative party
(e) No deputies and all staff members belonging to conservative parties.
Ans. (a)
39. In recommendations to the board of trustees a tuition increase of $500 per year,
the president of the university said "There were no student demonstrations over the
previous increases of $300 last year and $200 the year before". If the president's
statement is accurate then which of the following can be validly inferred from the
information given:
I. Most students in previous years felt that the increases were justified because of
increased operating costs.
II. Student apathy was responsible for the failure of students to protest the
previous tuition increases.
III. Students are not likely to demonstrate over new tuition increases.
(a) I only
(b) II only
(c) I or II but not both (d) I, II and III
(e) None
Ans. (a)
40. The office staff of XYZ corporation presently consists of three bookeepers--A, B,
C and 5 secretaries D, E, F, G, H. The management is planning to open a new
office in another city using 2 bookeepers and 3 secretaries of the present staff . To
do so they plan to seperate certain individuals who don't function well together.
The following guidelines were established to set up the new office
I. Bookeepers A and C are constantly finding fault with one another and should
not be sent together to the new office as a team
II. C and E function well alone but not as a team , they should be seperated
III. D and G have not been on speaking terms and shouldn't go together
IV Since D and F have been competing for promotion they shouldn't be a team
1. .If A is to be moved as one of the bookeepers,which of the following
cannot be a possible working unit.
A.ABDEH
B.ABDGH
C.ABEFH
D.ABEGH
Ans.B
2. If C and F are moved to the new office,how many combinations are
possible
A.1
B.2
C.3
D.4
Ans.A
3. If C is sent to the new office,which member of the staff cannot go with C
A.B B.D C.F
D.G
Ans.B
4. Under the guidelines developed,which of the following must go to the new
office
A.B B.D C.E D.G
Ans.A
5. If D goes to the new office,which of the following is/are true
I.C cannot go II.A cannot go III.H must also go
A.I only
B.II only
Ans.D
41.
D.III and IV
43.
3
A.I only
B.II only
C.III only
D.Both I and II
Ans.A
A certain city is served by subway lines A,B and C and numbers 1 2 and
Ans. D
(a) step 1
(b) step 2
(c) step 4
(d) step 5
(e) step 6
Ans: (a)
3. If Mr. B was on step 1, which step could A be on?
(a) 2&e only (b) 3&5 only (c) 3&4 only (d) 4&5 only (e) 2&4 only
Ans: (c)
4. If there were two steps between the step that A was standing and the step
that B was standing on, and A was on a higher step than D , A must be on
step
(a) 2
(b) 3
(c) 4
(d) 5
(e) 6
Ans: (c)
(b) ii only
Ans:
(b) II only
Ans: (e)
Ans: (e)
Ans: (e)
Test consist of Aptitude test having different mark mark for each question.
1.
There are 10 marbles each of 5 diff colors. what is the min. num of marbles to
You need 2 kill a dragon with 3 heads & 3 tails. You have a magic sword that
3.
Slow train runs b/w Blore & Mumbai, up as well as down. It starts at 10:00pm
everyday & reaches destination by 11:30pm after 3 days. If u travel by Slow train,
how many such trains will u encounter during journey?
4.
A num of birds, black & white, r sitting on thhe tele wire. There is at least 1 bir
of each color, also whenevr 2 birds are seperated by 4 or 7 other boirds of any color,
both birds r of same color. Wot is the max. num of birds dat can b seated in this
fashion?
5.
6.
hands with the same person more than once but everyone shakes hands with at least
1 person.
After the meeting is over, Mr.X realizes dat all the other ppl in the party had shook a
diff num of hands. How many hands did Mr.X shake?
7.
->25 ppl of the total num of them solved at least 1 prob each.
->Of all the contestants who did not solve A, the num who solved B was twice the
num who solved C.
->num of ppl who solved only A was 1 more than num who solved A & atleast 1 other
prob.
->Of all stud who solved just 1 prob, half didn't solve A
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
5.A large cube is painted red on its outer surface and cut into 27 cubes by 6 straight cuts.
a) No of cubes whose 3 sides r painted
b) No of cubes whose 2 sides r painted
c) No of cubes whose 1 sides r painted
d) No of cubes whose 0 sides r painted
ans: a-8,b-12,c-6 d-1
6.On a holiday a,b,c,d,e plan to have a picnic, they had a running race.c beats d. a&e
overtake b.e is not the last.d overtakes e.who won the race.
Ans:c(not sure)
Hi friends,
I always used to read all your experiences and got benifited a lot.
Same new pattern no change. 60% in all standards, Written, GD,
Tech+HR interview.
Written: there will be 4 easy questions which can be answered in
5min, then try to do another 4 in 25 min, thats all. This is for those
who are fully confident of getting those 8 right, because cutoff will be
< 7 at max 8. Others try to answer maximum and for some question
we can eliminate 3 options easily. Be careful negative marking is there.
One thing written test is easy.
GD: for me it is the easiest, because we have attended a lot of GDs
before and we are fully aware of GDs. It is cake walk if you have some
practice before and able to speak for some time grabbing the chance.
Leadership qualities are seen more. Try to give a chance for people
who are sitting idle, thats all its a part of leadership quality. One great
thing is the Satyam moderator who is rating our GD, finally gave us a
compliment that our GD was a very good GD, we achieved this
because we planned that all of us must speak and not to make the GD
a fish market. And we covered a lot of points. Our GD topic was role of
media in bringing awareness in the society all of us were for the topic
and before the end we also covered some negative aspects regarding
that and some preliminary measures for those.
some questions of apti are1)Avarage weight of p,q,r is given (cannot remember) the ratio of students in class p&q
is 3:4.no of students in r is 25% more than p.Find the avarage of all the 3 classes.
2)Odd man out(5 options where given)
3)A,B,C,D,E are 5 in family.A& D are unmarried women & dont work.in family there are
businessman,professor,artist.B is the brother of a & is not artist or businessman.E is
husband.Who is professor?a)Ab)Bc)Dd)Ee)NONE OF THIS
4)pie chat is given for a salary 6000 what will be the ratio of radius with a salary of
1500.a)2:1b)1:2c)3:2d)none of these.
5)Sum in S.I. becomes 5 times its pincipal in 8 years what is the rate?a)5/2b)6/3c)d)none of
these.
2nd GD topics:
Satyam GD Probables:
---------------------1. US war on iraq-justified or not.
2. Role of UN in peacekeeping.
3. Position of Women in India compared to other nations.
4. Environment MAnagement.
5. Is China better than India in software.
6. Should SONIA gandhi be made the PM
7. BPOs in INDIA
8. Govt contribution to IT
9. will punch lines rule the Advt
10. premaritial sex
3rd interview:
technical is very simple.C C++,ORACLE,JAVA only basics & ur project.
hr wud b very easy,Q's like tell about urself, why do u want 2 join satyam,
r u ready 2 relocate.
Satyam GD Probables:
---------------------1. US war on iraq-justified or not.
2. Role of UN in peacekeeping.
3. Position of Women in India compared to other nations.
4. Environment MAnagement.
5. Is China better than India in software.
6.Should SONIA gandhi be made the PM
7. BPOs in INDIA
8. Govt contribution to IT
9. will punch lines rule the Advt
10. prematial sex
11. is china a threat to indian industry
12. india or west , which is the land of opportunities
13. water resources should be nationalised
14."BALANCE BETWEEN PROFESSIONALISM AND FAMILY"
15. Effect of cinema on Youth
16. Education in India compared to Foreign nations
17. Is it necessary to ban COCOCOLA in India.
18. What is the effect of movies on youth.(is it good or bad)
19. Are studies more benifitial in India or in Abroad.
20."UN's peace activities" and "America's war on Iraq".
21."Environment-Whose Responisibility".
22.Is China a threat to the indian software industry.
23.Role of UN in Peace keeping
24.War on Iraq
25.About Hockey being the primary game in India.
Managerial skills learnt in the classroom can never match those learnt from experience
Democracy is hampering India progress
MBA in India is highly overrated.
Religion is a private affair and should be of no concern for the state
Decreasing defense expenditure and increasing social expenditure is the need of the hour
TCY Online:
1.Public sector is more a hindrance than help to promote socialism.
2.Economic betterment of the poorer nations is as important as disarmament to ensure lasting
world peace.
3.From public sector to privatization as in the U.K., is the right answer for Indias instant
economic breakthrough.
4.The doctrine of limited nuclear war is an ill-convinced, ill-logical, irrational and extremely
dangerous concept.
5.Some simple but effective electoral reforms will enable us to retain the present
parliamentary system and ensure the preservation of democracy in India.
6.We must have only two national parties to contest parliamentary elections and regional
parties should not be allowed to contest for the same.
7.We can increase our food production not only to match our population explosion but also for
export provided we adopt modern, mechanized farming methods with large size land
holdings.
8.Nuclear war cannot be won and should not be fought.
9.Private enterprise and not public sector will contribute to faster and higher economic growth
in India.
10.Inflation is inevitable in our developing country.
11.The policy of reservation is a legacy of the British and it has done more harm than good.
12.Do you think MBAs are useful in the manufacturing / production department?
13.For a marketing post graduate, without prior work experience working in a big marketing
firm is a disadvantage when compared with working in a small firm. Discuss.
14.Consumerism is destroying the social fabric of Indian culture.
15.Free market is a prerequisite for growth.
16.Cricket as a national obsession is a detriment to other sports.
17.To develop India has to empower women.
18.Formulate the governments health policy to control the spread of AIDS.
19.Advertising is a waste of resources.
20.Privatization will lead to less corruption.
21.State is the biggest violator of human rights.
22.There can never be a classless society.
23.Beauty pageants are a marketing gimmick.
24.Voting rights to illiterates in India is illogical because it is widely misused.
25.Joint family is a blessing in disguise.
26.Higher education should be made possible only for those who can pay for it.
27.The weaker sex is the weakness of the stronger sex.
28.Women cannot successfully combine both career and home.
29.Women are good managers.
30.Executive should be allowed to form unions.
31.Effect of liberalization on poverty.
32.Indians perform better as individuals rather than in groups.
33.Business and ethics go hand in hand, or do they?
34.Developing countries should spend more on development than on defense.
35.Political parties have outlived their utility.
36.Is Swadeshi relevant for India today?
37.Money is required to earn more money.
38.Foreign trade is necessary for any country to survive .
39.Presidential Vs Parliamentary form of government of India.
40.Technology: The Ism Of The New Millennium?
41.Religion And Politics Should Not Mix
42.TRIPS Controversy And The Patent Act Amendment
43.Export Stagnation: Causes And Cures
44.Excessive Depiction Of Sex And Violence In Films
45.Classical Music Heritage And The Growing Pop- Culture
46.Decentralisation & The Panchayati Raj Institutions
47.Should India Sign The CTBT
48.State Interventions In Market Kind Or Mixed Economy
49.Science Is A Boon Or Bane
50.Is Swapping Terrorists For Hostages An Encouragement For Plane-Hijackers?
51.India and the political dynasties: The Nehru Family context
52.Nice Guys Finish Last
53.All Work And No Play Makes Jack A Dull Boy
54.Individual Freedom And Civil Society
55.Conventionalism And Modernity: The Ever going Debate
56.Should There Be A Restriction On Permissiveness Being propagated by The MTV Culture
And Foreign Media?
5. How system level services in EJBs are managed ? And tell about Deployment Descriptor ?
6. What are various types of EJBs ?
WRITTEN EXAM:
The written exam is very easy. A little bit of time management
will definitely take you to next round. There were three sections:I. Aptitude
II. Critical reasoning
III. Verbal ability
for critical reasoning u need 2 be focussed, concentated and apply ur full mind and nothing
else u need 2 have(ofcourse gud luck is must!!).
for verbal ability the questions involve word meanings, opposites.
Time management is ofcourse important to answer all the questions in time.
aptitude is the easy one. just refer to R.S. Agarwal .refer some basic concepts in
streams,tank problems,percentage,etc..
IMPORTANT:
NEGATIVE MARKING is there .So be carefull in answering.
u will be given rough sheet. Solve ur answers on rough sheet as neat as u can.
Before the written exam u will be given a form. U r required 2 write ur % and some other
personal details and also paste a photo.
If u take ur photo in formals(tie,coat), that will be best.
Fill ur % CAREFULLY.
sectional cutoff will be there. so answer every section carefully.
Well thats all about written exam. After sometime d results were announced and our college
students those cleared written were asked 2 report with 2 copies of RESUME .
INTERVIEW:
In the interview of ASSURGENT, some general technical questions are asked based on ur
resume e.g. my friend mentioned about robotics so she was asked questions abt robot etc.
Basically they r not interested in ur answering, they r checking ur confidence levels.
So solve them nicely on the paper as u can or explain them verbally how r u solving ur
problem.
usually HRs of ASSURGENT want us 2 be very POLITE and confident.
So be POLITE and DONT SHOW UR ATTITUDE. DONT ARGUE with them.
Prepare some common things e.g. which newspaper u read, name of its editor, which
sections of paper u read, hw u gather information, wht u surf on internet etc
My HR was a very young person. My experience is as follows:
HR: come in
Me: gud afternoon sir
HR: have ur seat
Me: thnku sir
Hr: give ur resume
I stood and gave it
Hr: tell me abt urself
Me: bla bla
Hr: so krishna prasad, whats ur family background?
Me: bla bla
Written test :
In written test there were about 65(40 Aptitude + 25 Computer Related) questions and the
time limit was 60 minutes. This test is MANUAL TEST and comprised of Psycometric
test, aptitude, and basic computer related questions. There was 1/2 negative marking on
Aptitude, & no negative marking on Computer Related questions.
Technical Interview
This was about 90 minutes for me. Questions were started only from Aptitude (what was
in written) and later from subjects such as DBMS, C, OS, CN, Software Engineering, JAVA, and
other general questions. First the interviewer posed questions to know whether I am
really interested for joining cordys or not.
1: They asked to write a program in any language which was asked in Written Aptitude
Paper (Question is not in
my mind, but it was completely logical as i can say), It took a long time to solved
finally.
2: He gave two tables, table 'A' consists of eid, prjtid table 'B' consists of prjtid ,
prjtname and ask to select those
students how work on a particular prjt name.
4. Asked on 'c' Linked List , circularly doubly linked list and practical examples for that.
6. OSqs, like Demand Paging, Virtual Memory Concepts, Deadlock concept with real-time
example, etc.
7 Some basic question related to Computer Network.
The overall question what they asked, i answered very comfortably, & with confidence.
HR (Near around 150 minutes)
Tell abt your self and family
Appreciable work u have done in your previous life.
Strengths, weakness, hobbies etc. What you planned to remove your weakness?
Priority related question, like which one u'll gv first priority after joining: CORDYS or
your FAMILY.
Some Technical question was asked in this round also.
1. Let us suppose you need to tell all the features of OOPS to your Grand-Father, who
doesn't know even a
single letter of Computer. What real life example will u give to make him clear.
2. They asked to write a program to find the angle based on clock time.
3. Some DBMS query basically it was from JOIN operation.
4. Finally they asked a very twisted kind of question, like suppose there are two different
groups of two different
companies in front of you, and you are selected in both. Now you have to decide which
company you'll prefer
to join and why? Also the reason to cancel other one.
Lastly some questions related to my behaviours.
1. Given a Binary Search Tree, write a program to print the kth smallest element without
using any static/global variable. You can?t pass the value k to any function also.
2. What are the 4 basics of OOP?
3. Define Data Abstraction. What is its importance?
4. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at
least once except for 2 numbers. Find the missing numbers.
5. Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which
aren?t present.
6. Given a string,find the first un-repeated character in it? Give some test cases
7. You are given a dictionary of all valid words. You have the following 3 operations permitted
on a word: delete a character, insert a character, replace a character. Now given two words word1 and word2 - find the minimum number of steps required to convert word1 to word2.
(one operation counts as 1 step.)
8. Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller
cubes on the surface. Extend this to k-dimension.
9. What is a C array and illustrate the how is it different from a list.
10. What is the time and space complexities of merge sort and when is it preferred over quick
sort?
11. Write a function which takes as parameters one regular expression(only ? and * are the
special characters) and a string and returns whether the string matched the regular
expression.
12. Given n red balls and m blue balls and some containers, how would you distribute those
balls among the containers such that the probability of picking a red ball is maximized,
assuming that the user randomly chooses a container and then randomly picks a ball from
that.
13. Find the second largest element in an array with minimum no of comparisons and give the
minimum no of comparisons needed on an array of size N to do the same.
14. Given an array of size n, containing every element from 1 to n+1, except one. Find the
missing element.
15. How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do
the same
16. Explain polymorphism. Provide an example.
17. Given an array all of whose elements are positive numbers, find the maximum sum of a
subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the
array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of
3, 5 and 7)
18. You are given some denominations of coins in an array (int denom[])and infinite supply of
all of them. Given an amount (int amount), find the minimum number of coins required to get
the exact amount. What is the method called?
19. Given an array of size n. It contains numbers in the range 1 to n. Each number is present
at least once except for 1 number. Find the missing number
Hai,
On 25th AUG 2007 , Cordys, a product based company came to HYDERABAD CENTRAL
UNIVERSITY , HYDERABAD.
I was selected into Cordys and I want to share my experience with place ment procedure.
Placement procedure cosisted of three rounds.
HR
Tell abt yur self and family
Appreciable work u have done in prev 3 yrs.
Strengths, hobbies etc
Some kind of tech q?
You have to designa software for the vendor at super market. after calculating the bill, if you
give more amount , he gives the change. he gives change in efficient manner ex if 250 were
to be given back he gives 2 100 rupee notes and 1 50 rupees note.
The program output should be such that an efficient no of denominations should be displayed.
U have to take cases of available denominations and no of their availability. ( some times u
have 3 20 rupees notes and no 50 rs). the program also should have an idea of asking 5 rs
from the costomer if available ( if amt to be given back is 165 and if no denominations satisfy
it, if cust gives 5rs you can give 20 rs note).
MOST OF THE STUDENTS GOT THEIR WRITTEN CLEARED THIS WAY ONLY
next was a communication round, that was an intro cum extempore kinda round in which u
batches of 30 students were called in the conference room & were made t introduce
themselves one by one & HR was asking questions related to their hobbies, strebgths,
weaknesses & all. Also we were asked to speak upon a topic like.........
#
#
#
#
#
Ur native city
Ur family values (not value of ur family)
Tata Nano
Politics Vs Ethics
Bi-party Vs Multi-party......etc etc
After this results were declared, this communication round being an elimination round only 5060 students were able to make it to the next roundthat was the Technical cum HR round.
CS & IT students had seperate techincal round & HR rounds but ECE students (including me)
just had to pass through the TEchnical/HR round.
Mine TECHNICAL round was scheduled for 27th Nov at 9 am but when i reached my college, i
was shocked to see some students in formals, those who were not in the list of result for
previous round. [mind it,dont hesitate if u have some approach on ur TPO.]
My Technical/HR round : Group of 3 students were called in for this round. as soon as we
entered, the HR asked for our respective resume... after handing over resume, the 1st
question he asked was.......
HR : So, Gaurav sikka tell e something aboiut ur technical skills
ME : Sir m having a Basic knowledge of C & DE is kindda faviorite subject....
HR : What about Power electronics ?
ME : Sir, i m sorry but i never got a chance to study Power electronics
HR : Ok tell me whats an Op-amp
Me : Op-amp is the common name used for IC-741 & bla bla bla (i think he was just looking
for a gud start)
HR : OK, Good !
ME : Thankyou sir
HR : tell me smthin abt IC 555 Timer
ME : Sorry sir, i'v no idea about it.
HR : U know GSM ?
ME : Yes sir
HR : can u draw the Block diagram of GSM ?
ME : Yes sir sure, May i have that paper ?
HR : YEah sure
Me : After completing within half a minute......... handsed over the sheet to him
HR : Please explain it !
ME : explained everything....... i was confused in between my explanation so he made be
comfortale by asking me to cool down & all, after that i explained everything slowly.......
HR : in betwen my explanation he said... AB TO GAYA , AB TO GAYA :D
Interview1:
He is very soft-spoken and one of my friend told me that this guy had brutally destroyed him.
So I was terribly nervous. I usually am confident but in that room, I was stammering! Finally,
it turned out that he wasn't that brutal after all. Moral of the story: Stay confident at all times.
1.
He asked me my specialization? When I told him that I had none as I didn't want to
specialize in this stage, he was a little surprised but appeared satisfied with my
reason.
2.
Why not further studies? (He had noted that I was third in my batch. He appeared
impressed by that
Answer : I told him that my profile clearly indicated that I've been trying to get into
the industry via internships, industry-funded projects right from second year, second
sem. I said that I was fully sure that I didn't want to do MS anytime soon.
3.
4.
5.
He then asked me a question that had been asked in Round 4, written test:
Describe an optimal algorithm to find the second minimum number in an array of
numbers. What is the exact number of comparisons required in the worst case? Note
that they didn't ask the order in Big-Oh notation. They wanted the exact number of
comparisons.
Answer : I screwed up, big time in this question. I had superficially discussed this
question with my friend a while ago and he had outlined an algorithm which I thought
that I had understood, but I hadn't. I started off explaining it but got stuck in the
middle. He sternly told me to read it up again. One solution that I could tell him, and
which I had written in the test was this:
Use two variables - min and second min. Initialize them by comparing the first two
elements of the array. This is (1) comparison. Then, go through the entire array, from
index 2 to n-1 comparing each element, first with min and then with second min,
updating each variable as necessary. This will involve a worst case of two comparisons
for each element. Therefore, total number of comparisons = 2*(n-2) + 1 = 2*n - 3
comparisons.
I'll try to update this with a better solution, sometime soon.
6.
Given a polygon (could be regular, irregular, convex, concave), find out whether a
particular point lies inside it or outside it.
Answer : This is an easy, straight question from graphics. You shoot a ray parallel to
the x-axis passing through this point. Start with odd parity. Change parity of ray each
time it intersects an edge of the polygon (consider special case of when the line passes
through a vertex of the polygon. Change parity only if it passes through a vertex
which has one edge above it and one edge below the ray). If the parity of ray is even
when it passes through the point, it is inside the polygon, else it is not.
7.
He asked me to explain Canny's algorithm to him. (this was because my DIP project
was related to this)
Answer : This is simple. Study DIP
8.
Then, he gave me a practical problem to solve: Suppose you are given an image which
contains some text and some photos. How do you find the location of the image?
Answer : I gave various alternatives - from searching for RGB components, to using
OCR.. he didn't appear fully satisfied. I think he was looking for edge-detection, but
that would fail, if the text contained tables, etc.
Interview2 :
He was friendly at the start but this interview was my worst. He asked me my favorite subject.
I said that it was Programming. (He laughed at that)
1.
2.
Given a program:
int i;
int main()
{
int j;
int *k = (int *) malloc (sizeof(int));
...
}
Question on polymorphisms.
this is easy - get it from any C++ book. He tried to confuse me again, but this time I
was ready and he was finally satisfied.
Then he looked at my grades and said that out of all your grades, you have only two
Bs and one of them is in Compilers. Why? (Damn it.. three non-A grades and that's all
they ask about. What's wrong with this world?!)
4.
5.
Didn't you like Compilers? "Not in particular", I replied. "Fine. Now, I HAVE to ask you
questions on compilers", he said.
He again went back to the first question he had asked me. Once again, I had no
satisfactory answer for him.
Then he wrote out some code and asked me how the compiler will generate code for
it. I gave some answer, but he was clearly not satisfied. I thought it was all over by
then.
Then, he asked me a DIP question. He commented that he had given that particular
question to his juniors in IITB once and they had done a very good job at it. The
problem is this:
A teacher is writing on a blackboard and we want to pass all the information on the
blackboard over a low-bandwidth network in real-time. How do we do it.
Answer : I first suggested that we capture only a small portion of the board. To locate
that portion, we could search for the chalk in the prof's hand - of course, taking care
that it had the blackboard in the background (no point capturing a video of the prof
scratching his chin, na?). Further, if the prof was writing only text, we could convert
the video into text by OCR and then transmitting. Simple diagrams could also be
reduced to a set of vector-graphics instructions (we rarely, see the prof shading stuff).
I think he liked my approach, but was not completely satisfied. Anyway, we left it at
that and went forward.
6.
7.
8.
9.
Given a set of words one after another, give me a data structure so that you'll know
whether a word has appeared already or not.
Answer : I suggested various alternatives. but he kept helping me and finally, we
came up with an array of pointers to 26-trees (each node of the tree has 26 children).
Store every word as a path from the root to a leaf with pointers in the correct places.
For example, hello would be stored as - pointer from 'h' index of the root array to a
node which had a pointer from 'e' index of it's array to a node which had a pointer
from 'l' index of the array.. and so on. This is both time and space efficient.
He asked me some questions on Interprocess Communication: What's a semaphore?
How are they used? He would often pick out words from my answers and ask me what
they meant. He wanted to make sure that I really knew what I was talking about. I
was able to answer all his questions, but I made the mistake of telling him, when we
started off that I didn't know much about this subject as I had done it a long time ago.
He was very annoyed at that, apparently because a lot of people before me had said
this.
He then asked me some DB fundas. Transaction. Serializability, Consistent state, etc. I
was able to answer all of them. I stumbled around a bit in a few questions where I
was explaining correctly, but not using the keywords that he was looking for.
Finally, he asked me whether I had any questions. I thought that I should say
something to make him realize that I was not completely stupid and so asked him
whether there was any logic to the order in which the short-listed candidates were
called. This turned out to be a dumb move. The order was alphabetic and he sent me
off with a parting shot, saying "You guys do pattern recognition and stuff and still you
can't recognize such a simple pattern" Me and my big mouth! Moral of the story: Don't
ask questions for the sake of asking.
1.
There is a clock at the bottom of the hill and a clock at the top of the hill. The clock at
the bottom of the hill works fine but the clock at the top doesn't. How will you
synchronize the two clocks. Obviously, you can't carry either of the clocks up or down
the hill! And you have a horse to help you transport yourself. And, the time required
for going up the hill is not equal to the time required to go down the hill.
Answer : You have to go up the hill and come back, with horse, without horse,
getting four equations to solve four unknowns - time to go uphill - with horse, without
horse, time to go downhill - with horse, without horse. Then you can go up the hill and
set the clock to '(time when you left) + (time to go uphill with horse)'
2.
There was one more puzzle.. I don't remember it. but I do remember that we started
discussing ways of generating large prime numbers. I told him the funda of Mersenee
primes (luckily remembered it) and he was decently impressed.
3.
Finally, two people were selected out the ten that were shortlisted.
2nd Round:
Friends this is an unpredictable round. Actually we have said that we have a GROUP
DISSCUSSION round but after going there we have conducted JAM session. We can talk
on any topic. They will not restrict us.
Once we cleared this round we have the final technical round
3rd Round:
Now I will share my technical round experience.My technical panel is very cool.
I have called by my HR.I entered the room.There were two in the panel I wished them.
HR: Tell me about itself.He interrupted me many times
HR: ur favorite subject?
ME: I told switching theory & logic design Rhone of my HR asked me how u can
produce a delay of 20nsec.
ME:I tried it but failed the answer is using D-FLIP FLOP
HR: Can u explain the logic of D-FLIP FLOP?
ME:I explained it clearly. The asked to draw the outputs but not truth table.
HR: Another favorite subject?
ME:VHDL (VHSIC HARDWARE DESCRIPTION LANGUAGE)
HR: Do u know C?
ME: yes
HR: Abt data types in C?
ME: explained on a paper clearly
HR:Size of primary datatypes?
ME:explained.
HR:Can u give the difference between the union and structure?
ME:Explained clearly by writing a program
HR:How to perform division operation with out using / operator?
ME:I told that I will write a program but they asked me to explain the logic
I told that using subtract operator we can perform it
HR:We should not use any arithmetic operators
ME:when I was thinking he asked me to give names of different operators. I named them
then I told that using shift operators we can perform / operation
HR:which type of shift?
ME:right shift
HR:So which shift for / and * operations?
ME:Left shift for * and right shift /
HR:He opened my written test paper and asked me to identify the small mistake I made
in the program I have written.
ME:I was searching for it One of my HR gave clues to identify it With his help I found it
last.
HR:Ok do u have any questions?
ME:No sir
HR:thank u haritha
ME:Thank u sir
Friends technical round is the elimination round in L&T.84 students have cleared the
written test out of 250. 44 have cleared the jam session and finally 11 have been selected
in technical round.This gives the importance of each round.
It is more than enough to have a good knowledge on basics.We have to answer them with
a lot of confidence this is a must.
After 20days the results are announced.
It is very great to see that 9 out of 11 arefrom our college.
I am very glad to be one of them.
This is my experience I hope that this will help u to prepare well.
Ok Friends GOOD LUCK TO U
HOPE THAT WE WILL MEET IN L&T.
MY SINCERE REQUEST TO U IS TO JUST CONTRIBUTE UR EXPERIENCE TO
ALL SO THAT ONE CAN GAIN SOMETHING FROM U .PLS PASS THIS
MESSAGE TO EVERYONE TO GUIDE OTHERS THRU THEIR CONTRIBUTION.
THANK U FRIENDS.
WEP INDIA TELEPHONIC INTERVIEW 2006
Hi,
I have attended a telephonic interview from Wep India Peripherals. It was pure technical.
first they asked me to describe about my current job, current CTC, Expected CTS and
whether willing to relocate? like that...after that they asked me whether i am ready for a
technical interview now (day before yesterday HR called up me to inform abt the
telephonic interview). and they asked me to rate myself from 1-10 for sql server, asp.net
and vb6.
here r the questions they asked. just for ur reference
ASP.NET
Mark verification regarding written test all guys well known about pattern My suggestion is, in my written i had Venn
diagram,cube,binary logic code like 1 is represented as & like this 0 is* like this,data sufficiency
The paper for was easy and a good preparation of R.S.Agarwal quant and aptitute can make u get through in aptitude
part.Except cubes,i did everything. Please make sure u get 15 above in quant.
Regarding verbal .... i felt some difficulties here ., the passsage we got was a bit difficult, but a bit of concentration can
make u get through in that too. A good basics of grammar is necessary for u to get through. then analytical section
every one can do it without any preparation...
The results were declared in 2 hours. n for god's grace my name was called. This is how my interview went
Interview experiences:
int: Good afternoon Srinivas
me: GA sir
int :had lunch?
me: yes sir(with a broad smile)
int: what did u hv??
me: Chicken Biryani
int: SO u killed a hen and ate??
me: hehe....
int: oh!! he killed the hen n u had the chicken...right??
me: yes sir!!!
int: well srinivas,tell something abt ur family
me: told...(some questions related to my answer..told confidently)
int: R u gud in C??(i replied yes)
int: what is an array?
me: told
int: what is function overloading?
me: Doono sir
int: what is software development life cycle?
me: i donno sir(full stunned by d question.)
int: ohh...u r from ece right...sry sry...
me: Its ok sir(i dont know y i told so)
int: what is eddy current?
me: i donno sir
int: jus try to recollect
me: tried n told "sry sir i cannot recollect.it was 2 yrs when i read tht"
int: thats nt d rite answer.U studied A,B,C... 12 yrs bac but u remember...y cudnt u remember this??
me: told some bakwaas
int" asked my fav subj i told mc...asked abt mc
me: told
int: why into software?
me: told
int: hw can u cope up wid IT ppl?
me: told
int: u cudnt remember a question of 2 yrs bac...hw can i recruit u??
me: gave a gud answer
int: any questions?
me: asked n he answered
int: thnk u...
jus be thorough with ur technical skills and be confident in everything....even ur walking style...ur way of speech and
all...and above all....believe in god and urself....u ll be in CTS...all d best n c u all in CTS :) bye
I had questions like following:1. What is the difference between a class and object?
2. What is stored procedure? What are its advantages and disavantages?
3. Which is better trigger or stored procedure?
4. What is difference between data set and data reader?(.net)
5. Write a querry for accesing unique rows from emp(Ename,Age) sorted by age?
6. What is the difference between Function overloading, Function Overriding and Virtual
Functions?
7. Difference between multiple and multilevel inheritence?
8. Differnce between interfaces and abstract classes?
Sorry i don't remember remaining two. Like this he is concerntarting on OOPs,
DBMS, .NET
Coming to the 2nd section. This consists of 20 questions. Questions on Aptitude. All the
qestions came from R.S.Agarwal. Questions like Ages, Time and work,distance....etc
Coming to the 3rd section. This consists of 20 questions. He had given all C programs
and asks us to point out the errors and outputs. All the questions are from Test ur C skills
by Yashwanth Kanithkar
Thats all I'm still waiting fro the result...
Write a Code
1.
extra memory.
2.
and Struct.
4.
Testing and Maintenance.(will you work in it and what are they) Give the
outputs of a compiler and assembler and loader and linker etc. If a new data structure,
suppose a queue is to be added like int, long etc., where shall the changes be -- lex
or yacc or where.
5.
6.
7.
How does the scheduler know the time how it should be scheduled
8.
9.
10.
What is a semaphore?
11.
What exactly happens after each system call in sockets, both at the client and
at the server.
12.
13.
Test Pattern
1.Test I - Aptitude
2.Test II- English
3.Tech Interview
4.HR Interview
5.GM Interview
Aptitude
qns 1-10 - 1 mark each Logical Analysys which had sequence completion...for that strictly
follow RS Agarwal -Verbal & Non-Verbal....
qns 11-20- 1 mark each Data Sufficiency in which a question will be given with 2
statements....we have to analyse wether we r able to get the answer from a single statement,
both statements or neither of those statements....refer Verbal & Non-Verbal RS Agarwal.....
qns 21-35- 2 marks each Numerical Ability in which normal aptitude problems like trains,
time and distance, time and work etc...like.. -train passing a post -train passing a man
standing in another moving train... -trains passing each other.. -some men doin a
work...change in time wen some more men helped and wen some left the job after
completing half of it....
-questions like... a/3 = b/4 = c/5...then find the value of (a+b+c)/c...... Strictly refer
Quantitative Aptitude- R S Agarwal..
qns 36-45 5 marks each Programming section.....to my surprise C or BASIC languages wer
not ther...insted they created a new language with new keywords....new looping functions
etc. And a programming code was given wich was based on That particular
language....so...we had to compare each statement of the code with the description given for
each keyword used.........even though the code seemd very complicated....belive me it'll be a
simple program like A+B or assigning a value to A.. Almost 5-6 questions wer of this
type.....the rest wer algorithm and some simple questions..... Heard that some had flow
charts....but it was not ther in mine.. Ther isnt any book to refer for this section.....as it may
change always...
English
20 questions wer ther....100% simple......i'll say that its a lifeline while writing the
aptitude....score 20/20 for that...
Tech Interview
I wont say that its a normal one.....questions will be strictly based on the resume......and if ur
not strong in wat in wrote in resume...then its game over.....ther will be C questions.....but
dont expect normal C interview questions.....questions will be something we hadnt
imagined...he started the process by a friendly talk....and simple questions like enter strings in
all the ways.....
Passing on to the core question of interview.....he asked me to write the equivalent code for
modulus operator in C(%).....then he asked to
write the equivalent code for finding the absolute value of a number....the remaining questions
wer from wat i wrote in resume....he asked me about html,linux file systems....difference
between DBMS and RDBMS etc..... 6 candidates wer interviewd by that panel.....in wich 4 wer
eliminated...
HR Interview
Its not an interview actually.....they just need to talk to u....to check ur communication
skill,confidence etc.....be interactive.....i think its entirely different from the normal HR
interviews......for me he asked me to sell my mini project product to an imaginary crowd.....be
confident....avoid breaks in ur speech.....watever u say.....be sure that it wont affect the flow
of words.......im writing it once again....they expect a friendly talk without being stressed or
tensed........then ur forwarded to the GM...
GM Interview
Now the situation is really serious......he checks wether ur fit for the company...wether ur
industry ready.......he'll check it in many ways.....he may give real world situations.....like wat
will u do if u found that ur boss had forwarded a wrong design.....how will u inform
him??......and he'll ask wat r ur qualities....and will ask questions regarding that......
Also will test u by asking how u'll react if u wer eliminated....be cool....eventhough it seems
very easy and interesting....beware this is the place wer maximum elimination occurs.....ask
him questions wich proves ur eagerness to work for the perot family and ur eagerness to know
more about the company......
Finally...after 1 hr long discusion.....it was 9 pm wen they gave the result to Santharam
Sir,our placement officer.......8 wer selected...eventhough i got selected, it was very
disppointing that only one was selected from our college....
Tips
1.Study the ppt very well....by-heart each and every word he says......it'll
be very useful....
2.And pronounce it as "Peroe Systems"....dont say perot.....
3.Be 100% interactive....
Now i thank all those who posted their experiences in freshersworld. it really helped me a
lot.....especially my senior Soumya who had posted last year.....
A) English ability. -Q1. which is suitable combination similar to - pesticide : crop :: antiseptic: ?
a) wound b) clothing c) bandage d) bleeding.
Q2. It is a long time.............i saw my friend who lives...............his parents...........he
neighbouring town.
a) when ; at ; of b) since ; with ; in. c) when ; for ; in d) since ; for ; of.
and other questions of selecting suitable words and also 3 questions based on one small
passage. it was very easy one and in fact d easiest section was english section only.
B) Quantitive aptitude-Q1. if ratio of milk and water in one container is 3:5 and in another is 1:2 they mixed
togeher then what is ratio of milk and water ?
Q2. dimension of a room is 5*8 meters. room floor is covered by carpet by leaving space
4cm from walls. if carpet is 18rs. per meter then total cost?
Q3. find out d odd one in d series
a)9 b)121 c)361 d)881
answer is d)881 since it is not a perfect square.
it also contains questions related to tabulaion,distance and time, work percentage , profit
and loss. R. S. AGGARWAL is more than sufficient.it is time consuming part be fast
otherwise u will not be able to attempt all the questions.
C) Logical reasoning -for me dis section was tough coz it really consumed time n it was not possible to attempt
all d questions in mere 20 minutes
although i tried my level best n i was sure i will cross d cut off of this section so guys b
fast 4 dis section. simple q based on venn diagram and selection of suitable statement
were also there refer R.S.AGGARWAL (verbal).
D) Technical skills -this section was complete technical so be prepare. it contains C ,C++, DBMS ,RBMS and
general computer architecture.
This is all about written test. 66 students were selected out of 600. i cleared dis round and
then dey gave ppt to the selected candidates only. from my college only three cleared the
written test.in ppt dey talked about company profile. my interview was on d same day.
TECHNICAL INTERVIEW-
here he asked me to show him my resume. then he asked me about ORACLE. i strictly
said no sir i m not good at oracle because i havnt studied it yet.
then he said ok which languages u have studied so far
strctly mention all d languages which u have mentioned in ur resume
i said c,c++,JAVA
questions were very simple n was all basics a student from cs branch must know. i was
asked to wait outside after a few minutes i was called 4 the H.R. roundmay i come in mam?
hi vinay please come in
may i have a seat mam?
ya sure please sit.
ok vinay take dis paper n now i vil give u 5 mins write something abot urself ur college
ur branch n y u opted 4 dat branch
n how do u see urself after 5 years 4rm now?
i quickly finished the work in less than 2 mins.
mam started readin it
ok vinay wat do ur father do?
mam my father is a govt. servant
how long has he been serving 4 his organization?
27 years
oh dat is a very long time would u serve 4 an organisation 4 such a long time
i said mam it depends totlly on d work environment n also if there is a kind of emotional
bond b/w me n employees of the company
so u r avery emotional kind of person
yes mam i m a very emotional kind of person.
ok imagine u r a ceo of a company n one of ur friend who is emotionally attached to u
asks u to leak the secrets of the company wud u do dat?
no mam the first priority is 4 the firm 4 which i m serving n no compromise on dat part.
ok so u r emotional but not ethnically emotional.
wat kind of person r u? domestic or international?
i said domestic n justified wid my views
next she asked traditional or modern? i said traditional
n gave the example of lalu prasad yadav (rail minister of india) being a traditional kind of
person in speaking n living he is popular all over the world
she asked me really
then i said mam he recently gave management classes to students 4rm HORWARD
UNIV.
mam u must hav read in the news paper? she said yes i did.
ok what kind of animal do u like? n y?
i said ANT coz hard working, always moving towards its goal, n team work.
i think u watch national geography channel a lot.
i said no mam i dont.
then wat do u watch in ur tv set.
i said i dont get time to see tv
then she asked me how do i manage my time?
Hi Friends, I went to the interview which was an off campus one.If im not wrong they
were around 2k students who gave the Interview out of which 30 got selected.
This is how the whole selection procedure was
1) Aptitude+Technical written test
2) Technical Interview
3) H.R Interview
The Aptitude comprised of Verbal reasoning, Quants, Analytical Reasoning.The
technical had C&C++ and DBMS. In verbal they had Fill in the blanks,Rcs and Give the
closest meaning. Verbal was quite easy though the reading passages were a bit tuff but
still not that hard either.
For Quants a bit of brushing of basics is really going to help, they asked questions like
two trains moving in each direction etc. The analytical reasoning was the easiest of all.
In Technical they concentrated more on the programs of C&C++ like a program and then
depending on that the errors which can pop up while execution. Out of 2000 students 250
cleared the Apptitude.
Then came the technical interview,dis is how it went
1)Tell me something about Yourself?
Told
2)What is the difference between C nd C++?
told
3)Why is C++ called the oops Language?
Oops..Dont Know..told about encapsulation,abstratction etc...she looked quite satisfied.
and then came the programs...
4)given a set of 10 numbers write a program which is going to choose numbers which
only end with 3(not 6,9) and then add them.then Select numbers which start wid 9 and
add them after that subtract the sum of both...Took a bit of time but wrote.She was happy.
5)Given a set of numbers wap so as to pick a number which is a perfect square.
6)Wap for a palyndrome( Eg DAD)
7)WAP to take a number from the user (any digits) seperate the digits and add the squares
of the digits.
8)WAP on Bubble sort using Pointes.
well those were the programs though they were easy it took a bit of pain to re call the
logic of each nd every program.
She didnt asked a thing on DBMS.
After around 4 hrs the technical results were declared and I got through then came HR
interview,nd dis is how that went
HR-Sorry for making you wait this long( The time was 8 30 pm-The actual time was 9
AM of day 2)
Ray- No,probs sir.
HR-ok,tell me something about ur profile
Ray-Said
HR-OK Good..Now what are your career Goals and how are you planning to achieve
them
Ray-Said
HR-Stress a bit more on your skills
Ray-Comm skills,Team player and PROBLEM SOLVING ABILITY
HR-what do u mean by problem solving ability(PSA)?
Ray-Said
HR-Give one example where in ur PSA was utilised
Ray-made one and said..lol
HR-why HSBC??
Ray-Said
HR-What you know abt HSBC??
Ray-HSBC-Hong Kong Shanghai Banking Co-operation.
It has its branches in 82 countries.
It work in various domains like Data warehousing,Mainframes etc.
It is an Industry in Itself
HR-You got any questions for me??
Ray-Yep..asked one.
HR-OKay..Ray Thankyou.
Ray-My pleasure...
This is how it went and after 2 hrs the result was declared and BOY..my name was
actually there..and I was so happy... The pay package which dey offered was hmmm...
well..am not suppose to say that.
My advice to all is They are concentrating more on your comm skills, so be sure that in
both ur HR nd TEch interview ur FLUENT dont stammer aruond and make sure what ur
talking makes sense because specially in HR there was lot of Cross questioning.
HSBC doesnt have any BOND process so with the pay package and the scope which it
has it definelty one of the best companies around to work for.
By,
Give the output of the programs in each case unless mentioned otherwise
1.
void main()
{
int d=5;
printf("%f",d);
}Ans: Undefined
2.
void main()
{
int i;
for(i=1;i<4,i++)
switch(i)
case 1: printf("%d",i);break;
{
case 2:printf("%d",i);break;
case 3:printf("%d",i);break;
}
switch(i) case 4:printf("%d",i);
}Ans: 1,2,3,4
3.
void main()
{
char *s="\12345s\n";
printf("%d",sizeof(s));
}Ans: 6
4.
void main()
{
unsigned i=1; /* unsigned char k= -1 => k=255; */
signed j=-1; /* char k= -1 => k=65535 */
/* unsigned or signed int k= -1 =>k=65535 */
if(i<j)
printf("less");
else
if(i>j)
printf("greater");
else
if(i==j)
printf("equal");
}Ans: less
5.
void main()
{
float j;
j=1000*1000;
printf("%f",j);
}
1. 1000000
2. Overflow
3. Error
4. None
Ans: 4
6.
three ways:
/* pointer to char */
typedef pc fpc();
/* pointer to above */
/* function returning... */
/* pointer to... */
/* array of... */
Use the cdecl program, which turns English into C and vice versa:
cdecl> declare a as array of pointer to function returning
pointer to function
char *(*(*a[])())()
cdecl can also explain complicated declarations, help with casts, and indicate which
set of parentheses the arguments
one
above). Any good book on C should explain how to read these complicated
declarations "inside out" to understand them ("declaration mimics use"). The pointerto-function declarations in the examples above have not included parameter type
information. When the parameters have complicated types, declarations can *really*
get messy. (Modern versions of cdecl can help here, too.)
9.
A structure pointer is defined of the type time . With 3 fields min,sec hours
int f()
void main()
{
f(1);
f(1,2);
f(1,2,3);
}
f(int i,int j,int k)
{
printf("%d %d %d",i,j,k);
}What are the number of syntax errors in the above?
Ans: None.
12.
void main()
{
int i=7;
printf("%d",i++*i++);
}Ans: 56
13.
#define one 0
#ifdef one
printf("one is defined ");
#ifndef one
printf("one is not defined ");
Ans: "one is defined"
14.
void main()
{
intcount=10,*temp,sum=0;
temp=&count;
*temp=20;
temp=∑
*temp=count;
printf("%d %d %d ",count,*temp,sum);
}
Ans: 20 20 20
15.
There was question in c working only on unix machine with pattern matching.
16.
what is alloca()
out of scope
17.
main()
{
static i=3;
printf("%d",i--);
return i>0 ? main():0;
}
Ans: 321
18.
char *foo()
{
char result[100]);
strcpy(result,"anything is good");
return(result);
}
void main()
{
char *j;
j=foo()
printf("%s",j);
}
Ans: anything is good.
19.
void main()
{
char *s[]={ "dharma","hewlett-packard","siemens","ibm"};
char **p;
p=s;
printf("%s",++*p);
printf("%s",*p++);
printf("%s",++*p);
}Ans: "harma" (p->add(dharma) && (*p)->harma)
"harma" (after printing, p->add(hewlett-packard) &&(*p)->harma)
"ewlett-packard"
Mistral Solutions
C Section
1. What does the following program print?
#include <stio.h>
int sum,count;
void main(void)
{< BR> for(count=5;sum+=--count;)
printf("%d",sum);
}
a. The pgm goes to an infinite loop b. Prints 4791010974 c. Prints 4791001974
d. Prints 5802112085 e. Not sure
2. What is the output of the following program?
#include <stdio.h>
void main(void)
{
int i;< BR> for(i=2;i<=7;i++)
printf("%5d",fno());
}
fno()
{
staticintf1=1,f2=1,f3;
return(f3=f1+f2,f1=f2,f2=f3);
}
a. produce syntax errors b. 2 3 5 8 13 21 will be displayed c. 2 2 2 2 2 2 will be displayed
d. none of the above e. Not sure
c. prints garbage, address of the local variable should not returned d. print a e. Not sure
11. What does the following program print?
void main(void)
{
int i;
static int k;
if(k=='0')
printf("one");
else if(k== 48)
printf("two");
else
printf("three");
}
a. prints one b. prints two c. prints three
d. prints one three e. Not sure
12. What does the following program print?
#include<stdio.h>
void main(void)
{
enum sub
{
chemistry, maths, physics
};
struct result
{
char name[30];
enum sub sc;
};
struct result my_res;
strcpy (my_res.name,"Patrick");
my_res.sc=physics;
printf("name: %s\n",my_res.name);
printf("pass in subject: %d\n",my_res.sc);
}
a. name: Patrick b. name: Patrick c. name: Patrick
pass in subject: 2 pass in subject:3 pass in subject:0
d. gives compilation errors e. Not sure
13. What does
printf("%s",_FILE_); and printf("%d",_LINE_); do?
a. the first printf prints the name of the file and the second printf prints the line no: of the
second printf in the file
b. _FILE_ and _LINE_ are not valid parameters to printf function
c. linker errors will be generated d. compiler errors will be generated e. Not sure
14. What is the output of the following program?
#include <stdio.h>
void swap (int x, int y, int t)
{
t = x;
x = y;
y = t;
printf ("x inside swap: %d\t y inside swap : %d\n",x,y);
}
void main(void)
{
int x;
int y;
int t;
x = 99;
y = 100;
swap (x,y,t);
printf ("x inside main:%d\t y inside main: %d",x,y);
}
a. x inside swap : 100 y inside swap : 99 x inside main : 100 y inside main : 99
b. x inside swap : 100 y inside swap : 99 x inside main : 99 y inside main : 100
c. x inside swap : 99 y inside swap : 100 x inside main : 99 y inside main : 100
d. x inside swap : 99 y inside swap : 100 x inside main : 100 y inside main : 99
e. Not sure
15. Consider the following statements:
i) " while loop " is top tested loop ii) " for loop " is bottom tested loop
iii) " do - while loop" is top tested loop iv) " while loop" and "do - while loop " are top tested
loops.
Which among the above statements are false?
a. i only b. i & ii c. iii & i d. ii, iii & iv e. Not sure
16. Consider the following piece of code:
char *p = "MISTRAL";
printf ("%c\t", *(++p));
p -=1;
printf ("%c\t", *(p++));
Now, what does the two printf's display?
a. M M b. M I c. I M d. M S e. Not sure
17. What does the following program print?
#include <stdio.h>
struct my_struct
{
int p:1;
int q:1;
int r:6;
int s:2;
};
struct my_struct bigstruct;
struct my_struct1
{
char m:1;
};
struct my_struct1 small struct;
void main (void)
{
printf ("%d %d\n",sizeof (bigstruct),sizeof (smallstruct));
}
a. 10 1 b. 2 2 c. 2 1 d. 1 1 e. Not sure
18. Consider the following piece of code:
FILE *fp;
fp = fopen("myfile.dat","r");
Now fp points to
a. the first character in the file.
b. a structure which contains a char pointer which points to the first character in the file.
c. the name of the file. d. none of the above. e. Not sure.
19. What does the following program print?
#include <stdio.h>
#define SQR (x) (x*x)
void main(void)
{
int a,b=3;
a = SQR (b+2);
}
a. 25 b. 11 c. 17 d. 21 e. Not sure.
20. What does the declaration do?
int (*mist) (void *, void *);
a. declares mist as a function that takes two void * arguments and returns a pointer to an int.
b. declares mist as a pointer to a function that has two void * arguments and returns an int.
c. declares mist as a function that takes two void * arguments and returns an int.
d. there is a syntax error in the declaration. e. Not sure.
21. What does the following program print?
#include <stdio.h>
void main (void)
{
int mat [5][5],i,j;
int *p;
p = & mat [0][0];
for (i=0;i<5;i++)
for (j=0;j<5;j++)
mat[i][j] = i+j;
printf ("%d\t", sizeof(mat)); < BR> i=4;j=5;
printf( "%d", *(p+i+j));
}
a. 25 9 b. 25 5 c. 50 9 d. 50 5 e. Not sure
22. What is the output of the following program?
#include <stdio.h>
void main (void)
{
short x = 0x3333;
short y = 0x4321;
long z = x;
z = z << 16;
z = z | y;
printf("%1x\t",z);
z = y;
z = z >> 16;
z = z | x;
printf("%1x\t",z);
z = x;
y = x && y;
z = y;
printf("%1x\t",z);
}
a. 43213333 3333 1 b. 33334321 4321 4321 c. 33334321 3333 1
d. 43213333 4321 4321 e. Not sure
23. What is the output of the following program?
#include <stdio.h>
void main (void)
{
char *p = "Bangalore";
#if 0
printf ("%s", p);
#endif
}
a. syntax error #if cannot be used inside main function b. prints Bangalore on the screen
c. does not print anything on the screen
d. program gives an error "undefined symbol if" e. Not sure
24. If x is declared as an integer, y is declared as float, consider the following expression:
y = *(float *)&x;
Which one of the following statments is true?
a. the program containing the expression produces compilation errors;
b. the program containing the expression produces runtime errors;
c. the program containing the expression compiles and runs without any errors;
d. none of the above e. Not sure
25. What is the return type of calloc function?
a. int * b. void * c. no return type: return type is void
d. int e. Not sure
part 1 of paper
first aptitude having five sections (50 questions and 45 minutes)
part 2
second c debugging (test ur c skills - yashwant kanitkar)(questions 20 time 30 min.)
paper 1
section one
15 questions (data sufficiency)
a alone is sufficient
b alone is sufficient
a and b are both sufficient
a and b both are insufficient
section two
five questions (reading comprehence )
very easy
section three
15 questions (logical reasoning)
a pare is given and some hints are given u can fine out the ans
one hotel has two zones (east and west) not all east zone flats have ocean view but all weat
zone flats have harbour view all ocean view flats has extra charge in harbour view flats above
and on 3rd floor have extra charge west zone flats lower than 3rd floor some has kitchen so
extra charge all other flats of east zone not having ocean view has kitchen so extra charges
section four
10 questions verbal reasoning four or five sentences are given related to single topic four
options are given which are having order of three sentences(abe or bec) select correct order
sections five
five computational questions which were easy
* total 12 members half are in club a one third in b and one fourth in c how many are not in
any club
ans 5(check)
these type of questions u can find in
R. S. Agrawal
or IMS package of CAT
in question it was written that all five sections carry their cutoffs so attempt all but in electrical
one guy was selected who didnot attempt reading comprehension but attempted all 45
questions this paper also has negative marking of 50%
paper 2
1.what does p in
const char *p
stands for
p can be changed like this
2.main()
sturct date {
char name[20];
int age ;
float sal;
};
sturct data d ={"rajesh"};
printf("%d%f",d.age,d.sal);
}
tell the output
3.main()
int i=7;
printf("%d"i++*i++);
output
4.void main()
{
int d ;
int i=10;
d =sizeof(++i);
printf("%d");
output
5.difference between
extern int f();
int f();
6.choose correct
(i)stack is automatically cleared
(ii)heap is automatically cleared
(iii)user has to clear stack and heap
(iv)system takes care of ----------
Interview
they will give u puzzles in first round which will be from site techinterview.org this site has 70
puzzles and their answers so go through them
second round has c coding of data structure circular quese,tree etc also questions from c and
c++ like virtual functions
far near huge memory concepts like heap,stack etc
then in third round hr questions like hobbies and interets make ur curriculam vite and bring it
with ur file
they want people with good aptitude in interview rounds ur aptitude and approach matters so
solve puzzles.
Test Paper :1
Paper Type
Test Date
Posted By
Some of the questions will not have answers .Please forgive us.
1. Difference b/n scanf("%s",msg);and scanf("%[\^n]",msg); where msg is a char array.
2. What is ure of comma operator in for loop.
3. int shw(int *a){
*a = 10;
/* return stmt is missing */
}
main(){
int p=3,q=4;
q = shw(&p);
printf("%d %d",p,q);
}
4. which is true
a. all automatic variables are declared with in the function
b. all variables are automatic
c. all not declared variables are automatic
d. none
5. What is recursion. Recursive prog to generate Fibonacci series . Is it a best method?
6. write 7*a interms of +,-,<<
7. count number of 1's in a 32 bit integer.(i had not remembered whether array or integer).
8. main(){
char *s1 = "hello",*s2 ="abce";
strcpy(s1,"");
s2[0] = s1[0];
printf("%d%d",strlen(s1),strlen(s2));
}
9. regarding memset
10.Algorithm to delete a node in Double linked list.
11. Difference b/n fgets,fscanf which u will prefer.
Unix
11.What is creon and whats diff b/n 'at' command.
12. what is system call and lib function. whats diff b/n them. abt execve - expalin.
13.some thing abt makeall
14. write abt TCP,IP,ICMP
Enter Your Comments
test ( int ii = 0 )
{
i = ii ;
}
};
class sample
{
static test s ;
};
test sample::s ( 26 ) ;
Here we have initialized the object s by calling the one-argument constructor. We
can use the same convention to initialize the object by calling multiple-argument constructor.
3. What is forward referencing and when should it be used?
Ans: Consider the following program:
class test
{
public :
friend void fun ( sample, test ) ;
};
class sample
{
public :
friend void fun ( sample, test ) ;
};
void fun ( sample s, test t )
{
// code
}
void main( )
{
sample s ;
test t ;
fun ( s, t ) ;
}
This program would not compile. It gives an error that sample is undeclared identifier in the
statement friend void fun ( sample, test ) ; of the class test. This is so because the class
sample is defined below the class test and we are using it before its definition. To overcome
this error we need to give forward reference of the class sample before the definition of class
test. The following statement is the forward reference of class sample. Forward referencing is
generally required when we make a class or a function as a friend.
4. The istream_withassign class has been derived from the istream class and overloaded
assignment operator has been added to it. The _withassign classes are much like their base
classes except that they include overloaded assignment operators. Using these operators the
objects of the _withassign classes can be copied. The istream, ostream, and iostream classes
are made uncopyable by making their overloaded copy constructor and assignment operators
private.
5. How do I write my
Ans: This is shown in
#include
ostream& myhex
{
o.setf ( ios::hex)
return o ;
}
void main( )
{
cout << endl << myhex << 2000 ;
}
6.We all know that a const variable needs to be initialized at the time of declaration. Then how
come the program given below runs properly even when we have not initialized p?
#include
void main( )
{
const char *p ;
p = "A const pointer" ;
cout << p ;
}
Ans: The output of the above program is 'A const pointer'. This is because in this program p is
declared as 'const char*' which means that value stored at p will be constant and not p and so
the program works properly
7. How do I refer to a name of class or function that is defined within a namespace?
Ans: There are two ways in which we can refer to a name of class or function that is defined
within a namespace: Using scope resolution operator through the using keyword. This is
shown in following example:
namespace name1
{
class sample1
{
// code
};
}
namespace name2
{
class sample2
{
// code
};
}
using namespace name2 ;
void main( )
{
name1::sample1 s1 ;
sample2 s2 ;
}
Here, class sample1 is referred using the scope resolution operator. On the other hand we can
directly refer to class sample2 because of the statement using namespace name2 ; the using
keyword declares all the names in the namespace to be in the current scope. So we can use
the names without any qualifiers.
8. While overloading a binary operator can we provide default values?
Ans: No!. This is because even if we provide the default arguments to the parameters of the
overloaded operator function we would end up using the binary operator incorrectly. This is
explained in the following example:
sample operator + ( sample a, sample b = sample (2, 3.5f ) )
{
}
void main( )
{
}
public:
static sample* create( )
{
if ( ptr == NULL )
ptr = new sample ;
return ptr ;
}
};
sample *sample::ptr = NULL ;
void main( )
{
sample *a = sample::create( ) ;
sample *b = sample::create( ) ;
}
Here, the class sample contains a static data member ptr, which is a pointer
to the object of same class. The constructor is private which avoids us from creating objects
outside the class. A static member function called create( ) is used to create an object of the
class. In this function the condition is checked whether or not ptr is NULL, if it is then an
object is created dynamically and its address collected in ptr is returned. If ptr is not NULL,
then the same address is returned. Thus, in main( ) on execution of the first statement one
object of sample gets created whereas on execution of second statement, b holds the address
of the first object. Thus, whatever number of times you call create( ) function, only one object
of sample class will be available.
11. How do I write code to add functions, which would work as get and put properties of a
class?
Ans: This is shown in following code.
#include
class sample
{
int data ;
public:
__declspec ( property ( put = fun1, get = fun2 ) )
int x ;
void fun1 ( int i )
{
if ( i < 0 )
data = 0 ;
else
data = i ;
}
int fun2( )
{
return data ;
}
};
void main( )
{
sample a ;
a.x = -99 ;
cout << a.x ;
}
Here, the function fun1( ) of class sample is used to set the given integer value into data,
whereas fun2( ) returns the current value of data. To set these functions as properties of a
class we have given the statement as shown below:
__declspec ( property ( put = fun1, get = fun2 )) int x ;
As a result, the statement a.x = -99 ; would cause fun1( ) to get called to set the value in
data. On the other hand, the last statement would cause fun2( ) to get called to return the
value of data.
12. How do I write code to make an object work like a 2-D array?
Ans: Take a look at the following program.
#include
class emp
{
public :
int a[3][3] ;
emp( )
{
int c = 1 ;
for ( int i = 0 ; i <= 2 ; i++ )
{
for ( int j = 0 ; j <= 2 ; j++ )
{
a[i][j] = c ;
c++ ;
}
}
}
int* operator[] ( int i )
{
return a[i] ;
}
};
void main( )
{
emp e ;
cout << e[0][1] ;
}
The class emp has an overloaded operator [ ] function. It takes one argument an integer
representing an array index and returns an int pointer. The statement cout << e[0][1] ; would
get converted into a call to the overloaded [ ] function as e.operator[ ] ( 0 ). 0 would get
collected in i. The function would return a[i] that represents the base address of the zeroeth
row. Next the statement would get expanded as base address of zeroeth row[1] that can be
further expanded as *( base address + 1 ). This gives us a value in zeroth row and first
column.
13. What are formatting flags in ios class?
Ans: The ios class contains formatting flags that help users to format the stream data.
Formatting flags are a set of enum definitions. There are two types of formatting flags:
On/Off flags
Flags that work in-group
The On/Off flags are turned on using the setf( ) function and are turned off using the unsetf( )
function. To set the On/Off flags, the one argument setf( ) function is used. The flags working
in groups are set through the two-argument setf( ) function. For example, to left justify a
string we can set the flag as,
cout.setf ( ios::left ) ;
cout << "KICIT Nagpur" ;
To remove the left justification for subsequent output we can say,
cout.unsetf ( ios::left ) ;
The flags that can be set/unset include skipws, showbase, showpoint,
uppercase, showpos, unitbuf and stdio. The flags that work in a group can have only one of
these flags set at a time.
}
void display( )
{
cout << day << "/" << month << "/" << year ;
}
};
void main( )
{
date d1 ( 25, 9, 1979 ) ;
date d2 = d1 ;
date d3 ;
d3 = d2 ;
d3.display( ) ;
}
18. When should I use unitbuf flag?
Ans: The unit buffering (unitbuf) flag should be turned on when we want to ensure that each
character is output as soon as it is inserted into an output stream. The same can be done
using unbuffered output but unit buffering provides a better performance than the unbuffered
output.
19.What are manipulators?
Ans: Manipulators are the instructions to the output stream to modify the output in various
ways. The manipulators provide a clean and easy way for formatted output in comparison to
the formatting flags of the ios class. When manipulators are used, the formatting instructions
are inserted directly into the stream. Manipulators are of two types, those that take an
argument and those that don?t.
20. What is the difference between the manipulator and setf( ) function?
Ans: The difference between the manipulator and setf( ) function are as follows:
The setf( ) function is used to set the flags of the ios but manipulators directly insert the
formatting instructions into the stream. We can create user-defined manipulators but setf( )
function uses data members of ios class only. The flags put on through the setf( ) function can
be put off through unsetf( ) function. Such flexibility is not available with manipulators.
21. How do I get the current position of the file pointer?
Ans: We can get the current position of the file pointer by using the tellp( ) member function
of ostream class or tellg( ) member function of istream class. These functions return (in bytes)
positions of put pointer and get pointer respectively.
22. What are put and get pointers?
Ans: These are the long integers associated with the streams. The value present in the put
pointer specifies the byte number in the file from where next write would take place in the file.
The get pointer specifies the byte number in the file from where the next reading should take
place.
23. What do the nocreate and noreplace flag ensure when they are used for opening a file?
Ans: nocreate and noreplace are file-opening modes. A bit in the ios class defines these
modes. The flag nocreate ensures that the file must exist before opening it. On the other hand
the flag noreplace ensures that while opening a file for output it does not get overwritten with
new one unless ate or app is set. When the app flag is set then whatever we write gets
appended to the existing file. When ate flag is set we can start reading or writing at the end of
existing file.
24. What is the limitation of cin while taking input for character array?
Ans: To understand this consider following statements,
char str[5] ;
cin >> str ;
While entering the value for str if we enter more than 5 characters then there is no provision
in cin to check the array bounds. If the array overflows, it may be dangerous. This can be
avoided by using get( ) function. For example, consider following statement,
cin.get ( str, 5 ) ;
On executing this statement if we enter more than 5 characters, then get( ) takes only first
five characters and ignores rest of the characters. Some more variations of get( ) are
available, such as shown below:
get ( ch ) ? Extracts one character only
get ( str, n ) ? Extracts up to n characters into str
get ( str, DELIM ) ? Extracts characters into array str until specified delimiter (such as
'\n'). Leaves delimiting character in stream.
get ( str, n, DELIM ) ? Extracts characters into array str until n characters or DELIM
character, leaving delimiting character in stream.
25. What is the purpose of istream class?
Ans: The istream class performs activities specific to input. It is derived from the ios class. The
most commonly used member function of this class is the overloaded >> operator which can
extract values of all basic types. We can extract even a string using this operator.
26. Would the following code work?
#include
void main( )
{
ostream o ;
o << "Dream. Then make it happen!" ;
}
Ans: No! This is because we cannot create an object of the ostream class since its constructor
and copy constructor are declared private.
27. Can we use this pointer inside static member function?
Ans: No! The this pointer cannot be used inside a static member function. This is because a
static member function is never called through an object.
28. What is strstream?
Ans: strstream is a type of input/output stream that works with the memory. It allows using
section of the memory as a stream object. These streams provide the classes that can be used
for storing the stream of bytes into memory. For example, we can store integers, floats and
strings as a stream of bytes. There are several classes that implement this in-memory
formatting. The class ostrstream derived from ostream is used when output is to be sent to
memory, the class istrstream derived from istream is used when input is taken from memory
and strstream class derived from iostream is used for memory objects that do both input and
output. Ans: When we want to retrieve the streams of bytes from memory we can use
istrestream. The following example shows the use of istrstream class.
#include
void main( )
{
int age ;
float salary ;
char name[50] ;
char str[] = "22 12004.50 K. Vishwanatth" ;
istrstream s ( str ) ;
s >> age >> salary >> name ;
cout << age << endl << salary << endl << name ;
cout << endl << s.rdbuf( ) ;
}
Here, s is the object of the class istrstream. When we are creating the object s, the
constructor of istrstream gets called that receives a pointer to the zero terminated character
array str. The statement s >> age >> salary >> name ; extracts the age, salary and the
name from the istrstream object s. However, while extracting the name, only the first word of
name gets extracted. The balance is extracted using rdbuf( ).
29. When the constructor of a base class calls a virtual function, why doesn't the override
function of the derived class gets called?
Ans: While building an object of a derived class first the constructor of the base class and then
the constructor of the derived class gets called. The object is said an immature object at the
stage when the constructor of base class is called. This object will be called a matured object
after the execution of the constructor of the derived class. Thus, if we call a virtual function
when an object is still immature, obviously, the virtual function of the base class would get
called. This is illustrated in the following example.
#include
class base
{
protected :
int i ;
public :
base ( int ii = 0 )
{
i = ii ;
show( ) ;
}
virtual void show( )
{
cout << "base's show( )" << endl ;
}
};
class derived : public base
{
private :
int j ;
public :
derived ( int ii, int jj = 0 ) : base ( ii )
{
j = jj ;
show( ) ;
}
void show( )
{
cout << "derived's show( )" << endl ;
}
};
void main( )
{
derived dobj ( 20, 5 ) ;
}
The output of this program would be:
base's show( )
derived's show( )
30. Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Ans: Yes, we can have a reference as a data member of a class. A reference as a data
member of a class is initialized in the initialization list of the constructor. This is shown in
following program.
#include
class sample
{
private :
int& i ;
public :
sample ( int& ii ) : i ( ii )
{
}
void show( )
{
cout << i << endl ;
}
};
void main( )
{
int j = 10 ;
sample s ( j ) ;
s.show( ) ;
}
Here, i refers to a variable j allocated on the stack. A point to note here is that we cannot bind
a reference to an object passed to the constructor as a value. If we do so, then the reference i
would refer to the function parameter (i.e. parameter ii in the constructor), which would
disappear as soon as the function returns, thereby creating a situation of dangling reference.
31. Why does the following code fail?
#include
class sample
{
private :
char *str ;
public :
sample ( char *s )
{
strcpy ( str, s ) ;
}
~sample( )
{
delete str ;
}
};
void main( )
{
sample s1 ( "abc" ) ;
}
Ans: Here, through the destructor we are trying to deal locate memory, which has been
allocated statically. To remove an exception, add following statement to the constructor.
sample ( char *s )
{
str = new char[strlen(s) + 1] ;
strcpy ( str, s ) ;
}
Here, first we have allocated memory of required size, which then would get deal located
through the destructor.
32. assert( ) macro...
We can use a macro called assert( ) to test for conditions that should not occur in a code. This
macro expands to an if statement. If test evaluates to 0, assert prints an error message and
calls abort to abort the program.
#include
#include
void main( )
{
int i ;
cout << "\nEnter an integer: " ;
cin >> i ;
assert ( i >= 0 ) ;
cout << i << endl ;
}
33. Why it is unsafe to deal locate the memory using free( ) if it has been
allocated using new?
Ans: This can be explained with the following example:
#include
class sample
{
int *p ;
public :
sample( )
{
p = new int ;
}
~sample( )
{
delete p ;
}
};
void main( )
{
sample *s1 = new sample ;
free ( s1 ) ;
sample *s2 = ( sample * ) malloc ( sizeof ( sample ) ) ;
delete s2 ;
}
The new operator allocates memory and calls the constructor. In the constructor we have
allocated memory on heap, which is pointed to by p. If we release the object using the free( )
function the object would die but the memory allocated in the constructor would leak. This is
because free( ) being a C library function does not call the destructor where we have deal
located the memory.
As against this, if we allocate memory by calling malloc( ) the constructor would not get
called. Hence p holds a garbage address. Now if the memory is deal located using delete, the
destructor would get called where we have tried to release the memory pointed to by p. Since
p contains garbage this may result in a runtime error.
34. Can we distribute function templates and class templates in object libraries?
Ans: No! We can compile a function template or a class template into object code (.obj file).
The code that contains a call to the function template or the code that creates an object from
a class template can get compiled. This is because the compiler merely checks whether the
call matches the declaration (in case of function template) and whether the object definition
matches class declaration (in case of class template). Since the function template and the
class template definitions are not found, the compiler leaves it to the linker to restore this.
However, during linking, linker doesn't find the matching definitions for the function call or a
matching definition for object creation. In short the expanded versions of templates are not
found in the object library. Hence the linker reports error.
};
void main( )
{
cout << sizeof ( user ) ;
user u1 ;
cout << endl << sizeof ( u1 ) ;
u1.displaydata( ) ;
}
Ans: The output of this program would be,
9 or 7
9 or 7
Garbage
Garbage
Garbage
Since the user class contains three elements, int, float and char its size would be 9 bytes (int4, float-4, char-1) under Windows and 7 bytes (int-2, float-4, char-1) under DOS. Second
output is again the same because u1 is an object of the class user. Finally three garbage
values are printed out because i, f and c are not initialized anywhere in the program.
Note that if you run this program you may not get the answer shown here. This is because
packing is done for an object in memory to increase the access efficiency. For example, under
DOS, the object would be aligned on a 2-byte boundary. As a result, the size of the object
would be reported as 6 bytes. Unlike this, Windows being a 32-bit OS the object would be
aligned on a 4-byte boundary. Hence the size of the object would be reported as 12 bytes. To
force the alignment on a 1-byte boundary, write the following statement before the class
declaration.
#pragma pack ( 1 )
38. Write a program that will convert an integer pointer to an integer and vice-versa.
Ans: The following program demonstrates this.
#include
void main( )
{
int i = 65000 ;
int *iptr = reinterpret_cast ( i ) ;
cout << endl << iptr ;
iptr++ ;
cout << endl << iptr ;
i = reinterpret_cast ( iptr ) ;
cout << endl << i ;
i++ ;
cout << endl << i ;
}
39. What is a const_cast?
Ans. The const_cast is used to convert a const to a non-const. This is shown in the following
program:
#include
void main( )
{
const int a = 0 ;
int *ptr = ( int * ) &a ; //one way
ptr = const_cast_ ( &a ) ; //better way
}
Here, the address of the const variable a is assigned to the pointer to a non-const variable.
The const_cast is also used when we want to change the data members of a class inside the
const member functions. The following code snippet shows this:
class sample
{
private:
int data;
public:
void func( ) const
{
(const_cast (this))->data = 70 ;
}
};
40. What is forward referencing and when should it be used?
Ans: Forward referencing is generally required when we make a class or a function as a friend.
Consider following program:
class test
{
public:
friend void fun ( sample, test ) ;
};
class sample
{
public:
friend void fun ( sample, test ) ;
};
void fun ( sample s, test t )
{
// code
}
void main( )
{
sample s ;
test t ;
fun ( s, t ) ;
}
On compiling this program it gives error on the following statement of test class. It gives an
error that sample is undeclared identifier. friend void fun ( sample, test );
This is so because the class sample is defined below the class test and we are using it before
its definition. To overcome this error we need to give forward reference of the class sample
before the definition of class test. The following statement is the forward reference of class
sample.
class sample ;
41. How would you give an alternate name to a namespace?
Ans: An alternate name given to namespace is called a namespace-alias. namespace-alias is
generally used to save the typing effort when the names of namespaces are very long or
complex. The following syntax is used to give an alias to a namespace.
namespace myname = my_old_very_long_name ;
42. Using a smart pointer can we iterate through a container?
Ans: Yes. A container is a collection of elements or objects. It helps to properly organize and
store the data. Stacks, linked lists, arrays are examples of containers. Following program
shows how to iterate through a container using a smart pointer.
#include
class smartpointer
{
private :
int *p ; // ordinary pointer
public :
smartpointer ( int n )
{
p = new int [ n ] ;
int *t = p ;
for ( int i = 0 ; i <= 9 ; i++ )
*t++ = i * i ;
}
int* operator ++ ( int )
{
return p++ ;
}
int operator * ( )
{
return *p ;
}
};
void main( )
{
smartpointer sp ( 10 ) ;
for ( int i = 0 ; i <= 9 ; i++ )
cout << *sp++ << endl ;
}
Here, sp is a smart pointer. When we say *sp, the operator * ( ) function gets called. It
returns the integer being pointed to by p. When we say sp++ the operator ++ ( ) function
gets called. It increments p to point to The next element in the array and then returns the
address of this new location.
43. Can objects read and write themselves?
Ans: Yes! This can be explained with the help of following example:
#include
#include
class employee
{
private :
char name [ 20 ] ;
int age ;
float salary ;
public :
void getdata( )
{
cout << "Enter name, age and salary of employee : " ;
cin >> name >> age >> salary ;
}
void store( )
{
ofstream file ;
file.open ( "EMPLOYEE.DAT", ios::app | ios::binary ) ;
file.write ( ( char * ) this, sizeof ( *this ) ) ;
file.close( ) ;
}
void retrieve ( int n )
{
ifstream file ;
file.open ( "EMPLOYEE.DAT", ios:
change_value()
{
return(x+=1);
}
---------------------------------------------------------------------------main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
}
----------------------------------------------------------------------main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
---------------------------------------------------------------------main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
-------------------------------------------------------------------#define swap1(a,b) a=a+b;b=a-b;a=a-b;
main()
{
int x=5,y=10;
swap1(x,y);
printf("%d %d\n",x,y);
swap2(x,y);
printf("%d %d\n",x,y);
}
int swap2(int a,int b)
{
int temp;
temp=a;
b=a;
a=temp;
return;
}
---------------------------------------------------------------------main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
--------------------------------------------------------------------#include<stdio.h>
main()
{
char s1[]="Ramco";
char s2[]="Systems";
s1=s2;
printf("%s",s1);
}
----------------------------------------------------------------#include<stdio.h>
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}
Enter Your Commentsmostly triad is only for mech guys only
TRIAD PAPER
C - language:
1. write a program to calculate ncr
2. write a program to exchange the values of two variables
using
pointers
3. write program to open one file input some numbers and find
smallest,largest, avg. and store them in another file.
4. write a structure node using linked list
5. write a program to reverse a string
co-ordinate geometry
1. find the perpendicular distance from a point P(a,b) to a
line lx+my+n=0;
2. y=x^3+2x^2+5x+2 find the slope of this eqn when x=12;
regarding interview :
1.they will ask whether u r interseted to go
aborad,
ans:say no, not interested.
2. tell some project works that r done and or
going
to
be do in c , c++,
3. personal interview.
4. be perfect in c, they r asking that how u done
this
in test paper.
5.they ask u do be agree to the company bond. bond
is
for 3 years , breaking is at cost of 50,000.
apptitude ;
some puzzles r given around 9, study well it is
easy,
for it they provide 20 min00110
Elico Questions
*16 ppl can do a work in 3 hrs?, how much time vil 5 ppl take?
* 185 miles. travelled in bus for 2 hrs a dist of 85. in how much time, he need to travel the
ramaining 100 miles, if he need to get an average of 50 miles per hr.
*efface=? : similer word
* a 6 mtrs wide road is laid around a garden. rad area is 564sq mtsr. if the length of the
garden is 20 mtrs?, wat is the width of it.
*Woman said pointing to a guy " his mother is the only daughter of my mother"
* a 2 digit no, the diff of its digits is one twelth of it. Find sum of the 2 digits
-data insufficient
-6
-8
-10
-none
Cpp
* #include
main()
{
int x=20, t;
&t=x;
x=50;
cout<<x<<" "<<t;
}
o/p?
50 20
t
----*include<iostream.h>
int sum(int a, int b=5, int c=10);
main()
{
cout<<sum(5)<<endl<<sum(10,5)<<endl<<sum(5,10,10);
}
int sum(int a, int b, int c)
{ return a+b+c;}
ans?
20 25 25
-----* #include
main()
{
int x=20, &t;
&t=x;
int &tt;
cout<<x<<" "<<t;
}
o/p?
compile time error, as all references must b initialisded.
------
b) Defect Found -> Defect Debugged -> Defect Reported -> Defect Rechecked ->
DefectClosed
c) Defect Debugged -> Defect Found -> Defect Closed -> Defect Reported ->
DefectRechecked
d) Defect Found -> Defect Logged -> Defect Debugged -> Defect Rechecked ->
Defect Closed
2.
Which group does Winrunner ,Load Runner ,SQA Suite fall under ?
a) Databases
b) Automated Test Tools
c) Operating Systems
3.
4.
d) 9
Which of the following statements is true when a derivation inherits both a virtual and
non-virtual instance of a base class ?
a) Each derived class object has base objects only from the non virtual instance
b) Each base class object has derived objects only from the non-virtual instance
c) Each derived class object has base objects only from the virtual instance
5.
d) Each derived class object has a base object from the virtual instance and a base
object from non-virtual instance.
class Word
{
public:
Word(const char*,int = 0);
};
Referring to the sample code above what is the minimum number of arguments
required to call the constructor ?
a) 0
b) 1
c) 2
6.
d) 3
Which one of the following represents a correct and safe declaration of NULL ?
a) typedef((void *)0) NULL;
b) typedef NULL(char *)0;
c) #define NULL((void *)0)
7.
d) #define NULL((char*)0)
#include <iostraem>
Referring to the sample code above ,which of the following could you use to make the
standars I/O Stream classes accessible without requiring the scope resolution operator
?
a) using namespace std::iostream
b) using namespace std;
c) using namespace iostream ;
8.
d) using iostream;
Which one of the following statements allocates enough space to hold an array of 10
integers that are initialized to 0 ?
a) int *ptr = (int *) calloc(10,sizeof(int));
b) int *ptr = (int *) alloc( 10*sizeof(int));
c) int *ptr = (int *) malloc( 10*sizeof(int));
9.
d) gets()
10. What is the largest value an integer can hold in a Standard C compiler ?
a) 32767
b) 65536
c) 2147483647
d) INT_MAX
11. With every use of memory allocation function should be used to release allocated
memory which is no longer needed ?
a) dropmem()
b) dealloc()
c) release()
d) free()
12. int a=1;
int ab=4;
int main()
{
int b=3,a=2;
printf("%i*/%i*/%*/i",a,b,ab);
}
13. kernal execute the first process when system is start--ans :- init();
14. process id of kernal
(a) 1
(b) 0
(c) 2
(d) none
15. Which one of the following represents a correct and safe declaration of NULL ?
a) typedef((void *)0) NULL;
b) typedef NULL(char *)0;
c) #define NULL((void *)0)
d) #define NULL((char*)0)
16. Which one of the following statements allocates enough space to hold an array of 10
integers that are initialized to 0 ?
a) int *ptr = (int *) calloc(10,sizeof(int));
b) int *ptr = (int *) alloc( 10*sizeof(int));
c) int *ptr = (int *) malloc( 10*sizeof(int));
d) int *ptr = (int *)calloc(10*sizeof(int));.
After written ,group discussion and interview will be there
Topics for group discussion:
1.
2.
3.
4.
5.
Ramco
Directions: Each of the following question has a question and two statements labelled as (i)
and (ii). Use the data/information given in (i) and (ii) to decide whether the data are sufficient
to answer the question record your answer as
A) If you can get the answer from (1)alone but not from (2)
B) If you can get the answer from (2)alone but not from (1)
C) If can get the answer from (1)and (2)together ,although neither statement by
itself suffice
D) If statement (1)alone suffices and statement (2) alone also suffice.
E) If can't get the answer from statements (1) and (2) together and you need more
data.
1.
2.
3.
4.
5.
7.
There are two figures viz., a circle and a square. Which having greater area?
1) Perimeter of the circle is the same as the perimeter of the square.
2) Eleven times the radius is equal to seven times the length of one side of the square.
Ans: D
8.
A candidate who was found to be under weightin medical test had been selected
provisionally subject to his attainment of 60Kg weight within one year. What should be
the percentage increase of his weightso that selection is confirmed after one year.
1) Weight (Kg)=16+8 Height (ft) is standard equation for the Indian population. The
candidates height is 5.5
2) His present weight is 55Kg.
Ans: D
9.
Is angle =90
1) sin**2()+cos**2()=1
2) sin**2()-+cos**2()=1
Ans: E
10. What will be the average age of workers of an Institution after two years?
1) Present average age is 35 years
2) There are total 20 workers in the Institution
Ans: A
11. Is AB>AM ( A Triangle is given )
1) AB<AC
2) M is any point other than B and C on BC
Ans: E
12. Is X^2+Y^2<X+Y?
1) 0<X<1
x,y>0 <![endif]>
Technical Questions
21. Find the output for the following C program
main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
Ans. An empty string
22. Find the output for the following C program
main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
}
Ans. 57 94
23. Find the output for the following C program
main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
Ans. 5 20 1
24. Find the output for the following C program
#define swap1(a,b) a=a+b;b=a-b;a=a-b;
main()
{
int x=5,y=10;
swap1(x,y);
printf("%d %d\n",x,y);
swap2(x,y);
printf("%d %d\n",x,y);
}
int swap2(int a,int b)
{
int temp;
temp=a;
b=a;
a=temp;
return;
}
Ans. 10 5
25. Find the output for the following C program
main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
Ans. Samco Systems
26. Find the output for the following C program
#include<stdio.h>
main()
{
char s1[]="Ramco";
char s2[]="Systems";
s1=s2;
printf("%s",s1);
}
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}
Ans. RamcoSystems
28. Find the output for the following C program given that
[1]. The following variable is available in file1.c
static int average_float;
Ans. All the functions in the file1.c can access the variable
29. Find the output for the following C program
# define TRUE 0
some code
while(TRUE)
{
some code
}
Ans. This won't go into the loop as TRUE is defined as 0
30. Find the output for the following C program
main()
{
int x=10;
x++;
change_value(x);
x++;
Modify_value();
printf("First output: %d\n",x);
}
x++;
change_value(x);
printf("Second Output : %d\n",x);
Modify_value(x);
printf("Third Output : %d\n",x);
}
Modify_value()
{
return (x+=10);
}
change_value()
{
return(x+=1);
}
Ans. 12 1 1
31. Find the output for the following C program
main()
{
int x=10,y=15;
x=x++;
y=++y;
printf("%d %d\n",x,y);
}
Ans. 11 16
32. Find the output for the following C programmain()
{
int a=0;
if(a=0) printf("Ramco Systems\n");
printf("Ramco Systems\n");
}
Ans. Ony one time "Ramco Systems" will be printed
33. Find the output for the following C program
#include<stdio.h>
int SumElement(int *,int);
void main(void)
{
int x[10];
int i=10;
for(;i;)
{
i--;
*(x+i)=i;
}
printf("%d",SumElement(x,10));
}
int SumElement(int array[],int size)
{
int i=0;
float sum=0;
for(;i<size;i++)
sum+=array[i];
return sum;
}
34. Find the output for the following C program
#include<stdio.h>
void main(void);
int printf(const char*,...);
void main(void)
{
int i=100,j=10,k=20;
-- int sum;
float ave;
char myformat[]="ave=%.2f";
sum=i+j+k;
ave=sum/3.0;
printf(myformat,ave);
}
35. Find the output for the following C program
#include<stdio.h>
void main(void);
{
int a[10];
printf("%d",((a+9) + (a+1)));
}
print(i,fn);
}
void print(int i,int (*fn1)())
{
printf("%d\n",(*fn1)());
}
int fn(void)
{
return(i-=5);
}
39. Find the output for the following C program
#include<stdio.h>
void main(void);
{
char numbers[5][6]={"Zero","One","Two","Three","Four"};
printf("%s is %c",&numbers[4][0],numbers[0][0]);
}
40. Find the output for the following C program
int bags[5]={20,5,20,3,20};
void main(void)
{
int pos=5,*next();
*next()=pos;
printf("%d %d %d",pos,*next(),bags[0]);
}
int *next()
{
int i;
for(i=0;i<5;i++)
if (bags[i]==20)
return(bags+i);
printf("Error!");
exit(0);
}
41. Find the output for the following C program
#include<stdio.h>
void main(void)
{
int y,z;
int x=y=z=10;
int f=x;
float ans=0.0;
f *=x*y;
ans=x/3.0+y/3;
printf("%d %.2f",f,ans);
}
42. Find the output for the following C program
#include<stdio.h>
void main(void);
{
double dbl=20.4530,d=4.5710,dblvar3;
double dbln(void);
dblvar3=dbln();
printf("%.2f\t%.2f\t%.2f\n",dbl,d,dblvar3);
}
double dbln(void)
{
double dblvar3;
dbl=dblvar3=4.5;
return(dbl+d+dblvar3);
}
43. Find the output for the following C program
#include<stdio.h>
static int i=5;
void main(void)
{
int sum=0;
do
{
sum+=(1/i);
}while(0<i--);
}
44. Find the output for the following C program
#include<stdio.h>
void main(void)
{
int oldvar=25,newvar=-25;
int swap(int,int);
swap(oldvar,newvar);
printf("Numbers are %d\t%d",newvar,oldvar);
}
int swap(int oldval,int newval)
{
int tempval=oldval;
oldval=newval;
newval=tempval;
}
45. Find the output for the following C program
#include<stdio.h>
void main(void);
{
int i=100,j=20;
i++=j;
i*=j;
printf("%d\t%d\n",i,j);
}
46. Find the output for the following C program
#include<stdio.h>
void main(void);
int newval(int);
void main(void)
{
int ia[]={12,24,45,0};
int i;
int sum=0;
for(i=0;ia[i];i++)
{
sum+=newval(ia[i]);
}
printf("Sum= %d",sum);
}
int newval(int x)
{
static int div=1;
return(x/div++);
}
47. Find the output for the following C program
#include<stdio.h>
void main(void);
{
int var1,var2,var3,minmax;
var1=5;
var2=5;
var3=6;
minmax=(var1>var2)?(var1>var3)?var1:var3:(var2>var3)?var2:var3;
printf("%d\n",minmax);
48. Find the output for the following C program
#include<stdio.h>
void main(void);
{
void pa(int *a,int n);
int arr[5]={5,4,3,2,1};
pa(arr,5);
}
void pa(int *a,int n)
{
int i;
for(i=0;i<n;i++)
printf("%d\n",*(a++)+i);
}
49. Find the output for the following C program
#include<stdio.h>
void main(void);
void print(void);
{
print();
}
void f1(void)
{
printf("\nf1():");
}
50. Find the output for the following C program
#include "6.c"
void print(void)
{
extern void f1(void);
f1();
}
static void f1(void)
{
printf("\n static f1().");
}
51. Find the output for the following C program
#include<stdio.h>
void main(void);
static int i=50;
int print(int i);
void main(void)
{
static int i=100;
while(print(i))
{
printf("%d\n",i);
i--;
}
}
int print(int x)
{
static int i=2;
return(i--);
}
52. Find the output for the following C program
#include<stdio.h>
void main(void);
typedef struct Ntype
{
int i;
char c;
long x;
} NewType;
void main(void)
{
NewType *c;
c=(NewType *)malloc(sizeof(NewType));
c->i=100;
c->c='C';
(*c).x=100L;
printf("(%d,%c,%4Ld)",c->i,c->c,c->x);
}
53. Find the output for the following C program
#include<stdio.h>
void main(void);
const int k=100;
void main(void)
{
int a[100];
int sum=0;
for(k=0;k<100;k++)
*(a+k)=k;
sum+=a[--k];
printf("%d",sum);
}
int compute(int n)
{
if(n>0)
{
n=compute(n-3)+compute(n-1);
return(n);
}
return(1);
}
void main()
{
printf("%d",compute(5));
}
(a) 6
(b) 9
(c) 12
(d) 13
6.What is the output of the following code:void main()
{
int i;
for(i=0;i<3;i++)
{
int i=100;
i--;
printf("%d..",i);
}
}
(a0..1..2..
(b)99..98..97..
(c)100..100..100..
(d)99..99..99..
7.What is the output of the following code:void main()
{
int a[]={9,4,1,7,5};
int *p;
p=&a[3];
printf("%d",p[-1]);
}
(a)6
(b)1
(c)7
(d)Error
8.What is the output of the following code:-
void main()
{
int a[]={10,20,30,40,50};
int *p;
p= (int*)((char *)a + sizeof(int));
printf("%d",*p);
}
(a)10
(b)20
(c)30
(d)40
9.Which code will run faster
for(i=0;i<100;i++)
for(j=0;j<10;j++)
a[i][j]=0;
OR
for(j=0;j<10;j++)
for(i=0;i<100;i++)
a[i][j]=0;
(a)First code
(b)Second code
(c)Same
(d)Compiler and hardware dependent
Aptitude
-------1.How many 2 digit numbers are there which have 8 as the unit number in it's square.
(a)3
(b)None
(c)2
(d)1
2. B is 8km East of A. C is 6km North of B. D is 12km East of C. E is 16km North of D. What is
the distance b/w A and E.
(a)20km
(b)22km
(c)18km
(d)30km
3. x+y = z
Then
(a)...
(b)y<Z
(c)...
4. 2<X<y<8
Then which is the greatest
(a) (x^2)y
(b) 5xy
(c) x(y^2)
(d) 5(x^2)y/12
5. A is taller than B, D is taller than D, D is shorter than E.Then which of the following is
correct.
(a) C is taller than E
(b) A is taller than C
(c) D is shorter than A
(d) B is shorter than C
6.A small passage was given and 4 options which summarizes it was given.The best was to be
chosen.
7.Another passage was given and 4 inference was given and correct was to be chosen.This
one is very easy.
8.Which of the following is a parellogram:(a)130,50,130,50(angle in deg)
(b)120,30,130,20
(c)90,90,90,90
(d)a & c
9. In the following series (an - 1)^2, 1 is the first term.Which are the next three
(a)1,3,4
(b)0,3,6
(c)0,1,2
(d)0,1,0
Computer science
---------------1.Deadlock occur when
(a)Some resources are held up by some process.
(b)...
(c)...
(d)None of these
2. A prefix expression can be equal to a postfix expression reversed only if
(a)It is left associative
(b)It is commutative
(c)It is right associative
3.How many lines will be printed in the following
Pascal pgm [I don't remember the Pascal version,so I am giving C version]
void print(int n)
{
if(n>0)
{
print(n-1);
printf("%d",n);//println(n) in Pascal version.
print(n-1);
}
}
(a)3
(b)7
(c)15
(d)31
4.Maximum number of nodes in a tree with n levels.
(a)2^(n-1)
(b)(2^n)-1
(c)2^(n-1) - 1
5.Complete graphwith n nodes have
(a)n-1 edges
(b)n(n-1)/2
6.If d is the degree of a node in a graph and n is number of vertices then number of edges in
that graph is
(a)Edi^n
(b)0.25Edi
(c)0.5Edi
7.A grammar was given and 4 strings was given and the one which was not possible was to be
chosen.
8.A problem related to ethernet in which a station sending a frame is of p probablity.There are
m stations to send pckts.4 option was given.It was a mathematical kind of question related to
probablity.
9.Which of the following layer in the OSI model does error handling
(a)Data link
(b)Network
(c)Transport
(d) a & c
10.A network problem in which Data rate,Propagation delay,and distance was given and it was
to find how many packets will be in the line. Choices where
(a)5000
(b)Not possible to find with given data
(c)1000
A
Interview [For CS students]
--------There is Tech as well as HR interview. Tech interview is the important one.
Tech interview questions
-----------------------They will ask about the project.They will ask general questions about it and most probably
will not go into
the implementation part of it.So one must have a general idea about the project done.
- Introduce yourself
- Why should we take you
- What you know about Sasken and etc.
bubble sorting is
.c++ supports
no of comparisons = _________
no of exchanges = ____________
4.
Insertion sort
no of comparisons = _________
no of exchanges = ____________
5.
what is a language?
a) set of alphabets
b)set of strings formed from alphabets
c)............
d)none of the above
6.
Which of the following is not conducive for linked list implementation of array
a)binary search
b)sequential search
c)selection sort
d)bubble sort
9.
a)dynamic_cast
b)static_cast
c)const_cast
d)reintrepret_cast
10.
a)it is an undirected graph with vertex representing activities and edges representing
precedence relations
b)it is an directed graph "" "" """ "" "" "" "" "" "
c)........
d).......
11.
12.
13.
char *p="abcdefghijklmno"
then printf("%s",5[p]);
14.
15.
void main()
{
int a=5,b=10;
int &ref1=a,&ref2=b;
ref1=ref2;
++ ref1;
++ ref2;
cout<<a<<b<<endl;
} value of a and b
a)5 and 12
b)7 and 10
c)11 and 11
d)none of the above
17.
f(int n)
{
return n<1?0:n==1?1:f(n-1)+f(n-2)
}
hint:this is to generate fibonacci series
code for finding out whether a string is a palindrome,reversal of linked list, recursive
computation of factorial with
blanks in the case of some variables.we have to fill it out
18.
palindrome(char * inputstring)
{
int len=strlen ( ?);
int start= ?;
end =inputstring + ?-?;
for(; ?<end && ?==?;++ ?,--?);
return(?==?); }
we have to replace the question marks(?) with corresponding variables
19.
The exam was of 1:45 and consisted of C,C++,DataStructures, total 4(5 Marks)... but I
couldn't get thru....
Note that the code or the values may not be correct.... Just get the concept.
Predict the o/p... each 1 mark
1.
static int i;
{
i=10;
...
}
printf("%d",i);
Ans: 10
2.
#define func1(a) #a
#define func2(a,b,c) a##b##c
printf("%s",func1(func2(a,b,c)))
Ans: func2(a,b,c)
3.
const int* ptr;
int* ptr1;
int a=10;
const int p=20;
ptr=a;
ptr1=p;
4.
class a
virtual disp()
{ printf("In a");}
class b:public a
disp()
{ printf("In b");}
class c:public a
disp()
{ printf("In c");}
main()
{
a obj;
b objb;
c objc;
a=objb;
a.disp();
a=objc;
a.disp();
Ans: "In a" "In a"
5.
a="str";
char *b="new str";
char *temp;
malloc(sizeof(temp)+1,....
strcpy(a,temp);
malloc(sizeof(b)+1,....
strcpy(temp,b);
6.
int m,i=1,j=0,k=-1;
m=k++||j++&&i++;
printf("%d...",m,i,j,k);
7.
class x
{
double b;
double *l;
float &c;
}
main()
{
double g=10.34;
double *f=1.3;
float k=9;
x o;
o.b=g;
o.l=f;
o.c=k;
}
Ans: Compiler Error
Write C/C++ code for following:
For all the probs, u will have decide on wht DS to use.... and u'r program must be
efficient...explain in detail... (5 Marks)
1. Find the Kth smallest element in a Binary Tree. (5 Marks)
2. Each worker does a job and is given a rating +ve,-ve or Zero.
Find the MaxSubSequenceSum for given no. of workers.
Ex: Workers=6; Ratings={1,0,-1,4,5,-3}
MaxSubSequenceSum=4+5=9 (5 Marks)
3. 1 to N ppl sitting in a circle. Each one passes a hot potato to the next person. After M
passes the person holding the potato is eliminated. The last person remaining is winner. Find
winner for given N,M.
Ex: N=5, M=2, Winner=4 (5 Marks)
4. Reverse a given Linked List. (5 Marks)
5. There is a file called KnowledgeBase.txt which contains some words. Given a sub-string u
have to find all the words which match the word in the file.
Ex: file contains a, ant, and, dog, pen.
If I give "an" I should get o/p as "ant, and" (10 Marks)
6. Company employee have id,level,no. of sub-ordinates under him...
If a emp leaves then his sub-ordinates are assigned to any of the emp's seniors...
Write four functions:
DSQ PAPER
Techanical paper
Questions 1 -5 are reference to the followig psedo code
{
input m,n,z
TEST:if ((m+n)/3>5)z=z+1 else z =z-1
printf m,n,z
{
(m-m+1;n=n-3)
if (m+n+2)>14 then goto test
print m,n,z
end
}
1. what is the final output of the if the input is 2,14,12 (m,n,z)
a)1,8,4 b)1,4,8 c)4,8,1 d)8,4,2
ans=C.
2. what is the final output if the input is 1,18,2? (m,n,z)
ans) 5,6,2 i.e ans =c.
3. How many times is TEST execute ed if the input is 2,14,1?
ans) twice ans=c.
4) How many times the TEST exected if the input is 1,18,2?
ans)four times
5) what are the values taken by Z when input being 8,24,1?
a)only 5 b)only 6 c)neither 5 or 6 d)both 5 and 6
ans)D.
6) the function f(x) is defined as follows
if x=0 then f(x) =1
if x>0 then if ((x>10)then f(x) =x-10 else f(x) =x+1))
if x<0 then if (x**2 <100) then f(x) =f(-x+1) else f(x) =f(-(x+1))
6) the above of f(2) +f(-3) is
ans=8.
7) the value of f(8)+f(9) is
ans=20
8) the value of f(1)+f(2)+f(3).............+f(10) is
ans=65
9) the value of f(-10)+f(-9)+f(-8) is
a) 33 b)25 c)-27 d)27
11. 1997 haeadecimal is
a)7cb b)7cd c)7cf d)7ca
ans-c
12. the remainder when 9FA (hexa) is divided by 8 is added to the
12(to base ten) to get x.then x has the binary opertion
ans=1110
13. the remainder when 1221 (in hexa) is diveded by 17(decimal) in (hexa)is
ans=0
14. The binary number 100010011 will the hexa representation
ans=113
int j=4;
int k=34;
i=j+k;
while(times --)
{
i=times
j=times
k=times
}
printf("%d %d %d " ,i,j,k)
}
THe output of the praogram is (i,j,k)
a)19,9,35 b)38,42,80 c)43,47,85 d)15,14,41
ans=C
26) main()
{
int num =32765;
while (num++);
printf(" %d ",num)
}
what"s the out put ofthe program
a)prints all the number above 32765 including the number 32765
b)prints all the number above 32765 excluding the number 32765
ans=B.
27) main()
{
float k=3.4156
printf("%f %f ",float(k),c(k))
}
The output of the program
a) 3.4156 ,3.4156 b)4,5 c)3,4 d)3.45 3.40
ans=C.
28) main()
{
int bounce =4;
printf ("total number of bounce =%d",bounce ++);
}
The out put of the program is
ans=D (stoP)
29) main()
{
int number =25;
char name ='A'
printf("The addition of the name and the number is %o "name +_number)
}
the output of the program is
a)compiler error
b)run time error
ans= A
30)
31) ODBC means
ans= open data base connectivity
32) ASCII stands for
ans= american standard for information interchange
33)
34) flops stands for
ans)floating point operation per second
35) by superconductivity
ans)
36) PERT stands for
Program evalution and review techniq
37) IMS is a
ans) data base system
38) HTML is a
ans) Hyper text markup language
39) The default backend of visual basic is
ans)sybase
40) Client server is based on
ans) distribution processing
44) computer viruses can spread from one system to anther by means of
a) infected disks b)links to a network
c)downloaded program from a bulletin boardd)all of the program
ans)D
45) A front end processor is usually used in
ans=multi processing.
46) A radio active material of mass 16gms loses in 10 years due to
radiation.How many more years will take for the material to attain a
mass of of 1gm ?
ans=80 years
47) A block of ice floats on water in a beaker as the melts the water
level n the beaker will remain the same
ans=Remains same.
48) if va,vn,vs are velocities of sound in a air ,water ,and steel then
ans)vs>vn>va
49) in usual computer arthimetic the value of the integer expression
22/5*2+8*2/6
ans= 8.
50) an operting system is a
a)file manager b)memory manager
c)i/o manager d)all of the above
ans=D.
1.
int b=10;
int *p=&b;
*p++;
printf("%d",*p);
what is the output?
2.
3.
4.
main()
{
char *a="hello";
char *b="bye";
char *c="hai";
int x=10,y=100;
c=(x<y>)?a:b;
printf("%s",c);
}
whats the output?
5.
void main()
{
int a,b;
a=sumdig(123);
b=sumdig(123);
printf("%d %d",a,b);
}
int sumdig(int n)
{
static int sum;
int d;
if(n!=0)
{
d=n%10;
n=(n-d)/10;
sum=sum+d;
sumdig(n);
}
else
return s;
}
what is the output?
6.
7.
C++
8.
class A
{
public:
A()
{
}
~A();
};
class derived:public A
{
derived();
};
what is wrong with this type of declaration?
9.
10.
11.
13.
14.
15.
16.
18.
char *str;
19.
20.
There is a base class sub, with a member function fnsub(). There are
two classes super1 and super2 which are subclasses of the base class sub.
if and pointer object is created of the class sub which points to any
of the two classes super1 and super2, if fnsub() is called which one
will be inoked?
i2 Technologies
Q1.Convert 0.9375 to binary
a) 0.0111
b) 0.1011
c) 0.1111
d) none
Ans. (c)
Q2.( 1a00 * 10b )/ 1010 = 100
a) a=0, b=0
b)a=0, b=1
c) none
Ans. (b)
Q3. In 32 bit memory machine 24 bits for mantissa and 8 bits for exponent. To increase the
range of floating point.
a) more than 32 bit is to be there.
b) increase 1 bit for mantissa and decrease 1 bit for exponent
c) increase 1 bit for exponent and decrease one bit for mantissa
Q4.In C, "X ? Y : Z " is equal to
a) if (X==0) Y ;else Z
b) if (X!=0) Y ;else Z
c) if (X==0) Y ; Z
Ans. (b)
Q5. From the following program
foo()
int foo(int a, int b)
{
if (a&b) return 1;
return 0;
}
a) if either a or b are zero returns always 0
b) if both a & b are non zero returns always 1
c) if both a and b are negative returns 0
Q6. The following function gives some error. What changes have to be made
void ( int a,int b)
{
int t; t=a; a=b; b=t;
}
a) define void as int and write return t
b) change everywhere a to *a and b to *b
Q7. Which of the following is incorrect
a) if a and b are defined as int arrays then (a==b) can never be true
b) parameters are passed to functions only by values
c) defining functions in nested loops
Q8. include<stdio.h>
void swap(int*,int*);
main()
{
int arr[8]={36,8,97,0,161,164,3,9}
for (int i=0; i<7; i++)
{
for (int j=i+1; j<8;j++)
if(arr[i]<arr[j]) swap(&arr[i],&arr[j]);
}
}
void swap(int*x,int*y)
{
int temp; static int cnt=0;
temp= *x;
*x=*y;
*y=temp;
cnt++;
}
What is cnt equal to
a) 7
b) 15
c) 1
d) none of these
Q9.
int main()
{
FILE *fp;
fp=fopen("test.dat","w");
fprintf(fp,'hello\n");
fclose(fp);
fp=fopen ("test.dat","w");
fprintf (fp, "world");
fclose(fp);
return 0;
}
If text.dat file is already present after compiling and execution how many bytes does the file
occupy ?
a) 0 bytes
b) 5 bytes
c) 11 bytes
d) data is insufficient
Q10.
f1(int*x,intflag)
int *y;
*y=*x+3;
switch(flag)
{
case 0:
*x=*y+1;
break;
case 1:
*x=*y;
break;
case 2:
*x=*y-1;
break;
}
return(*y)
main()
{
*x=5;
i=f1(x,0); j=f1(x,1);
printf("%d %d %d ",i,j,*x);
}
What is the output?
a) 8 8 8
b) 5 8 8
c) 8 5 8
d) none of these
Each question had 5 options.There were 25 question in all and all were Objective Type.
1
You have written a code in C++, and u have to use a C library , what would u do?
(Ans: write extern "c" in header files)
void main()
{
int x=1;
int y=1;
int i;
for(i=2;i<=100;i++)
{
x=x+i;y=y*(i+1)/(i-1);
}
What are the values of x & y?
If we carry out operation (-3)+(-6),then which of the what will be the value of carry
if(a[i]>a[j])
k++;
else
j--;
}
How many times the loop will occur?
7
void main()
{
int a[]={5,4,3,2,1};
int x,y;
int *p=&a[2];
*p++;
x=++*p;
y=*(p++);
printf("%d %d",x,y)'
}
What will be the value of x and y?
10
11
12
13
needed to search an
element?
14
15
A C++ class has multiple references to base class.Then some options were given?
16
for(i=0;i<20;i++)
{
a[i]=i;
}
for(i=0;i<20;i++)
{
a[i]=a[19-i];
}
What is final value of array a? Options were there.
17
18
Two dices are thrown.What is the probality that the the number on the first dice is
greater or equal to
number on the second dice?
Optimize the below 1,2,3,4 questions for time:
1)
int i;
if i=0 then i:=1;
if i=1 then i:=0;
2)
int i;
if i=0 then i:=1;
if i=1 then i:=0;
(given that i can take only two values (1,0))
3)
int i;
if i=0 then i:=1;
else if i=1 then i:=0;
(given that i can take only two values (1,0))
4)
int m,j,i,n;
for i:=1 to n do
m:=m+j*n
5) Expand the following
a) ISDN
b) CASE
c) CSMA/CD
d) OOPS
e) MIMD
6) In the following questions, answer A,B,C,D depending on when
the errors are detected?
A if no error is detected
B if semantic and syntactic checking
C if during Code genration & Symbol allocation
D run time
a) Array overbound
b) Undeclared identifier
c) stack underflow
d) Accessing an illegal memory location
7) How many page faults will occur for below sequence of pages when LRU
page replacement algorithm is used ( The memory can only have 3pages):
1,2,3,4,2,1,5,2,4 (something like that)
1.
main()
{
int i=1;
switch(i)
{
case 1:
printf("\nRadioactive cats have 18 half-lives");
break;
case 1*2+4:
printf("\nBottle for rent -inquire within");
break;
}
}
Ans. No error. Constant expression like 1*2+4 are acceptable in cases of a
switch.
2.
program
main()
{
int a=10,b;
a>= 5 ? b=100 : b=200;
printf("\n%d",b);
}
Ans. lvalue required in function main(). The second assignment should be written
in parenthesis as follows:
a>= 5 ? b=100 : (b=200);
3.
4.
main()
{
int i=4;
switch(i)
{
default:
printf("\n A mouse is an elephant built by the
Japanese");
case 1:
printf(" Breeding rabbits is a hair raising experience");
break;
case 2:
printf("\n Friction is a drag");
break;
case 3:
printf("\n If practice make perfect, then nobody's perfect");
}
}
a) A mouse is an elephant built by the Japanese b) Breeding rabbits is a hare
raising experience
c) All of the above d) None of the above
5.
reported?
1. #define CIRCUM(R) (3.14*R*R);
2. main()
3. {
4. float r=1.0,c;
5. c= CIRCUM(r);
6. printf("\n%f",c);
7. if(CIRCUM(r))==6.28)
8. printf("\nGobbledygook");
9. }
a) line 1 b) line 5 c) line 6
7.
d) line 7
8.
#include<stdio.h>
main()
{
FILE *fp;
fp= fopen("trial","r");
}
fp points to:
a) The first character in the file.
b) A structure which contains a "char" pointer which points to the first character
in the file.
c) The name of the file. d) None of the above.
9.
b) C:\MYPROG.EXE 1 2 3
If the following program (myprog) is run from the command line as myprog
b) 6 c) error d) "123"
If the following program (myprog) is run from the command line as myprog
{
while(--argc >0)
printf("%s",*++argv);
}
a) myprog monday tuesday wednesday thursday
b) monday tuesday
wednesday thursday
c) myprog tuesday thursday d) None of the
above
13.
main()
{
const int x;
x=128;
printf("%d",x);
}
Ans. x should have been initialized where it is declared.
15.
main()
{
int y=128;
const int x=y;
printf("%d",x);
}
a) 128 b) Garbage value c) Error d) 0
16.
declarations?
const char *s;
char const *s;
Ans. No difference
17.
main()
{
char near * near *ptr1;
char near * far *ptr2;
char near * huge *ptr3;
printf("%d %d %d",sizeof(ptr1),sizeof(ptr2),sizeof(ptr3));
}
a) 1 1 1
18.
b) 1 2 4
c) 2 4 4
d) 4 4 4
If the following program (myprog) is run from the command line as myprog
b) f c) myprog d) friday
If the following program (myprog) is run from the command line as myprog
If the following program (myprog) is run from the command line as myprog
main()
{
int a=10;
void f();
a=f();
printf("\n%d",a);
}
void f()
{
printf("\nHi");
}
Ans. The program is trying to collect the value of a "void" function into an
integer variable.
22.
main()
{
int a[]={10, 20, 30, 40, 50};
char *p;
p= (char*) a;
}
Ans. printf("\n%d",*((int*)p+4));
23.
main()
{
int a=10,*j;
void *k;
j=k=&a;
j++;
k++;
printf("\n%u%u",j,k);
}
a) Yes b) No, the format is incorrect
c) No, the arithmetic operation is not permitted on void pointers
d) No, the arithmetic operation is not permitted on pointers
24.
f(int a, int b)
{
int a;
a=20;
return a;
}
a) missing parenthesis in the return statement b) The function should be declared
main()
{
const char *fun();
*fun()='A';
}
const char *fun()
{
return "Hello";
}
Ans. fun() returns to a "const char" pointer which cannot be modified
27.
main()
{
const int x=5;
int *ptrx;
ptrx=&x;
*ptrx=10;
printf("%d",x);
}
a) 5
28.
main()
{
printf("\nSonata Software");
main();
}
a) infinite loop
31.
main()
{
int n=5;
printf("\nn=%*d",n,n);
}
a) n=5
b) n=5
c) n= 5 d) error
MODE: CAMPUS
COLLEGE: Government Engineering College, Aurangabad
RECRUITMENT FOR: Development/Testing
The test consisted of a 1hr technical objective
questions and 1hr ,Programming test. Tech. Qs
There were six sections and each consist of 5qs.
A.
Computer Algorithms
1. Time Complexity
2. Which of the following cannot be implemented
efficiently in Linear Linked
List
1. Quicksort
2. Radix Sort
3. Polynomials
4. Insertion Sort
5. Binary Search
3. In binary search tree , n=nodes, h=height of tree.
What's complexity?
1. o(h)
2. o(n*h)
3. o(nLogn)
4. o(n*n)
5. None
4.
5.
B.
C Programs
1. Printf("%d%d",i++,i++);
1. Compiler Dependent
2. 4 4
3. 4 3
4. 3 4
5. None of Above
2. void main()
{
printf("persistent");
main();
}
1. Till stack overflows
2. Infinite
3. 65535
4. 34423
5. None
3. Swapping
4. what does it do?
void f(int n)
{
if(n>0)
{
if(A[i]>A[j])
swap();
}
else
f(n-1);
}
1. Swap
2. Sort in Ascending order
3. Sort in Descending order
4. Computes permutation
5.
5. Given a Fibonacci function
f1=1;f2=1
fn=f(n-1)+f(n-2) which of the following is true?
1. Every Second element is even
2. Every third element is odd
3. The series increases monotonally
4. For n>2, fn=ceiling(1.6 * f(n-1))
5. None
C.
Operating System
3. In Main memory
4. At a fixed location on Disk
5. At fixed location on System Disk
2. Problem on Concurrency
3. Problem on Round Robin Algorithm
4.
5.
D.
General
Theory
1. If a production is given
S -> 1S1
0S0
00
11
Then which of the following is invalid
1. 00101010100
2.
3.
4.
5.
2. Context free grammar cannot recognize
1. if-then-else
2. var
3. loops
4. syntax
5. None
3.
4.
5.
F.
DBMS
READ(X) READ(Y)
... ...
1. The problem is serializable
2. The problem is not serializable
3. It can be run in parallel
4.
5. None
PROGRAMMING SECTION
hour.)
A sparse matrix is a matrix in which a node with val=0 is not represented. The whole
matrix is represented by a Linked list where node typedef struct Node
{
int row;
int col;
int value;
sparsematrix next;
} Element, *sparsematrix;
The problem is, if there are two matrix given suppose m1 and m2, then add them and
return the resultant sparsematrix.
If suppose there are N functions say from 0,1,2,... N-1 and it's given that A[i][j]=1 if the
function i contains a call to
func. j otherwise A[i][j]=0, then write a function that will form groups of related functions
and print them line by line and at the end print the number of total groups
Enter Your CommentsThere were 24 questions.The questions are....
1.
2.
3.
macro question....#ifdefine.....#endif.
4.
5.
6.
7.
8.
9.
int i;
for(i=0;i<6;i++)
{
printf("%d",n[i]);
}
What is the output of the above program?
(2m)
q5)
Find the output of the following program,
#define swap(x,y) x=x+y;y=x-y;x=x-y;
void main()
{
int x=5,y=10;
swap(x,y);
printf("%d %d",x,y);
swap1(x,y)
printf("%d %d",x,y);
}
int swap1(int x,int y);
{
int temp;
temp =x;
x=y;
y=temp;
return 0;
}
(2m)
q6)
Consider the following code snippet,
void main()
{
char s=127;
unsigned char u;
s++;
}
(a) is s > 127?
(b) is s < u?
(1m)
q7) Write a function which compares two strings ending with a null character which
returns '0' when they are same and '-1' when they are not same? U should not use strcmp()
function.
(2m)
After the written test was over we waited for results for a long time. And only 11
cleared. Hope there was Sectional Cut-off. If u r preparing for this company, then kindly
concentrate on 'C' well. Moreover the solution, they see ur approach for solving the problem.
All the Best!!!!
Prodex Paper
1.x=3
function(++x)...value 4 is passed to the function
2 x=3
function(x++)...value 3 is passed to the function
3.some ques on file opening...
if(name)..(exixts)
{
...
} the file can be opened
4.if(!name)...(not exixts)
{
...
7. _________ is a point at which the debugger stops during program execution and awaits a
further command.
Memory Dump
Watch point<------ans
Break point
None of these options
8. ________do not contain any program logic and are ignored by the language Processor
Protocol
Virus
Comment
None of these options
9. The component of data base management system is ________
Data definition Language
Data manipulation Language
Data definition Language and Data manipulation Language
None of these options
10. The quality of Algorithm is judged on the basis of_________
Time requirement
Memory Requirement
Accuracy of solution
All of these options<------ans
11. Advantages of using flow charts is
Effective Analysis
Efficient Coding
Time consuming
Effective Analysis and Efficient Coding<-----ans
Programming in C
12. The Real constants in C can be expressed in which of the following forms
Fractional form only
Exponential form only
ASCII form only
Both Fractional and Exponential forms<------ans
13. The program, which translates high-level program into its equivalent machine language
program, is called
Transformer
Language processor
Converter
None of these options<------ans<!--[if !supportEmptyParas]-->
14. Consider the following statements. i.Multiplication associates left to right ii.Division
associates left to right
iii.Unary Minus associates right to left
iv.subtraction associates left to right All are true <------ans
only i and ii are true
all are false
only iii and iv are true
15. What will be the value of variable a in the following code?
unsigned char a;
a = 0xFF + 1;
printf("%d", a);
0xFF
0x100
0 <------ans
0x0
4 3 <------ans
4,address of i printed
Error:Lvalue required
33. What is the output of the following code? #include<stdio.h>
void main()
{
int arr[] = {10,20,30,40,50};
int *ptr = arr;
printf("\n %d\t%d\t",*ptr++,*ptr);
}
10 20
10 10<------ans
20 20
20 10
34. Which of these are reasons for using pointers?
1.To manipulate parts of an array
2.To refer to keywords such as for and if
3.To return more than one value from a function 4.To refer to particular programs more
conveniently
1 & 3 <------ans
Only 1
Only 3
All of the above
35. struct num
{
int no;
char name[25];
};
void main()
{
struct num n1[]={{25,"rose"},{20,"gulmohar"}, {8,"geranium"},{11,"dahalia"}};
printf("%d%d" ,n1[2].no,(*&n1+2)->no+1);
}
What is the output of this program?
88
8 9 <------ans
98
8 , unpredictable
36. During initializing a union
Only one member can be initialised.
All the members will be initialised. Initialisation of a union is not possible.<------ans
None of these options
37. Self referential structure is one
a. Consisting the structure in the parent structure
b. Consisting the pointer of the structure in the parent structure
Only a
Only b
Both a and b
Neither a nor b
38. Individual structure member can be initialized in the structure itself
True
False
Compiler dependent
None of these options
39. Which of the following is the feature of stack?
53.The code
int i = 7;
printf("%d\n", i++ * i++);
prints 49
prints 56 <------ans
is compiler dependent
expression i++ * i++ is undefined
54. Recursive procedure are implemented by
Linear list
Queue
Tree
Stack<------ans
55. Which of these are reasons for using pointers?
1. To manipulate parts of an array
2. To refer to keywords such as for and if
3. To return more than one value from a function 4. To refer to particular programs more
conveniently
1 & 3<------ans
only 1
only 3
None of these options
56. The expression x = 4 + 2 % -8 evaluates to -6
6
4
None of these options
57. What is the output of the following code? #include<stdio.h>
main()
{
register int a=2;
printf("\nAddress of a = %d,", &a); printf("\tValue of a = %d",a);
Address of a,2 <------ans
Linker error
Compile time error
None of these options
58. What is the output of the following code? #include<stdio.h>
void main()
{
int arr[]={0,1,2,3,4,5,6};
int i,*ptr;
for(ptr=arr+4,i =0; i<=4; i++) printf("\n%d",ptr[-i]);(as the 0=4,for -1 it becomes =3)
}
Error
65432
0 garbage garbage garbage garbage
4 3 2 1 0 <------ans
59. Which of the following is the correct way of declaring a float pointer:
float ptr;
float *ptr; <------ans
*float ptr;
None of the above
60.If the following program (newprog) is run from the command line as:newprog 1 2 3 What
would be the output of the following?
void main (int argc, char*argv[])
{
int I,j=0;
for (I=0;I<argc;I++)
j=j + atoi(argv[I]);
printf("%d",j);
}
123
6
123
Compilation error<------ans
C-Test Paper
1. #include
* What is wrong in the following problem
main() {
int i,j;
j = 10;
i = j++ - j++;
printf("%d %d", i,j);
}
ans: 0, 12
2.#include <STDIO.H
* What is the output of the following problem
main() {
int j;
for(j=0;j<3;j++)
foo();
}
foo() {
static int i = 10;
i+=10;
printf("%d\n",i);
}
/* Out put is (***since static int is used i value is retained between
* 20 function calls )
* 30
* 40
*
/
3.#include <STDIO.H
#include <STDIO.H
#include <STRING.H
/* This is asked in PCS Bombay walk-in-interview
* What is wrong in the following code
*/
main()
{
char *c;
c = "Hello";
printf("%s\n", c);
}
/*ans:- Hello, The code is successfully running */
4. #include <STDIO.H
/* This problem is given in PCS BOMBAY walk-in-interview.
* What is the final value of i and how many times loop is
* Executed ?
*/
main()
{
int i,j,k,l,lc=0;
/* the input is given as 1234 567 */
printf("Enter the number string:<1234 567 \n");
scanf("%2d%d%1d",&i,&j,&k);
for(;k;k--,i++)
for(l=0;l
printf("%d %d\n",i,l);}
printf("LOOPS= %d\n", lc-1);
}
/* Ans: i = 16, and loop is executed for 169 times */
5.#include <STDIO.H
/* This is given in PCS Bombay walk-in-interview */
/* What is the output of the following program */
main() {
union {
int a;
int b;
int c;
} u,v;
u.a = 10;
u.b = 20;
printf("%d %d \n",u.a,u.b);
}
/* Ans : The latest value assigned to any of the union member
will be present in the union members so answer is
20 20
*/
6.#include <STDIO.H
main()
{
float i, j;
scanf("%f %f", &i, &j);
printf("%.2f %.3f", i, j);
}
/Ans:- 123.34 3. 234 */
7.#include <STDIO.H
/* This is given in PCS Bombay walk-in-interview
* What is the out put of the following problem ?
*/
main()
{
char *str = "12345";
printf("%c %c %c\n", *str, *(str++), *(str++));
}
/* Ans: It is not 1 2 3
* But it is 3 2 1 Why ??
*/
8.#include <STDIO.H
/* This problem is asked in PCS Bombay Walk-in-interview
* Write a macro statement to find maximum of a,b
*/
#define max(a,b) (ab)?a:b
main()
{
int a,b;
a=3;
b=4;
printf("%d",max(a,b));
}
/* Ans is very simple the coding is just for testing it
and output is 4 */
~
9.#include <STDIO.H
/* This problem is asked in PCS Bombay
* What is the output of the following coding
*/
main()
{
int len=4;
char *st="12345678";
st = st -len;
printf("%c\n",*st);
}
/* Ans : It will print some junk value */
~
10.#include <STDIO.H
main()
{
func(1);
}
func(int i){
static char *str ={ "One","Two","Three","Four"};
printf("%s\n",str[i++]);
return;
}
/* Ans:- it will give warning because str is pointer to the char but
it is initialized with more values
if it is not considered then the answer is Two */
11.
#include <STDIO.H
main()
{
int i;
for (i=1;i<100; i++)
printf("%d %0x\n",i,i);
}
12.#include <STDIO.H
/* This problem is asked in PCS Bombay walk-in-interview
* In the following code please write the syntax for
* assing a value of 10 to field x of s and id_no 101 of s
*/
struct {
int x;
int y;
union {
int id_no;
char *name;
}b;
}s,*st;
main()
{
st = &s;
st-x=10;
st-b.id_no = 101;
printf("%d %d\n",s..x,s.b.id_no);
}
/* Ans: The answer is st-x=10;
* st-b.id_no=101;
*/
13.#include <STDIO.H
/* This problem was asked in PCS Bombay in a walk-in-interview
* Write a recursive function that calculates
* n * (n-1) * (n-2) * ....... 2 * 1
*/
main() {
int factorial(int n);
int i,ans;
printf("\n Enter a Number:");
scanf("%d",&i);
ans = factorial(i);
printf("\nFactorial by recursion = %d\n", ans);
}
int factorial(int n)
{
if (n <= 1) return (1);
else
return ( n * factorial(n-1));
}
~
14.#include <STDIO.H
/* This problem is asked in PCS Bombay walk-in-interview
* What is the output of the following problem
*/
main(){
int j,ans;
j = 4;
ans = count(4);
printf("%d\n",ans);
}
int count(int i)
{
if ( i < 0) return(i);
else
return( count(i-2) + count(i-1));
}
/* It is showing -18 as an answer */
15.#include<STDIO.H
main()
{
int i=4;
if(i=0)
printf("statement 1");
else
printf("statement 2");
}
/* statement 2 */
3.#include <STDIO.H
#include <STDIO.H
#include <STRING.H
/* This is asked in PCS Bombay walk-in-interview
* What is wrong in the following code
*/
main()
{
char *c;
c = "Hello";
printf("%s\n", c);
}
/*ans:- Hello, The code is successfully running */
4. #include <STDIO.H
/* This problem is given in PCS BOMBAY walk-in-interview.
* What is the final value of i and how many times loop is
* Executed ?
*/
main()
{
int i,j,k,l,lc=0;
/* the input is given as 1234 567 */
printf("Enter the number string:<1234 567 \n");
scanf("%2d%d%1d",&i,&j,&k);
for(;k;k--,i++)
for(l=0;l
printf("%d %d\n",i,l);}
printf("LOOPS= %d\n", lc-1);
}
/* Ans: i = 16, and loop is executed for 169 times */
5.#include <STDIO.H
/* This is given in PCS Bombay walk-in-interview */
/* What is the output of the following program */
main() {
union {
int a;
int b;
int c;
} u,v;
u.a = 10;
u.b = 20;
printf("%d %d \n",u.a,u.b);
}
/* Ans : The latest value assigned to any of the union member
will be present in the union members so answer is
20 20
*/
6.#include <STDIO.H
main()
{
float i, j;
scanf("%f %f", &i, &j);
printf("%s\n",str[i++]);
return;
}
/* Ans:- it will give warning because str is pointer to the char but
it is initialized with more values
if it is not considered then the answer is Two */
11.
#include <STDIO.H
main()
{
int i;
for (i=1;i<100; i++)
printf("%d %0x\n",i,i);
}
/* Ans:- i is from 1 to 99 for the first format,
for the second format 1to9, ato f, 10 to 19,1ato1f, 20 to 29, etc */
12.#include <STDIO.H
/* This problem is asked in PCS Bombay walk-in-interview
* In the following code please write the syntax for
* assing a value of 10 to field x of s and id_no 101 of s
*/
struct {
int x;
int y;
union {
int id_no;
char *name;
}b;
}s,*st;
main()
{
st = &s;
st-x=10;
st-b.id_no = 101;
printf("%d %d\n",s.x,s.b.id_no);
}
/* Ans: The answer is st-x=10;
* st-b.id_no=101;
*/
13.#include <STDIO.H
/* This problem was asked in PCS Bombay in a walk-in-interview
* Write a recursive function that calculates
* n * (n-1) * (n-2) * ....... 2 * 1
*/
main() {
int factorial(int n);
int i,ans;
printf("\n Enter a Number:");
scanf("%d",&i);
ans = factorial(i);
printf("\nFactorial by recursion = %d\n", ans);
}
int factorial(int n)
{
main()
{
char **p=="Hello";
printf("%s",**p);
}
Ans: Garbage or nothing
2.
main()
{
printf("%d%c\n");
printf("%d%c\n");
}
Ans: Garbage Value
3.
main()
{
int x==5;
printf("%d%d",x++,++x);
}
Ans==6 6
4.
main()
{
int x==4;
printf("%d",printf(" %d %d ",x,x) );
}
Ans: 4 4 5
5.
main()
{
union
{
int i;
char p;
struct
{
int t;
char e;
char o;
}w;
};
printf("%d\n",sizeof(l) );
}
Ans: 4
6.
main()
{
int i==0,n==6;
while(n--0);
i+==n;
printf("%d\n",i);
}
Ans: -1
7.
ain()
{
char a[]=="Hello";
printf("%c\n",*a++);
}
Ans: Error
8.
a=3,b=2,c=1;
What's the value of k?
k== a< b < c-1;
Ans: 0
9.
main()
{
int a=3;
do
{
printf("%d", a);
a=-1;
} while(a0);
}
Ans: 3
10.
c)FAIL1 FAIL2
d)FAIL1 PASS2
main()
{
char c==-32;
int i==-64;
unsigned u==-26;
if(ci)
printf("PASS1");
if( i < c)
printf("PASS2");
else
printf("FAIL1");
if(i<U)
printf("PASS2");
else
printf("FAIL2");
}
Ans: PASS1 PASS2 PASS1
11.
main()
{
int i==0;
for( i==0; i<= ;i++)
{
switch(i)
{
case 0: i+==5;
case 1: i+==2;
case 2: i+==5;
default: i+==4;
break;
}
printf("%d",i);
}
Ans: 16 21
12.
main()
{
int i==4;
switch(i)
{
case 1:
printf("HEllo"):
case default: // "case" should not come with "default"
printf("****");
}
}
Ans: Error
13.
main()
{
int sum==0,count;
for(count==1;sum+==count)
printf("%d\t",sum);
}
Ans: Error
14.
}
Ans:UPPER CASE
15.
main()
{
static int i==5;
printf("%d\t",i--);
if( i)
main();
}
Ans: 5 4 3 2 1
16.
main()
{
char *a1=="new",*a2=="dictionary",*t;
swap(a1,a2);
printf("(%s%s)",a1,a2);
t=;
a1=;
a2==t;
printf("-(%s%s)",a1,a2);
}
swap( char *s1,char *s2)
{
char *temp;
s1=s2;
s2=s1;
temp=s1;
}
Ans: (newdictionary)-(dictionarynew)
17.
*p++?
18.
main()
{
int a[]=={ 10,20,30,40,50};
char*p==(char*)a;
printf("%d", * ( (int *) p+4);
}
Ans: 50
19.
1.
one question nothig but calling a function before it has been defined.
Three beauty pageant finalists-Cindy, Amy and Linda-The winner was
musician. The one who was not last or first was a math major.The one who came in
third had black hair. Linda had red hair. Amy had no musical abilities. Who was
first?
(A) Cindy
2.
(B) Amy
(C) Linda
Two twins have certain peculiar characteristics. One of them always lies on
Monday, Wednesday, Friday. The other always lies on Tuesdays, Thursday and
Saturdays. On the other days they tell the truth. You are given a
conversation.Person A- today is Sunday, my name is Anil Person B-today is Tuesday,
my name is Bill What day is today?
(A) Sunday (B) Tuesday
3.
(C) Monday
(D) Thursday
The difference of a number and its reciprocal is 1/2.The sum of their squares
is
(A) 9/4
4.
(C) 5/3
(D) 7/4
(A) 42
5.
(B) 4/5
(B) 29
(C) 30
(D) 32
A trader has 100 Kg of wheat, part of which he sells at 5% profit and the rest
at 20% profit. He gains 15% on the whole. Find how much is sold at 5% profit?
(A) 60
6.
(B) 50
(D) 33.3
(A) (3,5)
(C) (4,5)
7.
(C) 66.66
(4,6)
(4,6)
(2,7)
(2,7)
(B) (3,5)
(4,7)
(2,3)
(D) (6,7)
(7,8)
(2,7)
A man leaves office daily at 7pm.a driver with car comes from his home to
pick him from office and bring back home. One day he gets free at 5.30 and instead
of waiting for driver he starts walking towards home. In the wayhe meets the car
and returns home on car. He reaches home 20 minutes earlier than usual. In how
(C) 1 hr 10 min
(D) 55 min
(A) 7/3
9.
(B) 1 hr
(B) 3/7
(C) 5/3
(D) 3/5
dog taken four leaps for every five leaps of hare but three leaps of the dog is
(B) 19:20
(C) 16:15
(D) 10:12
A watch ticks 90 times in 95 seconds. And another watch ticks 315 times in
323 secs. If they start together, how many times will they tick together in first
hour?
(A) 100 times
11.
(C) 99 times
12.
(A) Consistent
13.
(B) Repeatable
(B) Roles
(C) Grants
(A) No Binding
15.
Which of the constraint can be defined at the table level as well as at the
column level
(A) Unique
16.
(C) Check
(A)
Set the new format in the DATE_FORMAT key in the windows Registry.
(B)
(C)
(D)
17.
(D) Encapsulation.
19.
above.
20.
(A) One child table has multiple parent relation, but for anyone instance of a child
record
only one of the relations is applicable.
(B) One column of a table is related to another column of the same table.
(C) A child table is dependent on columns other than the primary key columns of
the parent
table.
(D) None of the above.
21.
value.
22.
(A) 7
23.
(B) 4
(C) 5
(D) 3
int n, sum=5;
switch(n)
{
case 2:sum=sum-2;
case 3:sum*=5;
break;
default:sum=0;
}
if n=2, what is the value of the sum?
(A) 0
25.
(B) 15
(C) 3
loop?
(A) x=0;
do{
While(TRUE){....}
(C) for(;;)
{....}
....}
While(x==0);
26.
27.
(B) 12,17,22
(C) 16,21
func(int i)
{
if(i%2) return 0;
else return 1;
}
main()
{
int i=3;
i=func(i);
i=func(i);
printf("%d",i);
}
(A) 3
28.
(B) 1
(C) 0
(D) 2
char*g()
{
static char x[1024];
return x;
}
main()
{
char*g1="First String";
strcpy(g(),g1);
g1=g();
strcpy(g1,"Second String");
printf("Answer is:%s", g());
}
(A) Answer is: First String
main()
{
int a[5]={1,3,6,7,0};
int *b;
b=&a[2];
}
The value of b[-1] is
(A) 1
30.
(B) 3
(C) -6
(D) none
int x[10];
int *ab;
ab=x;
To access the 6th element of the array which of the following is incorrect?
(A) *(x+5)
(B) x[5]
(C) ab[5]
(D) *(*ab+5}
Technical
1.
2.
int v,u;
while(v != 0)
{
t = v % u;
v = u;
u = t;
}
find the time complexity of the above program.
3.
4.
5.
ring counter's initial state is 01000. after how many clock cylces will it return to the
initial state.
6.
some boolesn expression of the form x'y'z' + yz + .. ( something like this) find the
simplified expression
7.
given 6 bit mantissa in 2s complement form and 4 bit exponent is in excess-4 form in
a floating point representation, find the number
ans -(something) * ( 2 to the power 3)
8.
A signed no is stored in 10-bit register, what is the max and min possible value of the
number.
Aptitude
1.
2.
3.
4.
connect nine point without take-off pen & without overlapping line segment
1234
***5
***6
0* * * 7
ans: start with 0 to 1 to 7 to 0 to 4 .
5.
A room is 30 X 12 X 12. a spider is ont the middle of the samller wall, 1 feet from the
top, and a fly is ont he middle of the opposite wall 1 feet from the bottom. what is the
min distance reqd for the spider to crawl to the fly.
6.
A man while going dowm in a escalator(which is miving down) takes 50 steps to reach
down and while going up takes 125 steps. If he goes 5 times faster upwards than
downwards. What will be the total no of steps if the escalator werent moving.
7.
2/3 of corckery(plates) are broken, 1/2 have someother thing(handle) broken , 1/4
are both broken and handle broken. Ultimately only 2 pieces of corckery were without
any defect. How many crockery were there in total.
8.
It is difficult to draw a figure but another question was in which some NAND and OR
gates were given.
ans - Z = true.
Texas Instruments
Date : 8/9/2005
1.
Ans: No. The virtual function mechanism is used on the specific object that determines
which virtual function to call. Since the static functions are not any way related to
objects, they cannot be declared as virtual.
2.
3.
// code
}
void main( )
{
sample s ;
test t ;
fun ( s, t ) ;
}
This program would not compile. It gives an error that sample is undeclared identifier
in the statement friend void fun ( sample, test ) ; of the class test. This is so because
the class sample is defined below the class test and we are using it before its
definition. To overcome this error we need to give forward reference of the class
sample before the definition of class test. The following statement is the forward
reference of class sample. Forward referencing is generally required when we make a
class or a function as a friend.
4.
The istream_withassign class has been derived from the istream class and overloaded
assignment operator has been added to it. The _withassign classes are much like their
base classes except that they include overloaded assignment operators. Using these
operators the objects of the _withassign classes can be copied. The istream, ostream,
and iostream classes are made uncopyable by making their overloaded copy
constructor and assignment operators private.
5.
How do I write my own zero-argument manipulator that should work same as hex?
Ans: This is shown in following program.
#include
ostream& myhex ( ostream &o )
{
o.setf ( ios::hex) ;
return o ;
}
void main( )
{
cout << endl << myhex << 2000 ;
}
6.
We all know that a const variable needs to be initialized at the time of declaration.
Then how come the program given below runs properly even when we have not
initialized p?
#include
void main( )
{
const char *p ;
p = "A const pointer" ;
cout << p ;
}
Ans: The output of the above program is 'A const pointer'. This is because in this
program p is declared as 'const char*' which means that value stored at p will be
constant and not p and so the program works properly
7.
8.
Ans: No!. This is because even if we provide the default arguments to the parameters
of the overloaded operator function we would end up using the binary operator
incorrectly. This is explained in the following example:
sample operator + ( sample a, sample b = sample (2, 3.5f ) )
{
}
void main( )
{
sample s1, s2, s3 ;
s3 = s1 + ; // error
}
9.
}
};
void main( )
{
rectangle r ( 20, 10 ) ;
circle c;
c=r;
}
Here, when the statement c = r ; is executed the compiler searches for an overloaded
assignment operator in the class circle which accepts the object of type rectangle.
Since there is no such overloaded assignment operator, the conversion operator
function that converts the rectangle object to the circle object is searched in the
rectangle class. We have provided such a conversion function in the rectangle class.
This conversion operator function returns a circle object. By default conversion
operators have the name and return type same as the object type to which it converts
to. Here the type of the object is circle and hence the name of the operator function as
well as the return type is circle.
10. How do I write code that allows to create only one instance of a class?
Ans: This is shown in following code snippet.
#include
class sample
{
static sample *ptr ;
private:
sample( )
{
}
public:
static sample* create( )
{
if ( ptr == NULL )
ptr = new sample ;
return ptr ;
}
};
sample *sample::ptr = NULL ;
void main( )
{
sample *a = sample::create( ) ;
sample *b = sample::create( ) ;
}
Here, the class sample contains a static data member ptr, which is a pointer to the
object of same class. The constructor is private which avoids us from creating objects
outside the class. A static member function called create( ) is used to create an object
of the class. In this function the condition is checked whether or not ptr is NULL, if it is
then an object is created dynamically and its address collected in ptr is returned. If ptr
is not NULL, then the same address is returned. Thus, in main( ) on execution of the
first statement one object of sample gets created whereas on execution of second
statement, b holds the address of the first object. Thus, whatever number of times
you call create( ) function, only one object of sample class will be available.
11. How do I write code to add functions, which would work as get and put properties of a
class?
Ans: This is shown in following code.
#include
class sample
{
int data ;
public:
__declspec ( property ( put = fun1, get = fun2 ) )
int x ;
void fun1 ( int i )
{
if ( i < 0 )
data = 0 ;
else
data = i ;
}
int fun2( )
{
return data ;
}
};
void main( )
{
sample a ;
a.x = -99 ;
The class emp has an overloaded operator [ ] function. It takes one argument an
integer representing an array index and returns an int pointer. The statement cout <<
e[0][1] ; would get converted into a call to the overloaded [ ] function as e.operator[ ]
( 0 ). 0 would get collected in i. The function would return a[i] that represents the
base address of the zeroeth row. Next the statement would get expanded as base
address of zeroeth row[1] that can be further expanded as *( base address + 1 ). This
gives us a value in zeroth row and first column.
13. What are formatting flags in ios class?
Ans: The ios class contains formatting flags that help users to format the stream data.
Formatting flags are a set of enum definitions. There are two types of formatting flags:
On/Off flags
Flags that work in-group
The On/Off flags are turned on using the setf( ) function and are turned off using the
unsetf( ) function. To set the On/Off flags, the one argument setf( ) function is used.
The flags working in groups are set through the two-argument setf( ) function. For
example, to left justify a string we can set the flag as,
cout.setf ( ios::left ) ;
cout << "KICIT Nagpur" ;
To remove the left justification for subsequent output we can say,
cout.unsetf ( ios::left ) ;
The flags that can be set/unset include skipws, showbase, showpoint, uppercase,
showpos, unitbuf and stdio. The flags that work in a group can have only one of these
flags set at a time.
14. What is the purpose of ios::basefield in the following statement?
cout.setf ( ios::hex, ios::basefield ) ;
Ans: This is an example of formatting flags that work in a group. There is a flag for
each numbering system (base) like decimal, octal and hexadecimal. Collectively, these
flags are referred to as basefield and are specified by ios::basefield flag. We can have
only one of these flags on at a time. If we set the hex flag as setf ( ios::hex ) then we
will set the hex bit but we won't clear the dec bit resulting in undefined behavior. The
solution is to call setf( ) as setf ( ios::hex, ios::basefield ). This call first clears all the
bits and then sets the hex bit.
15. Can we get the value of ios format flags?
Ans: Yes! The ios::flags( ) member function gives the value format flags. This function
takes no arguments and returns a long ( typedefed to fmtflags) that contains the
{
day = d.day ;
month = d.month ;
year = d.year ;
return d ;
}
void display( )
{
cout << day << "/" << month << "/" << year ;
}
};
void main( )
{
date d1 ( 25, 9, 1979 ) ;
date d2 = d1 ;
date d3 ;
d3 = d2 ;
d3.display( ) ;
}
setf( ) function can be put off through unsetf( ) function. Such flexibility is not
available with manipulators.
21. How do I get the current position of the file pointer?
Ans: We can get the current position of the file pointer by using the tellp( ) member
function of ostream class or tellg( ) member function of istream class. These functions
return (in bytes) positions of put pointer and get pointer respectively.
22. What are put and get pointers?
Ans: These are the long integers associated with the streams. The value present in the
put pointer specifies the byte number in the file from where next write would take
place in the file. The get pointer specifies the byte number in the file from where the
next reading should take place.
23. What do the nocreate and noreplace flag ensure when they are used for opening a
file?
Ans: nocreate and noreplace are file-opening modes. A bit in the ios class defines
these modes. The flag nocreate ensures that the file must exist before opening it. On
the other hand the flag noreplace ensures that while opening a file for output it does
not get overwritten with new one unless ate or app is set. When the app flag is set
then whatever we write gets appended to the existing file. When ate flag is set we can
start reading or writing at the end of existing file.
24. What is the limitation of cin while taking input for character array?
Ans: To understand this consider following statements,
char str[5] ;
cin >> str ;
While entering the value for str if we enter more than 5 characters then there is no
provision in cin to check the array bounds. If the array overflows, it may be
dangerous. This can be avoided by using get( ) function. For example, consider
following statement,
cin.get ( str, 5 ) ;
On executing this statement if we enter more than 5 characters, then get( ) takes only
first five characters and ignores rest of the characters. Some more variations of get( )
are available, such as shown below:
get ( ch ) ? Extracts one character only
get ( str, n ) ? Extracts up to n characters into str
get ( str, DELIM ) ? Extracts characters into array str until specified delimiter (such as
'\n'). Leaves delimiting character in stream.
get ( str, n, DELIM ) ? Extracts characters into array str until n characters or DELIM
istrstream s ( str ) ;
s >> age >> salary >> name ;
cout << age << endl << salary << endl << name ;
cout << endl << s.rdbuf( ) ;
}
Here, s is the object of the class istrstream. When we are creating the object s, the
constructor of istrstream gets called that receives a pointer to the zero terminated
character array str. The statement s >> age >> salary >> name ; extracts the age,
salary and the name from the istrstream object s. However, while extracting the
name, only the first word of name gets extracted. The balance is extracted using
rdbuf( ).
29. When the constructor of a base class calls a virtual function, why doesn't the override
function of the derived class gets called?
Ans: While building an object of a derived class first the constructor of the base class
and then the constructor of the derived class gets called. The object is said an
immature object at the stage when the constructor of base class is called. This object
will be called a matured object after the execution of the constructor of the derived
class. Thus, if we call a virtual function when an object is still immature, obviously, the
virtual function of the base class would get called. This is illustrated in the following
example.
#include
class base
{
protected :
int i ;
public :
base ( int ii = 0 )
{
i = ii ;
show( ) ;
}
virtual void show( )
{
cout << "base's show( )" << endl ;
}
};
class derived : public base
{
private :
int j ;
public :
derived ( int ii, int jj = 0 ) : base ( ii )
{
j = jj ;
show( ) ;
}
void show( )
{
cout << "derived's show( )" << endl ;
}
};
void main( )
{
derived dobj ( 20, 5 ) ;
}
The output of this program would be:
base's show( )
derived's show( )
30. Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Ans: Yes, we can have a reference as a data member of a class. A reference as a data
member of a class is initialised in the initialisation list of the constructor. This is shown
in following program.
#include
class sample
{
private :
int& i ;
public :
sample ( int& ii ) : i ( ii )
{
}
void show( )
{
cout << i << endl ;
}
};
void main( )
{
int j = 10 ;
sample s ( j ) ;
s.show( ) ;
}
Here, i refers to a variable j allocated on the stack. A point to note here is that we
cannot bind a reference to an object passed to the constructor as a value. If we do so,
then the reference i would refer to the function parameter (i.e. parameter ii in the
constructor), which would disappear as soon as the function returns, thereby creating
a situation of dangling reference.
31. Why does the following code fail?
#include
class sample
{
private :
char *str ;
public :
sample ( char *s )
{
strcpy ( str, s ) ;
}
~sample( )
{
delete str ;
}
};
void main( )
{
sample s1 ( "abc" ) ;
}
Ans: Here, through the destructor we are trying to deal locate memory, which has
been allocated statically. To remove an exception, add following statement to the
constructor.
sample ( char *s )
{
str = new char[strlen(s) + 1] ;
strcpy ( str, s ) ;
}
Here, first we have allocated memory of required size, which then would get deal
located through the destructor.
32. assert( ) macro...
We can use a macro called assert( ) to test for conditions that should not occur in a
code. This macro expands to an if statement. If test evaluates to 0, assert prints an
error message and calls abort to abort the program.
#include
#include
void main( )
{
int i ;
cout << "\nEnter an integer: " ;
cin >> i ;
assert ( i >= 0 ) ;
cout << i << endl ;
}
33. Why it is unsafe to deal locate the memory using free( ) if it has been allocated using
new?
Ans: This can be explained with the following example:
#include
class sample
{
int *p ;
public :
sample( )
{
p = new int ;
}
~sample( )
{
delete p ;
}
};
void main( )
{
sample *s1 = new sample ;
free ( s1 ) ;
sample *s2 = ( sample * ) malloc ( sizeof ( sample
));
delete s2 ;
}
The new operator allocates memory and calls the constructor. In the constructor we
have allocated memory on heap, which is pointed to by p. If we release the object
using the free( ) function the object would die but the memory allocated in the
constructor would leak. This is because free( ) being a C library function does not call
the destructor where we have deal located the memory.
As against this, if we allocate memory by calling malloc( ) the constructor would not
get called. Hence p holds a garbage address. Now if the memory is deal located using
delete, the destructor would get called where we have tried to release the memory
pointed to by p. Since p contains garbage this may result in a runtime error.
34. Can we distribute function templates and class templates in object libraries?
Ans: No! We can compile a function template or a class template into object code (.obj
file). The code that contains a call to the function template or the code that creates an
object from a class template can get compiled. This is because the compiler merely
checks whether the call matches the declaration (in case of function template) and
whether the object definition matches class declaration (in case of class template).
Since the function template and the class template definitions are not found, the
compiler leaves it to the linker to restore this. However, during linking, linker doesn't
find the matching definitions for the function call or a matching definition for object
creation. In short the expanded versions of templates are not found in
the object library. Hence the linker reports error.
35. What is the difference between an inspector and a mutator ?
Ans: An inspector is a member function that returns information about an object's
state (information stored in object's data members) without changing the object's
state. A mutator is a member function that changes the state of an object. In the class
Stack given below we have defined a mutator and an inspector.
class Stack
{
public :
int pop( ) ;
int getcount( ) ;
}
In the above example, the function pop( ) removes top element of stack thereby
changing the state of an object. So, the function pop( ) is a mutator. The function
getcount( ) is an inspector because it simply counts the number of elements in the
stack without changing the stack.
36. Namespaces:
The C++ language provides a single global namespace. This can cause problems with
global name clashes. For instance, consider these two C++ header files:
// file1.h
float f ( float, int ) ;
class sample { ... } ;
// file2.h
class sample { ... } ;
With these definitions, it is impossible to use both header files in a single program; the
sample classes will clash.A namespace is a declarative region that attaches an
additional identifier to any names declared inside it. The additional identifier thus
avoids the possibility that a name will conflict with names declared elsewhere in the
program. It is possible to use the same name in separate namespaces without conflict
even if the names appear in the same translation unit. As long as they appear in
separate namespaces, each name will be unique because of the addition of the
namespace identifier. For example:
// file1.h
namespace file1
{
float f ( float, int ) ;
class sample { ... } ;
}
// file2.h
namespace file2
{
class sample { ... } ;
}
Now the class names will not clash because they become file1::sample and
file2::sample, respectively.
37. What would be the output of the following program?
#include
class user
{
int i ;
float f ;
char c ;
public :
void displaydata( )
{
cout << endl << i << endl << f << endl << c ;
}
};
void main( )
{
cout << sizeof ( user ) ;
user u1 ;
cout << endl << sizeof ( u1 ) ;
u1.displaydata( ) ;
}
Ans: The output of this program would be,
9 or 7
9 or 7
Garbage
Garbage
Garbage
Since the user class contains three elements, int, float and char its size would be 9
bytes (int-4, float-4, char-1) under Windows and 7 bytes (int-2, float-4, char-1) under
DOS. Second output is again the same because u1 is an object of the class user.
Finally three garbage values are printed out because i, f and c are not initialized
anywhere in the program.
Note that if you run this program you may not get the answer shown here. This is
because packing is done for an object in memory to increase the access efficiency. For
example, under DOS, the object would be aligned on a 2-byte boundary. As a result,
the size of the object would be reported as 6 bytes. Unlike this, Windows being a 32bit OS the object would be aligned on a 4-byte boundary. Hence the size of the object
would be reported as 12 bytes. To force the alignment on a 1-byte boundary, write the
following statement before the class declaration.
#pragma pack ( 1 )
38. Write a program that will convert an integer pointer to an integer and vice-versa.
Ans: The following program demonstrates this.
#include
void main( )
{
int i = 65000 ;
int *iptr = reinterpret_cast ( i ) ;
cout << endl << iptr ;
iptr++ ;
cout << endl << iptr ;
i = reinterpret_cast ( iptr ) ;
cout << endl << i ;
i++ ;
cout << endl << i ;
}
39. What is a const_cast?
Ans. The const_cast is used to convert a const to a non-const. This is shown in the
following
program:
#include
void main( )
{
const int a = 0 ;
int *ptr = ( int * ) &a ; //one way
ptr = const_cast_ ( &a ) ; //better way
}
Here, the address of the const variable a is assigned to the pointer to a non-const
variable. The const_cast is also used when we want to change the data members of a
class inside the const member functions. The following code snippet shows this:
class sample
{
private:
int data;
public:
void func( ) const
{
(const_cast (this))->data = 70 ;
}
};
40. What is forward referencing and when should it be used?
Ans: Forward referencing is generally required when we make a class or a function as
a friend.
Consider following program:
class test
{
public:
friend void fun ( sample, test ) ;
};
class sample
{
public:
friend void fun ( sample, test ) ;
};
void fun ( sample s, test t )
{
// code
}
void main( )
{
sample s ;
test t ;
fun ( s, t ) ;
}
On compiling this program it gives error on the following statement of test class. It
gives an error that sample is undeclared identifier. friend void fun ( sample, test ) ;
This is so because the class sample is defined below the class test and we are using it
before its definition. To overcome this error we need to give forward reference of the
class sample before the definition of class test. The following statement is the forward
reference of class sample.
class sample ;
41. How would you give an alternate name to a namespace?
Ans: An alternate name given to namespace is called a namespace-alias. namespacealias is generally used to save the typing effort when the names of namespaces are
very long or complex. The following syntax is used to give an alias to a namespace.
namespace myname = my_old_very_long_name ;
42. Using a smart pointer can we iterate through a container?
Ans: Yes. A container is a collection of elements or objects. It helps to properly
organize and store the data. Stacks, linked lists, arrays are examples of containers.
Following program shows how to iterate through a container using a smart pointer.
#include
class smartpointer
{
private :
int *p ; // ordinary pointer
public :
smartpointer ( int n )
{
p = new int [ n ] ;
int *t = p ;
for ( int i = 0 ; i <= 9 ; i++ )
*t++ = i * i ;
}
int* operator ++ ( int )
{
return p++ ;
}
int operator * ( )
{
return *p ;
}
};
void main( )
{
smartpointer sp ( 10 ) ;
for ( int i = 0 ; i <= 9 ; i++ )
cout << *sp++ << endl ;
}
Here, sp is a smart pointer. When we say *sp, the operator * ( ) function gets called.
It returns the integer being pointed to by p. When we say sp++ the operator ++ ( )
function gets called. It increments p to point to
the next element in the array and then returns the address of this new location.
43. Can objects read and write themselves?
Ans: Yes! This can be explained with the help of following example:
#include
#include
class employee
{
private :
char name [ 20 ] ;
int age ;
float salary ;
public :
void getdata( )
{
cout << "Enter name, age and salary of employee : " ;
cin >> name >> age >> salary ;
}
void store( )
{
ofstream file ;
file.open ( "EMPLOYEE.DAT", ios::app | ios::binary ) ;
file.write ( ( char * ) this, sizeof ( *this ) ) ;
file.close( ) ;
}
void retrieve ( int n )
{
ifstream file ;
file.open ( "EMPLOYEE.DAT", ios::binary ) ;
file.seekg ( n * sizeof ( employee ) ) ;
file.read ( ( char * ) this, sizeof ( *this ) ) ;
file.close( ) ;
}
void show( )
{
cout << "Name : " << name
<< endl << "Age : " << age
<< endl << "Salary :" << salary << endl ;
}
};
void main( )
{
employee e [ 5 ] ;
for ( int i = 0 ; i <= 4 ; i++ )
{
e [ i ].getdata( ) ;
e [ i ].store( ) ;
}
for ( i = 0 ; i <= 4 ; i++ )
{
e [ i ].retrieve ( i ) ;
e [ i ].show( ) ;
}
}
Here, employee is the class whose objects can write and read themselves. The
getdata( ) function has been used to get the data of employee and store it in the data
members name, age and salary. The store( ) function is used to write an object to the
file. In this function a file has been opened in append mode and each time data of
current object has been stored after the last record (if any) in the file.Function
retrieve( ) is used to get the data of a particular employee from the file. This retrieved
data has been stored in the data members name, age and salary. Here this has been
used to store data since it contains the address of the current object. The function
show( ) has been used to display the data of employee.
44. Why is it necessary to use a reference in the argument to the copy constructor?
Ans : If we pass the copy constructor the argument by value, its copy would get
constructed using the copy constructor. This means the copy constructor would call
itself to make this copy. This process would go on and on until the compiler runs out of
memory. This can be explained with the help of following example:
class sample
{
int i ;
public :
sample ( sample p )
{
i = p.i ;
}
};
void main( )
{
sample s ;
sample s1 ( s ) ;
}
While executing the statement sample s1 ( s ), the copy constructor would get called.
As the copy construct here accepts a value, the value of s would be passed which
{
public :
fun( )
{
i = 10 ;
}
};
void main( )
{
multiple d ;
d.fun( ) ;
cout << d.i ;
}
46. Can we use this pointer in a class specific, operator-overloading function for new
operator?
Ans: No! The this pointer is never passed to the overloaded operator new() member
function because this function gets called before the object is created. Hence there is
no question of the this pointer getting passed to operator new( ).
47. Can we allocate memory dynamically for a reference?
Ans: No! It is not possible to allocate memory dynamically for a reference. This is
because, when we create a reference, it gets tied with some variable of its type. Now,
if we try to allocate memory dynamically for a reference, it is not possible to mention
that to which variable the reference would get tied.
48. When should I overload new operator on a global basis or a class basis?
Ans: We overload operator new in our program, when we want to initialize a data item
or a class object at the same place where it has been allocated memory. The following
example shows how to overload new operator on global basis.
#include
#include
void * operator new ( size_t s )
{
void *q = malloc ( s ) ;
return q ;
}
void main( )
{
int *p = new int ;
*p = 25 ;
cout << *p ;
}
When the operator new is overloaded on global basis it becomes impossible to
initialize the data members of a class as different classes may have different types of
data members. The following example shows how to
overload new operator on class-by-class basis.
#include
#include
class sample
{
int i ;
public :
void* operator new ( size_t s, int ii )
{
sample *q = ( sample * ) malloc ( s ) ;
q -> i = ii ;
return q ;
}
};
class sample1
{
float f ;
public :
void* operator new ( size_t s, float ff )
{
sample1 *q = ( sample1 * ) malloc ( s ) ;
q -> f = ff ;
return q ;
}
};
void main( )
{
sample *s = new ( 7 ) sample ;
sample1 *s1 = new ( 5.6f ) sample1 ;
}
Overloading the operator new on class-by-class basis makes it possible to allocate
memory for an object and initialize its data members at the same place.
49. How would you define a pointer to a data member of the type pointer to pointer?
Ans: The following program demonstrates this...
#include
class sample
{
public :
sample ( int **pp )
{
p = pp ;
}
int **p ;
};
int **sample::*ptr = &sample::p ;
void main( )
{
int i = 9 ;
int *pi = &i ;
sample s ( &pi ) ;
cout << ** ( s.*ptr ) ;
}
Here, ptr is the pointer to data member p of class sample, which in turn is a pointer
pointing to an int.
50. How do I write a code to catch multiple types of exceptions in one single catch block?
Ans: The following program demonstrates the use of a single catch block to catch
multiple exceptions.
#include
class test
{
};
class sample
{
public :
void fun1( )
{
throw 99 ;
}
void fun2( )
{
throw 3.14f ;
}
void fun3( )
{
throw "error" ;
}
void fun4( )
{
throw test( ) ;
}
};
void main( )
{
try
{
sample s ;
s.fun4( ) ;
s.fun1( ) ;
s.fun2( ) ;
s.fun3( ) ;
}
catch ( ... )
{
cout << "strange" ;
}
}
Here, different types of exceptions are thrown by the member functions of the class
sample. While catching the exception instead of four different catch blocks we can as
well define one single catch block. Note the syntax for defining the catch block, where
we have used three dots (?) in the formal parameter list. This indicates that any
thrown exception should get caught in the same catch block. When the exception is
thrown from the fun4( ) control reaches the catch block, ignoring the rest of the calls.
51. Can we return an error value from the constructor of a class?
Ans: No. We cannot return any error value from the constructor, as the constructor
doesn't have any return type. However, by throwing an exception we can pass value
to catch block. This is shown in the following example:
#include
class sample
{
public :
sample ( int i )
{
if ( i == 0 )
throw "error" ;
}
};
void main( )
{
try
{
sample s ( 0 ) ;
}
catch ( char * str )
{
cout << str ;
}
}
In this program, the statement throw "error" ; would throw an exception when an
object s of the class sample would get created. The catch block would collect the string
error.
52. How do I define the member function of a template class, which has to be defined
outside the template class. The function receives an object of its own class as a
parameter and returns the value of the same type.
Ans: The following example shows how we can define such a function.
sample sample::fun ( sample s )
{
// code
}
Here, the first sample indicates the return type of the function and the next sample is
used for the scope of function.
53. How name mangling can be prevented?
Ans: To avoid name mangling the function should be declared with an extern "C"
attribute. Functions declared as extern "C" are treated as C-style functions. Hence the
compiler does not mangle them. The following code snippet shows how to declare such
a function.
#include
}
operator int( )
{
return 123 ; // Write logic to convert string to integer
}
};
main( )
{
string s2 = "123" ;
int i1 = int ( s2 ) ;
cout << endl << i1 ;
}
57. How to obtain type information using typeid( ) operator?
Ans: typeid( ) operator takes an object, a reference or a pointer and returns its type.
Following program shows how to use the typeid( ) operator.
#include
#include
class Base
{
public :
virtual void show( )
{
}
};
class Der1 : public Base
{
};
void main( )
{
Base *b1 ;
cout << endl << typeid ( b1 ).name( ) ;
Der1 d1 ;
b1 = &d1 ;
cout << endl << typeid ( *b1 ).name( ) ;
cout << endl << typeid ( 12 ).name( ) << endl << typeid ( 12.5 ).name( ) ;
}
{
try
{
sample s ;
s.fun( ) ;
}
catch ( sample::errorclass )
{
// do something about the error
}
}
64. Consider the following code:
#include
class base
{
public :
int data ;
};
class d1 : public base
{
};
class d2 : public base
{
};
class der : public d1, public d2
{
public :
void showdata( )
{
cout << data ;
}
};
void main( )
{
der d ;
d.showdata( ) ;
}
If you run this program it is bound to give you errors. This is because of the rules of
inheritance:
1. Each base class not specified virtual will have its own sub-object representing it. In
the above program, if we create object of d1 it will have a sub-object of class base
containing a data member data. If we create an object of class der it will have subobjects of classes d1 and d2 and both the sub-objects will refer to a separate copy of
data. Hence, to access data from class der we will have to mention the class name.
For example, d1::data or d2::data.
2. If we want that only one sub-object should exist we must use the concept of virtual
base class. The single object of this will represent every base class of given name that
is specified to be virtual
class. After making d1 and d2 as virtual base class if we create an object of der only
one sub-object would exist and so accessing data would no longer give us errors.
65. How to declare a pointer to a member function?
Ans: Suppose, I wish to declare a pointer to a member function that receives an int
and returns an int. I will have to declare it as int (A::* ) ( int ). Following is an
example.
#include
class A
{
public :
int fun ( int f )
{
cout << "in fun\n" ;
return f * f ;
}
};
typedef int ( A:: *pfun ) ( int ) ;
void main( )
{
pfun p = A::fun ;
Aa;
int s = ( a.*p ) ( 6 ) ;
cout << s ;
}
7, 8, 9
};
void main( )
{
int **p ;
p = new int *[3] ;
for ( int i = 0 ; i < 3 ; i++ )
p[i] = new int[3] ;
for ( i = 0 ; i < 3 ; i++ )
for ( int j = 0 ; j < 3 ; j++ )
p[i][j] = a[i][j] ;
for ( i = 0 ; i < 3 ; i++ )
{
for ( j = 0 ; j < 3 ; j++ )
cout << p[i][j] ;
cout << "\n" ;
}
}
69. When should we use the :: ( scope resolution ) operator to invoke the virtual
functions?
Ans: Generally, :: operator is used to call a virtual function from constructor or
destructor. This is because, if we call a virtual function from base class constructor or
destructor the virtual function of the base class would get called even if the object
being constructed or destroyed would be the object of the derived class. Thus,
whenever we want to bypass the dynamic binding mechanism we must use the ::
operator to call a virtual function.
70. How do I use operators .* and ->* in a program?
Ans: The following code snippet demonstrates the use of .* and ->* operators.
#include
class sample
{
public :
int i ;
void fun( )
{
cout << "fun" << endl ;
}
};
void main( )
{
sample s ;
int i ;
i = s + 10 ;
cout << i ;
}
In the above program on adding 10 to an object s, the value of i would become 20.
72. Can we have a reference to an array?
Ans: Yes, we can have a reference to an array.
int a[ ] = { 8, 2, 12, 9 } ;
int ( &r ) [ 4 ] = a ; // reference to an array
Here, r is a reference to an array of four elements. We can even print the elements of
array with the help of reference. This is shown in the following code segment:
for ( int i = 0 ; i < 4 ; i++ )
cout << r [i] << endl ;
73. When friend function becomes indispensable...
Ans: Consider the following program.
#include
class distance
{
private :
int feet ;
public :
distance( )
{
feet = 0 ;
}
distance ( int f )
{
feet = f ;
}
distance operator + ( distance x )
{
int f = feet + x.feet ;
return distance ( f ) ;
}
};
void main( )
{
distance d1 ( 20 ), d2, d3 ;
d2 = d1 + 10 ;
d3 = 10 + d2 ;
}
If you run this program it is bound to give errors. The error lies in the statement d3 =
10 + d2 ; We may think that since we have overloaded + operator this statement
would add 10 to d2. But this does not happen. This is because the specified statement
will get converted as d3 = 10.operator+ ( d2 ) ; This means that this statement
should call the operator+( ) function that takes an object of distance class as
parameter written in
the float class, which is not possible. The solution is to write operator+( ) as a 'friend'
function. Declare operator+ function in distance class as given below:
friend distance operator + ( distance x1, distance x2 ) ;
and define it outside the class as shown below:
distance operator + ( distance x1, distance x2 )
{
int f = x1.feet + x2.feet ;
return distance ( f ) ;
}
When compiler would see that the 'friend' operator+( ) function is available it would
convert the statement d3 = 10 + d2 as operator+ (10, d2 ). Now since 10 is passed
as a parameter not as a calling object there would be no error. Thus in such cases
'friend' function becomes indispensable.
74. How to use a memory as a stream?
Ans: Suppose, details of an employee such as name, designation, age, etc. are stored
in different types of variables. Now, if we wish to concatenate these details in a
character array we will have to use various string manipulation functions like strcpy( )
and strcat( ). Instead of using these functions we can use more easy and clean way to
gather the details in the char array in the form of streams. We can declare the
memory allocated for the array as stream and use the << operator to store variables
having different types in this memory. Following program shows how to achieve this.
#include
void main( )
{
char buff [50] ;
}
};
void main( )
{
A a ( "abcd" ) ;
cout << a.rp ;
}
76. iostream library has made it easy to read data from various input devices and write
data to the output devices. The following program shows how to print a disk file
'data.dat' on the printer using stream classes. Every hardware device has a familiar
name given by the operating system. The printer is generally connected to the first
parallel port. So, the file name for the printer should be PRN or lpt1.
#include
void main( )
{
ifstream i ( "data.dat" ) ;
ofstream o ;
o.open ( "PRN" ) ;
char ch ;
while ( 1 )
{
i.get ( ch ) ;
if ( i.eof( ) )
break ;
o.put ( ch ) ;
}
o.put ( '\x0C' ) ;
}
77. We know that a destructor is automatically called when an object of a class goes out of
scope. There is another case where destructor is called automatically. If an object is
created in a try block and an exception is thrown after the object is created, then the
destructor is called automatically.
78. Can a function call be at the left hand side of the assignment operator?
Ans: Yes. Following program shows how it is possible.
#include
class ref
{
private :
struct data
{
int a ; char *p ;
} d1, d2 ;
public :
data &set ( )
{
return d1 ;
}
data &get ( )
{
cin >> d2.a >> d2.p ;
return d2 ;
}
};
void main( )
{
ref r ;
r.set( ) = r.get( ) ;
r.print( ) ;
}
In the above program the functions get( ) and set( ) both return a reference to the
object of the structure data. We have assigned the reference returned by get( ) to the
reference returned by set( ) function. That is, we are assigning d2 to d1. So, the
values of d2 would get assigned to d1. You can check this out by printing the values of
d1.
79. If a class contains a virtual function a pointer called VPTR is created. This VPTR
becomes a part of every object of that class. The first two bytes (in DOS) are occupied
by VPTR. We can prove this by displaying the first two bytes of memory allocated for
the objects. Following program shows how this can be achieved.
#include
class vir
{
public :
virtual void f( )
{
}
};
void main( )
{
vir v, v1 ;
int *p1 = ( int* ) &v ;
int *p2 = ( int* ) &v1 ;
cout << endl << *p1 << " " << *p2 ;
}
catch ( sample::errorclass )
{
// do something about the error
}
}
81. Accessing a private data member from a different Object...Different objects of the
same class can access each other's members, even if these members are private. For
example:
#include < iostream.h >
class sample
{
float f ;
public :
sample ( float ff )
{
f = ff ;
}
void fun ( sample* objptr )
{
objptr -> n = 0 ;
cout << "Value of this objects f is : " << f << endl ;
cout << "Value of other objects f" << objptr -> n << endl ;
} // another object's private member!
};
void main( )
{
sample s1 ( 6.5f ) , s2 ( 2.5f ) ;
s1.f ( &s2 ) ; // s1 changes s2's n
}
Typically, this coding style should be avoided. However, you should be aware that
private members of an object can be changed by another object of the same type.
Therefore, in certain special conditions, this coding style may be useful.
82. Can you access private data members of a class from out side the class?
Ans: Yes. This program shows how.
#include
class emp
private :
int i ;
public :
emp( )
{
i = 10 ;
}
};
void main( )
emp *p = new emp ;
int *pi = (int*) p ;
cout << *pi ;
*pi = 20 ;
cout << *pi ;
}
The pointer to the class is typecasted in an integer pointer. With the help of this
pointer private data member 'i' is accessed in main( ).
83. Why creating array of references is not possible?
Ans: The array name always refers or points to the zeroeth element. If array is of
references then the array name would point to the zeroeth element which happens to
be a reference. Creating pointer to a reference is not valid. So, creating array of
references too is not possible.
84. How do I call a virtual function of a class using a pointer to a function ?
Ans :
#include
class Cvirtual
{
public :
virtual float vfun( )
{
cout << "from vfun" << endl ;
return 7.03f ;
}
};
void main( )
{
Cvirtual obj ;
public :
infunc( )
{
outer *pout ;
pout = (outer*) this - ( size_t ) &( ( ( outer* ) 0 ) -> in ) ;
pout -> outfunc( ) ;
}
};
inner in ;
outfunc( )
{
cout << "in outer class's function" ;
}
};
void main( )
{
outer out ;
out.in.infunc( )
}
In the above example we are calling outer::outfunc( ) from inner::infunc(). To call
outfunc( ) we need a pointer to the outer class. To get the pointer we have subtracted
offset of the inner class's object (base address of outer class's object - address of
inner class's object) from address of inner class's object.
88. void f ( float n, int i = 10 ) ;
void f ( float a ) ;
void main( )
{
f ( 12.6 ) ;
}
void f ( float n, int i )
{
}
void f ( float n )
{
}
The above program results in an error (ambiguous call) since without the default
argument the two functions have arguments that are matching in number, order and
type.
89. Some programs need to exercise precise control over the memory areas where data is
placed. For example, suppose we wish to read the contents of the boot sector into a
structure. For this the byte arrangement of the
structure elements must match the arrangement of various fields in the boot sector of
the disk.
The #pragma pack directives offer a way to fulfill this requirement. The #pragma pack
directive specifies packing alignment for structure and union members. The #pragma
takes effect at the first structure or union declaration after the #pragma is seen.
Consider the following structure:
#pragma pack (1)
struct emp
{
int a ;
float s ;
char ch ;
};
#pragma pack( )
Here, #pragma pack ( 1 ) lets each structure element to begin on a 1-byte boundary.
Hence the size of the structure will be 9. (int - 4, float - 4, char - 1). If we use
#pragma pack ( 2 ) each structure element can begin on a 2-byte boundary. Hence
the size of the structure will be 10. (int - 4, float - 4, char - 2).
90. How to restrict a friend class's access to the private data members?
Ans: If we declare a class as a friend of our class the friend class can access the
private data members of our class. However, if we want we can restrict this access to
some selective functions of the class. Following program shows how to achieve this:
#include
class X
{
public :
void print ( class Z &z ) ;
};
class Z
{
private :
int i ;
public :
Z ( int ii )
{
i = ii ;
}
friend X::print ( class Z &z ) ;
};
void X::print ( Z &z1 )
{
cout << z1.i ;
}
main( )
{
Z z ( 10 ) ;
Xx;
x.print ( 10 ) ;
}
In the above program only the X::print( ) function can access the private data
members of class Z.
91. What is name mangling?
Ans: C++ enables you to assign the same function name to more than one functions
but with different parameter types. This feature is called function overloading. But
when we give several functions the same name, how does the compiler decide which
particular function is to be called? C++ solves this problem by applying a process
called name mangling. Name mangling applies a decorated name to the function. The
mangled name includes tokens that identify the functions' return type and the types of
its arguments.
class test
{
public :
void fun ( int a, char b ) ;
void fun ( char *c, float y ) ;
};
void main( )
{
test s1 ;
{
sample temp ;
temp.i = s1.i * s2.i ;
return ( temp ) ;
}
void main( )
{
sample s1 ( 10 ), s2 ;
s2 = s1 * 2 ;
s2.showdata( ) ;
s1 = 2 * s2 ;
s1.showdata( ) ;
}
Here the operator *( ) function takes two parameters. This is because the operator
function is no longer a member function of the class. It is a friend of the class sample.
Thus the statement s2 = s1 * 2 ; would not take the form s2.operator * ( 2 ). This
example shows that using friend permits the overloaded operators to be more
versatile.
96. What is a const_cast?
Ans: The const_cast is used to convert a const to a non-const. This is shown in the
following program.
#include
void main( )
{
const int a = 0 ;
int *ptr = ( int * ) &a ; // one way
ptr = const_cast ( &a ) ; // better way
}
Here, the address of the const variable a is assigned to the pointer to a non-const
variable. The const_cast is also used when we want to change the data members of a
class inside the const member functions. The following code snippet shows how to do
this.
class sample
{
private :
int data ;
public :
void fun( ) const
{
( const_cast ( this ) ) -> data = 70 ;
}
};
97. Using a smart pointer we can make an object appear like a pointer.
If a class overloads the operator -> then any object of that class can appear like a
pointer when the operator -> ( ) is called. The following program illustrates this.
#include
class test
{
public :
void fun( )
{
cout << "fun of smart pointer" ;
}
};
class smartpointer
{
test t ;
public :
test* operator ->( )
{
return &t ;
}
};
void main( )
{
smartpointer sp ;
sp -> fun( ) ;
}
The beauty of overloading operator -> is that even though sp is an object we can
make it work like a pointer. The operator -> ( ) returns the address of the object of
the type test. Using this address of the test object the function fun( ) of the class test
gets called. Thus even though fun( ) is not a member of smartpointer class we can still
call it using sp.
98. Can we apply delete on this pointer inside a member function?
Ans : Yes! If the member function of a class is called using a pointer to an object,
which is allocated dynamically, the object would get deleted. But if the member
function is called using the object, which is allocated statically, then a runtime error
would occur. This is because we cannot call delete on statically allocated objects. This
is illustrated in the following example.
class sample
{
private :
int i ;
public :
void fun( )
{
delete this ;
}
};
void main( )
{
sample *s = new sample ;
s -> fun( ) ; // no error
sample s1 ;
s1.fun( ) ; // would throw a runtime error
}
99. Why can't data members of a class be initialized at the time of declaration as given in
the following code?
class emp
{
private :
int j = 10 ;
};
Ans: Memory for data members of a class is allocated only when object of that class is
created. One cannot store data in a memory location, which does not exist at all.
Therefore initialization at the time of declaration
is not possible.
100.
shown below?
#include
class emp
{
public :
emp( )
{
}
emp ( emp& )
{
cout << "copy" ;
}
};
void main( )
{
emp e ;
emp e1 = e ;
}
Ans: A copy constructor is called when an object is created and initialised at the same
time. It is also called when object is passed to a function. So, If we pass the object to
copy constructor copy constructor would get called recursively. Thus it will stuck up in
an infinite loop.
101.
Ans: The term binding refers to the connection between a function call and the actual
code executed as a result of the call. Early Binding: If which function is to be called is
known at the compile-time it is known as static or early binding. Dynamic Binding: If
which function is to be called is decided at run time it is called as late or dynamic
binding. Dynamic binding is so called because the actual function called at run-time
depends on the contents of the pointer. For example, call to virtual functions, call to
functions to be linked from dlls use late binding.
102.
Ans: While outputting data to memory in the in-memory formatting we need to create
an object of the class ostrstream. The constructor of ostrstream receives the address
of the buffer but if we want that the ostrstream
object should do its own memory management then we need to create an ostrstream
object with no constructor arguments as:
ostrstream s ;
Now s will do its own memory management. We can stuff as many bytes into it as we
want. If it falls short of memory, it will allocate more memory. If it cannot, it may
even move the block of memory. When the object goes out of scope, the heap storage
is automatically released. This is a more flexible approach if we do not know how
much space we are going to need. If we want the physical address of the memory
used by s we can obtain it by calling the str( ) member function:
char* p = s.str( ) ;
Once str( ) has been called then the block of memory allocated by ostrstream cannot
be moved. This is logical. It can't move the block since we are now expecting it to be
at a particular location. In such a case we
say that ostrstream has freezed itself. Once frozen we can't add any more characters
to it. Adding characters to a frozen ostrstream results in undefined behavior. In
addition, the ostrstream is no longer responsible for cleaning up the storage. You took
over that responsibility when you asked for the char * with str( ). We can clean the
storage in two ways: Using the delete operator as shown below:
ostrstream s ;
char *p ;
p = s.str( ) ;
delete p ;
By unfreezing the ostrstream. You do this by calling freeze( ), with an argument 1.
During freezing it is called with the default argument of 0.
1. How many butes does an array A(1:8,-2:2,1:5) require for storage if each element of the
array is 24 bits long.
200 480 600 800 none
2. begin
i:=0;
j:=0; | block d
loop:
if(i != 0)
i := i-1;
else
i := i+1;
i := i+1; | block a
j := j+1; | block b
if (j <= 25)
goto loop;
end | block c
a) What is the value of i at [c]
2?
b) How many times is the goto executed
25 ?
c) How many times is the loop executed if i is initialized to 1
in [d] 26
d) How many times is the loop entered if the block [b] is changed
to j=j+1 ?
e) What is the value of i at [c] interchanging blocks [a] and [b] ?
2?
Follow the instructions given below [ From 1 to 8 ]
1. A cause B or C but not both
2. F occurs only if B occurs
3. D occurs if B or C occurs
4. E occurs if only c occurs
5. J occurs only if E or F occurs
6. H occurs if E occurs
7. D causes G, H or Both.
8. G occurs if F occurs.
Questions
--------1. If A occurs which of the following may occur
1. F & G (ii) E & H (iii) D
Ans
(a) 1 only (b) 2 only (c) 3 only (d) 1,2,3 or 2 & 3 but not 1
(e) 1,2 & 3
2. If B occurs which must occur
Ans
(a) F & G (b) D & G (c) D (d) G & H (e) J
3. If J occurs which must occur
Ans
(a) E (b) Both E & F (c) Either B or C (d) B (e) Both B & c
4. Which may occur as a result by a cause not mentioned.
(I) D (II) A (III) F
Ans
(a) I only (b) II (c) I & II (d) II & III (e) I,II,III
5. If E occurs which cannot occur.
(a) F (b) A (c) D (d) C (e) J
1) A - G are 7 consecutive +ve integers not necessarily in the same order
1) B is the middle number
2) D is 3 less than c
3) the difference between F & A is equal in magnitude and sign to the difference between E &
C
4) Neither F nor C lie between E & G
a) What is the value of B-F
1 2 -1 -2 cannot be determined
b) which is greatest
F C A E cannot be determined
c) Given both A & B are primes what is the lowest value of E
8 6 9 12 cannot
2) Given that a,b,c,d,e each represent one of the digits between
1-9 and that the following multiplication holds
abcde
4
---------edcba
1) Find the output for the following C program
main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
Ans. An empty string
2) Find the output for the following C program
main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
}
Ans. 57 94
3) Find the output for the following C program
main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
Ans. 5 20 1
4) Find the output for the following C program
#define swap1(a,b) a=a+b;b=a-b;a=a-b;
main()
{
int x=5,y=10;
swap1(x,y);
printf("%d %d\n",x,y);
swap2(x,y);
printf("%d %d\n",x,y);
}
int swap2(int a,int b)
{
int temp;
temp=a;
b=a;
a=temp;
return;
}
Ans. 10 5
5) Find the output for the following C program
main()
{
char *ptr = "Ramco Systems";
(*ptr)++;
printf("%s\n",ptr);
ptr++;
printf("%s\n",ptr);
}
Ans. Samco Systems
6) Find the output for the following C program
#include<stdio.h>
main()
{
char s1[]="Ramco";
char s2[]="Systems";
s1=s2;
printf("%s",s1);
}
Ans. Compilation error giving it cannot be an modifiable 'lvalue'
7) Find the output for the following C program
#include<stdio.h>
main()
{
char *p1;
char *p2;
p1=(char *) malloc(25);
p2=(char *) malloc(25);
strcpy(p1,"Ramco");
strcpy(p2,"Systems");
strcat(p1,p2);
printf("%s",p1);
}Ans. RamcoSystems
8) Find the output for the following C program given that
[1]. The following variable is available in file1.c
static int average_float;
Ans. All the functions in the file1.c can access the variable
9) Find the output for the following C program
# define TRUE 0
some code
while(TRUE)
{
some code
}
Ans. This won't go into the loop as TRUE is defined as 0
10) Find the output for the following C program
main()
{
int x=10;
x++;
change_value(x);
x++;
Modify_value();
printf("First output: %d\n",x);
}
x++;
change_value(x);
printf("Second Output : %d\n",x);
Modify_value(x);
printf("Third Output : %d\n",x);
}
Modify_value()
{
return (x+=10);
}
change_value()
{
return(x+=1);
}
Ans. 12 1 1
Sample Test Paper
C test
1.
2.
3.
FILENAME(back)
a. test_back
b. test_#back
c. test_##back
d. ??
4.
5.
6.
7.
d. ??
8.
class b
{
}
class a
{
class b
friend
}
then what is ture
a. a can access all protected and public members in b
b. b can access all protected and public members in a
c. a can access all members of a
d. b can access all members of b
9.
#include
main()
{
int n=0;
int i;
i=2;
switch(1)
{
case 0:do{
case 1:n++;
case 2:n++;
}
while(--i>0);
}
printf(\"n==%d\",n);
}
a. compile error
b. 4
c. 1
d. 0
Mathematics
10.
Two liquids A : B in ratio 7:5 and now 24 gallons drain out and b is added
the
man has rope of length 660 mtr to fence a area , what is the max area he
can fence ?
12.
Son
is about to celebrate 10th birthday. after 11 years his age will be half
the average of his parents. his mother is 17 years older to him. what is the age of
the father.
13.
15.
no. -> 5
16.
diff of three consecutive nos square and the nos is 214; find the nos :
Interview Technical
17.
18.
19.
main()
{
int i==2;
int a==4;
if((i+==3)>a)
{
printf( \" TRUE \");
}
else
{
printf(\"FALSE \");
}
}
What is the output of the program ..
Ans ) TRUE , coz i+==3 becomes incremented and i becomes 5 . So i is greater than a
20.
What is an OS ?
21.
22.
performed on the data. It makes the task of a programmer easy coz it has all the set of
data and operations at a particular place
23.
What is OOP.
24.
25.
26.
27.
28.
HR interview..
29.
30.
31.
32.
33.
34.
what do u do on sundays???
35.
Do u like hyderabad???
36.
37.
38.
void main ()
{ int i = 0 , a[3] ;
a[i] = i++;
printf (?%d",a[i]) ;
}
Ans: The output for the above code would be a garbage value. In the statement a[i] =
i++; the value of the variable i would get assigned first to a[i] i.e. a[0] and then the
value of i would get incremented by 1. Since a[i] i.e. a[1] has not been initialized, a[i]
will have a garbage value
2.
3.
4.
5.
How do I write code that reads data at memory location specified by segment and
offset?
Ans: Use peekb( ) function. This function returns byte(s) read from specific segment
and offset locations in memory. The following program illustrates use of this function.
In this program from VDU memory we have read characters and its attributes of the
first row. The information stored in file is then further read and displayed using peek( )
function.
#include
#include
main( )
{
char far *scr = 0xB8000000 ;
FILE *fp ;
int offset ;
char ch ;
if ( ( fp = fopen ( "scr.dat", "wb" ) ) == NULL )
{
printf ( "\nUnable to open file" ) ;
exit( ) ;
}
// reads and writes to file
for ( offset = 0 ; offset < 160 ; offset++ )
fprintf ( fp, "%c", peekb ( scr, offset ) ) ;
fclose ( fp ) ;
if ( ( fp = fopen ( "scr.dat", "rb" ) ) == NULL )
{
printf ( "\nUnable to open file" ) ;
exit( ) ;
}
// reads and writes to file
for ( offset = 0 ; offset < 160 ; offset++ )
{
fscanf ( fp, "%c", &ch ) ;
printf ( "%c", ch ) ;
}
fclose ( fp ) ;
}
6.
);
c = memicmp ( arr1, arr2, sizeof ( arr1 ) ) ;
if ( c == 0 )
printf ( "\nStrings arr1 and arr2 compared using memicmp are identical" )
;
else
printf ( "\nStrings arr1 and arr2 compared using memicmp are not
identical" ) ;
}
7.
Fixed-size objects are more appropriate as compared to variable size data objects.
Using variable-size data objects saves very little space. Variable size data objects
usually have some overhead. Manipulation of fixed-size data objects is usually faster
and easier. Use fixed size when maximum size is clearly bounded and close to
average. And use variable-size data objects when a few of the data items are bigger
than the average size. For example,
char *num[10] = { "One", "Two", "Three", "Four",
"Five", "Six", "Seven", "Eight", "Nine", "Ten" } ;
Instead of using the above, use
char num[10][6] = { "One", "Two", "Three", "Four",
"Five", "Six", "Seven", "Eight", "Nine", "Ten" } ;
The first form uses variable-size data objects. It allocates 10 pointers, which are
pointing to 10 string constants of variable size. Assuming each pointer is of 4 bytes, it
requires 90 bytes. On the other hand, the second form uses fixed size data objects. It
allocates 10 arrays of 6 characters each. It requires only 60 bytes of space. So, the
variable-size in this case does not offer any advantage over fixed size.
8.
{
printf ( "Too many or Too few arguments..." ) ;
exit ( 0 ) ;
}
for ( i = 1 ; i < argc ; i++ )
a[i] = atoi ( argv[i] ) ;
ret = a[1] * a[2] ;
return ret ;
}
/* Spawn.c */
#include
#include
main( )
{
int val ;
val = spawnl ( P_WAIT, "C:\\Mult.exe", "3", "10",
"20", NULL ) ;
printf ( "\nReturned value is: %d", val ) ;
}
Here, there are two programs. The program 'Mult.exe' works as a child process
whereas 'Spawn.exe' works as a parent process. On execution of 'Spawn.exe' it
invokes 'Mult.exe' and passes the command-line arguments to it. 'Mult.exe' in turn on
execution, calculates the product of 10 and 20 and returns the value to val in
'Spawn.exe'. In our call to spawnl( ) function, we have passed 6 parameters, P_WAIT
as the mode of execution, path of '.exe' file to run as child process, total number of
arguments to be passed to the child process, list of command line arguments and
NULL. P_WAIT will cause our application to freeze execution until the child process has
completed its execution. This parameter needs to be passed as the default parameter
if you are working under DOS. under other operating systems that support
multitasking, this parameter can be P_NOWAIT or P_OVERLAY. P_NOWAIT will cause
the parent process to execute along with the child process, P_OVERLAY will load the
child process on top of the parent process in the memory.
9.
dno = getdisk( ) ;
printf ( "\nThe current drive is: %c\n", 65 + dno
);
maxdr = setdisk ( 3 ) ;
dno = getdisk( ) ;
printf ( "\nNow the current drive is: %c\n", 65 +
dno ) ;
}
15. The functions memcmp( ) and memicmp( )
The functions memcmp( ) and memicmp( ) compares first n bytes of given two blocks
of memory or strings. However, memcmp( ) performs comparison as unsigned chars
whereas memicmp( ) performs comparison as chars but ignores case (i.e. upper or
lower case). Both the functions return an integer value where 0 indicates that two
memory buffers compared are identical. If the value returned is greater than 0 then it
indicates that the first buffer is bigger than the second one. The value less than 0
indicate that the first buffer is less than the second buffer. The following code snippet
demonstrates use of both
#include
#include
main( )
{
char str1[] = "This string contains some
characters" ;
char str2[] = "this string contains" ;
int result ;
result = memcmp ( str1, str2, strlen ( str2 ) ) ;
printf ( "\nResult after comapring buffer using
memcmp( )" ) ;
show ( result ) ;
result = memicmp ( str1, str2, strlen ( str2 ) ) ;
printf ( "\nResult after comapring buffer using
memicmp( )" ) ;
show ( result ) ;
}
show ( int r )
{
if ( r == 0 )
printf ( "\nThe buffer str1 and str2 hold
identical data" ) ;
if ( r > 0 )
printf ( "\nThe buffer str1 is bigger than buffer
str2" ) ;
if ( r < 0 )
printf ( "\nThe buffer str1 is less than buffer
str2" ) ;
}
16. How do I write code to find an amount of free disk space available on current drive?
Ans: Use getdfree( ) function as shown in follow code.
#include
#include
#include
#include
main( )
{
int dr ; struct dfree disk ;
long freesp ;
dr = getdisk( ) ;
getdfree ( dr + 1 , &disk ) ;
if ( disk.df_sclus == 0xFFFF )
{
printf ( "\ngetdfree( ) function failed\n");
exit ( 1 ) ;
}
freesp = ( long ) disk.df_avail
* ( long ) disk.df_bsec
* ( long ) disk.df_sclus ;
printf ( "\nThe current drive %c: has %ld bytes
available as free space\n", 'A' + dr, freesp ) ;
}
17. Use of array indices...
If we wish to store a character in a char variable ch and the character to be stored
depends on the value of another variable say color (of type int), then the code would
be as shown below:
switch ( color )
{
case 0 :
ch = 'R' ;
break ;
case 1 :
ch = 'G' ;
break ;
case 2 :
ch = 'B' ;
break ;
}
In place of switch-case we can make use of the value in color as an index for a
character array. How to do this is shown in following code snippet.
char *str = "RGB' ;
char ch ;
int color ;
// code
ch = str[ color ] ;
18. Function atexit( ) recevies parameter as the address of function of the type void fun
( void ). The function whose address is passed to atexit( ) gets called before the
termination of program. If atexit( ) is called for more than one function then the
functions are called in "first in last out" order. You can verify that from the output.
#include
#include
void fun1( )
{
printf("Inside fun1\n");
}
void fun2( )
{
printf("Inside fun2\n");
}
main( )
{
atexit ( fun1 ) ;
/* some code */
atexit ( fun2 ) ;
printf ( "This is the last statement of
program?\n" );
}
19. How do I write a user-defined function, which deletes each character in a string str1,
which matches any character in string str2?
Ans: The function is as shown below:
Compress ( char str1[], char str2[] )
{
int i, j, k ;
for ( i = k = 0 ; str1[i] != ?\0? ; i++ )
{
for ( j = 0 ; str2[j] != ?\0? && str2[j] !=
str1[i] ; j++ );
if ( str2[j] == ?\0? )
str1[k++] = str1[I] ;
}
str1[k] = ?\0?
}
20. How does free( ) know how many bytes to free?
Ans: The malloc( ) / free( ) implementation remembers the size of each block
allocated and returned, so it is not necessary to remind it of the size when freein;
21. What is the use of randomize( ) and srand( ) function?
Ans: While generating random numbers in a program, sometimes we require to control
the series of numbers that random number generator creates. The process of
assigning the random number generators starting number is called seeding the
generator. The randomize( ) and srand( ) functions are used to seed the random
number generators. The randomize( ) function uses PC's clock to produce a random
seed, whereas the srand( ) function allows us to specify the random number
generator's starting value.
22. How do I determine amount of memory currently available for allocating?
Ans: We can use function coreleft( ) to get the amount of memory available for
allocation. However, this function does not give an exact amount of unused memory.
If, we are using a small memory model, coreleft( ) returns the amount of unused
memory between the top of the heap and stack. If we are using a larger model, this
function returns the amount of memory between the highest allocated memory and
the end of conventional memory. The function returns amount of memory in terms of
bytes.
23. How does a C program come to know about command line arguments?
Ans: When we execute our C program, operating system loads the program into
memory. In case of DOS, it first loads 256 bytes into memory, called program
segment prefix. This contains file table, environment segment, and command line
information. When we compile the C program the compiler inserts additional code that
parses the command, assigning it to the argv array, making the arguments easily
accessible within our C program.
24. When we open a file, how does functions like fread( )/fwrite( ), etc. get to know from
where to read or to write the data?
Ans: When we open a file for read/write operation using function like fopen( ), it
returns a pointer to the structure of type FILE. This structure stores the file pointer
called position pointer, which keeps track of current location within the file. On
opening file for read/write operation, the file pointer is set to the start of the file. Each
time we read/write a character, the position pointer advances one character. If we
read one line of text at a step from the file, then file pointer advances to the start of
the next line. If the file is opened in append mode, the file pointer is placed at the very
end of the file. Using fseek( ) function we can set the file pointer to some other place
within the file.
25. The sizeof( ) function doesn?t return the size of the block of memory pointed to by a
pointer. Why?
Ans: The sizeof( ) operator does not know that malloc( ) has been used to allocate a
pointer. sizeof( ) gives us the size of pointer itself. There is no handy way to find out
the size of a block allocated by malloc( ).
26. FP_SEG And FP_OFF?
Sometimes while working with far pointers we need to break a far address into its
segment and offset. In such situations we can use FP_SEG and FP_OFF macros.
Following program illustrates the use of these two macros.
#include
main( )
{
unsigned s, o ;
char far *ptr = "Hello!" ;
s = FP_SEG ( ptr ) ;
o = FP_OFF ( ptr ) ;
printf ( "\n%u %u", s, o ) ;
}
27. How do I write a program to convert a string containing number in a hexadecimal form
to its equivalent decimal?
Ans: The following program demonstrates this:
main( )
{
char str[] = "0AB" ;
int h, hex, i, n ;
n=0;h=1;
for ( i = 0 ; h == 1 ; i++ )
{
if ( str[i] >= '0' && str[i] <= '9' )
hex = str[i] - '0' ;
else
{
if ( str[i] >= 'a' && str[i] <= 'f' )
hex = str[i] - 'a' + 10 ;
else
if ( str[i] >= 'A' && str[i] <= 'F' )
hex = str[i] - 'A' + 10 ;
else
h=0;
}
if ( h == 1 )
n = 16 * n + hex ;
}
printf ( "\nThe decimal equivalent of %s is %d",
str, n ) ;
}
The output of this program would be the decimal equivalent of 0AB is 171.
28. How do I write code that reads the segment register settings?
Ans: We can use segread( ) function to read segment register settings. There are four
segment registers?code segment, data segment, stack segment and extra segment.
Sometimes when we use DOS and BIOS services in a program we need to know the
segment register's value. In such a situation we can use segread( ) function. The
following program illustrates the use of this function.
#include
main( )
{
struct SREGS s ;
segread ( &s ) ;
printf ( "\nCS: %X DS: %X SS: %X ES: %X",s.cs,
s.ds, s.ss, s.es ) ;
}
29. What is environment and how do I get environment for a specific entry?
Ans: While working in DOS, it stores information in a memory region called
environment. In this region we can place configuration settings such as command
path, system prompt, etc. Sometimes in a program we need to access the information
contained in environment. The function getenv( ) can be used when we want to access
environment for a specific entry. Following program demonstrates the use of this
function.
#include
#include
main( )
{
char *path = NULL ;
path = getenv ( "PATH" ) ;
if ( *path != NULL )
printf ( "\nPath: %s", path ) ;
else
printf ( "\nPath is not set" ) ;
}
30. How do I display current date in the format given below?
Saturday July 12, 2004
Ans: Following program illustrates how we can display date in above given format.
#include
#include
main( )
{
struct tm *curtime ;
time_t dtime ;
char str[30] ;
time ( &dtime ) ;
curtime = localtime ( &dtime ) ;
strftime ( str, 30, "%A %B %d, %Y", curtime ) ;
printf ( "\n%s", str ) ;
}
Here we have called time( ) function which returns current time. This time is returned
in terms of seconds, elapsed since 00:00:00 GMT, January 1, 1970. To extract the
week day, day of month, etc. from this value we need to break down the value to a tm
structure. This is done by the function localtime( ). Then we have called strftime( )
function to format the time and store it in a string str.
31. If we have declared an array as global in one file and we are using it in another file
then why doesn't the sizeof operator works on an extern array?
Ans: An extern array is of incomplete type as it does not contain the size. Hence we
cannot use sizeof operator, as it cannot get the size of the array declared in another
file. To resolve this use any of one the following two solutions:
1. In the same file declare one more variable that holds the size of array. For example,
array.c
int arr[5] ;
int arrsz = sizeof ( arr ) ;
myprog.c
extern int arr[] ;
extern int arrsz ;
2. Define a macro which can be used in an array
declaration. For example,
myheader.h
#define SZ 5
array.c
#include "myheader.h"
int arr[SZ] ;
myprog.c
#include "myheader.h"
extern int arr[SZ] ;
32. How do I write printf( ) so that the width of a field can be specified at runtime?
Ans: This is shown in following code snippet.
main( )
{
int w, no ;
printf ( "Enter number and the width for the
number field:" ) ;
scanf ( "%d%d", &no, &w ) ;
printf ( "%*d", w, no ) ;
}
Here, an '*' in the format specifier in printf( ) indicates that an int value from the
argument list should be used for the field width.
33. How to find the row and column dimension of a given 2-D array?
Ans: Whenever we initialize a 2-D array at the same place where it has been declared,
it is not necessary to mention the row dimension of an array. The row and column
dimensions of such an array can be determined programmatically as shown in
following program.
void main( )
{
int a[][3] = { 0, 1, 2,
9,-6, 8,
7, 5, 44,
23, 11,15 } ;
int c = sizeof ( a[0] ) / sizeof ( int ) ;
int r = ( sizeof ( a ) / sizeof ( int ) ) / c ;
int i, j ;
printf ( "\nRow: %d\nCol: %d\n", r, c ) ;
for ( i = 0 ; i < r ; i++ )
{
for ( j = 0 ; j < c ; j++ )
printf ( "%d ", a[i][j] ) ;
printf ( "\n" ) ;
}
}
gets ( fname ) ;
if ( access ( fname, 0 ) != 0 )
{
printf ( "\nFile does not exist." ) ;
return ;
}
}
35. How do I convert a floating-point number to a string?
Ans: Use function gcvt( ) to convert a floating-point number to a string. Following
program demonstrates the use of this function.
#include
main( )
{
char str[25] ;
float no ;
int dg = 5 ; /* significant digits */
no = 14.3216 ;
gcvt ( no, dg, str ) ;
printf ( "String: %s\n", str ) ;
}
36. What is a stack ?
Ans: The stack is a region of memory within which our programs temporarily store
data as they execute. For example, when a program passes parameters to functions, C
places the parameters on the stack. When the function completes, C removes the
items from the stack. Similarly, when a function declares local variables, C stores the
variable's values on the stack during the function's execution. Depending on the
program's use of functions and parameters, the amount of stack space that a program
requires will differ.
37. Allocating memory for a 3-D array
#include "alloc.h"
#define MAXX 3
#define MAXY 4
#define MAXZ 5
main( )
{
int ***p, i, j, k ;
p = ( int *** ) malloc ( MAXX * sizeof ( int ** ) ) ;
for ( i = 0 ; i < MAXX ; i++ )
{
p[i] = ( int ** ) malloc ( MAXY * sizeof ( int * ) ) ;
for ( j = 0 ; j < MAXY ; j++ )
p[i][j] = ( int * ) malloc ( MAXZ * sizeof ( int ) ) ;
}
for ( k = 0 ; k < MAXZ ; k++ )
{
for ( i = 0 ; i < MAXX ; i++ )
{
for ( j = 0 ; j < MAXY ; j++ )
{
p[i][j][k] = i + j + k ;
printf ( "%d ", p[i][j][k] ) ;
}
printf ( "\n" ) ;
}
printf ( "\n\n" ) ;
}
}
Data Structures
How to distinguish between a binary tree and a tree?
Ans: A node in a tree can have any number of branches. While a binary tree is a tree
structure in which any node can have at most two branches. For binary trees we
distinguish between the subtree on the left and subtree on the right, whereas for trees
the order of the subtrees is irrelevant.
Consider the following figure...
This above figure shows two binary trees, but these binary trees are different. The first
has an empty right subtree while the second has an empty left subtree. If the above
are regarded as trees (not the binary trees), then they are same despite the fact that
they are drawn differently. Also, an empty binary tree can exist, but there is no tree
having zero nodes.
38. How do I use the function ldexp( ) in a program?
Ans: The math function ldexp( ) is used while solving the complex mathematical
equations. This function takes two arguments, a double value and an int respectively.
The order in which ldexp( ) function performs calculations is ( n * pow ( 2, exp ) )
where n is the double value and exp is the integer. The following program
demonstrates the use of this function.
#include
#include
void main( )
{
double ans ;
double n = 4 ;
ans = ldexp ( n, 2 ) ;
printf ( "\nThe ldexp value is : %lf\n", ans ) ;
}
Here, ldexp( ) function would get expanded as ( 4 * 2 * 2 ), and the output would be
the ldexp value is : 16.000000
39. Can we get the mantissa and exponent form of a given number?
Ans: The function frexp( ) splits the given number into a mantissa and exponent form.
The function takes two arguments, the number to be converted as a double value and
an int to store the exponent form. The function returns the mantissa part as a double
value. Following example demonstrates the use of this function.
#include
#include
void main( )
{
double mantissa, number ;
int exponent ;
number = 8.0 ;
mantissa = frexp ( number, &exponent ) ;
printf ( "The number %lf is ", number ) ;
printf ( "%lf times two to the ", mantissa ) ;
printf ( "power of %d\n", exponent ) ;
return 0 ;
}
40. How do I write code that executes certain function only at program termination?
Ans: Use atexit( ) function as shown in following program.
#include
main( )
{
int ch ;
void fun ( void ) ;
atexit ( fun ) ;
// code
}
}
The output of the above program would be as given below:
i = 5 j = 16 k = 12 l = 1
44. How can I find the day of the week of a given date?
Ans: The following code snippet shows how to get the day of week from the given
date.
dayofweek ( int yy, int mm, int dd )
{
/*Monday = 1 and Sunday = 0 */
/* month number >= 1 and <= 12, yy > 1752 or so */
static int arr[ ] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 } ;
yy = yy - mm < 3 ;
return ( yy + yy / 4 - yy / 100 + yy / 400 + arr[ mm - 1] + dd ) % 7 ;
}
void main( )
{
printf ( "\n\n\nDay of week : %d ", dayofweek ( 2002, 5, 18 ) ) ;
}
45. What's the difference between these two declarations?
struct str1 { ... } ;
typedef struct { ... } str2 ;
Ans : The first form declares a structure tag whereas the second declares a typedef.
The main difference is that the second declaration is of a slightly more abstract type -its users don't necessarily know that it is a structure, and the keyword struct is not
used when declaring instances of it.
46. How do I print the contents of environment variables?
Ans:. The following program shows how to achieve this:
main( int argc, char *argv[ ], char *env[ ] )
{
int i = 0 ;
clrscr( ) ;
while ( env[ i ] )
printf ( "\n%s", env[ i++ ] ) ;
}
main( ) has the third command line argument env, which is an array of pointers to the
strings. Each pointer points to an environment variable from the list of environment
variables.
49. How do I use scanf( ) to read the date in the form 'dd-mm-yy' ?
Ans: There are two ways to read the date in the form of 'dd-mm-yy' one possible way
is...
int dd, mm, yy ;
char ch ; /* for char '-' */
printf ( "\nEnter the date in the form of dd-mm-yy : " ) ;
scanf( "%d%c%d%c%d", &dd, &ch, &mm, &ch, &yy ) ;
And another best way is to use suppression character * as...
int dd, mm, yy ;
scanf( "%d%*c%d%*c%d", &dd, &mm, &yy ) ;
The suppression character * suppresses the input read from the standard input buffer
for the assigned control character.
50. How do I print a floating-point number with higher precision say 23.34568734 with
only precision up to two decimal places?
Ans: This can be achieved through the use of suppression char '*' in the format string
of printf( ) as shown in the following program.
main( )
{
int i = 2 ;
float f = 23.34568734 ;
printf ( "%.*f", i, f ) ;
}
The output of the above program would be 23.35.
51. Are the expressions *ptr++ and ++*ptr same?
Ans: No. *ptr++ increments the pointer and not the value pointed by it, whereas +
+*ptr increments the value being pointed to by ptr.
52. strpbrk( )
The function strpbrk( ) takes two strings as parameters. It scans the first string, to
find, the first occurrence of any character appearing in the second string. The function
returns a pointer to the first occurrence of the character it found in the first string. The
following program demonstrates the use of string function strpbrk( ).
#include
main( )
{
char *str1 = "Hello!" ;
char *str2 = "Better" ;
char *p ;
}
fun ( int *p )
{
struct emp *q ;
int offset ;
offset = ( char * ) ( & ( ( struct emp * ) 0 ) -> age ) - ( char * ) ( (
struct emp* ) 0 ) ;
q = ( struct emp * ) ( ( char * ) p - offset ) ;
printf ( "\nname: %s", q -> name ) ;
printf ( "\nage: %d", q -> age ) ;
printf ( "\nsalary: %f", q -> salary ) ;
}
58. How to restrict the program's output to a specific screen region?
Ans: A C function window( ) can be used to restrict the screen output to a specific
region. The window( ) function defines a text-mode window. The parameters passed to
this function defines the upper-left and lower-right corner of the region within which
you want the output. In the following program, the string 'Hello!' gets printed within
the specified region. To print the string we must use cprintf( ) function which prints
directly on the text-mode window.
#include
main( )
{
int i, j ;
window ( 20, 8, 60, 17 ) ;
for ( i = 0 ; i < 8 ; i++ )
for ( j = 0 ; j < 10 ; j++ )
cprintf ( "Hello!" ) ;
}
59. Sometimes you need to prompt the user for a password. When the user types in the
password, the characters the user enters should not appear on the screen. A standard
library function getpass( ) can be used to perform such function. Maximum number of
characters that can be entered as password is 8.
main( )
{
char *pwd ;
pwd = getpass ( "Enter Password" ) ;
if ( strcmp ( pwd, "orgcity" ) )
printf ( "\nPassword %s is incorrect", pwd ) ;
else
printf ( "\nCorrect Password" ) ;
}
60. How to obtain the current drive through C ?
Ans: We can use the function _getdrive( ) to obtain the current drive. The _getdrive( )
function uses DOS function 0X19 to get the current drive number
#include
main( )
{
int disk ;
disk = _getdrive( ) + 'A' - 1 ;
printf ( "The current drive is: %c\n", disk ) ;
}
61. How come the output for both the programs is different when the logic is same?
main( )
{
int i, j ;
for ( i = 1, j = 1 ; i <= 5, j <= 100 ; i++, j++ )
{
gotoxy ( 1, 1, ) ;
printf ( "%d %d", i, j ) ;
}
}
main( )
{
int i, j ;
for ( i =1, j = 1; j <= 100, i <= 5; i++, j++ )
{
gotoxy ( 1, 1 ) ;
printf ( "%d %d", i, j ) ;
}
}
Output -> 5 5
Even if logic of both the programs is same the output of the first program comes out
to be 100, 100, but of the second program it is 5, 5. The comma operator plays a vital
role inside the for loop. It always considers the value of the latest variable. So, at the
time of testing the condition in for loop, the value of j will be considered in the first
program and value of i in the second.
62. Can we get the x and y coordinate of the current cursor position ?
Ans : The function wherex( ) and wherey( ) returns the x-coordinate and y-coordinate
of the current cursor position respectively. Both the functions return an integer value.
The value returned by wherex( ) is the horizontal position of cursor and the value
returned by wherey( ) is the vertical position of the cursor. Following program shows
how to use the wherex( ) and wherey( ) functions.
#include
main( )
{
printf ( "Just\n To\n Test\n Where\n the cursor\n goes" ) ;
printf ( "Current location is X: %d Y: %d\n", wherex( ), wherey( ) ) ;
}
63. How do I programmatically delete lines in the text window?
Ans: While writing programs that perform screen-based I/O, you may want to-delete
the current line's contents, moving one line up, all of the output that follows. In such
cases a function called delline( ) can be used. Following code snippet illustrates the
use of function delline( ).
#include
main( )
{
int i ;
clrscr( ) ;
for ( i = 0; i <= 23; i++ )
printf ( "Line %d\r\n", i ) ;
printf ( "Press a key to continue : " ) ;
getch( ) ;
gotoxy ( 2, 6 ) ;
for ( i = 6; i <= 12; i++ )
delline( ) ;
getch( ) ;
}
64. How do I get the time elapsed between two function calls ?
Ans: The function difftime( ) finds the difference between two times. It calculates the
elapsed time in seconds and returns the difference between two times as a double
value.
#include
#include
#include
main( )
{
int a[] = { 2, -34, 56, 78, 112, 33, -7, 11, 45, 29, 6 } ;
int s ;
time_t t1, t2 ; // time_t defines the value used for time function
s = sizeof ( a ) / 2 ;
t1 = time ( NULL ) ;
sel_sort ( a, s ) ; // sort array by selection sort
bub_sort ( a, s ) ; // sort array by bubble sort method
t2 = time ( NULL ) ;
printf ( "\nThe difference between two function calls is %f", difftime (
t2, t1 ) ) ;
}
In the above program we have called difftime( ) function that returns the time elapsed
from t1 to t2.
65. How do I use swab( ) in my program ?
Ans: The function swab( ) swaps the adjacent bytes of memory. It copies the bytes
from source string to the target string, provided that the number of characters in the
source string is even. While copying, it swaps the bytes which are then assigned to the
target string.
#include
#include
#include
main ( )
{
char *str1 = "hS eesll snsiasl not eh es as oher " ;
char *str2 ;
clrscr( ) ;
swab ( str1, str2, strlen ( str1 ) ) ;
printf ( "The target string is : %s\n", str2 ) ; // output -- She sells
snails on the sea shore
getch( ) ;
}
66. Turbo C provides various command line compiler options which we can use through
TCC. The compiler options include : displaying specific warning messages, generating
8087 hardware instructions, using a filename for generating assembly code, etc.
Instead of compiler options being executed at command line we can use these
compiler options in our program. This can be achieved using #pragma options. We can
use various flags with #pragma options to use the compiler options. All these flags are
available in turbo C's online help.
67. I have an array declared in file 'F1.C' as,
int a[ ] = { 1, 2, 3, 4, 5, 6 } ;
and used in the file 'F2.C' as,
extern int a[ ] ;
In the file F2.C, why sizeof doesn't work on the array a[ ]?
Ans: An extern array of unspecified size is an incomplete type. You cannot apply sizeof
to it, because sizeof operates during compile time and it is unable to learn the size of
an array that is defined in another file. You have three ways to resolve this problem:
1. In file 'F1.C' define as,
int a[ ] = { 1, 2, 3, 4, 5, 6 } ;
int size_a = sizeof ( a ) ;
and in file F2.C declare as,
extern int a[ ] ;
extern int size_a ;
2. In file 'F1.H' define,
#define ARR_SIZ 6
In file F1.C declare as,
#include "F1.H"
int a[ ARR_SIZ ] ;
and in file F2.C declare as,
#include "F1.H"
extern int a[ ARR_SIZ ] ;
3. In file 'F1.C' define as,
int a[ ] = { 1, 2, 3, 4, 5, 6, -1 } ;
and in file 'F2.C' declare as,
extern int a[ ] ;
Here the element -1 is used as a sentinel value, so the code can
understand the end without any explicit size.
68. How to delete a line from text displayed on the screen?
Ans: Sometimes, specially when we are creating a text editor like program we may
wish to allow user to delete a line. We can do so by using two functions namely
clreol( ) and delline( ). The clreol( ) function deletes the line from the current cursor
position to the end of line. The delline() function deletes the entire line at the current
cursor position and
moves up the following line. Following program shows how to use these functions.
#include
main( )
{
int i ;
for ( i = 1 ; i <= 20 ; i++ )
printf ( "This is Line %d\n", i ) ;
getch( ) ;
gotoxy ( 1, 7 ) ;
clreol( ) ;
getch( ) ;
gotoxy ( 1, 12 ) ;
delline( ) ;
getch( ) ;
}
69. How do I programmatically insert lines in the text window?
Ans: We can insert a blank line in the text window using the insline( ) function. This
function inserts line at current cursor position. While doing so, it shifts down the lines
that are below the newly inserted line.
#include
void main( )
{
printf ( "The little snail was slowly moving up. She wanted\r\n" ) ;
printf ( "to reach the top of the tree. It was chilly\r\n" ) ;
printf ( "winter season. Most of the animals were resting in\r\n" ) ;
printf ( "their nests as there was a heavy snow fall.\r\n" ) ;
printf ( "\r\nPress any key to continue:" ) ;
gotoxy ( 10, 2 ) ;
getch( ) ;
insline( ) ;
getch( ) ;
}
70. What will be the output of the following program?
main( )
{
on the screen where something is already written or drawn only that portion should
get overwritten which is to be occupied by the mouse cursor. Of the 64 bytes the first
32 bytes contain a bit mask which is first ANDed with the screen image, and then the
second 32 bytes bit mask is XORed with the screen image.
The following program changes the mouse cursor in graphics mode to resemble an
hour glass.
# include "graphics.h"
# include "dos.h"
union REGS i, o ;
struct SREGS s ;
int cursor[32] =
{
/* Hour-glass screen mask */
0x0000, 0x0000, 0x0000, 0x0000,
0x8001, 0xc003, 0xf00f, 0xfc3f,
0xfc3f, 0xf00f, 0xc003, 0x8001,
0x0000, 0x0000, 0x0000, 0x0000,
/* The mouse pointer bitmap */
0xffff, 0x8001, 0xffff, 0x8001,
0x4002, 0x2004, 0x1008, 0x0240,
0x0240, 0x0810, 0x2004, 0x4002,
0x8001, 0xffff, 0x8001, 0xffff,
};
main( )
{
int gd = DETECT, gm ;
initgraph ( &gd, &gm, "c:\\tc\\bgi" ) ;
if ( initmouse( ) == -1 )
{
closegraph( ) ;
printf ( "\n Mouse not installed!" ) ;
exit( ) ;
}
gotoxy ( 10, 1 ) ; printf ( "Press any key to exit..." ) ;
changecursor ( cursor ) ; showmouseptr( ) ;
getch( ) ;
}
initmouse( )
{
{
move ( n - 1, sp, ep, ap ) ;
move ( 1, sp, ' ', ep ) ;
move ( n - 1, ap, sp, ep ) ;
}
}
And here is the output...
Move from A to B
Move from A to C
Move from B to C
Move from A to B
Move from C to A
Move from C to B
Move from A to B
Move from A to C
Move from B to C
Move from B to A
Move from C to A
Move from B to C
Move from A to B
Move from A to C
Move from B to C
This problem is the famous Towers of Hanoi problem, wherein three pegs are to be
employed for transferring the disks with the given criteria. Here's how we go about it.
We have three pegs: the starting peg, sp, the auxiliary peg ap, and the ending peg,
ep, where the disks must finally be. First, using the ending peg as an auxiliary or
supporting peg, we transfer all but the last disk to ap. Next the last disk is moved
from sp to ep. Now, using sp as the supporting peg, all the disks are moved from ap to
ep. ?A?, B and C denote the three pegs. The recursive function move( ) is called with
different combinations of these pegs as starting, auxiliary and ending pegs.
73. What would be the output of following program?
struct syntax
{
int i ;
float g ;
char c ;
}
main( )
{
printf ( "I won't give you any error" ) ;
}
Ans: The above program would get compiled successfully and on execution it would
print the message given in printf(). What strikes in the above code snippet is the
structure syntax which is declared but not terminated with the statement terminator,
the semicolon. The compiler would not give any error message for it, as it assumes
that main( ) function have a return type of struct syntax and hence would successfully
compile and execute the program.
74. How to get the memory size ?
Ans: Consider the following program
#include
#include
main( )
{
int memsize;
memsize = biosmemory( ) ;
printf ( "RAM size = %dK\n",memsize ) ;
return 0 ;
}
The function biosmemory uses BIOS interrupt 0x12 to return the size of memory.
75. Float Format
How does C compiler stores float values ?
Ans: In C, the float values are stored in a mantissa and exponent form. While writing a
number we specify the exponent part in the form of base 10. But, in case of C
compiler, the exponent for floats is stored in the form of base 2. Obviously, because,
computer stores the numbers in binary form. The C compiler follows an IEEE standard
to store a float. The IEEE format expresses a floating-point number in a binary form
known as `normalized' form. Normalization involves adjusting the exponent so that
the "binary point" (the binary analog of the decimal point) in the mantissa always lies
to the right of most significant nonzero digit. In binary representation, this means that
the most significant digit of the mantissa is always a 1. This property of the
normalized representation is exploited by the IEEE format when storing the mantissa.
Let us consider an example of generating the normalized form of a floating point
number. Suppose we want to represent the decimal number 5.375. Its binary
equivalent can be obtained as shown below:
2|5
.375 x 2 = 0.750 0
|-----.750 x 2 = 1.500 1
2|21
.500 x 2 = 1.000 1
|-----2|10
|-----|01
Writing remainders in reverse writing whole parts in the same order we get 101 order
in which they are obtained we get 011 thus the binary equivalent of 5.375 would be
101.011. The normalized form of this binary number is obtained by adjusting the
exponent until the decimal point is to the right of most significant 1. In this case the
result is 1.01011 x 22. The IEEE format for floating point storage uses a sign bit, a
mantissa and an exponent for representing the power of 2. The sign bit denotes the
sign of the number: a 0 represents a positive value and a 1 denotes a negative value.
The mantissa is represented in binary. Converting the floating-point number to its
normalized form results in a mantissa whose most significant digit is always 1. The
IEEE format takes advantage of this by not storing this bit at all. The exponent is an
integer stored in unsigned binary format after adding a positive integer bias. This
ensures that the stored exponent is always positive. The value of the bias is 127 for
floats and 1023 for doubles. Thus, 1.01011 x 22 is represented as shown below:
--- --------------- ---------------------------------------------| 0 | 100 0000 1 | 010 1100 0000 0000 0000 0000 |
--- ---------------- --------------------------------------------sign bit exponent- mantissa stored in normalized form obtained after adding a bias
127 to exponent 2
Data Structures
Which is the best sorting method?
Ans: There is no sorting method that is universally superior to all others. The
programmer must carefully examine the problem and the desired results before
deciding the particular sorting method. Some of the sorting methods are given below:
Bubble sort : When a file containing records is to be sorted then Bubble sort is the
best sorting method when sorting by address is used.
Bsort : It can be recommended if the input to the file is known to be nearly sorted.
Meansort : It can be recommended only for input known to be very nearly sorted.
Quick Sort : In the virtual memory environment, where pages of data are constantly
being swapped back and forth between external and internal storage. In practical
situations, quick sort is often the fastest available because of its low overhead and its
average behavior.
Heap sort : Generally used for sorting of complete binary tree. Simple insertion sort
and straight selection sort : Both are more efficient than bubble sort. Selection sort is
recommended for small files when records are large and for reverse situation insertion
sort is recommended. The heap sort and quick sort are both more efficient than
insertion or selection for large number of data.
Shell sort : It is recommended for moderately sized files of several hundred elements.
Radix sort : It is reasonably efficient if the number of digits in the keys is not too
large.
76. Calculating Wasted Bytes On Disk
When a file gets stored on the disk, at a time DOS allocates one cluster for it. A cluster
is nothing but a group of sectors. However, since all file sizes cannot be expected to
be a multiple of 512 bytes, when a file gets stored often part of the cluster remains
unoccupied. This space goes waste unless the file size grows to occupy these wasted
bytes. The
following program finds out how much space is wasted for all files in all the directories
of the current drive.
#include
#include
#include
#include
#include
unsigned bytes_per_cluster ;
unsigned long wasted_bytes ;
unsigned long num_files = 0 ;
main( )
{
int ptr = 0, flag = 0, first = 0 ;
struct ffblk f[50] ;
struct dfree free ;
/* get cluster information and calculate bytes per cluster */
getdfree ( 0, &free ) ;
bytes_per_cluster = free.df_bsec * free.df_sclus ;
chdir ( "\\" ) ;
/* check out files in root directory first */
cal_waste( ) ;
/* loop until all directories scanned */
while ( ptr != -1 )
{
);
while ( flag == 0 )
{
num_files++ ;
full_cluster = ff.ff_fsize / bytes_per_cluster * bytes_per_cluster ;
wasted_bytes += bytes_per_cluster - ( ff.ff_fsize - full_cluster ) ;
flag = findnext ( &ff ) ;
}
}
Data Structures
Polish Notation
The method of writing all operators either before their operation, or after them, is
called Polish notation, in honor of its discoverer, the Polish mathematician Jan
Lukasiewicz. When the operators are written before their operands, it is called the
prefix form. When the operators come after their operands. It is called the postfix
form, or, sometimes reverse Polish form or suffix form. In this context, it is customary
to use the coined phrase infix form to denote the usual custom of writing binary
operators between their operands. For example, the expression A + B becomes +AB in
prefix form and AB+ in postfix form. In the expression A + B x C, the multiplication is
done first, so we convert it first, obtaining first A + ( BCx ) and then ABCx+ in postfix
form. The prefix form of this expression is +A x BC. The prefix and postfix forms are
not related by taking mirror images or other such simple transformation. Also all
parentheses have been omitted in the Polish forms.
77. The Longjmp And Setjmp
The C programming language does not let you nest functions. You cannot write a
function definition inside another function definition, as in:
int fun1( )
{
int fun2() /* such nesting of functions is not allowed */
{
.....
}
}
Because of this restriction it is not possible to hide function names inside a hierarchy.
As a result all the functions that you declare within a program are visible to each
other. This of course is not a major drawback since one can limit visibility by grouping
functions within separate C source files that belong to different logical units of the
program. C does, however, suffer in another way because of this design decision. It
provides no easy way to transfer control out of a function except by returning to the
expression that called the function. For the vast majority of function calls, that is a
desirable limitation. You want the discipline of nested function calls and returns to help
you understand flow of control through a program. Nevertheless, on some occasions
that discipline is too restrictive. The program is sometimes easier to write, and to
understand, if you can jump out of one or more function invocations at a single stroke.
You want to bypass the normal function returns and transfer control to somewhere in
an earlier function invocation.
For example, you may want to return to execute some code for error recovery no
matter where an error is detected in your application. The setjmp and the longjmp
functions provide the tools to accomplish this. The setjmp function saves the "state" or
the "context" of the process and the longjmp uses the saved context to revert to a
previous point in the program. What is the context of the process? In general, the
context of a process refers to information that enables you to reconstruct exactly the
way the process is at a particular point in its flow of execution. In C program the
relevant information includes quantities such as values of SP, SS, FLAGS, CS, IP, BP,
DI, ES, SI and DS registers.
To save this information Turbo C uses the following structure, which is defined, in the
header file 'setjmp.h'.
typedef struct
{
unsigned j_sp ;
unsigned j_ss ;
unsigned j_flag ;
unsigned j_cs ;
unsigned j_ip ;
unsigned j_bp ;
unsigned j_di ;
unsigned j_es ;
unsigned j_si ;
unsigned j_ds ;
} jmp_buf[1] ;
This is a system-dependent data type because different systems might require
different amounts of information to capture the context of a process. In Turbo C,
jmp_buf is simply an array of ten 2-byte integers. To understand the mechanics of
setjmp and longjmp, look at the following code
fragment.
#include "setjmp.h"
jmp_buf buf ;
main( )
{
if ( setjmp ( buf ) == 0 )
process( ) ;
else
handle_error( ) ; /* executed when longjmp is called */
}
process( )
{
int flag = 0 ;
/* some processing is done here */
/* if an error occurs during processing flag is set up */
if ( flag )
longjmp ( buf, 1 ) ;
}
Upon entry to setjmp the stack contains the address of the buffer buf and the address
of the if statement in the main function, to which setjmp will return. The setjmp
function copies this return address as well as the current values of registers, SP, SS,
FLAGS, BP, DI, ES, SI and DS, into the buffer buf. Then setjmp returns with a zero. In
this case, the if statement is satisfied and the process( ) function is called. If
something goes wrong in process( ) (indicated by the flag variable), we call longjmp
with two arguments: the first is the buffer that contains the context to which we will
return. When the stack reverts back to this saved state, and the return statement in
longjmp is executed, it will be as if we were returning from the call to setjmp, which
originally saved the buffer buf. The second argument to longjmp specifies the return
value to be used during this return. It should be other than zero so that in the if
statement we can tell whether the return is induced by a longjmp.
The setjmp/longjmp combination enables you to jump unconditionally from one C
function to another without using the conventional return statements. Essentially,
setjmp marks the destination of the jump and longjmp is a non-local goto that
executes the jump.
Data Structures
Comparison Trees...
The comparison trees also called decision tree or search tree of an algorithm, is
obtained by tracing through the actions of the algorithm, representing each
comparison of keys by a vertex of the tree (which we draw as a circle). Inside the
circle we put the index of the key against which we are comparing the target key.
Branches (lines) drawn down from the circle represent the possible outcomes of the
comparison and are labeled accordingly. When the algorithm terminates, we put either
F (for failure) or the location where the target is found at the end of the appropriate
branch, which we call a leaf, and draw as a square. Leaves are also sometimes called
end vertices or external vertices of the tree. The remaining vertices are called the
internal vertices of the tree. The comparison tree for sequential search is especially
simple.
78. Suppose we have a floating-point number with higher precision say 12.126487687 and
we wish it to be printed with only precision up to two decimal places. How can I do
this?
Ans. This can achieved through the use of suppression char '*' in the format string of
printf( ) which is shown in the following program.
main( )
{
int p = 2 ;
float n = 12.126487687 ;
printf ( "%.*f",p, n ) ;
}
79. Spawning All programs that we execute from DOS prompt can be thought of as
children of COMMAND.COM. Thus, the program that we execute is a child process,
whereas COMMAND.COM running in memory is its parent. The process of a parent
process giving birth to a child process is known as 'spawning'. If the spawned program
so desires, it may in turn spawn children of its own, which then execute and return
control to their parent. Who is the parent of COMMAND.COM? COMMAND.COM itself.
We can trace the ancestors of our program using the field Parent Process ID (PID)
present at offset 0x16 in the Program Segment Prefix (PSP). To trace this ancestry our
program should first locate its PSP, extract the parent process ID from it and then use
this to find PSP of the parent. This process can be repeated till we reach
COMMAND.COM (process ID of COMMAND.COM is its own PSP), the father of all
processes. Here is a program which achieves this...
/* SPAWN.C */
#include "dos.h"
unsigned oldpsp, newpsp, far *eb_seg, i ;
char far *eb_ptr ;
main( )
{
oldpsp = _psp ;
while ( 1 )
{
printf ( "\n" ) ;
printname ( oldpsp ) ;
printf ( " spawned by " ) ;
newpsp = * ( ( unsigned far * ) MK_FP ( oldpsp, 0x16 ) ) ;
if ( * ( ( unsigned * ) MK_FP ( newpsp, 0x16 ) ) == newpsp )
break ;
else
oldpsp = newpsp ;
printname ( newpsp ) ;
}
printf ( "%-20s (%04X)", "COMMAND.COM", newpsp ) ;
}
printname ( unsigned lpsp )
{
char drive[5], dir[68], name[13], ext[5] ;
eb_seg = ( unsigned far * ) MK_FP ( lpsp, 0x2C ) ;
eb_ptr = MK_FP ( *eb_seg, 0 ) ;
i=0;
while ( 1 )
{
if ( eb_ptr[i] == 0 )
{
if ( eb_ptr[i + 1] == 0 && eb_ptr[i + 2] == 1 )
{
i += 4 ;
break ;
}
}
i++ ;
}
fnsplit ( eb_ptr + i, drive, dir, name, ext ) ;
strcat ( name, ext ) ;
printf ( "%-20s (%04X)", name, oldpsp ) ;
}
On running the program from within TC the output obtained is shown below.
SPWAN.EXE (58A9) spawned by TC.EXE (0672) TC.EXE (0672) spawned by
COMMAND.COM (05B8). The program simply copies its own process ID in the variable
oldpsp and then uses it to extract its own filename from its environment block. This is
done by the function printname( ). The value in oldpsp is then used to retrieve the
parent's PID in newpsp. From there the program loops reporting the values of oldpsp,
newpsp and the corresponding file names until the program reaches COMMAND.COM.
The printname( ) function first locates the environment block of the program and then
extracts the file name from the environment block. The fnsplit( ) function has been
used to eliminate the path present prior to the file name. Do not run the program from
command line since it would give you only one level of ancestry.
Data Structures
Choosing the data structures to be used for information retrieval. For problems of
information retrieval, consider the size, number, and location of the records along with
the type and structure of the keys while choosing the data structures to be used. For
small records, high-speed internal memory will be used, and binary search trees will
likely prove adequate. For information retrieval from disk files, methods employing
multiway branching, such as trees, B-trees , and hash tables, will usually be superior.
Tries are particularly suited to applications where the keys are structured as a
sequence of symbols and where the set of keys is relatively dense in the set of all
possible keys. For other applications, methods that treat the key as a single unit will
often prove superior. B-trees, together with various generalization and extensions, can
be usefully applied to many problems concerned with external information retrieval.
80. Variably Dimensioned Arrays
While dealing with Scientific or Engineering problems one is often required to make
use of multi-dimensioned array. However, when it comes to passing multidimensional
arrays to a function C is found wanting. This is because the C compiler wants to know
the size of all but the first dimension of any array passed to a function. For instance,
we can define a function compute ( int n, float x[] ), but not compute ( int n, x[][]).
Thus, C can deal with variably dimensioned 1-D arrays, but when an array has more
than one dimension, the C compiler has to know the size of the last dimensions
expressed as a constant. This problem has long been recognized, and some of the
solutions that are often used are:
Declare the arrays in the functions to be big enough to tackle all possible situations.
This can lead to a wastage of lot of precious memory in most cases. Another solution
is to construct multiple-dimension array as an array of pointers. For example, a matrix
(2-D array) of floats can be declared as a 1-D array of float pointers, with each
element pointing to an array of floats. The problem with this method is that the calling
function has to define all arrays in this fashion. This means that any other
computations done on the arrays must take this special structure into account.
Another easy solution, though seldom used, exists. This is based on the following
method:
Pass the array to the function as though it is a pointer to an array of floats (or the
appropriate data type), no matter how many dimensions the array actually has, along
with the dimensions of the array. Reference individual array elements as offsets from
this pointer.Write your algorithm so that array elements are accessed in storage order.
The following program for multiplying two matrices illustrates this
procedure.
# define M 3
# define N 2
# define P 4
float a[M][N], b[N][P], c[M][P] ;
void mulmat ( int, int, int, float*, float*, float* ) ;
main( )
{
int i, j ;
for ( i = 0 ; i < M ; i++ )
for ( j = 0 ; j < N ; j++ )
a[i][j] = i + j ;
for ( i = 0 ; i < N ; i++ )
for ( j = 0 ; j < P ; j++ )
b[i][j] = i + j ;
mulmat ( M, N, P, a, b, c ) ;
for ( i = 0 ; i < M ; i++ )
{
printf ( "\n" ) ;
for ( j = 0 ; j < P ; j++ )
printf ( "%f\t", c[i][j] ) ;
}
}
void mulmat ( int m, int n, int p, float *a, float *b, float *c )
{
float *ptrtob, *ptrtoc ;
int i, j, k, nc ;
/* set all elements of matrix c to 0 */
for ( i = 0 ; i < m * p ; i++ )
*( c + i ) = 0 ;
for ( i = 0 ; i < m ; i++ )
{
ptrtob = b ;
to store several values in a single integer. Bit fields are discussed in most standard C
texts. They are usually used when we want to store assorted information which can be
accommodated in 1, 2, 3 bits etc.
For example, the following data about an employee can be easily stored using bit
fields.
male or female
single, married, divorced or widowed
have one of the eight different hobbies
can choose from any of the fifteen different schemes proposed by the company to
pursue his/her hobby.
This means we need one bit to store gender, two to store marital status, three for
hobby, and four for scheme (with one value used for those who are not desirous of
availing any of the schemes). We need ten bits altogether, which means we can pack
all this information into a single integer, since an integer is 16 bits long.
At times we may need to store several True or False statuses. In such cases instead of
using bit fields using an array of bits would be more sensible. On this array we may be
required to perform the following operations:
Set a bit (make it 1).
Clear a bit (make it 0).
Test the status of a bit in the array.
Reach the appropriate bit slot in the array.
Generate a bit mask for setting and clearing a bit.
We can implement these operations using macros given below:
#define CHARSIZE 8
#define MASK ( y ) ( 1 << y % CHARSIZE )
#define BITSLOT ( y ) ( y / CHARSIZE )
#define SET ( x, y ) ( x[BITSLOT( y )] |= MASK( y ) )
#define CLEAR ( x, y ) ( x[BITSLOT( y )] &= ~MASK( y ) )
#define TEST ( x, y ) ( x[BITSLOT( y )] & MASK( y ) )
#define NUMSLOTS ( n ) ( ( n + CHARSIZE - 1) / CHARSIZE )
Using these macros we can declare an array of 50 bits be saying,
char arr[NUMSLOTS(50)] ;
To set the 20th bit we can say,
SET(arr, 20 ) ;
And if we are to test the status of 40th bit we may say,
if ( TEST ( arr, 40 ) )
Using bit arrays often results into saving a lot of precious memory. For example, the
following program which implements the Sieve of Eratosthenes for generating prime
numbers smaller than 100 requires only 13 bytes. Had we implemented the same logic
using an array of integers we would have required an array of 100 integers, that is
200 bytes.
#include
#include
#define MAX 100
main( )
{
char arr[NUMSLOTS( MAX )] ;
int i, j ;
memset ( arr, 0, NUMSLOTS( MAX ) ) ;
for ( i = 2 ; i < MAX ; i++ )
{
if ( !TEST ( arr, i ) )
{
printf ( "\n%d", i ) ;
for ( j = i + i ; j < MAX ; j += i )
SET ( arr, j ) ;
}
}
}
83. Information Hiding in C
Though C language doesn't fully support encapsulation as C++ does, there is a simple
technique through which we can implement encapsulation in C. The technique that
achieves this is modular programming in C. Modular programming requires a little
extra work from the programmer, but pays for itself during maintenance. To
understand this technique let us take the example of the popular stack data structure.
There are many methods of implementing a stack (array, linked list, etc.). Information
hiding teaches that users should be able to push and pop the stack's elements without
knowing about the stack's implementation. A benefit of this sort of information hiding
is that users don't have to change their code even if the implementation details
change.
Consider the following scenario:
To be able to appreciate the benefits of modular programming and thereby information
hiding, would first show a traditional implementation of the stack data structure using
pointers and a linked list of structures. The main( ) function calls the push( ) and
pop( ) functions.
#include
typedef int element ;
}
element pop ( struct node *p )
{
element n ;
struct node *r ;
n = p -> data ;
r=p;
p = p -> next ;
free ( r ) ;
return ( n ) ;
}
int isempty ( struct node *p )
{
if ( p == NULL )
return ( -1 ) ;
else
return ( 0 ) ;
}
Notice how the specific implementation of the data structure is strewn throughout
main( ). main( ) must see the definition of the structure node to use the push( ),
pop( ), and other stack functions. Thus the implementation is not hidden, but is mixed
with the abstract operations.
Data Structures
Radix Sort
This sorting technique is based on the values of the actual digits in the positional
representations of the numbers being sorted. Using the decimal base, for example,
where the radix is 10, the numbers can be partitioned into ten groups on the sorter.
For example, to sort a collection of numbers where each number is a four-digit
number, then, All the numbers are first sorted according to the the digit at unit's
place.
In the second pass, the numbers are sorted according to the digit at tenth place. In
the third pass, the numbers are sorted according to the digit at hundredth place. In
the forth and last pass, the numbers are sorted according to the digit at thousandth
place.
During each pass, each number is taken in the order in which it appears in partitions
from unit's place onwards. When these actions have been performed for each digit,
starting with the least significant and ending with most significant, the numbers are
sorted. This sorting method is called the radix sort.
Let us take another example. Suppose we have a list of names. To sort these names
using radix sort method we will have to classify them into 26 groups The list is first
sorted on the first letter of each name, i.e. the names are arranged in 26 classes,
where the first class consists of those names that begin with alphabet 'A', the second
class consists of those names that begin with alphabet 'B' and so on. During the
second pass each class is alphabetized according to the second letter of the name, and
so on.
84. Exception Handling in C
Consider the following program:
#include
void main( )
{
float i ;
i = pow ( -2, 3 ) ;
printf ( "%f", i ) ;
}
int matherr ( struct exception *a )
{
if ( a -> type == DOMAIN )
{
if ( !strcmp ( a -> name, "pow" ) )
{
a -> retval = pow ( - ( a -> arg1 ), a -> arg2 ) ;
return 1 ;
}
}
return 0 ;
}
If we pass a negative value in pow( ) function a run time error occurs. If we wish to
get the proper output even after passing a negative value in the pow( ) function we
must handle the run time error. For this, we can define a function matherr( ) which is
declared in the 'math.h' file. In this function we can detect the run-time error and
write our code to correct the error. The elements of the exception structure receives
the function name and arguments of the function causing the exception.
Data Structures
AVL Trees
For ideal searching in a binary search tree, the heights of the left and right sub-trees
of any node should be equal. But, due to random insertions and deletions performed
on a binary search tree, it often turns out to be far from ideal. A close approximation
to an ideal binary search tree is achievable if it can be ensured that the difference
between the heights of the left and the right sub trees of any node in the tree is at
most one. A binary search tree in which the difference of heights of the right and left
sub-trees of any node is less than or equal to one is known as an AVL tree. AVL tree is
also called as Balanced Tree. The name "AVL Tree" is derived from the names of its
inventors who are Adelson-Veilskii and Landi. A node in an AVL tree have a new field
to store the "balance factor" of a node which denotes the difference of height between
the left and the right sub-trees of the tree rooted at that node. And it can assume one
of the
three possible values {-1,0,1}.
85. Unique combinations for a given number
How do I write a program which can generate all possible combinations of numbers
from 1 to one less than the given number ?
main( )
{
long steps, fval, bstp, cnt1 ;
int num, unit, box[2][13], cnt2, cnt3, cnt4 ;
printf ( "Enter Number " ) ;
scanf ( "%d", &num ) ;
num = num < 1 ? 1 : num > 12 ? 12 : num ;
for ( steps = 1, cnt1 = 2 ; cnt1 <= num ; steps *= cnt1++ ) ;
for ( cnt1 = 1 ; cnt1 <= steps ; cnt1++ )
{
for ( cnt2 = 1 ; cnt2 <= num ; cnt2++ )
box[0][cnt2] = cnt2 ;
for ( fval = steps, bstp = cnt1, cnt2 = 1 ; cnt2 <= num ; cnt2++ )
{
if ( bstp == 0 )
{
cnt4=num ;
while ( box[0][cnt4] == 0 )
cnt4-- ;
}
else
{
fval /= num - cnt2 + 1 ;
unit = ( bstp + fval - 1 ) / fval ;
bstp %= fval ;
for ( cnt4 = 0, cnt3 = 1 ; cnt3 <= unit ; cnt3++ )
while ( box[0][++cnt4] == 0 ) ;
}
box[1][cnt2] = box[0][cnt4] ;
box[0][cnt4] = 0 ;
}
printf ( "\nSeq.No.%ld:", cnt1 ) ;
for ( cnt2 = 1 ; cnt2 <= num ; cnt2++ )
printf ( " %d", box[1][cnt2] ) ;
}
}
This program computes the total number of steps. But instead of entering into the loop
of the first and last combination to be generated it uses a loop of 1 to number of
combinations. For example, in case of input being 5 the number of possible
combinations would be factorial 5, i.e. 120. The program suffers from the limitation
that it cannot generate combinations for input beyond 12 since a long int cannot
handle the resulting combinations.
Data Structures
Hashing...
Hashing or hash addressing is a searching technique. Usually, search of an element is
carried out via a sequence of comparisons. Hashing differs from this as it is
independent of the number of elements n in the collection of data. Here, the address
or location of an element is obtained by computing some arithmetic function. Hashing
is usually used in file management. The general idea is of using the key to determine
the address of a record. For this, a function fun( ) is applied to each key, called the
hash function. Some of the popular hash functions are: 'Division' method, 'Midsquare'
method, and 'Folding' method. Two records cannot occupy the same position. Such a
situation is called a hash collision or a hash clash. There are two basic methods of
dealing with a hash clash. The first technique, called rehashing, involves using
secondary hash function on the hash key of the item. The rehash function is applied
successively until an empty position is found where the item can be inserted. If the
hash position of the item is found to be occupied during a search, the rehash function
is again used to locate the item. The second technique, called chaining, builds a linked
list of all items whose keys hash to the same values. During search, this short linked
list is traversed sequentially for the desired key. This technique involves adding an
extra link field to each table position.
86. The following program demonstrates how to get input from the user in graphics mode,
echoed in the current colors and font size and font style.
#define ON 1
#define OFF 0
#include
main( )
{
char nameString[80], ageString[80] ;
int age, gd = DETECT, gm ;
initgraph ( &gd, &gm, "c:\\tc\\bgi" ) ;
setbkcolor ( BLUE ) ;
setcolor ( YELLOW ) ;
settextstyle ( GOTHIC_FONT, HORIZ_DIR, 0 ) ;
moveto ( 0, 0 ) ;
outtext ( "Enter your name: " ) ;
getGrString ( nameString ) ;
moveto ( 0, gety( ) + textheight ( "A" ) ) ;
outtext ( "Name: " ) ;
outtext ( nameString ) ;
moveto ( 0, gety( ) + textheight ( "A" ) ) ;
outtext ( "Press key to exit! " ) ;
getch( ) ;
closegraph( ) ;
restorecrtmode( ) ;
}
getGrString ( char *inputString )
{
int stringIndex = 0, oldColor ;
char ch, outString[2] ;
/* xVal will store the screen position for each char */
int xVal[255] ;
outString[1] = 0 ;
xVal[0] = getx( ) ;
do
{
cursor ( ON ) ;
ch = getch( ) ;
cursor ( OFF ) ;
if ( ch == 0 ) /* avoid dealing with all special keys */
getch( ) ;
else
{
if ( ch == 8 ) /* backspace */
{
oldColor = getcolor( ) ;
--stringIndex ;
if ( stringIndex < 0 )
stringIndex = 0 ;
/* move to ( old horz position, current vert position ) */
moveto ( xVal[stringIndex], gety( ) ) ;
setcolor ( getbkcolor( ) ) ;
outString[0] = inputString[stringIndex] ;
outtext ( outString ) ;
moveto ( xVal [stringIndex], gety( ) ) ;
setcolor ( oldColor ) ;
}
else
{
inputString[stringIndex] = ch ;
outString[0] = ch ;
outtext ( outString ) ;
++stringIndex ;
xVal[stringIndex] = getx( ) ;
}
}
} while ( ch != 13 && ch != 10 ) ;
inputString[stringIndex] = 0 ;
}
cursor ( int on )
{
int curX, oldColor ;
/* we'll use an underscore as a cursor */
char uBarStr[2] = { '_', 0 } ;
if ( !on )
{
oldColor = getcolor( ) ;
setcolor ( getbkcolor( ) ) ;
}
t1 = time ( NULL ) ;
sel_sort ( a, s ) ; // sort array by selection sort
bub_sort ( a, s ) ; // sort array by bubble sort method
t2 = time ( NULL ) ;
printf ( "\nThe difference between two function calls is %f", difftime (
t2, t1 ) ) ;
}
In the above program we have called difftime( ) function that returns the time elapsed
from t1 to t2.
88. General
main( )
{
char *s ;
s = fun ( 128, 2 ) ;
printf ( "\n%s", s ) ;
}
fun ( unsigned int num, int base )
{
static char buff[33] ;
char *ptr ;
ptr = &buff [ sizeof ( buff ) - 1 ] ;
*ptr = '\0' ;
do
{
*--ptr = "0123456789abcdef"[ num % base ] ;
num /= base ;
} while ( num != 0 ) ;
return ptr ;
}
The above program would convert the number 128 to the base 2. You can convert a
number to a hexadecimal or octal form by passing the number and the base, to the
function fun( ).
Data Structures
What is a priority queue?
Ans: As we know in a stack, the latest element is deleted and in a queue the oldest
element is deleted. It may be required to delete an element with the highest priority in
the given set of values and not only the oldest or the newest one. A data structure
that supports efficient insertions of a new element and deletions of elements with the
highest priority is known as priority queue. There are two types of priority queues: an
ascending priority queue is a collection of items into which items can be inserted
arbitrarily and from which only the smallest item can be removed. A descending order
priority queue is similar but allows only the largest item to be deleted.
89. What is the difference between const char *p, char const *p, and char* const p ?
'const char *p' and 'char const *p' are the same, i.e. p points to a constant character.
On the other hand, 'char* const p' means p is a constant pointer pointing to a
character which means we cannot change the pointer p but we can change the
character which p is pointing to.
90. What's the difference between a null pointer, a NULL macro, the ASCII NUL character
and a null string?
Ans: A null pointer is a pointer which doesn't point anywhere. A NULL macro is used to
represent the null pointer in source code. It has a value 0 associated with it. The
ASCII NUL character has all its bits as 0 but doesn't have any relationship with the null
pointer. The null string is just another name for an empty string "".
System Utility
Sparse Matrix...
A sparse matrix is one where most of its elements are zero. There is no precise
definition as to know whether a matrix is sparsed or not, but it is a concept which we
all can recognize intuitively. The natural method of representing matrices in memory
as two-dimensional arrays may not be suitable for sparse matrices. That is one may
save space by storing only those entries which may be nonzero. If this is done, then
the matrix may be thought of as an ordered list of non-zero elements only.
Information about a non-zero element has three parts:
an integer representing its row,
an integer representing its column and
the data associated with this element.
That is, each element of a matrix is uniquely characterized by its row and column
position, say i, j. We might store that matrix as a list of 3-tuples of the form (i, j,
data), as shown below,
Although the non-zero elements may be stored in the array in any order, keeping
them ordered in some fashion may be advantageous for further processing. Note that
above array is arranged in increasing order of the row number of non-zero elements.
Moreover, for elements in the same row number, the array is arranged in order of
increasing column number.
91. Pointers
What does the error "Null Pointer Assignment" mean and what causes this error?
Ans: The Null Pointer Assignment error is generated only in small and medium
memory models. This error occurs in programs which attempt to change the bottom of
the data segment. In Borland's C or C++ compilers, Borland places four zero bytes at
the bottom of the data segment, followed by the Borland copyright notice "Borland C+
+ - Copyright 1991 Borland Intl.". In the small and medium memory models, a null
pointer points to DS:0000. Thus assigning a value to the memory referenced by this
pointer will overwrite the first zero byte in the data segment. At program termination,
the four zeros and the copyright banner are checked. If either has been modified, then
the Null Pointer Assignment error is generated. Note that the pointer may not truly be
null, but may be a wild pointer that references these key areas in the data segment.
Data Structures
How to build an expression trees ?
Ans: An expression tree is a binary tree which is built from simple operands and
operators of an (arithmetic or logical ) expression by placing simple operands as the
leaves of a binary tree and the operators as the interior nodes. If an operator is binary
, then it has two nonempty subtrees, that are its left and right operands (either simple
operands or sub expressions). If an operator is unary, then only one of its subtrees is
nonempty, the one on the left or right according as the operator is written on the right
or left of its operand. We traditionally write some unary operators to the left of their
operands, such as "-" ( unary negation) or the standard functions like log( ), sin( ) etc.
Others are written on the right, such as the factorial function ()!. If the operator is
written on the left, then in the expression tree we take its left subtree as empty. If it
appears on the right, then its right subtree will be empty. An example of an expression
tree is shown below for the expression ( -a < b ) or ( c + d ) .
92. Can we get the remainder of a floating point division ?
Ans : Yes. Although the % operator fails to work on float numbers we can still get the
remainder of floating point division by using a function fmod( ). The fmod( ) function
divides the two float numbers passed to it as parameters and returns the remainder as
a floating-point value. Following program shows fmod( ) function at work.
#include
main( )
{
printf ( "%f", fmod ( 5.15, 3.0 ) ) ;
}
The above code snippet would give the output as 2.150000.
93. How to extract the integer part and a fractional part of a floating point number?
Ans: C function modf( ) can be used to get the integer and fractional part of a floating
point.
#include "math.h"
main( )
{
double val, i, f ;
val = 5.15 ;
f = modf ( val, &i ) ;
printf ( "\nFor the value %f integer part = %f and fractional part = %f",
val, i, f ) ;
}
The output of the above program will be:
For the value 5.150000 integer part = 5.000000 and fractional part =
0.150000
94. How do I define a pointer to a function which returns a char pointer?
Ans:
char * ( *p )( ) ;
or
typedef char * ( * ptrtofun )( ) ;
ptrtofun p ;
Here is a sample program which uses this definition.
main( )
{
typedef char * ( * ptrtofun ) ( ) ;
char * fun( ) ;
ptrtofun fptr ;
char *cptr ;
fptr = fun ;
cptr = (*fptr) ( ) ;
printf ( "\nReturned string is \"%s\"", cptr ) ;
}
char * fun( )
{
static char s[ ] = "Hello!" ;
printf ( "\n%s", s ) ;
return s ;
}
95. What's wrong with the following declaration: char* ptr1, ptr2 ; get errors when I try to
use ptr2 as a pointer.
Ans: char * applies only to ptr1 and not to ptr2. Hence ptr1 is getting declared as a
char pointer, whereas, ptr2 is being declared merely as a char. This can be rectified in
two ways :
char *ptr1, *ptr2 ;
typedef char* CHARPTR ; CHARPTR ptr1, ptr2 ;
96. How to use scanf( ) to read the date in the form of dd-mm-yy?
Ans: To read the date in the form of dd-mm-yy one possible way is,
int dd, mm, yy ;
char ch ; /* for char '-' */
printf ( "\nEnter the date in the form of dd-mm-yy : " ) ;
scanf( "%d%c%d%c%d", &dd, &ch, &mm, &ch, &yy ) ;
Another way is to use suppression character * is as follows:
int dd, mm, yy ;
scanf( "%d%*c%d%*c%d", &dd, &mm, &yy ) ;
The suppression character '*' suppresses the input read from the standard input buffer
for the assigned control character.
97. Why the output of sizeof ( 'a' ) is 2 and not 1 ?
Ans: Character constants in C are of type int, hence sizeof ( 'a' ) is equivalent to sizeof
( int ), i.e. 2. Hence the output comes out to be 2 bytes.
98. Can we use scanf( ) function to scan a multiple words string through keyboard?
Ans: Yes. Although we usually use scanf( ) function to receive a single word string and
gets( ) to receive a multi-word string from keyboard we can also use scanf( ) function
for scanning a multi-word string from keyboard. Following program shows how to
achieve this.
main( )
{
char buff[15] ;
scanf ( "%[^\n]s", buff ) ;
puts ( buff ) ;
}
In the scanf( ) function we can specify the delimiter in brackets after the ^ character.
We have specified '\n' as the delimiter. Hence scanf( ) terminates only when the user
hits Enter key.
99. How to set the system date through a C program ?
Ans: We can set the system date using the setdate( ) function as shown in the
following program. The function assigns the current time to a
structure date.
#include "stdio.h"
#include "dos.h"
main( )
{
struct date new_date ;
new_date.da_mon = 10 ;
new_date.da_day = 14 ;
new_date.da_year = 1993 ;
setdate ( &new_date ) ;}
100.
Ans: Given below is the program which uses the stringizing preprocessor directive ##
for building a general purpose swap macro which can swap two integers, two floats,
two chars, etc.
#define swap( a, b, t ) ( g ## t = ( a ), ( a ) = ( b ), ( b ) = g ## t )
int gint;
char gchar;
float gfloat ;
main( )
{
int a = 10, b = 20 ;
char ch1 = 'a' , ch2 = 'b' ;
float f1 = 1.12, f2 = 3.14 ;
swap ( a, b, int ) ;
printf ( "\na = %d b = %d", a, b ) ;
swap ( ch1, ch2, char ) ;
printf ( "\nch1 = %c ch2 = %c", ch1, ch2 ) ;
swap ( f1, f2, float ) ;
printf ( "\nf1 = %4.2f f2 = %4.2f", f1, f2 ) ;
}
swap ( a, b, int ) would expand to,
( gint = ( a ), ( a ) = ( b ), ( b ) = gint )
101.
What is a heap ?
the amount of heap space available to the program is fixed, and can vary from one
program to another.
102.
Ans: The function searchpath( ) searches for the specified file in the subdirectories of
the current path. Following program shows how to make use of the searchpath( )
function.
#include "dir.h"
void main ( int argc, char *argv[] )
{
char *path ;
if ( path = searchpath ( argv[ 1 ] ) )
printf ( "Pathname : %s\n", path ) ;
else
printf ( "File not found\n" ) ;
}
103.
Ans: Yes! The macro getpid( ) gives us the process identification number of the
program currently running. The process id. uniquely identifies a program. Under DOS,
the getpid( ) returns the Program Segment Prefix as the process id. Following program
illustrates the use of this macro.
#include
#include
void main( )
{
printf ( "The process identification number of this program is %X\n",
getpid( ) ) ;
}
104.
Ans: Yes, We can! The function stime( ) sets the system date to the specified date. It
also sets the system time. The time and date is measured in seconds from the
00:00:00 GMT, January 1, 1970. The following program shows how to use this
function.
#include
#include
void main( )
{
time_t tm ;
int d ;
tm = time ( NULL ) ;
printf ( "The System Date : %s", ctime ( &tm ) ) ;
printf ( "\nHow many days ahead you want to set the date : " ) ;
scanf ( "%d", &d ) ;
tm += ( 24L * d ) * 60L * 60L ;
stime ( &tm ) ;
printf ( "\nNow the new date is : %s", ctime ( &tm ) ) ;
}
In this program we have used function ctime( ) in addition to function stime( ). The
ctime( ) function converts time value to a 26-character long string that contains date
and time.
106.
Ans : The string function strdup( ) copies the given string to a new location. The
function uses malloc( ) function to allocate space required for the duplicated string. It
takes one argument a pointer to the string to be duplicated. The total number of
characters present in the given string plus one bytes get allocated for the new string.
As this function uses malloc( ) to allocate memory, it is the programmer?s
responsibility to deallocate the memory using free( ).
#include
#include
#include
void main( )
{
char *str1, *str2 = "double";
str1 = strdup ( str2 ) ;
printf ( "%s\n", str1 ) ;
free ( str1 ) ;
}
107.
How to write a swap( ) function which swaps the values of the variables using
bitwise operators.
Ans: Here is the swap( ) function.
swap ( int *x, int *y )
{
*x ^= *y ;
*y ^= *x ;
*x ^= *y ;
}
The swap( ) function uses the bitwise XOR operator and does not require any
temporary variable for swapping.
Texas Instruments
Date : 8/9/2005
1.
given an expression tree and asked us to write the in fix of that expression
four choices : 2
2.
3.
size of(int)
a) always 2 bytes
b) depends on compiler that is being used
c) always 32 bits
d) can't tell
4.
5.
7.
8.
main(){
char str[5]="hello";
if(str==NULL) printf("string null");
else printf("string not null");
}
what is out put of the program?
a) string is null b) string is not null c) error in program d) it executes but print nothing
9.
There are 0ne 5 pipe line and another 12 pipe line sates are there and flushed time
taken to execute five instructions a) 10,17
b) 9,16
c)25,144
d)
printf("%d ",a);
f(&a);
printf("%d ",a);
}
what will be out put?
a)10,10
13. struck a{
int x;
float y;
char c[10];
}
union b{
int x;
float y;
char c[10];
}
which is true?
a) size of(a)!=sizeof(b);
b)
c)
d)
14. # define f(a,b) a+b
#defiune g(c,d) c*d
find valueof f(4,g(5,6))
a)26 b)51 c) d)
15. find avg access time of cache
a)tc*h+(1-h)*tm b)tcH+tmH
c) d) tc is time to access cache tm is time to access when miss occure
16. main()
{
char a[10]="hello";
strcpy(a,'\0');
printf("%s",a);
}
out put of the program?
a) string is null b) string is not null c) program error d)
3 flipflops are connected so that after 0 to 5 count occured next number is zero. So
what is the counter?
Ans: mod 6 counter
2.
3.
Given inorder sequence and preorder sequence and asked to find out postorder
sequence.
4.
5.
Given an interger in binary form,find the number of ones in that number without
counting each bit.(This questin is not multiple choice question. This question carries
more marks. So please take care for this question.)
6.
1-way set associative memory is called----a)direct b)something c)1-way set associative 4)something
Ans: c
7.
8.
Some page references are given. You are asked to implement it with Least Frequently
Used algorithm.
9.
Some diagram is given. Iam describinmg the diagram. A 2*1 MUX is given. The inputs
are A,B. Output is C. C and A are tied together. What is the diagram.?
Ans:Latch.
This paper is for Electrical & Electronics students. There is separate test for computer
Science Students. There are 20 questions.
1.
2.
1)Some circuit is given. Iam describing the circuit.A resistor R & a capacitor C are
connected in parallel.
To this circuit another circuit which is having a capacitorof capacity 2C & an impedence
Z, is connected in series.
You are asked to find out the value of Z? Note that 2C & Zare connected in series.
a)Z=2C
b)Z=2L
c)Z=L/2
d)Z=2R
Some circuit which consist of only resistors R is given. This is a repetative circuit. U
have to find the effctive
resistance of the entire circuit.
A)Rin=R
B)Rin=(5+sqrt(3))/7
C)Rin=(19+sqrt(3))/8
D)None.
3.
Two wave forms are given. You are asked to write the cirsuit to get B(second wave
form) from A(first wave form).
4.
5.
number(int i)
{
number++;
printf("%d\n",number);
}
main()
{
static int i=0;
number(i);
}
Ans: I don't know.
6.
7.
8.
This Paper is for Computer Science Students. THis paper is very easy. You can
definitely do it in one hour.
1.
2.
3.
4.
5.
main()
{
unsigned char i;
int sum;
for(i=0; i<300; i++)
sum+ = i;
printf("\nSum = %d\n", sum);
}
Ans : infinite loop
6.
7.
int a[10[15];
char b[10[15];
(a) location g a[3][4], if base location g a[0][0] is ox1000
(b) location g b[3][4], if base location g b[0][0] is ox2000
int taken 32 bits and char taken 8 bits.
Ans : (a) ox10C4 (b) ox2031
8.
9.
(ii) Code 1,
(iii) Code 2,
(iv) None.
Ans : Code 2
13. main()
{
int a[10] = {1, 2, 3, ...., 10}, i, x=10, temp;
for(i=0; i
temp = a[i];
a[i] = a[x-i-1];
a[x-i-1] = temp;
}
(i) All contents of array a are reversed
(ii) Only some portions are altered
(iii) Remains same
(iv) None
Ans : (iii)
14. An array is stored in row major order. The memory capacity is 30 MB. And in unix
system demand paging is used. Which one will give more page faults?
#define V_L_I 10000
int i, j, array[V_L_I][V_L_I];
Code 1 :
array[i][j] = 1;
Code 1 :
for(j=0; j
for(i=0; i
array[i][j] = 1;
Ans : Code 2
15. In C which parameter passing technique is used?
(i) call by value,
(ii) call by reference,
(iii) both
Ans : call by value
16. A circuit is given with 2 exclusive OR gates whose boolean expression will be y = '(AB)
+ AB (' indicates bar)
Hi.. I have attended Honeywell interview on 13th ofSeptember 2008 at HTS, Bannergatta,,
Bangalore.
It has total of Four Rounds,
1. Written Test (Completetly technical) 30 mins
2. Technical Interview around 45 mins
3. Technical Interview around 45 mins
4. Technical Interview around 15 mins
5. HR interview around 15 mins
Written TEst questions were from Entirely C.
I got Question Paper 2
It had questions on File operations, Basic functions,
Pointer to functions, pointer declarations, functioncall in a for loop...
I have recalled what ever i could and provided here....
void main()
{
int x=10;
changevalue(x);
x++;
printf("%d", x);
x++;
printf("%d", x);
modifyvalue();
printf("%d", x);
}
Ans : 11, 12, 12
The above question is 90% repruduced here
6.a question on hoe to free the node in linked list in a for loop....
we have say whether it is correct or not....
8. x=0;
while(x<10)
{
stmt;
x++;
}
Represent in for loop. options given
Nothing much i remember about the written test....
In technical interview they asked only the basics, and about the project and what i have
mentioned in the resume and about the embedded protocols.
In HR, they asked....
1. Tell me about ur self
2.
3.
4.
Aptitude
1.
A problem on time and work ,A and b takes 15 days to completer the work,A
concept.
3.
A question on finding the speed of boat given the speed of upstream and
downstream.
System Concept ( mainly questions from OS,data structures,networks)
4.
5.
6.
Complexity of hastable
7.
8.
Aquestion on DMA
C programming
9.
int *(*p[10])(char *)
Explain the variable assignment
10.
main()
{
printf("hello"):
main();
}
what is the output?
ans :stack overflow
Novell Sample Test paper
Paper consist of
OS : 10 Q
C : 10 Q
C++:10 Q
Java : 10 Q
OS is compulsory and you can choose any one of these three language
C++ Questions
1.
If there is one class template which has one static member variable that static
a) right shift operator and insertion operator depend upon the use
b) right shift operator and extraction operator depend upon the context use
c) right shift operator and insertion/extraction operator depend upon the use
6.
class A
{
int a ,b;
A() : a(0)
{
b=0;}
};
if you create obj of this class as A obj;
a) b will be initialized before a
b) a will be initialized before b
c) both will be initialized together
d) none of these.
OS Question (All OS questions were based on basics of UNIX all small -2 commands.)
1.
a) exec
2.
a) fork
3.
How can you list all the files used by a particular process
4.
C Questions
1.
int main()
{
char *a= "Novell";
char *b;
b=malloc(10*sizeof(char));
memset(b,0,10);
while(*b++=*a++);
printf("%s",b);
return 0;
}
2.
int main()
{
printf("Hello");
fork();
printf("World");
}
cin is an
a.function
b.object
c.class.
2.
I con't remember the ques but the ans is Virtual base class
3.
4.
5.
copy constructor is
ans:call by value.
6.
7.
8.
C paper
1.
2.
3.
main()
{
int n,i=1;
switch(n)
{
case 1:
some stuff;
case 2:
some stuff;
default:
i=10;
}
printf("i=%d",i);
}
what will be value of i;
ans:non of the above
4.
--};
5.
6.
malloc
b.
calloc
c.
new(ans)
7.
char *ptr;
p=malloc(20);
How will u de allocate the memory?
a. delete.
b. free.
There r about 20 q's in this section rest i am un able to remember?
UNIX paper:
1.
awk $2
3.
A program in shell
script?
find the o/p.
4.
5.
6.
7.
Test Paper :9
Paper Type
Posted By
2. k-map
ab
---------c1x00
1x0x
solve it
a. A.B
B. ~A
C. ~B
D. A+B
3.CHAR A[10][15] AND INT B[10][15] IS DEFINED WHAT'S THE ADDRESS OF A[3][4] AND
B[3][4] IF ADDRESS OD A IS OX1000 AND B IS 0X2000
A. 0X1030 AND 0X20C3
B. OX1031 AND OX20C4
AND SOME OTHERS..
4. int f(int *a)
{
int b=5;
a=&b;
}
main()
{
int i;
printf("\n %d",i);
f(&i);
printf("\n %d",i);
}
what's the output .
1.10,5
2,10,10
c.5,5
d. none
5. main()
{
int i;
fork();
fork();
fork();
printf("----");
}
how many times the printf will be executed .
a.3
b. 6
c.5
d. 8
6.
void f(int i)
{
int j;
for (j=0;j<16;j++)
{
if (i & (0x8000>>j))
printf("1");
else
printf("0");
}
}
15.Two program is given of factorial. one with recursion and one without recursion . question
was which program won't run for very big no. input because
of stack overfow .
a. i only (ans.)
b. ii only
c. i& ii both .
c. none
16.
struct a
{
int a;
char b;
int c;
}
union b
{
char a;
int b;
int c;
};
which is correct .
a. size of a is always diff. form size of b.(ans.)
b. size of a is always same form size of b.
c. we can't say anything because of not-homogeneous (not in ordered)
d. size of a can be same if
Sample Questions
1.What is the meaning memory allocation and why we use it ?
2.What is the meaning of physical memory and virtual memory ?
2.What are the 3Ms of production ?
4.What does 6 Sigma represent ?
5.What is a register ?
6.llocating memory at runtime is also call as _____ ?
7.What is static and dynamic memory allocation ?
2. 2n+1 numbers in a list except for 1 num all had duplicates, how to
find duplicate in O(n)
3. In 1000 wine bottles stack 10 are poisoned given 10 rats what is
the minimum number of tries to find the poisoned one. Rat dies once it
licks the poisoned wine.
4. Write 1,3,6,4 using +,-,*,/ to get 24 (no repeat of numbers)
5. Which is the DS used in dictionary mode in mobile (t9)
6. Which is DS used for chess program...to predict move each and every
time..
7. There are $1070 dollars how to split them into bags such that asked
for any denomination from $1 to $1070 , u must b able to give without
opening bag...
If any one has idea do mail me qrio.qrio at gmail.com (qrio dot qrio
at gmail dot com).. Eagerly waiting...
Another paper:
1. First fit issues...
2. Algorithm to partition set of numbers into two s.t. diff bw their
sum is min and they hav equal num of elements
3. Prog: given Numerator & Denominator.... print 0.3333333333 as .(3)
0.123123 as .(123)
1.
2.
3.
4.
5.
How to call a C++ function which is compiled with C++ compiler in C code?
When you deliver your C++ headers and C++ library of a class (what all can you
change in the class so that application using your class does not need to recompile the
code)
How do you initialize a static member of a class with return value of some function?
How can one application use same API provided by different vendors at the same
time?
If you are given the name of the function at run time how will you invoke the function?
4.
5.
6.
a fairly good idea about the pattern and the kind of preparation I needed to do. the pattern
is as follows..
VERBAL( 20 min):
5 synonyms, 10 antonyms( all from BARRON'S GRE book. Please work on the exercises
given in it). And in addition to this there was a paragraph given with blanks in it. Each
blank had a number in brackets( this refers to the question no). to fill these blanks 5
sentences were given. We had to choose the appropriate sentence which would fit in to
the blank so that there was continuity between the sentences preceding and following the
blank. This was very difficult.
QUANTITATIVE (40 min):
This was the easiest section. Solve all the old questions from the previous papers of
YAHOO and your sure to attempt 90% of the questions. There were some data
interpretation questions also (10 in number). Totally 50 questions, so managing the time
is very important.
CRITICAL REASONING (30 min):
This section had 3 questions with 4 sub questions each. One question was very simple
having a 5 delegates speaking different languages and questions based on them. Another
question was on seating arrangement and the third question was on time table for a
student to take up various classes. I was told that similar can be found in the Barron's
GRE book from 12th edition. Please practise solving such questions as the time given is
very less.
After I submitted my answers, I got the psychometry test on the screen. 150 questions
with yes no can't say as the answers. A lot of students were eliminated from this also so
be frank while answering the questions and don't try to change the answers once u have
marked them.
The next day interviews were held. Around 20 people had come. My interview went well.
Basically it was Technical, but he also asked HR questions. There were 2 people. One
guy would look straight at me as I was answering, observing keenly and the other guy
was looking in to the form that we were asked to fill up and asking me questions. Some
of the questions were :
Tell us about yourself.
What was your DBMS
project all about. What s/w you used for it?
Are comfortable using MS Visual Basic?
What is ODBC?
What is a binary tree?
What do you call a binary tree in which the value of the nodes to left of the root is less than
that of those on the right of the root?
Do you know C?
What about pointers?
Write a structure for a node in a doubly linked list.( he asked me explain the structure)
What are the different types of file structures(we had file structure project in 6th semester)
What do you mean by Indexing? What are the different types of indexing?
What is your career objective?
What are the leadership qualities that you think you have? ( he asked me this because I said
in would like to be a project leader in 3 years time)
Did you write infosys test yesterday? (I said no)
He asked me why? (I told him about the world-class training provided by YAHOO etc)
The interview panel was very cool and friendly. They did not intimidate us. There were many
light moments during the interview when they were cracking jokes.( the member of the panel
offered me coffee before he started asking questions!!) I was totally at ease. Just maintain the
eye contact and look at every member of the panel. A couple of times they even helped me
get to the answer.
After this we were grouped together in to batches of 10 and GD was conducted. The topics
were :
America's invasion of Iraq: is it justified or not?
Todays IT scenario is a total eye-wash.
Is it necessary to have an IT background to work in It industry.
As I heard from the previous batches, GD was utter chaos with everyone literally screaming.
So I made an attempt to start the GD, and succeeded. After that I got only one chance to
speak. Rest of the time I was listening to others and agreeing or disagreeing with them. I tried
to make people who were silent to speak. Basically if you make yourselves heard a couple of
times its enough. Try to be a good listener, that's very important. Don't pound on the table
and don't try to overpower others.
Finally after two days of grueling tests, I finally made through. Though it was mentally and
physically very taxing, I think it was ultimately worth it. Though this was the first placement
test ever, I have seen my friends not making it through, and I know how hard it is, but please
don't loose hopes. I thank this group, its members and the moderators from the bottom of
my heart.
PLEASE REMEBER I AM A FINAL YEAR STUDENT AND NOT AN EMPLOYEE OF YAHOO SO
PLEASE DON'T ASK FOR EMPLOYEE REFFERALS.
I would be more than glad to help you.
Thank you once again and all the best to everybody.
Test
Statistics:
Total
Appeared:
400
+
After
written
test
short
listed
After
Technical
Interview
short
listed
FINALLY SLECTED IN WIPRO: 63
(approximately)
candidates:
155
candidates:
70
TEST PATTERN:
Written Test (60 Minutes)
1. Analytical (15 Questions)
2. English (15 Questions)
3. Technical (20 Questions)
Technical Interview
HR Interview
Written Test:
Analytical:
1) Time and distance (1 Question)
2) Time and Work (1 question)
3) Some series type question i.e. 1 12 1211 11211 1122311231 so on find last number
( something like that)
4) two numbers are in the ratio 5:7 and their product is 5680 find the difference between
two numbers.
5) In a family there are six members, P, Q, R, S, T, U. they are doctor, teacher, lawyer,
engineer, nurse, and mechanic. Some relations were given and we have to find out
occupation of P.
6) One question on the volume of the cube after increasing its height( somewhat like that)
7) One passage of around 5-6 lines and question is to infer the theme of the passage.
8) one person sends of his income on transportation and of remaining on food etc
and he is left with 12000. Find his expenditure on transportation.
9) Question on Simple and Compound interests difference and find actual amount.
Sorry I cant remember all the question and they were simple enough. You can crack them
with a good hold on basics of quantitative ability.
English Section: (15 Questions)
The easiest section of all the three sections. You can finish this section with in 5 minutes.
1. Rearrange the statements.
2. Rearrange the statements
3. Rearrange the statements
4, 5, 6) In a statement one word was highlighted and you are supposed to replace that
word by choosing a word from options opposite in that context of the statement.
8) Conversion from ACTIVE to PASSIVE
9, 10, 11) Choose the word which is spelt wrongly. (quiet easy)
12, 13) Fill in the blanks with appropriate words from choices.
14, 15) Some simple questions, sorry I cannot remember.
Me: Tried for a while and said that this could be done by using KILL command in unix.
But this was wrong. I said I cannot do this.
He: List the Concepts of OOP.
Me: Listed
He: How many types of inheritance exist?
Me: Listed, and explained with the help of diagrams.
He: Differences between C and C++.
Me: Virtual functions and OOPs Support found in C++ but not in C.
He: Demonstrate IF ELSE and NESTED IF ELSE with help of an example.
Me: Demonstrated
He: Demonstrate SWITCH statement.
Me: Done
He: Differentiate between CALL BY VALUE and CALL BY REFERENCE
Me: explained
He: Do you know COBOL?
Me: yes. He asked me because I mentioned it in the TECHNICAL EXPERTISE. But was
not prepare for it at all.
He: Write a simple program to add two numbers in COBOL. And said Take your own
time and write it.
Me: First recalled the DIVISIONs of COBOL program. And then wrote an exactly
correct program and then explained him about the program
syntaxes, rules followed in writing a COBOL program, the LEVEL numbers, sections
and sub sections in each of the four DIVISIONS.
While I was explaining he was very much suprised and impressed with my explanation.
He: when did you study this (COBOL)subject?
Me: in First year second semester.
He: Now you are in third year first semester.
Me: yes
He: Its really extremely surprising that you remember the subject so well that you learnt
so long back.
Then came the moment for which I was fighting. though they donot tell you openly that
you are selected in the company just in the second phase itself, but he told me after I
wrote the COBOL program that,
I have SELECTED YOU. YOU ARE IN WIPRO. JUST GO AND FILL THIS FORM
AND SIT FOR A SMALL HR INTERVIEW.
He: Then asked me some questions about my seminar on NETWORK SECURITYAUTHENTICATION PROTOCOLS.
Finally I was given an HR FORM. And greeted me and I came out. Filled the form and
Appeared for HR Interview.
NOTE: If you are given a form after TECHNICAL INTERVIEW, it means your selection
in the company is 95% certain.
HR INTERVIEW:
After filling the form I appeared for the HR interview. He was a gentleman who
delivered the Pre Placement Talk.
He: Introduce Yourself
Me: done
He: Tell me about your FAMILY members.
Me: told
He: do you discuss with your family members about WIPRO.
Me: Answered
He: Prove yourself as Innovative.
Me: gave two to three examples and he was impressed
He: Why should I hire you
Me: Because Wipro respects INNOVATION a lot and it was honored many a times by
BUSINESS WEEK and NASSCOM for its innovation
and I feel that I am Innovative. And gave some other reasons that I mentioned in my HR
form.
He: why wipro?
Me: Explained comprehensively.
He: Your EXPECTATIONs from WIPRO.
Me: SATISFACTION in the work I do at WIPRO.
He: DONT YOU WANT SALARY? !!!!!!!!!!!!!
Me:No.You will be giving me salary around 3 lakhs per annum, as told by you in PPT
He: Laughed and greeted me and asked to wait for result.
Results came around 9:15 in the night on the same day. And a total of 63 from 70 made it
into WIPRO. Among those 63, FOUR students are from MCA I hope this experience of
mine would help you a lot and may facilitate you in your campus placements. And I
PRAY TO THE GOD FOR THE SELECTION OF YOU ALL DESERVING
STUDENTS.
ALL THE VERY BEST.
WIPRO PAPER ON 7th JULY
Hi this is A.Venkateswarlu. I appear for the reassessment exam of WIPRO. I want to
share my experience with u all.
Totally 800 candedates are appear for the exam from MIC college, GEC college, SRKR
college, RVR & JC college , SSIT college, SVH college.
After written test almost 400 students are selected for other interviews. Some students
have first HR interview test and other have technical interview. For MIC college first HR
interview and then Technical interview. At the time of last interview what ever it may be
the wish the selected students as u are selected I will see u at WIPRO.
The total procedure is as follows.
1.Written test
2.Technical Interview
3.HR interview.
1.written test.
It consist of three parts.
1.English port (15 questions)
2.Arethamic and reasoning part (15 questions)
3.Technical part (20 questions)
I will give u the almost total question paper
1.English part:
1.find the miss spelt word among the 4 choices.
2.passege is given which is very easy and it consist the 5 questions.
3.active voice to passive voice conversion like I was reading the book for 2 hours
ans: the book was being read by me for 2 hours
4.give a sentence and find the improper meaning from the choices (2 questions)
5.One question fro Matching
6.OICPT word is given and some series is given and ask for the correct sequence
ans:51423 TOPIC
7.The sequences of statements are given which are said by the author and ask find the
idea of the author.
Before u working as a novalist u must not be a writer like this
Almost I cover 12 questions from 15) in this part
2.Arethamatic & reasoning
1.series like 5,20,____ ,6.2,8,12 and the options are 10,14,24,12
2.there are some players in a volley ball team. after end of the game the each girl drinks 4
liters of water and each boy drinks 7 liters of water and the coach drinks 9 liters of water.
After end of the game 42liters of water is drank by the all. The find the no of boys and
girls in the volley ball team.
Ans : Among the options 2 boys + 5 girls is correct.. note that we must be include the
Coach also.
3.a problem of trains
120m long train crosses the pole after 2 sec. Find how much time it takes to cross the
140m long plotform.
4.Two problems on probability
2blue ,3 red, 4 green balls are there we have to arienge ge them like no 2 red are come
together and no 2 blue balls are come together like this.
5.8 persons are there devide in to two parts 4 to each are placed in two different rooms,
and some conditions are given and ask to find the sequences of them. Like this.
6. Six persons are given find the person who done the crime. Among 4 persons 1 person
said the false answer and the statements of the all persons given and ask for the person
who did the crime.
7. 300m paper is given and ask for to rolled it and at last ask for caliculation of that
problem. Like this.
8.a problem on seating arrangements and find the left end person.
9.a question on the Blood Relations the problem is
showing a photograph Asha said he is the brother of only daughter of my mother and
asked how is she related to him.
10.total amount of some cats and the cheans is 360 in a shop.but at night the shop keeper
forget to close the door. the next day he found the 2 cats and kg cheane is lost and the
present cost is 340 and asked to fine the no of cats and the total cheane.
11.a problem is given like 160 of 168 is used and give some conditions and ask some
question.
3.Technical part
1.who invited the Mouse : Dugles angle bart.
2.The use of swapping over paging : it improves the Multi programming
3.main()
{
printf(%d,150/50/5);
}
output: o
4.main()
{
printf(%d,150/50%5);
}
output: 3
5.The command which gives the device of our system : WHO
6.The command which gives the all list of files without graphic symbols the choices are
as follows
ls-a
ls-b
ls-l
7.a question on system calls
fork()
renice
nice
8.int a[3][5]={ {1,2,3,4,5],{2,3,4,5,6},{10,11,12,13,14}};
int *p=&a;
printf(%d,*(*(x+1)+3));
9.int a=0xdeabc;
char x=a;
printf(%x,x);
find the output of this endiane machine.
a)de b)ab c)0
d)cannot be predictable
10.A question on Computer Networks giving 3 lines o theorey on CSMA/CD
CSMA/CA.
11.sizeof() is an operator .
12.main()
{
pfrintf(%d,f1(10,10);
}
the function declaration of f1(int,int) is given in some other program find how the
function declaration is
extern int f1(int,int)
13.What is use of the Wait for Graph
14.main()
{
a=5;
if(a=1)
{
printf(d,a);
}
always if prints the value of a is 1
15.a bit on convewrtion of binary number to Octal .10111000 first convert it into the
decimal and convert it into the Octal by deviding 8.
16. A bit on OS
a theorey question
this is the written test Please more consantrate on Technical I think they give mager
priority on Technical thats why they give the technical column in written test and also in
the Technical interview. So please take more consontrate on technical.
For MIC college students first HR interview and then Technical interview
HR Interview :
The round was started at 2:10 pm but I waited for 6 hour after 9 Oclock they ask
me to attend for Hr Interview.
HR: tell me your favourate topic (subjects)
I : I replaid as c++ (OOPS)
HR: So tell me about OOPS
I : I replaid the main features of Encapsulation ,Inheritence, Polymaophisms and
Genricity and I Stopped.
HR; u have to say at least 5 Minits
I: Then I show my real face in OOPS non stoply. About detail explanation on function
overloading ,object, class ,and also templates in detail at lest 6 minit and I stopped.
HR;U must be identify the situation of the other person he is ready to understand the data
or not so u have to give some time in between the communication with others that wha u
have to imrove.
I: I replaid ok sir
HR; He asked me to tell about Team work.
I: I explained it with my own idea.
HR: He asked me is there any nead of team work.
I: must and should sir otherwise there may be a problem while doing the projects.
HR: He replaid ok. And
Are u class first in Degree
I: Yes sir and also in MCA.
HR: Are u played which games in your school .( I mentioned the details in resume thats
why he asked me that question)
I: I relaid I participated School level ,mandal level and also District level Games & Sports
meet sir. And I was played CHO-CHO ,SOFT BALL and FOOT BALL and I was got
first rank in Running in Spors.
HR; ok
I will give u a form u fill it an d then appear for Technical interview. Then I replaid
Thanks sir.
And I asked I want to drink some water sir ok take it my boy and take some food in the
canteen and ready for Technical Interview. When I am drinkin water he said continue ur
Sports ok . I replaied thenk u sir.
Technical Interview :
I gave him the form whichis given by the HR inter viewer and my resume he identified
my name and asked the spelling of my Surname which I didnt write clearly and he
replaid u must be write clearly ok. Ok u are MCA student. What is the group in your
Degree I replaid BSC Computer Science. When I am giving the details he write some It
consists of 3 rounds.
1. written test
2. Technical interview
3. HR interview.
Written test: It consists of 50Q and the duration is 1 hr.
15Q from verbal (topics: active voice & passive voice, reported speech, phrases,
antonym, synonym, jumbled word,analogies)
15Q from aptitude (topics: Blood relations, conclusion from the paragraph, time& work,
theme of the paragraph, probability, avg, areas, si and ci, ratios and proportion )
20Q from technical (topics: C , DS, java, c++, general, OS, Unix, networks)
Verbal section:
1. convert the following sentence into indirect speech
The teacher told the students"Dont make noise".
2. convert the following sentence into passive voice
Will the postman post the letters?
Ans: Will the letters be posted by the postman.
3. what is the meaning of the phrase " deep water"
a) secret b) serious trouble c) ocean d)
4. In the following options what is the best phrase which replaces the underlined phrase
in the given sentence.
Aptitude Section:
1. The sharp decline in the mortality since 1941 shows that who argue that the
introduction of new chemicals has caused serve health problems are mistaken from
1940-1979, the average life expectancy for the entire United States population increased
from 63.6 to 73.6 years, and the total age adjusted death rate declined by forty five
percent, including decline in every age, sex and racial group. There were also the years in
which there was a dramatic increase in the
use of new chemicals in this country. Clearly, then those modern aids to industry have no
adverse effects on the general health of society. Which of the following is an assumption
underlying the conclusion of the passage above?
A) The increase in life expectancy in the United States was paralleled by corresponding
increases in other countries.
B) The growth in the average life expectancy in the United States cannot be attributed to
any single factor, but is a general phenomenon.
C) The increase in life expectancy would not have been greater if there had not been an
increase in the use of chemicals.
D) Growth in the use of chemicals was a crucial factor in the development of industry
from 1940-1979.
2. There is a family of six persons P,Q,R,S,T and U.They are Lawyer, Doctor, Teacher,
Salesman,Engineer and Accountant. There are two married couples in the family. S, the
salesman is married to the Lady Teacher. The Doctor is married to the Lawyer U, The
Accountant is the son of Q and brother of T. R, the Lawyer is the daughter-in-law of P. T
is the unmarried Engineer. P is the Grandmother of U. Which is the profession of P?
a)Lawyer
b)Teacher
c)Doctor
d)Accountant
Ans: b
3. There are 6 volumes of books on a rack kept in order(i.e vol.1, vol.2 and so on). Give
the position after the following changes were noticed.
All books have been changed.
vol.5 was directly to the right of vol.2.
vol.4 has vol.6 to its left and both weren't at vol.3's place.
vol.1 has vol.3 on right and vol.5 on left.
An even numbered volume is at vol.5's place.
Find the order in which the books are kept now.
a)2,5,1,3,6,4
b)4,1,3,6,5,2
c)5,4,6,3,1,2
d)3,5,4,2,6,1
4.Examine carefully the following sequence of numbers:
1
11
21
1211
111221
312211
13112221
1113213211
31131211131221
13211311123113112211
hint: ( in first row one 1, in 2nd row two 1s, in 3rd row one 1,........
Although the sequence appear to behave totally at random, In fact , after the first
sequence, each sequence is constructed in a precise and methodical way based on the
previous one. What is the next sequence?
a)11322212311233113232211211
c)11131221133112221132122211
Ans : c (not confirm)
b)11131221133112132113212221
d)11131221133312112211321222
7. 9 laboures can complete the construction of a wall in 18 days.How many less days
will 12 laboures take to complete the same wall?
A)2 1/2
B)4 1/2
C)13 1/2
D)1/2
Ans: B
8. The rectangle box with square base is open at the top.The maximum volume of the box
made from 1200 m2 tin,in m3 is:
A)2000
B)2500
C)3000
D)4000
9. A person was fined for exceeding the speed limit by 10 km/hr.Another person was also
fined for exceeding the same speed limit by twice the same.If the second person was
traveling at a speed of 35km/hr,find the speed limit.
A)19km/hr
B)27 km/hr
c)30 km/hr
D)15 km/hr
10. The difference between the compound and simple interest on a certain sum for 2
years at the rate of 8% per annum is Rs.80,What is the sum?
A)11,880
B)12,500
C)13,250
D)14,270
11. The ratio between two numbers is 5:7 and their product is 560.What is the difference
between these two numbers?
A)8
B)12
C)6
D)21
Ans: A
12. In a family Reshma is elder sister of Ragini.Soni is Reshma's daughter and Saloni is
Soni's cousin.Ragini's mother is Rajani.Ramani is the sister-in-law of Reshma.Who is
Soni's grandmother?
A)Reshma
B)Ragini
C)Rajani
D)Ramani
Ans: C
13. The mean and the variance of a binomial distribution are 4 and 2 respectively.Then
the probability of 2 successes is:
A)37/256
B)219/256
C)128/256
D)28/256
Ans: D
14. Take any positive whole number not greater than 50.If the number is even, divide it
by 2.If the number is odd,multiply it by 3,and add 1 to the result.Apply the same method
to the resulting numbers until you finally arrive at the number 1.shown below is the chain
of numbers that results from this method if you begin with 15.
15->46->23->70->35->106->53->160->80->40->20->10->5->16->8->4->2->1
As you can see, the number 15 requires 17 steps to end up at 1.Of the numbers not greater
than 50,which takes the longest to reach the number 1 ?
A)26
B)27
C)28
D)17
Ans: B
15. After spending 2/3 of his salary on rent and food items and 1/4th of the remaining on
transportation,Rajesh has 6000 with him.How much did he pay on transportation?
A)Rs.2000
B)Rs.4000
C)Rs.6000
D)Rs.1000
Ans: A
Technical Section:
1. what is the o/p of the program
main()
{
incr(); incr(); incr();
}
incr()
{
static int i;
printf(%d,++i);
}
a) prints 123
Ans: a
a) syntax error b) prints some letter in those given c) prints garbage value d)
( The above program may not be the exact one but the same with small changes in the
letters given above)
3. what is the o/p (I cant exactly remember this program and options)
main()
{
int i=123;
printf(\06%d,i);
}
a) 123 b) 0123 c) 00123 d) error
4. After compiling a c program in UNIX using gcc compiler the executable file will be
a) a.out b) a.exe c) a.bat d)
Ans: a
5. In UNIX the commands like date, cat ,ls etc., are present in
a) /dev
Ans: b
c) tree d) none
7. If we declare a variable with which of the following keyword so that its value will be
automatically initialized to 0.
a) auto b) static c) extern d) register
Ans: b
8. The language in which we can represent class and all its members with some
graphical symbols
a) Unified graphical language b) Unified Modelling language c)
d)
Ans: b
9. Thrashing means
a) excessive page i/o b) no paging c)
Ans: a
d)
(d).none of these.
8. For each f the words given below a contextual usage is provided. Pick the work from
the alternatives given that is most INAPPROPRIATE in the given context . A
comprehensive approach to headache management combined with the rise of new drugs ,
appear to provide a reprieve to the numerous sufferers.
(a).doubt
(b). acquittal (c) assurance (d) belief
9. Select among the given choices the correct phrase to replace the underlined phrase in
the following sentence.
One person was killed and several others are injured in police firing and stone throwing,
yesterday.
(a) one person is killed and severals others are injured
(b)
one
person
was
killed
and
several
others
were
injured.
(c). one person has been killed and several others are injured
(d). one person was being killed and several others are being injured.
(10). Given below are words three of which belong to the same category. Find the word
which does not belong to the that category.
(a). respect (b) believe (c) revere (d) worship
(11). Choose one of the words given in four alternatives which has wrong suffix.
(a) beginning (b) begineng (c) begininng (d) beginning
(12). Select the word among the given choices that is most nearly opposite meaning to
the word NOTORIOUS.
(A)Fashionable (B) invincible (C)intrepid (D)renowned
13.select the word or pharse among the given choices that is most nearly similar in
meaning to the word BASHFUL.
(A)Vigilant (B)confident (C)shy (D)complicated.
14.for each of the words given below a contextual usage is provided .pick the work from
the alternatives given that is most INAPPROPRIATE in the given context .she is hot she
is tasty, a delectable morsel on cool. Britain s multicultural gravy train.
(A) Palatable (B) bland (C)unsavory (D) offensive
15.select the option that can be substituted for the given sentence. A person with
prejudiced views against religion.
(A) bigot (b) fanatic (c) orthodox (d) profane.
ANALYTICAL
16. Two cards players, peter and parul,have Rs 100 in the pot . They have agreed that the
first player to win 5 games shall win the pot. Each player has an equal chance of
winning each play.after peter has won 4 times and parul has won 3 times ,the game is
interrupted and they have to stop playing and share money . Whats the most fair amount
of money that peter should get?
(A)50
(B)75
(C)66.75
(D) 80
17.The fraction EVE/DID=0.7986798679867986.. is a normal fraction that can also
be written as a recurring decimal. What is the vlue of I.
(A)0
(B)1
(C)3
(D)4.
18. Substitute digits for the letters to the following divison true
HIL
--------------IL |PHIL
|IL
-------------TI
LS
--------------HIL
HIL
-----------000
note that the leftmost letter can,t be zero in any word.Also , there must be a one-one
mapping between digits and letters . E.g if you substitute 9 for the letter H, no other
letter can be 9 and all other H in the puzzle must be 9. what is the value of P.
(A) 2 (B)3 (C) 5 (D) 1
19. A solar powered car is being test driven. The vechile is driven at 30mph under
solar power and 40 mph under regular power .The trip to the nearest town takes 45
min using both solar and regular power ,wheras the return trip takes 50 min using only
solar power . on the trip to the town ,find the distance driven using regular power?
(A)10 miles (B) 15 miles (C) 40 miles (D) 25 miles
20. A team of 36 members is divided into groups of equal size to make a trip. Since
the groups were too large to fit in a car , 3 members were taken from each group
and these members then formed into two additional groups . after this , all groups
had the same number of members . how many members of the team were in a group
before the three members were taken out from each group ?
(A) 4
(B) 6
(C) 9
(D) 3
21. seven members of a town boards F,G,H;J,K,L and M Vote on a series of
resolutions. On each resolution ,every member votes either aye or nay according to the
following patterns.
H always votes the same way as G. If F votes aye ,then K votes aye. Either M or H
votes the opposite way from J. H and M never both votes aye. L never votes the same
way as K. If G and K vote aye which of the following must be true.
(A) F votes aye and M votes aye (b) H votes aye and F votes nay. (c) J votes may and
F votes nay . (D) L votes nay and M votes nay.
22. which of the following will appear in the series ? 243,5, 81, 15, 27, 45, 9, ?.
(A) 27
(B) 15 (C) 5 (D) 135
23. how many times do the hands of the clock point towards each other in a day?
(A) 12
(B)18
(C) 22
(D) 24
24. a boy was asked to calculate the roots of quadratic equation Ax2+Bx+C=0. HE
CALCULATED one of the roots wrong and other one right . with his calculation the
sum and product of the roots were found to be 7 and 12 respectively. The product
exceeded the product of the correct roots by 6. which of the following could nave been
the original quadratic equation?
(A)x2+7x+12=0 (B) x2-5x+6=0 (C) x2-7x-12=0 (D) x2-8x+12=0
25.The speed of the boat is 36 kmph higher than that of the stream in which it
travels . if it can travel 828 km downstream in 18 hours and the same in upstream in 23
hours , its average speed is __________.
(A) 36 kmph (B) 41 kmph (C) 46 kmph (D) 31 kmph.
26. A man travels by bus for 20 hours and they by train for 05 hours . if the average
speed of the bus was 20 kmph and that of the entire journey was 24 kmph. What was the
average speed of the train?
(A) 44kmph (B) 30 kmph (C) 36 kmph (D) 40 kmph
27. 1) B is mother of D but D is not daughter of B. 2) A is son of M and brother of
G.
3) G is sister of D
which of the following cannot be referred from the given information .?
(A)B has 3 children (B)M has two sons (c) G is younger to B. (D) A is younger to D.
28. 50% of the subscriber to newspaper A are corporate managers and those 30% are in
finance. If 40% of the subscriber who are corporate managers in finance are money
managers, how many of the newspapers 25,000 subscriber are corporate money
managers in the financial field.
(A) 1500
(B)1600 (C) 1800 (D) 1900
29.there are six children A.B,C,D,E and F are playing a game of football . they are related
with each other as follows:
B is A uncles son,
TECHNICAL
31. Consider the following program
#include
main()
{char x[10],*ptr=x;
scanf(%s,x);change(&x[4]);}
change(char a[])
{puts(a);}
if abcdefg is input, the output will be
(A) abcd (B)abc (C) efg (D) garbage.
32.what will be the output ?
main()
{
struct xyz
{int i:
}
struct xyz *p;
struct xyz a;
p=&a;
p->i=50;
printf(%d,*p,i);
}
(A) compile time error (B) 0 (C)50 (D) garbage value.
33. a two dimensional array A is declared as int A[4][2]={0}. What values would be
printed after execution the following statement?
Printf(%d,sizeof(A));
(A)4 (B)8
(C) 32 (D) none of these.
34. the output of the code fragment is
int x=4,*y;
y=&x;(*y)++;
printf(%d,%d\n,*y);
(A)5 (B) 4 (C) 0 (D) syntax error.
35. In the link list implementation of the queue class,where does the insert method place
the new entry on the linked list.?
(A)at the head
(B) at the tail
(C) after the other entries that are greater than the other entry.
(D)after all other entry that are smaller than the new entry.
36.what is the drawback in the threaded binary tree?
(A)null links are replaced with thread links (B)doesnt contain null links. (C)extra
memory is required. (D)no extra memory is required.
38. which of the following option of the ls command prints non-graph character in octal.
(A) ls-a (B) ls-b (C) ls-I (D) ls-r
39.which of the following are essential operating system services that are general purpose
,multipurpose ,multi user computer operating system should support
(A) interface support for computer operators
(B) performance analysis software for tuning the file system,process scheduling ,memory
management and device driver characteristics
(C)facilities for making an inventory if installed software and hardware on the platform
(D)none of these.
40.when pack command is used the original file size is reduced by__________.
(A)25-40% (B) 50-70% (C) 80% (D) none of these.
41 The __________ command extracts the fixed string and displace it.
(A) egrep (B) fgrep (C)grep (D) sgrep
42.here is a small piece of c++code containing a while loop
int i=0;
while (i<10)
{cout<<I<<ENDL;< P>
i++;
}
(A)0 (B)8 (C) 9 (D) 10
43. What is the difference between public and private inheritance?
(A) under the public inheritance ,public and protected members of the base class have
the same status in the derived class.
(B)under private inheritance ,public and protected members of the base class all become
private members of the derived class.
(C)both A &B
(D) none of these.
44.inheritance facilitates reusability because
(A) child object cannot be modified.
(B)the base class need not be modified to derive a new class.
(C)derived class objects inherit only the desirable feature of the base class.
(D) objects of the base class can be treated as objects of the derived class.
45.the ability for the processor to delegate its use by application is called?
(A) cooperative multitasking (B) preemptive multitasking (C) time slicing
(D)sharing
BYE,
selection
1.
2.
3. HR interview.
Written test:
process
of
WIPRO
Written
consists
of
rounds:
test.
Technical
interview.
It
consists
of
1.
Verbal
2.
aptitude
50
questions,
sections:
15
questions
15
questions
3. technical 20 questions
Remember there will be sectional cutoff.
Verbal section: This section was very difficult. This time questions were only based on
anatomy, analogy and arranging the sentences in order. Not even a single question was on
active to passive voice, direct to indirect speech and paragraph reading. They gave very
difficult words. I suggest you to refer GRE Barrons book for this section.
Aptitude: Even this section was difficult because it was time consuming (Lengthy
problems). Please work on all the chapters in R.S. Aggarwal. Dont neglect even a single
topic. (This time we had questions from stocks & shares, partnership too).
Technical: This section was bit easy compared to other two. But you should know the
concepts of all your subjects in depth. We had many question from UNIX & USP (UNIX
Shell Programming). Others are from C, C++, OS, Data structures, ADA and Computer
Networks. Some times they will ask logic design too.
They announced the short list at 2:30. At 3:00 interview process started. I had my
interview at 6:00. When I went to my panel I was shocked. (We got the information that
among 13 candidates no body has cleared tech round from that panel. I was the 15 th
person to enter that panel & thank God 2nd to clear the tech round).
Finishing the interview for 14th candidate he went out & came after 10 minutes
and told the volunteer to send me in.
Me:
He:
may
yes.
Please
Me:
He:
come
come
thank
sorry
Me:
(with
He:
so
smile
can
in.
sir?
take
your
you
Sandhya,
a
in
on
you
I
my
sir.
made
face)
please
seat.
you
its
ok
define
to
sir.
No
your
wait.
problem.
self?
Me: sir (Told about my family background), as my hobby I write portraits, read technical
magazines
like
Digit,
PC
Quest,
Chip
(+point)
He:
(stopped
me)
Me:
who
is
the
editor
Maulik
of
Digit?
Jasubhai.
(Please note, whenever you tell about your hobbies, strengths, weakness, etc please be
ready
to
prove
them.
Prepare
an
example
for
each.)
He:
(Impressed)
good,
continue.
Me: My another and interesting hobby is to write C-programs. I love C-coding, because
of which today I have 6 projects in my hand, 5 completed projects and another one is
under
progress.
He: (shocked) 6 projects? Hmm I am impressed. Can you explain your projects?
Me: Sure sir (I went there with full preparation. I took my projects in a CD. Even I took
the printout of the programs). I explained my projects by showing the source code.
He: very good. You have done good projects. If I ask you to write programs it will be
meaning less, so I dont ask you to write program. (Thought for sometimes) ok tell me
what will be the output of this program? (Wrote a small block)
Me:
(explained
He:
ok.
Me:
(shit!
He:
Tell
I
about
forgot
(gave
Me:
something)
types
them
and
me
told
was
thinking)
hmm
clue)
the
answer.
(smiled)
Me:
(smiled)
what
scheduling.
He:
He:
of
about
SQL?
Me: (Oh! god. I am weak in SQL, so told frankly) sir I am weak in SQL. But still you can
test
my
knowledge.
He:
Me:
gave
some
information
(wrote
&
told
to
write
something)
query.
He: (smiled) you told you are weak in SQL. How come you wrote the perfect answer?
Me:
He:
(smiled)
(Thought
for
while)
asked
an
aptitude
question.
Me: (shocked! Aptitude question in tech round!) Calculated something and explained. (I
think
I
was
wrong.
So
lost
confidence)
(Friends please remember if you dont know the answer dont sit simply. Try to explain
something or anything related to the topic. It may be right too. They never ask for
perfection.
But
you
should
at
least
know
the
basics.
)
He:
Me:
ok.
(Gave
(Started
calculation,
but
was
another
wrong
problem)
again)
He: (Stopped me) its ok. Leave. Again some basic questions on arrays and strings.
Me:
told
everything
(got
He:
ok
Sandhya.
It
was
nice
Me:
(I
thought
lost
the
to
my
talk
battle,
confidence
with
still
you.
smiled)
You
thank
back).
may
leave.
you
sir.
He: (Just wanted to see my reaction it seems) gave me a form & told take this form and
go
to
HR.
Me: (with big smile) thank you sir. (Came out & told yesssss!!!)
I took half an hour to fill that form. Be careful while filling that form. You may get
questions on that form. Please use effective sentences while filling the form. (Meanwhile
my other two friends came with a big smile. Oh god! We all cleared the tech round. We
were happy). I phoned my brother & took his help to fill the form. 2 cool HRs were there
to
help
us.
After finishing the form filling process, we came down. Within 5 minutes HR called me
(at
7:55).
Me:
He:
Me:
may
Yes.
I
Come
thank
come
in.
in
take
you
sir?
your
seat.
sir.
He: Define your self. Tell me about your family background (he specified).
Me:
(Told
about
my
family
background.)
He: why your marks are so less? (I got less percentage in 5 th and 6th semester)
Me: sir, I am very much interested in practical application more than theories. You can
see my resume sir I have mentioned 6 projects. I have done all of them from 3 rd to 6th
sem.
Means
2
projects
per
semester.
He: (stopped me) doing projects is good. I really appreciate you. But still your main
objective is to score good marks na? How can I believe that you are technically good?
Me: sir I have cleared my tech round. It proves that I have good control over my subjects.
I have studied my subjects to gain knowledge but not for examination purpose.
He:
(Impressed)
will
you
score
good
marks
7th
in
&
8th
SEM?
Me: sir, I have done these projects only to prove my technical skills and get placed in a
reputed company like WIPRO. After getting placed I will be tension free and I can
concentrate
on
my
studies.
So
I
will
sir.
He:
are
Me:
(Told
He:
(Impressed)
you
with
confidence)
ok.
You
sure?
yes
may
sir.
leave.
3) end with ;
like that they give some rules.. then gave some statements like
X one is te...............9
for the above statement
rule 1 -- ok
rule 2 -- not ok
rule 3 -- not ok
so we want to fill as b,c
i gave a sample statement only.. not an exact one..
then they asked
3 html ( basic -- mailto tag)
2 dbms
3 css
and some basic questions.. test was very easy..
Aptitude
1. There were 36 chairs. how many ways can they be placed such that all rows have equal no.
of chairs and at least three chairs are there in each row and there are at least three rows.
5 ways.
2. There are 27 balls, of which 1 is heavier. given a balance how many times you need to
weigh to find out the odd ball.
3 Weighs.
3. Product of three consecutive nos. 210. What is the sum of two least numbers
11
4. If the area of the sqaure is increased by 69 % how much the length of the side will
increase?
30%
5. if the sum of five consecutive nos. 35? how many prime nos are there :
2 primes.
6. if the length of the rectangle is reduced by 20% and breath is increased by 20 % what is
the net change ?
4 % decrease
7. A question on sets. There are some 20 Basketball players & 30 Football players, and 25
cricket players. 1 of them plays all the three games. 8 of them plays atleast two games. They
are 50 altogether. How many of them plays none of the games.
b)
c)
d) cp takes the size of a pointer.
(d ) is the ans.
5. If the area of the sqaure is increased by 69 % howmuch the length of the side will increase?
ans:30%
6. if the sum of five consecutive nos. 35? how many prime nosare there :
ans:2 primes.
7. if the length of the rectangle is reduced by 20% and breathis increased by 20 % what is the
net change ?
ans:4 % decrease
8. A question on sets.
There are some 20 Basketball players & 30 Football players,and 25 cricket players. 1 of them
plays all the three games.
8 of them plays atleast two games. They are 50 altogether.How many of them plays none of
the games.
9. A question on directions.
B is 20 miles east of A. D is 30 miles east of C. E is 10 milesnorth of D. C is 20 miles north of
B. How far E is from A?
Some 3 questions on Reasoning like,
10. If you say that giving stock options to employees increases the productivity of the
company, which of the following sentences
support it.
A) Giving stock options increases the morale of the employees
..
..
etc.,
11. Gamblers comes to the Amusement parks. There are some Amusement parks in each city.
There are some gamblers in each city. So
what can you infer.
A) Amusement park always have gamblers.
..
..
etc.,
2. Technical Questions.
Electrical & Electronics : 15 Questions
1.A Circuit with nand gates. (ans. may be XOR)
2.CMRR. relates to (options not in order)
voltage follower
non invering amplifier
inverting amplifier
integrator
3. Given a circuit , give the ouput.
(ans. may be triangular wave.)
4. o/p of an assembly code.
mulitply by 11.
5. how to handle asynchronous events.
a) polling
b) interrrupt
etc.
21. Messages are transferred in some E71 code, where after 7 bits of data,
1 bit of stopping data is to be transferred. what should be done.
options were like
a) send directly
b) send after encoding
etc.
22. There are three processes A, B, C. A sends data to B. B removes theheader stores it and
sends the data to C. C returns it to B. B receives themessage, identifies the message and adds
the header that was stored and sends to A.B receives the messages from C such that atmost
'm' messages
B
are pending.
Identify the best Data Structure.
23. A question in compiler about the heap and stack allocation of memory.
24. struct
{
char a[3];
int b;
}x;
char *cp;
a) size of x is 7.
B
b)
c)
d) cp takes the size of a pointer.
(d ) is the ans.
What is FSB?
What is crystal frequency?
What is flash memory?
What is virtual memory?
What is paging?
When can you say a microprocessor is efficient?
Speed of processor will depend on what?
In 8086 how many instructions will be processed per second?
QUESTIONS ON 'C' LANGUAGE
Tell all the points which you know about malloc function?
What is a structure and its advantage?(derived data type & can use more than one data
type using structs at same time)
What is difference between a structure and a union?(regarding memory usage)
Write a program for swapping of 2 numbers with out using a third variable?
(simple Arithmetic equations let x, y are variables take x=x+y, y=x-y, x=x-y take an
example to understand)
What is difference between a stack and a heap?
What is #define why do we use it?
MISCELENIOUS QUESTIONS
ISO OSI Layers?
What all are the communications do you know?
Difference b/w analog and digital communications give examples?
Expand modem?
What is modulation and demodulation?
Draw all the pictorial representations of logic gates?
LOGICAL QUESTIONS
There are 36 ball which look identical but one of them is less weighted than others and
there is a common balance with you in how many least chances will you trace that ball
with less weight out of the group?
Ans: 4 chances
12 12 12 --> we will get group of 12 balls
4 4 4 -->we will get group of 4 balls
2 2 -->we will get group of 2 balls
1 1 -->here you will get the add ball out.
So 4 steps.
Guys please go through with all that you mentioned in your resume
All the best.
TRIANZ PATTERN AT BANGALORE ON 6th JULY 2006
hai friends,
This is pavan kumar from GIT banglore.Iam very happy beacause i placed in Trianz.
This good software company providing IT solutions and product oriented softwares.
Trianz pattern
---------------------1.Written test(75q-60min)
Verbal(15)
reasoning(15)
Technical(35)
Qunatitive(10)
2.Group Discussion(15 min)
3.TR+HR round(30 min)
C
Java
DBMS
written Test:
1.
APPRENTICE : PLUMBER ::
A. player : coach
B. child : parent
C. student : teacher
D. author : publishe
E. intern : doctor
2.
MUSICIAN : ORCHESTRA ::
A.
B.
C.
D.
E.
mechanic : car
songwriter : lyrics
desk : office
player : team
actor : screen
3.ASSENGERS : AIRPLANE ::
A. audience : theater
B. birds : nest
C. sailors : submarine
D. freight : warehouse
E. students : classroom
CORRAL : LIVESTOCK ::
A.
B.
C.
D.
E.
fence : posts
capture : thieves
nest : birds
devise : plans
fire : employees
y=x;
x=y;
y=t;
}
a).(New,Dictionary)-(New,Dictionary)
b).(Dictionary,New)-(New,Dictionary)
c).(New,Dictionary)-(Dictionary,New)
d).(Dictionary,New)-(Dictionary,New)
e).None of the above
(Ans will be b or e) check
Q10).If a directory contains public files (can be valied and used
by any one ) which should not be altered ,the most liberal
permissions that can be given to the directory is
a)755
b)777
c)757
d)775
e)None of the above
(Ans a)
11) what would the following program results in
main()
{
char p[]="string";
char t;
int i,j;
for(i=0,j=strlen(p);i<j;i++)
{
t=p[i];
p[i]=p[j-i];
p[j-i]=t;
}
printf("%s",p);
}
a)will print:string
b)will not print anything since p will be pointing to a null string
c)will print:gnirtS
d)will result in a complication error
e)will print invallid characters(junk)
(Ans will be b ) check
12) After the following command is executed
$ ln old new
a listing is performed with the following output
$ ls -li
total 3
15768 -rw-rw-rw- 2 you 29 Sep 27 12:07 old
15768 " " " " " " " " new
15274 " " 1 " 40 " " 09:34 veryold
which of the following is true
a)old and new have same i-node number,2
b) " " " " " " " , 15768
c)old and new have nothing yo do with each other
d)very old and new are linked
e)very old and old are linked
(Ans is b)
13) What will be the result of executing the following statement
int i=10;
printf("%d %d %d",i,++i,i++);
a).10 11 12
b).12 11 10
c).10 11 11
d).result is OS dependent
e).result is compiler dependent
(Ans is e)
14) What does extern means in a function declaration
a)the funct has global scope
b)the funct need not be defined\
c)nothing really
d)the funct has local scope only to the file it is defined in
e)none of the above
(Ans will be c)
15) What will be result of the following program
main()
{
void f(int,int);
int i=10;
f(i,i++);
}
void f(int i,int j)
{
if(i>50)
return;
i+=j;
f(i,j);
printf("%d,",i);
}
a).85,53,32,21
b)10,11,21,32,53
c)21,32,53,85
d)32,21,11,10
e)none of the above
(Ans is e)
16). MS windows 3.1 is a
a)operating system
b)Application
c)Programing language
d)database
e)shell
(Ans will be b)
17).MS Windows 3.1 supports which type of multi-tasking?
a)cycle
b)executive
c)preemptive
d)Non-preemptive
e)Manual
(Ans )
18)The command ......ln /bin/mail /usr/you/bin/m
a)will not be executed because you are linking files
across different file systems
b)results ln /bin/main being the same file as /usr/you/bin/m
c)results in 2 links to the file mail
d) " " " " m
e)none
(Ans will be b)
19)In a standerd directory lay out ,/etc is the directory where
d)
E)
(Ans is b)
25)Send Message and postmessage are
a)send message puts the message in the message queue and results,
postmessage processes the message immediately
b)Sendmessage processes the message immediately,postmessage puts
the message in the queue and returns
c) Both put the message in the message queue and returns
d) Both process the message immediately
e) None of the above
(Ans will be b check)
26) Which of the following message is used to limit the size
of teh Window
a)WM_SIZE
b)WM_PAIN
c)- - - d)- -- - (Ans is a)
27)until who|grep mary
do
sleep 60
done
a) is syntactically incorrect
b) waits 60 seconds irrespective of Mary being logged in or not
c) waits until Marry is logged in
d)waits till Mary exited
e)None
(Ans is c)
28)The UNIX system call that transforms an executable binary file into
a process is
a)execl()
b)execv()
c)execle()
d)execve()
e)All of the above
(Ans will be d check)
29)Which of the following is true about fork()
a)- - - - b)causes the creation of a new process ,the CHILD process
with a new process ID
c)
d)
e)
(Ans is b)
30) What do the following variable names represents?
sort register
volatile default
a)- - - b)---c)all the above are keywords
(Ans is c)
31)What will be the result of the following program
main()
{
char *x="String";
char y[] = "add";
char *z;
z=(char *) malloc(sizeof(x)+sizeof(y)=1);
strcpy(z,y);
strcat(z,y);
printf("%s+%s=%s",y,x,z);
}
a)Add+string=Add string
b)syntax error during compilation
c)run time error/core dump
d)add+string=
e)none
(Ans will be e consider cap&small leters)
32)What does the following expression means
a)
b)
c)
d)an arrey of n pointers to function returning pointers to
functions returning pointers to characters
(ANS IS d)
33)Which of the following is not a DDL object
a)HBRUSH
b)HPEN
c)HBITMAP
d)HRGN
e)HWND
(Ans ic e)
34) Which of the following message is used to initialize the
contents of a dialog
a)WM_CREATE
b)WM_SIZE
c)WM_COMMAND
d)WM_INITDIALOG
e)none
(Ans will be d)
35)Interprocess communication in UNIX can be achieved using
a)pipe
b)Message
c)Semaphores
d)Shared Memory
e)All of the above
(Ans is e)
36) Which of the following is true
a)UNIX is a time sharing multi-user OS
b)UNIX has a device independent file system
c)UNIX is full duplex
d)UNIX has command interpreter
e)All of the above
(Ans is e)
Q). PS1 pwd
export PS1 results in
a). your primary prompt being your current directory
b). " " and secondary prompts being the current dir
c). " " prompt being your home dir
d). " " and secondary prompts being the home dir
e). None of the above.
Q). If you type in the command
nohup sort employees > list 2 > error out &
and log off ,the next time you log in . the output
will be
a). in a file called list and the error will de typed in
APTITUDE TEST
****************************************
Missing leter
1).eefgghii- (Ans j)
2)
3)defdefghi- (Ans g)
4)cdexyzfghxyz-(Ans i)
5)defdegde- (h)
6)abczabcyabc- (x)
7)fgbhibjkb- (l)
- - - - - (Ans is r)
9)aarbsctarb- (s)
10)bccdeefg- (g)
11)efhikl- (n)
12)abccdeffg- (h)
13amnbopc- (q)
14)tttssrqqqp- (p)
15)ddffhhjj- (l)
16)mnmnklopopkl- (q)
17)cddeeefff- (f)
18)gfed- (c)
19)dfhjl- (n)
20)abcijdefij (g)
21)efgefghefghi- (e)
22)bcbdedfgfhi- (h)
23)aababccdc- (d)
24)aibcidef- (i)
25)cehl- (q)
26)abdehimn- (s) check again
27)becfdge- (h)
28)agbhc- (i)
29)adhko- (r)
30)efghjklno- (q)
31)aedhg- (k)
32aeibf- (j)
33)zdwgt- (J)
34)zeyijxg- ()find
35)cqreuvg- (y)
36)ksjtiuh- (v)
37)rsjtuhvw- (f)
38)ieajfbk- (g)
39)hebifej- (g)
40)hjlmiel- (h)
--------------------------------
2.statement 2 is enough
3.statement 1 and statement 2 together is required
4.Statement 1 is enough and statement 2 is enough separately
5.data is insufficient
Aptitude ::
37.5 % of a number is 450 what is the 87.5 % of the number?
Ans:1050
30% of 40% of 200
Ans:24
SI = 240
R=6
N=4
P=?
Ans:1000
Difference between simple interest and compound interest for 2 years = p(N/100) square
2. A problem based on this.
TECH MAHINDRA PAPER ON 4th NOVEMBER KOLKATA
HI, friendz.I'm Amitava from Kolkata.It was an Off Campus drive for 2006 freshers
batch. The aptitude was not so tough, but the buzzword was 'TIME'...they will give u
very little time to do these.u will be given one hour, and u need to answer 70 questions.
There was no negative marking and sectional cutoff. They announced it prior to the
test.So when ur time is almost exhausted, guessworks will come handy. There were five
sections.
Section 1: It was fill in the blanks without any options.it was simple.Just fill in with
prepositions,tenses etc.
Section 2: There were 'choose the most appropriate word'.some small 3-4 line
paragraphs will be given and u will be asked some easy questions on them. SEC 1 & 2
should be attempted first.It is scoring and one can do these 20 ques in maximum 15
mins.Score definite 20 here and keep much time for other sections.
They set a high cutoff.Only 29 cleared apti including myself from about 100.
They call for technical interview first.It was a panel of two.One was an young man in
his 20s, another was a middleaged man about 40+. They were friendly.They started
with .."Tell about yourself".then as I'm a CS guy, started asking from C,C++,Java.They
asked to rate myself in all those three.I rated.Then they asked to write the code of
swapping two numbers using pointer and witout using temporary variable.I started
well,but got a bit confused in the middle.They helped me.Then command line
arguments in C & Java. Polymorphism,abstract class,multiple inheritance,interface,
exceptions, operator/method overloading,overriding,java thread and two ways of
implementation, arrays, stack related basic questions were asked.then they started with
DBMS.At first they started with a unfamiliar question bout DBase.I told i didnt used or
ever saw DBase.then Normalization,3NF,BCNF, referential integrity.They smiled and
asked "Lets get into Oracle." They asked if i know PL/SQL.I said no.They asked wat is
subquery and asked to fetch the salary of the top 3 highest paid employees.It lasted for
about 45 minutes.Then they asked me to wait in a room.
Then after half an hour of anxiety, one person came and called me for HR.This time it
wasnt a panel.Only one middle aged gentleman.He asked me typical HR related
questions such as why TM,why should we hire u,
strength,weaknesses,hobbies,semester marks,future plans.He seemed to be very
intersted about philately i.e stamp collecting which i told as one of my hobbies.Asked
about how many stamps I have,of which nations, catalogues,rare stamps, & blah
blah.Then asked to wait in the same room again.
Then in 10 minutes they called again.now it was a luxuriously decorated room and I
was greeted by an elderly lady.She asked me about how was the day, about my
family,work culture at tech mahindra,pay package etc.Then asked me "If I select u, will
u be able to cope up with immense pressure tat TM training will impart upon u??" Then
After 5 mins they called me agin and smiled and said"Amitava.now u are one of us.U r
selected and u will have to join Tm by DEC,06." I was so happy.A long 1.5 yr job hunt
ended atlast.I am thankful to God and all my well wishers.When I was getting so
depressed tat no one will ever take me, God gifted me one of the best opportunity.I got
thru a company tat many of my friends who cracked campus earlier would envy.
APTITUDE TEST:It consisted of 5 sections each with atleast 10 questions while one or two
sections contained 20 questions.There were altogether 75 questions which u have to answer in
1 hr only(remember time is very very imp in this round).The sections were:
a) Verbal reasoning and analytical
b) Non verbal reasoning and analytical
c) MCQ-questions based on English grammar(very easy)
d) English comprehension( Do it at last..coz it consumes time)
(a) Rs.500
(b) Rs.600
(c) Rs.800
(d) Rs.900
6. x% of y is y% of?
(a) x/y
(b) 2y
(c) x
(d) can't be determined
ans: C
7. The population of a city increases @ 4%p.a. there is an additional annual increases of 4%
of the population due to the influx of job seekers. Find
the % increase in population after 2 years?
8. The ratio of the number of boys and girls in a school is 3:2. Out of these 10% the boys and
25% of girls are scholarship holders. % of students who
are not scholarship holders?
9. A rectangular plant (2)^1/2 meters wide can be placed so that it is on either side of the
diagonal of a square shown below. (Figure is available). what
is the area of the Plank?
ans: 7*(2)^1/2.
1. a,c,e,g..
(a) h
(b)i
(c)d
(d)j
Ans: b
2. a,e,i,m,q,u_,_
(a) y,e
(b) b,f
(c) g,i
(d) none
3. 1,2,3,5,7,11....
(a) 15
(b) 9
(c)13
(d)12
ans: c(Series of prime no)
4. 1,3,4,8,15,27,...
(a) 60
(b)59
(c)43
(d)50
and similar to these there are many more ques.....so be prepare for them also.....
HR ROUND.......
This round is merely a formality....as they asked us about any special quality that we have....
i said sir i love to ride bikes...
they told us to take any topic frm ourselves and then give idea on that.....
then they take each of our's resume with one photograph and then they asked us to make
It will be all......
best of luck....just have confidence in urself...
hope i will help u all frm my experience..
meet u soon at MBT......
BEST OF LUCK TO U ALL.....
BEST WISHES...
"NIKHIL SRIVASTAVA"
BE(IT)
RKDFIST-BHOPAL