All Company Interview Questions Answers
All Company Interview Questions Answers
All Company Interview Questions Answers
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 wi
th 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 circumscr
ibed 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 forme
d 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 a
nother is
a lawyer.
a)If the doctor is younger than the lawyer, then the doctor and the lawyer are n
ot 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 b
e
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 s
tudied
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 mor
e 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 da
ys.
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 th
e
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 pr
ofit 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 cl
assmates go
to canteen.
Ans: Cannot be determined.
26. The price of a product is reduced by 30% . By what percentage should it be i
ncreased
to make it 100%
Ans: 42.857%
27. There is a square of side 6cm . A circle is inscribed inside the square. Fin
d 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 thick
er 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 com
es 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 a
rea
increase?
Ans : 300%
42. Perimeter of the back wheel = 9 feet, front wheel = 7 feet on a certain dist
ance, 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 t
imes.
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 percen
tage of
the mixture of solution
Ans: 36%
45.City A's population is 68000, decreasing at a rate of 80 people per year. Cit
y B having
population 42000 is increasing at a rate of 120 people per year. In how many yea
rs both
the cities will have same population?
Ans: 130 years
Retrieved from "http://www.freshersonline.com/wiki/Aptitude_Questions_I"
Sample test paper conducted on 10th sep 2003.
1.
write the program/algorithm or pseudo code to do
following operation given matrix
Input Matrix
123
456
789
Output Matrix
987
654
321
the algo or program should be able to do this.
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 answer approach is 2+3+.....127
ans: 137 (check it)
4.
One more quetion about 4 ships do it well ther are 7 conditions and 7th conditio
n
will not be
satisfied.dont go for that consider the first 6 conditions
Interview questions:
5.
differecne b/w c and c++.
6.
polymorphism, decalring functions in structures,virtual base class.
7.
If it is HTML
8.
statements
A: I'am a doctor B is a barber and C is the taxi driver.
B: I'am an employee of water works dept, A is the taxi driver and
C is the doctor.
C: I'am a lawyer A is a taxi driver and B is the doctor.Who is the thief?
Ans:.......................
9.
In one country they prefer only boys to have. If it is a girl in the
first birth then there must be the other child to have,
if it is also a girl then they will go for the next birth and stops when
they got the boy. Then what is the proportion of
girl to boys in that country?
Ans: (n+1)/2:1
10.
While three friends Abe, Bob, Cort in a restaurant taking their snacks one lady
came and she asked them how many
children you have. One of them replied "By looking at the total number of childr
en we
have you can uniquely identify
the no of children I'am having" but she failed to guess then he made the followi
ng
16.
The girl's age is twice that of boy, if the boy is four years old. After four ye
ars
the age of the girl is
Ans: 12 years
17.
Sister's age is twice than that of the brother. If the brother's age is six, wha
t is
the sister's age after two years?
Ans: 14 Yrs.
18.
Two lemons cost 10 cents. Then one and a half dozen cost
Ans: 90 cents
19.
A clock is late by 1 minute 27 seconds in a month. Then how much will it be
late in 1 day?
Ans: 2.9 seconds
20.
Opposite of Remote?
(a) Far (b) Near (c) Huge (d) Village
21.
Statement A: All great men are ridiculous; Statement B: I am ridiculous ;
Inference : I am a great man;
(a) True (b) False (c) Not clear
22.
Statement: Normal children are active; Inference: All children are active;
(a) True (b) False (c) Uncertain
23.
Next number in the series 1, 1/2, 1/4, 1/8 ?
Ans: 1/16
24.
In 6 seconds a light flashes once. In one hour how many times it will flash?
Ans: 601 times
25.
At 20% discount, a cycle is sold at a selling price of 2500 Rs. What is the
actual price?
Ans: Rs. 3125
26.
Statement A: A & B have same age; Statement B: B is younger than C;
5.
Minimum no. of lines required for communication using RS232
6.
To convert 1's complement to 2's complement and vice versa
7.
During which time we use 'size of' command.
8.
Out of four choice we have to identify which is a macro.
9.
There was one pointer _expression related question.
10.
To find post fix _expression.
11.
What type of operating system is unix
a)pre-emptive b)non-preemptive c)batch
12.
Where we use DFD(Data flow design)
a)structural languages b)object oriented languages c)UML d)none of these
13.
Name the error which occurs when we write on a page
a) segment fault b)permission fault c) page fault
14.
A question based on the representation of an array in C An array whose
elements are fn pointers which inturn returns a character
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
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
whim (impulse)
15. Confiscate
- appropriate (to take
tocharge)
merit = to deserve
stifle
= suffocate (smother)
16. Emancipate
- liberate
inert
=
passive
17. Misery
- distress
latitude
= scope
18. Annihilate
- to destroy
momentary
= transient
20. Acumen
- exactness
tranquil
= serene (calm)
21. Metamorphosis
- transform
admonish
=
cautious
22. Scrutiny
- close examination
efface
= obliterate(wipe
out)
23. Obstinate
- stubborn
conciliation=
make
less
angry
or more friendly
24. Fuse
- combine
intermittent
then starting
25. Whet = stopping
- and
sharpen
preponderant= superiority of power or quality
vacillate = undecided or dilemma
deprecate = feel and express disapproval
assess = determine the amount or value
litigation = engaging in a law suit
negotiate = discuss or bargain
expedient = fitting proper, desirable
conglomeration = group, collection
connotation = suggest or implied meaning of
expression
discretion = prudence
= 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
= 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
21. Incentive = spur
22. Instigate = incite
23. Inert = passive
24. Latitude = freedom from narrow
limitations
25. Lament = wail
26. Momentary = for small time
27. Merit = to deserve
28. Miserable = unhappy, sad
29. Obstinate = stubborn
30. Overt = obvious, clear, explicit, open
31. Pretentious = ostentatious
32. Potential = latent
33. Renounce= give up, reject
34. Solicit = Humble, urge
35. Subside = settle down, descend
36. Stifle = suppress, extinguish
37. Tranquil = calm, silent, serene
38. To merit = to deserve
39. Volume = quantity
40. Veer = change in direction
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) prophetic (5) false
(4) fundamental
(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
(4) private (5) cautious
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 th
e
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 t
ime and
TCS keeps repeating the RC from Barrons.Infact instead of remembering all th ewo
rds
from barrons its better to remember all the RCs as u will get 6 marks without wa
sting 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
maniac out there! You cant leave me alone here! Youll have to hide in the back of th
e
car. Lock all the doors & lie on the floor in the back, under this blanket. No-o
ne 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 t
he
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 ca
r. Marie
was terrified. She listened, holding her breath. Then she heard 3 slow knocks, o
ne 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 some
body-or something--else. She was shaking with fear. But she forced herself to li
e still. The
knocking continued-- bump, bump, bump, bump Many hours later, as the sun rose, s
he
was still lying there. She had not slept for a moment. The knocking had never st
opped, all
night long. She did not know what to do. Where was George? Why had he not come f
or
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. Severa
l policemen
leap out. One of them rushed towards the car as Marie opened the door. He took h
er by
the hand.
Get out of the car & walk with me to the police vehicle. miss. Youre safe now. Loo
k
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 emp
ty
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)
b)
c)
d)
The carburetor
The rain drumming on the roof
The accelerator
He had no idea
3)
a)
b)
c)
d)
4)
a)
b)
c)
d)
5)
a)
b)
c)
d)
6)
a)
b)
c)
d)
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 th
e
_________ 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 mathemati
cs
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 lan
guage 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 becam
e
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
13) In fact, the night of the concert, the house
was packed; every ticket ________________
d)
a)
b)
c)
d)
have been
is selling
was selling
sold
had been sold
was taking
will not be
has not been
had not been
was not
are finding
have found
groans
groaned
had groaned
d) were groaning
18) The environment turned from excitement
to frustration
a) will give
b) had given
The stand-in performer__________ the
performance everything he had.
19) When he had finished, there was nothing
but an uncomfortable silence. No one
_____________
c)
d)
a)
b)
c)
gave
gives
Applauded
Applauds
Was applauding
shouted
breaks
broke
had broken
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 acciden
ts.
b) On a table at the rear of the room was a notebook, a pair of scissors, & a
biology textbook
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 characte
r
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
33) Reemas bad-mouthing Peter only because she is jealous of him.
Means______________
a) Peter really is a nice person
b) Peter really is a mean person
c) Peter really is a difficult person
d) Peter really is a tough person
34) If some one is gung ho, they are_______
a) stupid
b) Childish
c) Enthusiastic
d) Loud
35) Mr. Hughes has been asked to___________ this difficult project because of hi
s
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 s
ame
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
40) This looks too heavy,______________ pick it up?
a) Can I
b) may I
c) need I
d) would I
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
42) Pope John Paul II ___________ more than 90 countries.
a) has visited
b) was visited
c) visits
d) has been visiting
43) I _____________ Carl since I ______________ a little child.
a) have known, have been
b) have known, was
c) knew, have been
d) knew, was
44) I wonder if _____________ will show up at the meeting?
a) someone
b) anyone
c) one
d) everyone
45) Have you given up______________.
a) to smoke
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
Use: She tried always to be
circumspect
n. the act of placating
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,
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
before your eyes
n. freedom from narrow limitations
Use: I think you have permitted your
son too much latitude in this manner
n. outward demonstration, indication
Use: Mozarts early attraction to the
harpsichord was the first manifestation
of his pronounced musical bent
v. lessen or try to lessen the
seriousness or extent of Use: Nothing
he could do to mitigate her anger, she
refused to forgive him
Adj. Multicolored or mixed Use: he
wore a motley tunic, red and green and
blue and gold all patched together
haphazardly
Adj. Dreamily thoughtful, thoughtful
with a hint of sadness Use: The
pensive lover gazed at the portrait of
his beloved and sighed deeply.
Adj. Abundantly fruitful Use: She was
a prolific writer, who produced as
meany as three books a years
v. give up something with reluctance,
yield Use: once you get used to fringes
like expense account meal and
company car, it is very difficult to
relinquish them
v. request earnestly, seek Use: The
Mayor telephoned all the member of
the city council to solicit their votes
Adj. Docile, easily managed,
susceptible to suggestion Use:
Although Susan seemed to be a
tractable young woman, she had a
stubborn streak of independence
v. change in direction Use: After what
seemed to be en eternity, the wind
veered to the east and the storm abated
Adj. Forceful, intensely emotional;
coincide, assent,
acquiesce
Stupor, indolence,
weariness
Let out
Surreptitious,
clandestine
open
Obliterate, eradicate,
Engrave
Ostentatious, pompous,
conceited
Down-toearth
Regret, scruple, qualm,
guilt, reluctance,
hesitation,
Conflict,
resist
Get-up-andgo
c. 0.015%
d. 0.0015%
2.
x<y,y<z and z>w which of the follwing is always true
a.
b.
c.
d.
3.
x<w
y<w
x>w
y>w
12 men can do a job in 4 hours .in wat time the same job can be done by
15
a.
b.
c.
d.
4.
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.
When operator * is applied to a number the result is 10 subtracted from the
twice of the original number ,so wat is *(*9)
6.
A husband and wife has 6 sons and each has 5 children each, How many
are there in the family altogether
7.
3x-2y=8 so what is 4y-6x
a. 16
b. 16
c. data not sufficient
8.
From chennai to trichy it is 250 miles and from Chennai to pondicherry it is
120 miles.wat percentage of mile from Chennai to trichy is Chennai to pondi
a. 34
b. 20
c. 36
9.
City B is 8 miles east of City A.City C is 6 miles north of City B. City D is 16
miles east of city C. City E is north of City D by 12 miles .what is the shortes
t
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
X gets 80% of Z wat is the weekly wage of X
11.
I think answer is 200.
There are 50 employees of a company .21 were in training for both
economics and science training.11 were in 2 different training programs .find ho
w
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
code how is TABLE written Elbat(reverse the word)
13.
In a certain code if READ is written as SEADR then how is SING written with
that code SINGS
14.
If kanchan is son of Sunils sons son then how is Sunil related to Kanchangrandson
15.
Find the odd one out
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 :
+ followed by -,*,/ parentheses r given higher precedence to operators unary
operator - is always written within parentheses association is from right to left
3.
Questions were given like L-Value R-Value
a) z[I+2]
b)*x
c)&x
d)&(&x)
e)
4.
Assume the following:
a. A tape drive can store 4096 bytes/millimeter
b. Forgot
c. A IRG is necessary and the length is 2 millimeter
Answer the following question:
For storing 20MB how many millimeters of tape is required
What is the storage capacity if the tape is 10000meters long
For a infinite storage how many IRGs are required in a tape that stores 1 GB of
data.
5.
The following program is to calculate the number of lines, number of words,
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 except
ion is thrown when Servlet initialization fails ?
(a) IOException
(b) ServletException
(c) RemoteException
ANS: (b)
------------------------------------------------------------------2. How can a S
ervlet call a JSP error page ?
(a) This capability is not supported.
(b) When the servlet throws the exception, it will automatically be caught by th
e 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, savin
g 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 a
re 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 conn
ections 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 multipl
e 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 sta
ge, 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 Ques
tions 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)
-------------------------------------------------------------------
------------------------------------------------------------------13. 2 Question
s on RMI and EJB related (I don t reemember them)
------------------------------------------------------------------14. Purpose of
<jsp:plugin> tag
(a) used to incorporate Java applets into a Web page.
(b) Downloads a plugin to the client Web browser to execute an applet or Bean.
(c) Both (a) & (b)
ANS: (c)
EXPLANATION:
JSP Syntax :
<jsp:plugin
type="bean|applet"
code="classFileName"
codebase="classFileDirectoryName"
[ name="instanceName" ]
[ archive="URIToArchive, ..." ]
[ align="bottom|top|middle|left|right" ]
[ height="displayPixels" ]
[ width="displayPixels" ]
[ hspace="leftRightPixels" ]
[ vspace="topBottomPixels" ]
[ jreversion="JREVersionNumber | 1.1" ]
[ nspluginurl="URLToPlugin" ]
[ iepluginurl="URLToPlugin" ] >
[ <jsp:params>
[ <jsp:param name="parameterName" value="parameterValue" /> ]+
</jsp:params> ]
[ <jsp:fallback> text message for user </jsp:fallback> ]
Description :
The <jsp:plugin> tag is replaced by either anor tag, whichever is most appropria
te 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 a
t
startup. The <jsp:fallback> element provides a message for the user if the plugi
n 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 introd
uced:
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 appl
et, as this
attribute has no default value.
code="classFileName"
The name of the Java class file that the plugin will execute. You must include t
he .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 B
eans 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 securel
y, 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 lin
e in the JSP
result page that corresponds to the line in the JSP file containing the <jsp:plu
gin> 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 lin
e.
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 display
s, 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. T
he default
value is 1.1.
nspluginurl="URLToPlugin"
The URL where the user can download the JRE plugin for Netscape Navigator. The v
alue 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 va
lue 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 specif
y more than
one name and value, use multiple <jsp:param> tags within the <jsp:params> elemen
t.
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 parame
ters 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 converte
d to its
HTML equivalent.
<html> <head> </head> <body>
</body>
</html>
-----------
------------------------------------------------------------------15. Difference
between <jsp:forward> and <jsp:include> tags
ANS:
<jsp:forward> transfers the control to the mentioned destination page.
<jsp:include> tag substitutes the output of the destination page. Control remain
s on the same
page.
------------------------------------------------------------------16. Which of t
he following is true ?
(a) Unlimited data transfer can be done using POST method
(b) Data is visible in Browser URL when using POST method
(c) When large amounts of data transfer is to be done, GET method is used.
ANS: (a)
------------------------------------------------------------------17. EJB class
should implement
(a) javax.ejb.EntityBean
(b) javax.ejb.rmi
(c) javax.ejb.EJBHome
(d) javax.ejb.EJBObject
ANS: I think the answer is (a)
------------------------------------------------------------------18. Generally
Servlets are used for complete HTML generation. If you want to generate partial
HTMLs that include some static text (This should not be hard coded in Servlets)
as well as
some dynamic text, what method do you use ?
(a) Serverside includes
(b) JSP code in HTML
(c) Not possible to generate incomplete HTMLs using Servlets
(Note: I don t remember the question word to word. But it is similar to what I h
ave given)
------------------------------------------------------------------19. Which of t
he following can not be used as the scope when using a JavaBean with JSP?
(a) session
(b) application
(c) request
(d) response
ANS: (d)
------------------------------------------------------------------20. Which is t
rue about Servlets
(a) Only one instance of Servlet is created in memory
*
*
*
*
*
*
*
*
*
*
Try, Catch, Finally
Switch statements (Some question on "default" option of Switch)
Java Exceptions
Scope (Public, Private, protected)
Inner & Outer classes
Strings & StringBuffers
Serialization
Applets
Abstract Classes & Interfaces
Static classes & methods
There were two sections Aptitude Technical
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
more coins. Find out how many coins he
had originally in terms of x and y
3.
Find out the Simple Interest paid for a sum of $4000 at the rate of 8% per
annum for 3 months.
4.
If it takes 10 technicians working 6 hours to build a server. They start
woring at 11 AM and 1 technician is
added per hour starting at 5 PM. At what time they will finish the server?
5.
A chart was there giving the speed of train after some minutes like
0 30 60 90 120 150 180
40 45 50 55 60 65 70
6.
Find the % increase in the speed of train?
7.
If it is extrapolated further what will be the speed after 5 hrs.
8.
If the data is for 10 bogies and for every 2 bogies added speed decreases
by 5% what will be the speed after 5
hrs.
9.
The type of questions where Both stmt are necessary First one is
sufficient in itself.. What is the perimeter of the quadrilateral?
10.
The quadrilateral is rectangle
11.
The area of the quadrilateral is 36 What is a*b
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
white Elephant What does White
15.
Elephant mean?
Sometime they irritate me because they are up with the lark whereas I like
to lie in What does Up with Lark
mean?
Technical
1.
What exception can an overridden method throw in comparison with the
method it is overriding?
2.
What does parseQueryString return?
3.
Anonymous classes Can they have constructors?
4.
what is wrong with this
abstract class MyClass
{
transient a,
synchronized b.
}
5.
How can an inner class access the members of outer class?
6.
Find the output:
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
given Array was used.
8.
Some For stmts was given Mark all valid once
9.
byte b=1
While(++b > 0);
System.out.println(b);
Deutsche - Placement sample question papers
1. What is the percentage represented by 0.03 * 0.05 ?
(a)0.0015
(b)0.000015
(c)0.15
(d)15
Ans.B
2. (x-a)(x-b)(x-c)....(x-z) = ?
(a) 1
(b) -1
(c) 0
(d) Can t be determined
Ans. C
3. If a = 1, b = 2, c = 3.......z = 26 what is the value of p+q+r ?
(a)33
(b)51
(c)52
(d)48
Ans. B
4. A is 8 miles east of B.
C is 10 miles north of B.
D is 13 miles east of C and E is 2 miles north of D.
Find shortest distance between A and E.
(a) 5 miles
(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 blu
e. What is the
maximum number of times that socks have to be taken out so that atleast 1 blue p
air 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 in
terest
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 wil
l 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 t
he right. He
then travels 5 km to the right and then travels 15 km towards the right and fina
lly 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 met
ers. He then
ran a distance of 7 meters southwards and then travels towards east a distance o
f 3 meter
Finally he travels southwards a distance of 10 meters.What is his vertical dista
nce 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.
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 Telug
u
46. How many speak both English and Telugu?
(a) 10
(b) 15
(c) 20
(d) 12
Ans. C
47.How many speak only Telugu?
(a) 55
(b) 45
(c) 65
(d) none of the above
Ans.C
48.How many speak at least one of the two languages?
(a) 120
(b) 100
(c) 250
(d) 50
Ans. A
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 h
im. 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.
find
find
find
FIND
find
FIND
the
the
the
THE
the
THE
next
next
next
NEXT
next
NEXT
letter
letter
letter
LETTER
letter
letter
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/(yz)
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 disco
unts 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 inheri
tance of Rs.
70,000. The rest is 2 be divide so that the widow recives 3/2 times as much of i
t 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 ne
gative ,
3x/5 dollars for each of the first 10 prints, & x/5 dollars for each print in ex
cess 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 i
n 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 y
ear 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 ye
ar?
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 ex
actly 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,r
ed & 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 whi
ch 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 seqi
uences 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 sa
leems
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) le
ss.
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 .
HFCL CAMPUS TEST [1]
(1) TTL to CMOS pullup & vice-versa
(2) function of Ping
(3) SNMP protocol
(4) Application layer
(5) ## ----> token pasting in C
(6) Question on C: i^=j you have to tell the output given the values
(7) Complexity of Binary Search tree
(8) Macro is given as follows : SQR(x) x*x
find the value of SQR(i-j) , when i and j were given
(9) Multiplexer 1 to 3 inputs--- A,B,C control lines--- S1,S2 Output
e Y interms of
S1,S2
(10) Bandwidth minimum sampling theorem
(11) Shannon s Law
(12) Difference between fork() & execve()
(13) Banker s algorithm
(14) append(&struct , fp)
(15) Windows95 , X-Windows what are they?
(16) 16k memory , ending address of the address space FFFFH find the
dress?
(17) Difference between TCP/IP and OSI model
(18) Difference between Bridge and router
(19) A graph was given : " a qudrilateral with 1 diagonal " find the
rees in the
graph
(20) Difference between TCP and UDP
(21-23) Pass by reference in C (3 questions)
(24) Synchronisation technique for IPC ( probably which method among
es was
best was asked)
(25) Address of RST 6.5
of i and j;
--- Y .Writ
starting ad
number of t
the 4 choic
To change any answer already marked, cancel the previous mark by placing
an= symbol. Thereafter, place a fresh tick mark ( ).
All questions have only one right answer. If more than one answer is
indicated, the question will not be evaluated.
The duration of this test is strictly 60 minutes. In case you continue to answer
beyond 60 minutes, your sheet will
not be evaluated.
Any attempt to impersonate will be viewed seriously.
SECTION A
Directions : For each question in this section, select the best of the choices g
iven
1.
#define AND &&
#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.
What error would the following function give on compilation.
f (int a,int b)
{
int a;
a=20;
return a;
}
8.
#define sqr(x) (x*x)
main( )
{
int a,b=3;
a=sqr(b+2);
printf(%d,a);
}
a. 25 b. 11 c. Error d. Garbage value
9.
#define str(x) #x
#define Xstr(x) str(x)
#define oper multiply
main( )
{
char *opername=Xstr(oper);
printf(%s,opername);
}
a. oper b. multiply c. Error d. None
10.
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
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 cho
ices
26.
A logic gate is an electronic circuit which
a. Makes logic decisions
b. Allows electron flow in only direction
c. Works on binary algebra
d. Alternates between 0 and 1
27.
The process of converting analog signal into digital signals so they can be
processed by a receiving computer is referred to as
a. Modulation
b. Demodulation
c. Synchronizing
d. Desynchronizing
28.
A distributed data processing configuration in which all activities must pass
through a centrally located computer is called
a. Ring Network
b. Spider network
c. Hierarchical Network
d. Data control Network
29.
Multiprogramming was made possible by
a. Input/Output units that operate independently of the CPU
b. Operating Systems
c. Both c and d
d. Neither a and b
30.
What is the alternative name for application software?
a. Utility software
b. Specific software
c. End-user software
d. Practical software
31.
Compared with the secondary storage, the primary storage is:
a.
b.
c.
d.
slow
fast
fast
slow
and
and
and
and
inexpensive
inexpensive
expensive
expensive
32.
EBCDIC ca code up to how many different characters?
a. 8
b. 16
c. 32
d. 64
e. 256
33.
program written in machine language is called as ___________ program
a. Assembler
b. Object
c. Computer
d. Machine
34.
A factor in the section of source language is
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.
Data integrity refers to
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
directions at the same time?
a. Super duplex
b. Simplex
c. Half duplex
d. Full duplex
38.
What is the usual number of bits transmitted simultaneously in parallel data
transmission used by microcomputers?
a. 6
b. 9
c. 8
d. 7
39.
In the IBM PC - AT, What do the words AT stand for
a. Additional Terminal
b. Advance Technologies
c. Applied Technologies
d. Advanced terminology
40.
Different components on the motherboard of a PC processor unit are linked
together by sets of parallel electrical conducting lines. What are these lines c
alled?
a. Conductors
b. Buses
c. Connectors
d. Connectivity
SECTION C
Directions : The following set of Questions is based on a brief premise and a se
t of rules.
For each question, select
the best answer from the five A particular seafood restaurant
serves dinner Tuesday through Sunday. The restaurant is
closed on Monday. 5 entrees
Egg, Chicken, Mutton, Fish and Lamb are served each week according to thefollowi
ng
restrictions.
41.
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
Chicken and Mutton may be served?
a. Tuesday, Thursday
b. Tuesday, Wednesday, Thursday
c. Monday, Tuesday, Wednesday
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 t
he
remaining part of the trip. Which of the following expressions represents the av
erage
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 i
t
make if it were folded in half 10 times?
a. 2.047
b. 1.024
c. 1.023
d. 0.512
e. 2.048
57.
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
many people were in the contest?
a. 13
b. 25
c. 26
d. 27
e. 28
59.
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 be
en 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 experienc
ed 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 p
age. Using this JSP
page, if I want to send the file to a servlet (this servlet will store it somewh
ere), 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 Des
criptor ?
6. What are various types of EJBs ?
T
1
2
3
here are Three streams
hardware ( sps)
software (gsg)
dsp
ppt for 2 hours
salary 28000
hardware 13 questions 1hour and 15 minutes
software 20 questions
Hardware questions
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 b
it 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)
buffer has the delay of 1nsec
what is the setup time _________ns
what is the hold time ___________ns
a.
b.
3.
for Each gate delay time is 0.5 ns
a. For each gate the delay time is 0.5 ns when will the glitch occur draw the gl
itch
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.
what is the output of the following circuit?
6.
Draw the output waveform for the following ckt
Vtp=Vtn=1V
7.
obtain expression for the output (the i/ps may not be in correct
order)
8.
Determine the output waveform input is
9.
a.
What is the output waveform
b. What will happen when the AND gate is replaced by OR gate
10.
using 2:1 Mux and one inverter make XOR gate
11.
using 2:1 Mux make a transparent latch (D f/f)
12.
Design a ckt such that f (clk_out)=2 f (CLK_in) that is frequency doubling
circuit is needed
13.
Find the outputs of the following ckts
a). assume Vt = threshold voltage
b).
c).
Software questions:
Totally 20 questions were asked
* Most of them from C and datastructures (in equal nos)
* few from c++
1.
Numbers sequential search has to compare ______ elements on worst and
_______numbers on an average
2.
3.
Which of the following algorithm is not applicable for lived list
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
they give, we have to write the logic part
i.e. live
typedef struct link
{
int element;
struct link *next;
}code;
struct link rev(node *p)
{
node *t;
node *r=0;
while(p!=___)
{
t=____;
p=_____;
r=______;
}
return=______
5.
exactly same type of question to check whether the given string is
palindrome or not
6.
they gave one program and asked what it is (it is fibonacci series)
7.
int i=7;
printf(%d,i++*i++); what is the answer
8.
int i=7;
printf(%d,i++*i++); what is the answer
7. struct code
{ int I;
int t;
}
/* some code */
main()
{
}
what is wrong ?
semicolon is missing after structure declaration
9.
Selection sort for N elements the no of comparisions needed and no of
swapping
10.
One question from heap sort
11.
One question about breadth search
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 Pharmaceuti
cal. It
has a very good brand name. It s having around 80,000 employees. It s entering I
T insustry
now to handle the large number of their in-house projects. As of now, the only d
evelopment
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.
Paper Type
Posted By
: General - other
: admin
Philips Genaral Paper :
1.6*12*15 is the volume of some material.How many cubes can be inserted into tha
t?
Ans.40
2.Two pipes can fill a tank in 10 1nd 12 hours while third pipe will make the ta
nk empty in 20
hours.If all three pipes operate simultaneously,in how many hours the
tank will be filled ?
Ans.7hours 30 minutes.
3.Diameter of a beaker is 7cm. Mambler(some instrument)dia is 1.4cm.How many mam
blers
has to be put to increase the water level by 5.6cm.
4.Cost of an item is x. It s value increases by p% and decreases by p%Now the ne
w value is 1
rupee, what is the actual value.
Ans.(1000)/(1000-p*p).
5.A right circular cylinder and a cone are there.Base radius of cone is equal to
radius of
cylinder.What is the ratio of height to slant side.
6.Distance between two poles is 50 meters.A train goes by 48 kmph in one minute.
How many
poles will be crossed by the train.
7.A pole seen from a certain distance at an angle of 15 degrees and 100 meters a
head by 30
degrees. What is th height of pole.
8.15 people--each has to pay Rs.20.. 20 people--each has to pay Rs.18.. for 40 p
eople--how
much has to pay ?
9.if p=2q then q=r*r,if p-odd then q is even,whether we decide r is even or odd
?
choices:a)first condition is sufficient
b)second condition is sufficient
c)both are sufficient
d)both are not sufficient
10.What is the value of m given that
i) m is devided by 2
ii) m is devided by 5
Ans: none of these
11.If he sells 40 magoes, he will get the selling price of 4 mangoes extra, What
is his %
increse in profit ?
Ans: 25%
12.100 glasses are there. A servant has to supply glasses to a person If he supp
lies the
glasses without any damage he will et 3 paise otherwise he will loose 3 paise.At
the end of
supplying 100 glasses if he gets 270 paise, how many glasses were supplied safel
y.
Ans: 95
( uca )
9. No of page faults asked by giving the sequence 2 3 6 7 1 3 4 8 9 10 3 2 4 ( j
ust 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 .
D) @(/(A,B),2
Ans. A.
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 wis
h 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 a
n 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
tement of
Lila is false, hence her first statement is true that is she is married to ram,
hence the first
statement of Laxman is false, hence his second statement is true, that is take t
he left road.
23) You find that your boat is stolen.You question three inhabitants of the isla
nd 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 mean
s he
knows who did it, which means his second statement is false, which means his fir
st statement
is true
Directions for question nos 24-25: There are five trains A, B, C, D and E that r
un 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 t
ouch 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 sequ
ence.
c.) Stable sort will always sort using the fastest scheme available in the libra
ry.
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 pa
ranthesis
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
thecoffee mixture is taken is mixed with tea cup.Which has higher concentration?
Ans: Tea
3.
Jack is taller than Peter.Bill is Shorter than Jack.
a) Bill is Taller than Peter
b) Bill is Shorter than Peter
c) Bill is as Tall as Peter
d) imposssible to say
Ans: d
4.
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.
A passage is given in a jumbled manner.Rearrange and give a suitable
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 aptitu
de question,
questions on comp n/w & OS were 7-8, 1-2 on CSO, 1 que on controls, 1 on samplin
g 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 sectio
n 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 aptitu
de question,
questions on comp n/w & OS were 7-8, 1-2 on CSO, 1 que on controls, 1 on samplin
g 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 sectio
n 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
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.
Two triangles are congruent
2.
two triangles are right triangles
3.
two triangles have same perimeter
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
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.
37.5 % of a number is 450 what is the 87.5 % of the number?
Ans:1050
2.
30% of 40% of 200
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)
square 2 A problem based on this.
TVS LUCAS PAPER
The test was for 1 hour containing 100 questions. 50 and above was the cut off f
or selection.
Negative marking was there. Easy questions will be at the end. So dont waste time
answering
difficult questions. Quants was dead easy.(no preparations are required).
Concentrate on technical topics.
1. Thyristor is a device ans: pnpn
2. LVDT works on the principle of
3. A diameter of the wheel is 20 cm if it revolved around 60 revolutions then ho
w many
revolutions will be made by a wheel of 50 cm diameter.
4. Whether compressor or the turbine should be started first in the case of a ga
s turbine
5. Discharge Vs time graph is called as.
6. x/y=2; x=4 then (x-y)/y=?
7. p/q=2;what is the value of 2p/q+q ans : cant be determined
8. What is the cutin voltage of germanium and silicon diodes??
Theory questions from the following areas were asked.
9. Torque Vs speed characteristics of shunt motor
10. Dynamic breaking
11. Basics in Electron devices and Induction and Synchronous Machines
Problems on
12. Maximum Power Transfer theorem
13. Star to Delta Conversion.
14. Network Theory
Section 1 - Quantitative
1.
Sum of three nos is 98. The ratio between 1 and 2 is 2:3. The ratio between 2
and 3 is 5:8 . Find the second no?
2.
A car travels uphill at 30 km/hr and downhill at 60 km/hr. It goes 100 km
uphill and 50 km downhill. Find the average speed of the car?
3.
A batsman s avg in 12 innings is 24.00 . If his avg is to be double of the no of
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%
profit and other for 10% loss.What is total profit/loss percentage?
5.
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
children. What is total probability that he will choose 1G , 2B , 1C?
7.
Some questions on Geometry?
8.
Some questions on Measurements?
9.
Some questions on permutation and combination.
Section 2 - Ananlytical
10.
Cities A - M are connected.Distance between any two cities is 1mile.They gave
which city connects which city.Q s based on these data
11.
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.
My Family
My Career
What two things i would change if I was the prime minister of India.
INTERVIEW:
a=a XOR b;
b=a XOR b;
a= a XOR b;
answer is swaping of a and b so b,a is answer
7.
8.for a given CMOS the voltage is halved freqency doubled capacitance halved wha
t is the
present CMOS power
ans (b)---- dynamic power is 1/2 *C*f*V^2
9.if a row daminated two dimentional arry in the following which one is advantag
e
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]
I donot know ans
10. what is area of a Hexagon with side as 1unit
ans is 3*(sqrt(3))/2
11. If traverse in a chess board right and down from one corner to another corne
r how many
possible ways will be there
ans is C(16,8) or (16!/(8!*8!))
12. Tick the below which can biparate (graph theory)
1)tree 2)forest of trees 3) evencycle graph 4) oddcycle graph
ans is 1,2,3
13.The fig shown in below is a SRAM (1K* 4 bits) ,how many of this SRAMS are req
ired to
design 16K of one byte
ans is 32 SRAMS and one 4 to 16 decoder
14. suppose two persons entering into one room in the morning 5 to 6 A.M. what i
s 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.
ans is highest is N and lowest is log(N+1) base 2
16.represent 3 and -3 in base -2 form taking two states (0,1) only
OTHER 5 QUESTIONS FROM SORTING TECHNICS SO PLEASE GO THROUGH SORTING
TECHNICS .
OTHE 5 QUESTIONS FROM FLIP-FLOP DELAYS EXAMPLE
1. THERE IS ONE LOOKAHEAD ADDER IS THERE ONLY TWO STAGES IT GIVES CARRY AHEAD
WHAT IS
THE TOTAL DELY IF IT IS 8 BIT ADDER.
2. WHAT IS PROPAGATION DELAY TIME FOR RING COUNTER.
3. WHAT IS MAX FREQENCY FOR SOME COUNTER SO PLESE CHECK COUNTES AND FLIPFLOPS
NeST PAPER ON 25th AUGUST AT TRIVANDRUM
Hi Friends, I m Prabha Joseph from LBS Institute of Technology For Women.I atten
ded the NeST placement @ SCT
clg on 25th Aug,2008.Cutt-off was 70%.There was ppt in the morning.After that th
ey conducted separate test 4 CSE &
EC students. There was NO NEGATIVE MARKING.
The pattern (CSE) was as follows:
(1)IQ(20 questions in 20 min)
(a)4*4 matrix given with 1 box empty,find the no
(b).5,.55,.65,.8,.....(series)
(c)find no of triangles in given fig.,
(d)if log 3=.477 & log(1000)x=3,find value of x,odd one out,....
(2)APTITUDE(30 questions in 30 min)
(a) % problems-3 or 4 questions
(b) direction-from X movin forward 8m reaches Y,move towards rite 5m,reach Z,tur
n rite move 7m then turn rite &
move 5m.find distance from X 2 this pt?
(c) blood relation,
(d) time& distance-car travels in 15kmph after sometime increases speed to 18 km
ph & total distance is 350km,find
time taken,
(e) ratio & proportion-prob on (M*H*D)/W,
There are options for us to choose C or C++ with networking or C++ with data str
uctures or
Java...You can choose the language u are comfortable with...
I chose C++ with networking ...Those who attended the other tests can also pleas
e post
their experience...It was all 20 questions including 3 programs (with options) w
ithin 30
minutes...It consists of 10 C++ and 10 Networking concepts questions.Any how due
to my
bad luck i was not able to clear that
HR is also easy. It will last for some 2-3 minute and at the most 5 minutes. Jus
t 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 writ
ten 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
GMR PAPER ON 15th SEPTEMBER 2008
Hi i appeared for GMR- Airport.
Pattern is
1.Written exam (q s 4m Power system, control system, EMFT, Analog, Electrical ma
chines)
2.Tech+HRInterview
3.Hard core Tech Interview (toughest of all)
some of interview q s are as follows
Starting Methods of IM
Speed Control of IM
application of IM
types Of circuit breaker n thr working
Relays, fuses
q s 4m power electronics
(application of phase control rectifiers, inverters, cycloconvertor, ac regulato
r, chooper)
Transformer efficiency and losses
cooling of transformer,
cooling of alternator,
synchronizing procedure 4 alternator..
what is power factor?
q s on transformer banks
why synchronous motor is not self starting??
why IM is self staring>??
Is transformer is a electrical machine ??(it is ..em )
i was asked 2 make a SLD
layout of thermal power station
q s 4m opamp
Types of UPS
dc motor applications (like where would we used dc series, shunt, compound etc..
.)
NALCO PAPER ON 28TH OCTOBER 2007,DELHI
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.
b) 20
c) 7
d) 14
19) One passes which have 4Qs
20) Some fill in blanks
21) One Q about the find the % of fifth harmonics in a current wave equation.
22) 4pole 3phase 50 htz induction motor running at 1460 rpm. What is the speed o
f running
slip wrt to rotor?
23) Find the new kva rating of transformer which has 220 kva, 1watt iron loss an
d 2watt cu
loss?
24) Hays bridge used for the measurement of?
25) In R-L-C parallel resonant circuit
a) Impedance is max.
b) Resistance is min
Two more options I didnt remember.
26) Two bulb 100w & 50w respectively with constant resistances connect in series
with
220v dc source then what is the value of voltage across first bulb?
27) AC ammeter used for measurement in
a) Pmmc
b) induction meter
c) Dynamometer
d) moving iron type meter
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?
BRAIN VISA PAPER ON 1ST JUNE 2007
Test is very simple any body can crack it. You need to have knowledge of HTML, J
ava
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 conditio
ns are
given, M should be after p, p must be tan, white must be before yellow, orange a
t 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 wi
fes
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 attribut
es,
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 ca
n 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
Due to short time they didn t conducted PI .my interview was over at 12:30 and r
esult came
on 7:30 Pm and luckily i was one of 24 who were finally selected. They prefer yo
u 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
MINVESTA PAPER ON 5TH OCTOBER 2007,DRK COLLEGE
Hi every body this is pavan of Aurora.We had interview of minvesta company on oc
tober 5th
2007 in DRK college. Well the interview was quiet easy and consists of three sec
tions. The
duration of the test is 1 hour.
Coming to 1st section.It consists of 10 questionns. This section consists of all
theory
questions. Friends 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, DB
MS, .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....e
tc
Coming to the 3rd section. This consists of 20 questions. He had given all C pro
grams 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
MINVESTA PAPER ON 5TH OCTOBER 2007,DRK COLLEGE
Hi every body this is pavan of Aurora.We had interview of minvesta company on oc
tober 5th
2007 in DRK college. Well the interview was quiet easy and consists of three sec
tions. The
duration of the test is 1 hour.
Coming to 1st section.It consists of 10 questionns. This section consists of all
theory
questions. Friends
try to answer them in one line.I had questions like following:1q)What is the dif
ference 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, DB
MS, .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....e
tc
Coming to the 3rd section. This consists of 20 questions. He had given all C pro
grams 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 t
ake 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 so
me 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 ou
r 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 ro
bot etc.
Basically they r not interested in ur answering, they r checking ur confidence l
evels.
So solve them nicely on the paper as u can or explain them verbally how r u solv
ing ur
problem.
4.
A 16 stored building has 12000 sq.feet on each floor. Company A rents 7
floors and company B rents 4 floors.
What is the number of sq.feet of unrented floor space. Ans.60000
5.
During a given week A programer spends 1/4 of his time preparing flow
chart, 3/8 of his time coding and the rest
of the time in debugging the programs. If he works 48 hours during the week ,
how many hours did he spen debugging the program. Ans. 18.
6.
A company installed 36 machines at the beginning of the year. In March
they installed 9 additional machines and
then disconnected 18 in August. How many were still installed at the end of the
year. Ans. 27
7.
A man owns 2/3 of the market research beauro business and sells 3/4 of
his shares for Rs.75000. What is the
value of Business. Ans.150000
8.
If 12 file cabinets require 18 feet of wall space, how many feet of wall
space will 30 cabinets require? Ans.45
9.
A computer printer produced 176,400 lines in a given day. If the printer
was in operation for seven hours during
the day, how many lines did it print per minute? Ans.420
10.
From its total income, A sales company spent Rs.20,000 for advertising,
half of the remainder on commissions
and had Rs.6000 left. What was its total income? Ans.32000
11.
On Monday a banker processed a batch of cheques, on Tuesday she
processed three times as many, and on
Wednesday she processed 4000 cheques. In the three days, she processed 16000
cheques. How many did she
process on Tuesday? Ans.9000
12.
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
she process in a seven and one half
hour day? Ans.1200
14.
In a library, there are two racks with 40 books per rack. On a given dya,
30 books were issued. What fraction
remained in the racks? Ans.5/8
15.
The average length of three tapes is 6800 feet. None of the tapes is less
than 6400 feet. What is the greatest
possible length of one of the other tapes? Ans.7600
16.
A company rented a machine for Rs.700/- a month. Five years later the
treasurer calculated that if the company
had purchased the machine and paid Rs.100/- monthly maintenance charge, the
company would have saved Rs.2000/-. What was the purchase price of the
machine? Ans.Rs.34000
17.
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 7
800
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.
On a given day, a bank had 16000 cheques returned by customers.
Inspection of the first 800 cheques indicated that 100 of those 800 had errors a
nd
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. Fractiona
l
parts of sq.feet cannot be ordered. At Rs.9/- a sq.feet, how much would the carp
et
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
with 20% women how many men
should be hired?Ans.8
23.
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.
It cost a college Rs.0.70 a copy to produce a Programme for the
homecoming football game. If Rs.15,000/- was
received for advertisements in the programme, how many copies at Rs.0.50 a
copy must be sold to make
a profit of Rs.8000/- ? Ans. 35000
section I: 25 questions (ENGLISH) in 15 minutes
section II: 45 questions (QUANTITATIVE) in 45 minutes
section III: 30 questons (REASONING) in 30 minutes
SECTION I
1.
Few questions on finding out the segment of sentence which is wrong.
2.
analogy.
1. celebrate::marriage
ans.lament::bereavement
2. bouquet::flowers
ans.chain::link
3.
germ::disease
ans.war::destruction
SECTION II
1.
Maximum numbers that can be formed using all the 4 digits 6 4 8 1
without repetition and which is divisible by 9.( ans none)
2.
Find the number of sides of a regular convex polygon whose angle is
40degrees.
3.
a+b+c=0, then roots of ax^2+bx+c=0 is
1.imag 2.real 3.coincidental 4.zero
4.
Difference b/w the compound interest and simple interest for Rs.2500 for
2 years is given-----. find the rate of interest.
5.
6.
There was one more question on S.I and C.I
7.
The minimum number by which 60 is to be multiplied to generate a
square.
ans 15
8.
A monkey climbs 6 mts and falls 3mts in alternate minutes.Then time
taken to climb a tree 60metres high?
18.
A string of pearls such that 1/3 is lost and of that 1/4th is missing,
remaining is 20 then actual number of pearls? ans. 40
19.
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)
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 corr
ect
time?
21.
Boat moves upstream in 6 hrs and covers the same distance downstream in
5 hrs. then speed of a raft floating?(accuracy of question not sure)
22.
(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
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.
There was one more question on volume and surface area.....
26.
1 Rs, 50 ps , 25 ps coins are in the ratio ---------, then the number of 50 ps
coins if they sum to ------Rs. (similar question in R.S.Agarwal)
27.
There was one more question on coins i.e. abt getting a change of 10ps
and 25 coins for ------Rs.(how many possible combinations or so possible)
28.
x/y+y/x=40/21(don t remember the exact value, believe this is the one)
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
-----boys and -----women. How much time would be the question)
31.
figure was given a square with four corners shaded and asked to find the
area of the shaded portion.... ie area of square-area of the regular octagon....
.
SECTION III
1.
A simple flowchart whose steps are as follows. value of r and h are given,
a and b=0 m=pi*r*r*h n=(pi*r*r*h)/3 if (m==n) do ------else b=4*pi*r*h print a
and b [DON T REMEMBER IF conditon is m==n or m<n]
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.
There were 3 questions based on an argument given... questions were to
find out which statement in the objectives given could strengthen the argument o
r
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 re
ach
the top?
a. 31
5.
b.33
c.37
d.40 (ans: 37)
A number when multiplied by 7/18 instead of 7/8 and got the result 770
less than
the actual result , find the
original number?
6.
The volume and the radius of both cone and sphere are equal , then find
the ratio of height of the cone to the diameter of the sphere?
7.
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.
Find their profits.
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.
An amount of 64 Rs has to become 125 in 3 years in compound interest ,
find the rate of interest?
10.
A similar to the above problem find the time(rate of interest is given)
11.
The prime no., which is greater than 6 when divide by 6 will always gives
the remainder ans: 1 or 5
12.
Length of a rectangle is increased by 50% and breadth is decreased by
15.
A two digit number is 4 times to its sum of digits , when 9 is added to the
number, the digits will get reversed.
Then what is that number? Ans: 12
16.
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
u/2 kmph, what is his average speed.
18.
A cistern will be filled in 9 hrs, but becoz of an outlet it is filled in 10 hrs
,
if the cistern is filled, then how much
time the outlet takes to empty the cistern.
19.
In a right angled triangle ABC angle B = 90 , BM is the median to AC ,
then AB2 + BC2 (in terms of BM)
20.
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
products in ---- days.
22.
The compound interest for first and second years is 200 and 220 on a
certain amount. Find the sum.
23.
Marked price of a commodity is 35% above the cost price. If he gives a
discount of 15%, how much he gains on the deal.
24.
5 mangoes + 4 oranges = 7 mangoes + 1 orange. Find the ratio of mango
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
sufficient for 500men?
27.
If 8men 8hrs per day works for 8days get 45/- then how many men
required if the work is 5hrs per day
for10days they get 60/-?
28.
A person sold an item at a profit of 12% .If he sold it at a loss of 12% then
he would get Rs.6/- less. What is the
cost price?
29.
(1 /((3/4-2/5 )/(2/3+4/5))) * ((2 /((4/3-2/5 )/(5/3+6/5))) (Numbers
different)
30.
Avg age of X number of adults in a class is 30yrs. If 12 new adults with
avg age of 32 joined with them then the
avg age increases by one. Find X?
31.
A sphere of radius 2cms is dropped into a cylinder of radius 4 cms
containing water upto certain level. The raise
in the water level is (not sure)
32.
Find the average of reciprocals of x and y :
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)
Odd man out
stem b) fruits c) flowers d) tree e) root
2.
9, --, 15, 18, 21, 24
3.
seating arrangement(2 puzzles)
4.
books arrangement (puzzle)
5.
If 3rd day of a month is Monday. Then what is the 5th day after 21st of
that month?
6.
blood relation
Sample Test Paper
1.
Maximum numbers that can be formed using all the 4 digits 6 4 8 1 without
repetition and which is divisible by 9.( ans none)
2.
Find the number of sides of a regular convex polygon whose angle is
40degrees.
3.
a+b+c=0, then roots of ax^2+bx+c=0 is1.imag 2.real 3.coincidental 4.zero
4.
Difference b/w the compound interest and simple interest for Rs.2500 for 2
years is given-----. find the rate of interest.
5.
There was one more question on S.I and C.I
6.
The minimum number by which 60 is to be multiplied to generate
a square.ans 15
7.
A monkey climbs 6 mts and falls 3mts in alternate minutes.Then time taken
to climb a tree 60metres high?
a. 35 b.37 c.32 d.34 (think the answer is 37)
8.
(This was the second last question) A bucket contains z drops. and it leaks x
drops in t secs.then the time required to empty the bucket(in minutes)?
9.
6 pipes fill or empty the cistern. find the number of emptying pipes iff it take
s
18hrs to fill and 18 hrs to empty.... (don t remember the question exactly)
10.
The largest no: which is a factor of 1080 and 729
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
minutes later then speed is??
13.
There are 6 keys and 6 locks. then number of combinations to be tried out to
get the actual solution
a. 5^6 b.6^5 (don t remember the rest)
14.
Choosing 2 people out of 10 in how many combinations can a particular
person(some name) be always
included....
15.
From 6 white balls and 7 black balls probability that 2 balls drawn at random
are of the same color?
16.
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
is 20 then actual number of pearls?
ans. 40
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
ahead of actual time on (not sure)
4 p.m. friday. when will it show the correct time?
20.
Boat moves upstream in 6 hrs and covers the same distance downstream in
5 hrs. then speed of a raft
floating?(accuracy of question not sure)
21.
(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
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)
23.
There was one more question on volume and surface area.....
24.
1 Rs, 50 ps , 25 ps coins are in the ratio ---------, then the number of 50 ps
coins if they sum to ------Rs.(similar question in R.S.Agarwal)
25.
There was one more question on coins i.e. abt getting a change of 10ps and
25 coins for ------Rs.(how many possible combinations or so possible)
26.
x/y+y/x=40/21(don t remember the exact value, believe this is the one) find
x and ythere were 2 questions on train and one was like:
27.
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
-----boys and -----women. How much time would bethe question)
29.
30.
There was one question on triangle
A figure was given a square with four corners shaded and asked to find the
area of the shaded portion.... ie area of square-area of the regular octagon....
.
Texas Instruments
1.
If the date is written as MMDDYYYY, and then 10022001, ie)oct 2 2001 is a
palindrome. which is the immediate palindrome before that date.
2.
There r 2 trains travelling at 100 MPH each. there is a 200Mile tunnel. the trai
ns travel
in opposite directions. when the trains enter, a supersonic bee starts at the tu
nnel,
touches the other train, comes back touches the first train, turns again and tou
ches
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 k
now
if i am sure with this one. sorry. i didnt do this.
5.
In a train Art is found dead. hours later 4 people are queried,
Blonde says i am innocent, i didnt speak with Art
White says i am innocent, Blonde spoke with Art
Old says i am innocent, the brunette killed Art
Brunette says i am innocent, one of the men killed Art
The inspector says simple, 4 true statements, 4 false statements.
I know the killer, very simple!!!
Find out the killer. (only one is involved.)
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, bu
t I
cant find it out. The other says. . simple. ok, my eldest daughter has just star
ted 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 shar
ed
accordingly. else the senior is killed and the next senior most is asked to pres
ent a
plan and so on .note, all the guys r very clever and very greedy and dont want t
o 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(revers
e
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 3
0
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 th
e
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 touc
hed the
trains. phew lot of calculation.. and got the ans as 1000.But when i rechecked i
t 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 apar
t. so
in 60 minutes the gain is 55 mins for the min hand. to be together it has to gai
n
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.
Sorry no time to see this and dont remember it correctly.
1.
A topic on Gandhiji s Salt Satyagrah Movement Four sentences were
given and you have to arrange them
to make a paragraph.
Ans. CABD (Check it out).
2.
What can t be changed by the user program (Four choices were there).
Ans. Memory Map (Check it out).
3.
In which layer ROUTING is performed ?
Ans. Network Layer
4.
What is the output of the following code snippet
main()
{
printf(5+"Fascimile");
}
Ans. mile
5.
What is the output
Int count=10,sum=0,*temp;
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.
Which one has no L-Value
[i] a[i]
[ii] i
[iii] 2 [iv] *(a+i) Ans . [iii]
7.
In threaded binary for which traversal orders unused left and right links
are used?
8.
Which is false for binary tree?
[i] Any node should have two children.
[ii]
[iii] At fourth level the number of node should be less than 16.
9.
Which is true for binary search ?
[i] Traversal scheme
[ii]
[iii]Greedy algorithm
[iv] Divide and conquer algorithm
Ans. [iv]
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.
If DELHI is coded as CCIDD then how BOMBAY will be coded?
12.
Opposite meaning of SPUR.
13.
Opposite of HARBINGER .
Ans. Follower
14.
Opposite meaning of PROTRUSION.
15.
Opposite meaning of RESTIVENESS.
Ans.Docility.
16.
Find the odd one in a given analogy Ans. Mundane.
17.
Find the analogy : SURPRISE : EXCLAMATION
Ans. Dismay:groan.
18.
Find the analogy : Plateau : Taxonomy.
19.
Question from congestion control topic:
Ans: source quench.
20.
Question from kernel mode:
Ans:Disable Interrupts.
21.
which one is a page replacement algorithim.
[i]fifo
[ii]
[iii]Least recently used.
[iv]All of above.
22.
Using two numbers And interchanging + and * there was a question.
Ans: (iii)(some expression=22).
23.
For each hour an watch is going slow by 30 seconds.Now time is
8a.m.What will be the actual time at 8p.m.
Ans:ii)7:54.
24.
Question regarding while loop. Ans:(iii).
25.
Alphabetical order L,M,(cant remember) Ans:F.
26.
One puzzle:(I cant exactly remember this question giving brief idea of this
question)there were four guys A,B,C,D. the older
and younger relation is given . U have to find the age of the A
Ans: 7 years(check it out).
27.
Fallacy question: six sentences are given.
[i]
[ii]
[iii]
[iv] Ans: [i].
28.
Nine people six floor. Conditions are given.(This was a very long
paragraph).Peoples named like I,J,K,L,M,N,O,P,Q.
Ans:i)J.
29.
A question regarding node.
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.
Point out error:(about a flowers garden)
ans:(I can t remember the options).answer will be "among on another".
Sample test Paper
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
a
d) 101
e) 137
2.
A boy was asked to multiply a certain number by 53. He multiplied it by
35 and got his answer less than the correct one by 1206. Find the number to be
multiplied.
a) 37
b) 67
a
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 th
e
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.
A trader marks his goods up by 50% and declares two successive
discounts of 20% each. What is his overall gain?
a) 10% gain b) 4% gain c) 4% loss (A) d) 10% loss e) No loss No gain
5.
Age problems -3 , find mothers age,fathers age etc.
6.
Statistics Problems(probability) as A-this much , B-This Much, A n Bthis much and A u B - ?
7.
Angle Problems which deals with triangle - 3 problems.
Section III - Logical reasoning - 30 qns in 30 mins.
8.
Tower of Hanoi Problem 9.
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??
A
B
C
Y
0
0
0
1
0
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
1
1
1
1
1
Ans. (A )(B )(AB) , where stands for complement.
Q. A works thrice as much as B. If A takes 60 days less than B to do a work then
find the
number of days it would take to complete the work if both work together?
Ans. 22days
Q. How many 1 s are there in the binary form of 8*1024 + 3*64 + 3
Ans. 4
Q. In a digital circuit which was to implement (A B) + (A)XOR(B), the designer i
mplements (A
B) (A)XOR(B)
What is the probability of error in it ?
Q. A boy has Rs 2. He wins or loses Re 1 at a time If he wins he gets Re 1 and i
f he loses the
game he loses Re 1.He can loose only 5 times. He is out of the game if he earns
Rs 5. Find the
number of ways in which this is possible?
Ans. 16
Q. If there are 1024*1280 pixels on a screen and each pixel can have around 16 m
illion 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 sai
d. 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(a
pprox)
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 45d
egrees 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 daught
er 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 d
ifference 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 i
s the greatest of
these integers?
Quantitative
21. jen , ken and len devided
3/5 of what
she took. Ken took 40% of the
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
22. Elian types twice as fast
n 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
. 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
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
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
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
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)
B)
C)
D)
given
given
given
given
Column A is greater
Column B is greater
Both are equal
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 PAPE
R
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 remai
ning 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 Satur
day. 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 sam
e
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 stor
ed..
(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 an
d 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.
If 2x-y=4 then 6x-3y=?
(a)15
(b)12 (c)18 (d)10 Ans. (b)
If x=y=2z and xyz=256 then what is the value of x? (a)12 (b)8
(d)6 Ans. (b)
(c)16
3. (1/10)18 - (1/10)20 = ?
(a) 99/1020
(b) 99/10
(c) 0.9 (d) none of these
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 ta
nk
(a) 17 1/7 mins
(a)
(b) 20 mins
(c) 8 mins
(d) none of these
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?
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 s
lips 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 b
rand
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 b
ridge
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
(c) II and III only
Ans. (a)
(d) III and IV 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)
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 y
ear,
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 t
he
information given:
I. Most students in previous years felt that the increases were justified becaus
e 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
C.I and II only D.I and III only
Ans.D
41.
42. After months of talent searching for an administrative assistant to the
president of the college the field of applicants has been narrowed down to 5--A,
B, C, D, E .It was announced that the finalist would be chosen after a series of
all-day group personal interviews were held.The examining committee agreed
upon the following procedure
I.The interviews will be held once a week
II.3 candidates will appear at any all-day interview session
III.Each candidate will appear at least once
IV.If it becomes necessary to call applicants for additonal interviews, no more
1
such applicant should be asked to appear the next week
V.Because of a detail in the written applications,it was agreed that whenever
candidate B appears, A should also be present.
VI.Because of travel difficulties it was agreed that C will appear for only 1
interview.
1.
.At the first interview the following candidates appear
A,B,D.Which of the follwing combinations can be called for the
interview to be held next week.
A.BCD
B.CDEC.ABED.ABC
Ans.B
2.
Which of the following is a possible sequence of combinations
for interviews in 2 successive weeks
A.ABC;BDE B.ABD;ABE C.ADE;ABC D.BDE;ACD
Ans.C
3. If A ,B and D appear for the interview and D is called for additional
interview the following week,which 2 candidates may be asked to appear
with D?
I. A II B III.C IV.E
A.I and II
only
Ans.D
B.I and III only
C.II and III only
D.III and IV
4. Which of the following correctly state(s) the procedure followed by the
search committee
I.After the second interview all applicants have appeared at least once
II.The committee sees each applicant a second time
III.If a third session,it is possible for all applicants to appear at least twic
e
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
son
stated.
had upon
that no
VI No M s are G s
45. There are six steps that lead from the first to the second floor. No two peo
ple can
be on the same step
Mr. A is two steps below Mr. C
Mr. B is a step next to Mr. D
Only one step is vacant ( No one standing on that step )
Denote the first step by step 1 and second step by step 2 etc.
1. If Mr. A is on the first step, Which of the following is true?
(a) Mr. B is on the second step
(b) Mr. C is on the fourth step.
(c) A person Mr. E, could be on the third step (d) Mr. D is on higher step
than Mr. C.
Ans: (d)
2. If Mr. E was on the third step & Mr. B was on a higher step than Mr. E
which step must be vacant
(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)
5. Which of the following is false
i. B&D can be both on odd-numbered steps in one configuration
ii. In a particular configuration A and C must either both an odd numbered
steps or both an even-numbered steps
iii. A person E can be on a step next to the vacant step.
(a) i only
(c)
(b) ii only
(c) iii only
(d) both i and iii
Ans:
46. Six swimmers A, B, C, D, E, F compete in a race. The outcome is as follows.
i. B does not win.
ii. Only two swimmers separate E & D
iii. A is behind D & E
iv. B is ahead of E , with one swimmer intervening
v. F is a head of D
1. Who stood fifth in the race ?
(a) A (b) B (c) C (d) D (e) E
Ans: (e)
2. . How many swimmers seperate A and F ?
(a) 1 (b) 2 (c) 3 (d) 4 (e) cannot be determined
Ans: (d)
3. The swimmer between C & E is
(a) none
(b) F (c) D (d) B (e) A Ans: (a)
4. If the end of the race, swimmer D is disqualified by the Judges then
swimmer B finishes in which place
(a) 1 (b) 2 (c) 3 (d) 4 (e) 5
Ans: (b)
47. Five houses lettered A,B,C,D, & E are built in a row next to each other. The
houses are lined up in the order A,B,C,D, & E. Each of the five houses has a
colored chimney. The roof and chimney of each housemust be painted as follows.
i. The roof must be painted either green,red ,or yellow.
ii. The chimney must be painted either white, black, or red.
iii. No house may have the same color chimney as the color of roof.
iv. No house may use any of the same colors that the every next house uses.
v. House E has a green roof.
vi. House B has a red roof and a black chimney
made?
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 trai
n,
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 thi
s
fashion?
5.
5 ppl, A, B, C, D, E are supposed 2 cover a certain distance from their car to a
house. There is only 1 umbrela dat can b shared by 2 ppl at a time.
It takes 1min for A 2 cover the dist, B->2 min, C->5min, D->10min, E->15min.
Wot is d quickest poss time 4 the entire grp 2 get into the house?
6.
Mr.X belongs 2 a grp of 8 ppl including himself. In d meeting, nobody shakes
hands with the same person more than once but everyone shakes hands with at leas
t
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.
In a contest 3 probs, A, B, C r given
->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 othe
r
prob.
->Of all stud who solved just 1 prob, half didn t solve A
NAGARRO 9th FEBRUARY AT NEW DELHI
Hello friends, Navneet here from Meerut.I gave Nagarro paper.
APTITUDE:
1.sinx+sin2x=1,then cos2x+xos4x=?
a)1
b)3
c)0
d)none
2.cos 30d/sin 10d + cos 59d/sin 31d =?
a)1
b)2
c)3
d)4
3. x pow (a+b) . x pow(b+c). x pow (c+a)/ (x pow(a). x pow(b) . x pow(c)) pow(2)
=?
a)0
b)1
c)8
d) 5
4) length of minute hand is 5.4 cm, area covered by this in 10 min is ?
a)50.97
b)57.23
c)55.45
d)59.14
h use
bikes and 1/9th use cycle. Find the number of students at present.
Two trains of equal length when moving in opposite direction takes 5 sec. to cro
ss
each other completely and when moving in same direction takes 15 sec. Find the r
atio
of their speed.
In a battle of tanks.60% lose their commanders, 70% lose their guns and 80% lose
their tracks. Find the number of tanks that lose all.
In a race if A beat B by 15m, A beat C by 25m and in a race between B and C, B b
eat
C by 15m.Find the length of the tracks.
Price of sugar decreases by Rs.2 per kg. If a man is able to buy 4 kg more for R
s.16,
then what was the original price of sugar.
3 black cows, 4 white cows and 2 brown cows give same amount of milk as given by
4
black, 5 white and 1 black cows. Find the type of cow which gives least milk.
If a composite number is multiplied by a composite number the result is a :
A problem of men, work and time.
A bird is flying between two trains approaching each othertype of problem.
Four boys were playing a game of cards .At the end each of them had Rs.400. They
lost in the reverse order of their alphabets. Five question were their.
SATYAM PAPER - 16 JAN 2006 - HYDERABAD
Hi,
Here is SATYAM paper held on 16th jan 2006 at hyderabad.
I think the cutoff is 8.
5.A large cube is painted red on its outer surface and cut into 27 cubes by 6 st
raight 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)
7.a) 46636,3125,256,27, --, 1 Ans:4=2^2
b) 3,10,7,8,--,12,9,16 ans:11(may be)
8.A motorcyclist says "I drove with the sped of ten miles/hr while going.while r
eturning
traffic was less so I drove the same didstance with 15miles/hr." what is his ave
rage
speed.
Ans: 12miles/hr.
9. There are 2 systems And B.14 degrees in A equal to 36 in B.133 in A equivalen
t to
87.at what temperature both shoe equal readings.
Ans:52.5 (A=7/3B-70.)
10.5 persons A,B,C,D,E go for a meeting B and C are talking in English, when D j
oined
they used Spanish which was the only common language.A and E can speak only
Italian.and some conditions. one person can speak 5 languages, another 4 languag
es,one
3,one 2 and one can only speak one language. 4 QUESTIONS BASED ON THIS.
(Paper Submitted By : Kiranmai)
SATYAM PATTERN ON 5th AUGUST 2006 AT ST. THOMAS COLLEGE OF ENGG, KOLKATA
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) t
he 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 clas
ses.
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 businessma
n.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 sa
lary 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
rience
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 en
sure lasting
world peace.
3.From public sector to privatization as in the U.K., is the right answer for In
dias 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 prese
nt
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 har
m 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 misus
ed.
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
5. How system level services in EJBs are managed ? And tell about Deployment Des
criptor ?
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 so
me 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 ou
r 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 ro
bot etc.
Basically they r not interested in ur answering, they r checking ur confidence l
evels.
So solve them nicely on the paper as u can or explain them verbally how r u solv
ing 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, whic
h
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
es 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 confid
ence.
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 tw
o 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 als
o.
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 numbe
r 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 n
umbers which
aren?t present.
6. Given a string,find the first un-repeated character in it? Give some test cas
es
7. You are given a dictionary of all valid words. You have the following 3 opera
tions permitted
on a word: delete a character, insert a character, replace a character. Now give
n two words word1 and word2 - find the minimum number of steps required to conve
rt 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 numbe
r 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 preferr
ed 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 regu
lar
expression.
12. Given n red balls and m blue balls and some containers, how would you distri
bute those
balls among the containers such that the probability of picking a red ball is ma
ximized,
assuming that the user randomly chooses a container and then randomly picks a ba
ll from
that.
13. Find the second largest element in an array with minimum no of comparisons a
nd 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 adja
cent in the
array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should retur
n 15 (sum of
3, 5 and 7)
18. You are given some denominations of coins in an array (int denom[])and infin
ite supply of
all of them. Given an amount (int amount), find the minimum number of coins requ
ired 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 numb
er 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 pro
cedure.
Placement procedure cosisted of three rounds.
Interview1:
He is very soft-spoken and one of my friend told me that this guy had brutally d
estroyed him.
So I was terribly nervous. I usually am confident but in that room, I was stamme
ring! Finally,
it turned out that he wasn t that brutal after all. Moral of the story: Stay con
fident 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 g
et into
the industry via internships, industry-funded projects right from second year, s
econd
sem. I said that I was fully sure that I didn t want to do MS anytime soon.
3.
He asked me to tell him about my favorite project.
Answer : I told him about the web-browser that I had developed for cell-phones.
I
thought that was the only project which was closest to what Adobe was working on
.
He appeared satisfied with my answers.
4.
He then looked at my grades. He commented that my lowest grade - B- was in Digit
al
Image Processing. I just looked at him like a doofus thinking of what to say. Bu
t he
quickly added, don t worry, it happens. So people, be fully prepared to explai
n any
anomalous grades. I was prepared with the explanation of the W in the my gradesh
eet but not of the B- in DIP. I know that this is really stupid considering that
I was
interviewing with Adobe. Don t make this mistake.
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? Not
e
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 tho
ught
that I had understood, but I hadn t. I started off explaining it but got stuck i
n the
middle. He sternly told me to read it up again. One solution that I could tell h
im, and
which I had written in the test was this:
Use two variables - min and second min. Initialize them by comparing the first t
wo
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 compa
risons
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 paral
lel to
the x-axis passing through this point. Start with odd parity. Change parity of r
ay each
time it intersects an edge of the polygon (consider special case of when the lin
e passes
through a vertex of the polygon. Change parity only if it passes through a verte
x
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 projec
t
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 wh
ich
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 usi
ng
OCR.. he didn t appear fully satisfied. I think he was looking for edge-detectio
n, 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 fav
orite subject.
I said that it was Programming. (He laughed at that)
1.
Which are the four storage classes in C.
Answer : static, extern, register, auto
2.
Given a program:
int i;
int main()
{
int j;
int *k = (int *) malloc (sizeof(int));
...
}
Where are each of these variables stored?
Answer : I started off correctly, but he was able to confuse me. He brought in s
hared
libraries, static libraries fundas into the discussion. We had a discussion for
about
twenty-minutes on this. Finally, he was happy with one of my answers because I h
ad
deduced which policy made sense and answered correctly. He said that out of all
the
people interviewed so far (I was second last), nobody had been able to answer al
l of
these questions correctly
3.
Question on polymorphisms.
this is easy - get it from any C++ book. He tried to confuse me again, but this
time I
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 o
ver 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. Th
e
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, taki
ng 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 shadin
g 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, w
e
came up with an array of pointers to 26-trees (each node of the tree has 26 chil
dren).
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 poin
ter
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, whe
n we
started off that I didn t know much about this subject as I had done it a long t
ime ago.
He was very annoyed at that, apparently because a lot of people before me had sa
id
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 we
re
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 s
till 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.
change section2.
The results of written test are given to college after 20 days.
2nd Round:
Friends this is an unpredictable round. Actually we have said that we have a GRO
UP
DISSCUSSION round but after going there we have conducted JAM session. We can ta
lk
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 t
hem.
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 bee
n 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 t
echnical.
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 r
eady 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
1) Difference between Server.Transfer and Response.Redirect?
2) Directives in .NET? - (Page directive & Error Directive)
3) Explain about Web.Config file?
4) How many web.config file can be used with an application?
5) Page level tracing and application level tracing?
6) Explain about ViewState and what will happen if view state is false?
7) Explain about Dataview?
8) What is Ispostback?
9) Use of datagrid and its major properties?
10) How dataset differ from data reader?
11) How to implement polymorphism in .NET?
12) Explain about the use of Ctype and its Syntax?
13) What is shared functions?
14) How to create xml using Dataset?
15) Explain about Global Assembly cache?
I had questions like following:1. What is the difference between a class and obj
ect?
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....e
tc
Coming to the 3rd section. This consists of 20 questions. He had given all C pro
grams
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.
To reverse a string using a recursive function, without swapping or using an
extra memory.
2.
To reverse a linked list as above. given a macro like
#define MAX(A,B) {to return that is larger}
what will MAX(i++,j),MAX(i,j++) return.
3.
Difference between Macro and ordinary definition. Difference between Class
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 str
ucture,
suppose a queue is to be added like int, long etc., where shall the changes be - lex
or yacc or where.
5.
what is a Real Time OS.Name some.
6.
Describe VRTX in few words.
7.
How does the scheduler know the time how it should be scheduled
8.
sockets, TLI, streams.. and much about project
9.
What is deadlock? How do you avoid it?
10.
What is a semaphore?
11.
What exactly happens after each system call in sockets, both at the client and
at the server.
12.
What is the difference between widget & gadget in XWindows?
13.
Tell about strtok & strstr functions.
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 singl
e statement,
both statements or neither of those statements....refer Verbal & Non-Verbal RS A
garwal.....
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 passi
ng 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...... Stri
ctly refer
Quantitative Aptitude- R S Agarwal..
qns 36-45 5 marks each Programming section.....to my surprise C or BASIC languag
es wer
not ther...insted they created a new language with new keywords....new looping f
unctions
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 descripti
on 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 h
ad flow
charts....but it was not ther in mine.. Ther isnt any book to refer for this sec
tion.....as it may
change always...
English
20 questions wer ther....100% simple......i ll say that its a lifeline while wri
ting the
aptitude....score 20/20 for that...
Tech Interview
I wont say that its a normal one.....questions will be strictly based on the res
ume......and if ur
not strong in wat in wrote in resume...then its game over.....ther will be C que
stions.....but
dont expect normal C interview questions.....questions will be something we hadn
t
imagined...he started the process by a friendly talk....and simple questions lik
e enter strings in
all the ways.....
These sections in paper contains 80 questions and duration was 80 mins.we have t
o do
each section in 20 minutes. We coudnt move to next section before 20 mins. and o
nce a
section is completed we coudn t go back.there was sectional cutoff. some of the
sample
questions which i remember are --
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 com
e 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 d
at 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 traditi
onal 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?
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.
How do you declare an array of N pointers to functions returning pointers to
functions returning pointers to characters?
be answered in at least
7.
Ans: The first part of this question can
three ways:
Build the declaration up incrementally, using typedefs:
typedef char *pc;
/* pointer to char */
typedef pc fpc();
/* function returning pointer to char */
typedef fpc *pfpc;
/* pointer to above */
typedef pfpc fpfpc();
typedef fpfpc *pfpfpc;
pfpfpc a[N];
8.
/* 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
returning pointer to char
pointer to function
char *(*(*a[])())()
cdecl can also explain complicated declarations, help with casts, and indicate w
hich
set of parentheses the arguments
one
go in (for complicated function definitions, like the
above). Any good book on C should explain how to read these complicated
C
declarations "inside out" to understand them ("declaration mimics use"). The poi
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()
Ans : It allocates and frees memory after use/after getting
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 s
ure
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 loo
p " 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 poi
nter to an int.
b. declares mist as a pointer to a function that has two void * arguments and re
turns an int.
c. declares mist as a function that takes two void * arguments and returns an in
t.
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 t
he 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 followi
ng 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 m
in.)
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 vi
ew 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 e
xtra 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 c
orrect 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 man
y 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 ----------
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 a
rray.
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 o
r 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 - expa
lin.
13.some thing abt makeall
14. write abt TCP,IP,ICMP
Enter Your Comments
TEXAS INSTRUMENTS PAPER - 08 SEP 2005
Test Paper 01
1. Can we declare a static function as virtual?
Ans: No. The virtual function mechanism is used on the specific object that dete
rmines which
virtual function to call. Since the static functions are not any way related to
objects, they
cannot be declared as virtual.
2. Can user-defined object be declared as static data member of another class?
Ans: Yes. The following code shows how to initialize a user-defined object.
#include
class test
{
int i ;
public :
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. W
e
can use the same convention to initialize the object by calling multiple-argumen
t 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 iden
tifier in the
statement friend void fun ( sample, test ) ; of the class test. This is so becau
se 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 defi
nition 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 over
loaded
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 op
erators the
objects of the _withassign classes can be copied. The istream, ostream, and iost
ream classes
are made uncopyable by making their overloaded copy constructor and assignment o
perators
private.
5. How do I write my
Ans: This is shown in
#include
ostream& myhex
{
o.setf ( ios::hex)
return o ;
}
void main( )
own zero-argument manipulator that should work same as hex?
following program.
( ostream &o )
;
{
cout << endl << myhex << 2000 ;
}
6.We all know that a const variable needs to be initialized at the time of decla
ration. 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 th
is program p is
declared as const char* which means that value stored at p will be constant an
d 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 namesp
ace?
Ans: There are two ways in which we can refer to a name of class or function tha
t is defined
within a namespace: Using scope resolution operator through the using keyword. T
his 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 othe
r 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 w
e 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 parame
ters of the
overloaded operator function we would end up using the binary operator incorrect
ly. 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 cre
ating objects
outside the class. A static member function called create( ) is used to create a
n 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 p
tr is not NULL,
then the same address is returned. Thus, in main( ) on execution of the first st
atement 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 proper
ties 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 valu
e into data,
whereas fun2( ) returns the current value of data. To set these functions as pro
perties 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] tha
t can be
further expanded as *( base address + 1 ). This gives us a value in zeroth row a
nd first
column.
13. What are formatting flags in ios class?
Ans: The ios class contains formatting flags that help users to format the strea
m data.
Formatting flags are a set of enum definitions. There are two types of formattin
g flags:
On/Off flags
Flags that work in-group
The On/Off flags are turned on using the setf( ) function and are turned off usi
ng the unsetf( )
function. To set the On/Off flags, the one argument setf( ) function is used. Th
e flags working
in groups are set through the two-argument setf( ) function. For example, to lef
t justify a
year = d.year ;
}
// an overloaded assignment operator
date operator = ( date d )
{
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( ) ;
}
18. When should I use unitbuf flag?
Ans: The unit buffering (unitbuf) flag should be turned on when we want to ensur
e that each
character is output as soon as it is inserted into an output stream. The same ca
n be done
using unbuffered output but unit buffering provides a better performance than th
e 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 comp
arison to
the formatting flags of the ios class. When manipulators are used, the formattin
g 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 direct
ly 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 ma
nipulators.
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( ) m
ember function
of ostream class or tellg( ) member function of istream class. These functions r
eturn (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 p
lace in the file.
The get pointer specifies the byte number in the file from where the next readin
g should take
place.
23. What do the nocreate and noreplace flag ensure when they are used for openin
g a file?
Ans: nocreate and noreplace are file-opening modes. A bit in the ios class defin
es 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 writ
e gets
appended to the existing file. When ate flag is set we can start reading or writ
ing 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 i
s no provision
in cin to check the array bounds. If the array overflows, it may be dangerous. T
his 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( ) take
s 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 delimite
r (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 w
hich can
extract values of all basic types. We can extract even a string using this opera
tor.
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 i
ts 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 i
s 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 a
llows 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-m
emory
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 fr
om memory
and strstream class derived from iostream is used for memory objects that do bot
h input and
output. Ans: When we want to retrieve the streams of bytes from memory we can us
e
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 termin
ated character
array str. The statement s >> age >> salary >> name ; extracts the age, salary a
nd 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 t
he override
function of the derived class gets called?
Ans: While building an object of a derived class first the constructor of the ba
se 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 cl
ass 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 in
itialise 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 t
hat 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), wh
ich would
disappear as soon as the function returns, thereby creating a situation of dangl
ing 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 con
structor.
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
ether the
call matches the declaration (in case of function template) and whether the obje
ct definition
matches class declaration (in case of class template). Since the function templa
te and the
class template definitions are not found, the compiler leaves it to the linker t
o restore this.
However, during linking, linker doesn t find the matching definitions for the fu
nction call or a
matching definition for object creation. In short the expanded versions of templ
ates are not
found in the object library. Hence the linker reports error.
{
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 (int4, float-4, char-1) under Windows and 7 bytes (int-2, float-4, c
har-1) under DOS. Second
output is again the same because u1 is an object of the class user. Finally thre
e garbage
values are printed out because i, f and c are not initialized anywhere in the pr
ogram.
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 e
xample, 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 t
he class
declaration.
#pragma pack ( 1 )
38. Write a program that will convert an integer pointer to an integer and viceversa.
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
{
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 functio
n 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 clas
s. 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 u
sing 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 refe
rence 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 l
ong 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 proper
ly organize and
store the data. Stacks, linked lists, arrays are examples of containers. Followi
ng 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 c
alled. 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:
1]. The following variable is available in file1.c
static int average_float;
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<std
io.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;
* a 6 mtrs wide road is laid around a garden. rad area is 564sq mtsr. if the len
gth 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 di
gits
-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.
d) Rapid Application Development Tool
i = 0;
j = 0;
for(j=1;j<10;j++)
i=i+1;
In the (generic) code segment above what will be the value of the variable i at
completion ?
a) 0
b) 1
c) 3
4.
d) 9
Which of the following statements is true when a derivation
ual and
non-virtual instance of a base class ?
a) Each derived class object has base objects only from the
b) Each base class object has derived objects only from the
c) Each derived class object has base objects only from the
5.
d) Each derived class object has a base object from the virtual instance and a b
ase
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 op
erator
?
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) int *ptr = (int *)calloc(10*sizeof(int));
What function will read a specified number of elements from a file ?
a) fread()
b) readfile()
c) fileread()
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 alloc
ated
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 arra
y 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.
Is IT sector made a difference to rural India.
Does the world need army?
are there stars in the sky?
capital punishment should be avoided .
Is India really shining ?
Ramco
Directions: Each of the following question has a question and two statements lab
elled as (i)
and (ii). Use the data/information given in (i) and (ii) to decide whether the d
ata 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 mor
e
data.
1.
What will be the population of city X in 1991?
1) Population of the city has 55% annual growth rate
2) in 1991,the population of city X was 8 million
Ans:C
2.
Was it Rani s birthday yesterday?
1)Lata spends Rs.100 on Rani s birthday
2)Lata spent Rs.100 yesterdayAns: E
3.
Is 3*5 or is 4*6 greater ?
1) a*b =b*a
2) a*b is the remainder of ab%(a+b)
Ans:B
4.
Will the graph X-Y pass through the origin?
1) x proportional to the Y
2)increment in y per units rise of x is fixed.
Ans:E
5.
What was the value of the machine 2 years ago?
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);
}
Ans. Compilation error giving it cannot be an modifiable
27. Find the output for the following C program
#include<stdio.h>
main()
lvalue
{
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);
}
Sasken Exam 20th Jul 2004
Pattern : C(10 Qs) + Aptitude(10 Qs) + Discpline based[CS/EC](10 Qs)
Duration : 1 Hr
C questions
-----------1.Consider the following declaration:-
char const *p = d ;
Which of the following is not a permissible operation
(a) *p++
(b) ++p
(c) (*p)++
(d) All
2.What is the output of the following code:void print_arr(float **p)
{
printf(" 0 %f 1 %f 2 %f\n",p[0][0],p[0][1],p[0][2]);
}
void main()
{
float arr[2][3] = {{0,1,2},{3,4,5}};
float **fl_arr;
fl_arr = (float *)arr;
print_arr(fl_arr);
fl_arr++;
print_arr(fl_arr);
}
(a)
(d)segmentation fault
3.What is the output of the following code:#define putchar (c) printf("%c",c)
void main()
{
char s= c ;
putchar (s);
}
(a) c
(b) 99
(c) Compilation error
(d) Execution error
4.What is the output of the following code:void main()
{
printf("%d",printf("ABC\\"));
}
(a) ABC\\
(b) 1
(c) ABC\4
(d) ABC\3
5.What is the output of the following code:-
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 i
t 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 chos
en.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 th
ree
(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 numbe
r 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 proba
blity.There are
m stations to send pckts.4 option was given.It was a mathematical kind of questi
on 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 o
ne.
Tech interview questions
-----------------------They will ask about the project.They will ask general que
stions 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.
MOTOROLA PSGTECH 2003
There were basically 3 papers -software ,DSP, Semiconductor software paper (20 q
uestions 45
minutes) concentrate more on data structures 10 questions from data structures a
nd 10 from
C++ and data structures10 questions were in the fill in the blank format and 10
questions
were multiple choice questions.
1.
bubble sorting is
a)two stage sorting
b).....
c)....
d)none of the above
2.
.c++ supports
a)
b)
c)
d)
3.
pass
pass
pass
pass
by
by
by
by
value only
name
pointer
value and by reference
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.
What does this return
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, r
ecursive
computation of factorial with
blanks in the case of some variables.we have to fill it out
18.
for eg; for palindrome
palindrome(char * inputstring)
{
int len=strlen ( ?);
int start= ?;
end =inputstring + ?-?;
for(; ?<end && ?==?;++ ?,--?);
return(?==?); }
we have to replace the question marks(?) with corresponding variables
19.
.linked list reversal
Linked (Link *h)
{
Link *temp,*r=0,*y=h;
while(y!= ?) (ans:Null)
{
temp = ?;(ans:y->next)
some code here with similar fill in type
}
20.
fill in the blanks type question involving recursive factorial computation
Enter Your CommentsNCR Placement Paper and Sample Paper
The pattern for the company NCR Teradata in HYD.
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 pers
on. 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 s
ub-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.How many liters of water must be added to 30 liters of alcohol to make a
solution thatis 25%
ans:120
2.How much is 3/7 larger than 20 percent of 2
ans;1/35
3.xyz=120,then which of the following cannot be a value of y
ans:0
4.a number of subsets of a set s is 128, then s has
ans:7
5. xsqrt(0.09)=3 , then x equals
ans:
6.perimeter of rectangle is s and the other sideis x, then the other side
ans:(s-2x)/2
7.solution of system of equations y-z=0,x+8y=4,3x+4y=7z is
ans:x=1,y=1,z=1
}
what is the output?
6.
Declare a pointer to a function that takes a char pointer
as argument and returns a void pointer.
7.
How do we open a binary file in Read/Write mode in C?
C++
8.
class A
{
public:
A()
{
}
~A();
};
class derived:public A
{
derived();
};
what is wrong with this type of declaration?
9.
what do you mean by exception handling?
10.
What are "pure virtual" functions?
11.
What is the difference between member functions and
static member functions?
12.
What is the4 difference between delete[] and delete?
13.
Question on Copy constructor.
14.
What are namespaces?
15.
One question on namespace.
16.
19.
Difference between function overloading and function overriding.
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 in
crease 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
When compiled from command line what are linking options?
2
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)
3
Fiber optic backbone is in which OSI layer?
4
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?
5
If we carry out operation (-3)+(-6),then which of the what will be the value of
carry
and sign flag?
6
void abc(int a[])
{
int k=0;int j=50;
while(k<j)
{
if(a[i]>a[j])
k++;
else
j--;
}
How many times the loop will occur?
7
Integrate e^(x^-2)dx , with limits -infinity to +infinity?What is the final valu
e?
8
Let p be a 16 bit number.The 2 s complement of p will be represented by?
9
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
Let there be a set of 3 numbers.Then number of groups possible?
11
A question on some technique used in DA-converter?
12
Which data structure to use for fastest search?
13
A binary tree contains 1024 elements.What is maximum number of comparisons
needed to search an
element?
14
s=1-1/4+1/16-1/32...... What is the value of S?(Ans = 0.8 Hint Its a GP)
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
In Java can a variable be initilised inside a loop?
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)
Sample Technical Paper
1.
Point out error, if any, in the following program
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.
Point out the error, if any, in the following
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.
In
a=
a)
c)
4.
What would be the output of the following program?
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.
What is the output of the following program?
#define SQR(x) (x*x)
main()
{
int a,b=3;
a= SQR(b+2);
printf("%d",a);
}
a) 25
6.
b) 11 c) error d) garbage value
In which line of the following, an error would be
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
What is the type of the variable b in the following declaration?
#define FLOATPTR float*
FLOATPTR a,b;
a) float b) float pointer c) int d) int pointer
8.
In the following code;
#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 charact
er
in the file.
c) The name of the file. d) None of the above.
9.
We should not read after a write to a file without an intervening call to
fflush(), fseek() or rewind() < TRUE/FALSE>
Ans. True
10.
If the program (myprog) is run from the command line as myprog 1 2 3 ,
What would be the output?
main(int argc, char *argv[])
{
int i;
for(i=0;i<argc;i++)
printf("%s",argv[i]);
}
a) 1 2 3
b) C:\MYPROG.EXE 1 2 3
c) MYP d) None of the above
11.
If the following program (myprog) is run from the command line as myprog
1 2 3, What would be the output?
main(int argc, char *argv[])
{
int i,j=0;
for(i=0;i<argc;i++)
j=j+ atoi(argv[i]);
printf("%d",j);
}
a) 1 2 3
12.
b) 6 c) error d) "123"
If the following program (myprog) is run from the command line as myprog
monday tuesday wednesday thursday,
What would be the output?
main(int argc, char *argv[])
{
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.
In the following code, is p2 an integer or an integer pointer?
typedef int* ptr
ptr p1,p2;
Ans. Integer pointer
14.
Point out the error in the following program
main()
{
const int x;
x=128;
printf("%d",x);
}
Ans. x should have been initialized where it is declared.
15.
What would be the output of the following program?
main()
{
int y=128;
const int x=y;
printf("%d",x);
}
a) 128 b) Garbage value c) Error d) 0
16.
What is the difference between the following
declarations?
const char *s;
char const *s;
Ans. No difference
17.
What would be the output of the following program?
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
friday tuesday sunday,
What would be the output?
main(int argc, char*argv[])
{
printf("%c",**++argv);
}
a) m
19.
b) f c) myprog d) friday
If the following program (myprog) is run from the command line as myprog
friday tuesday sunday,
What would be the
output?
main(int argc, char *argv[])
{
printf("%c",*++argv[1]);
}
a) r b) f c) m d) y
20.
If the following program (myprog) is run from the command line as myprog
friday tuesday sunday,
What would be the output?
main(int argc, char *argv[])
{
while(sizeofargv)
printf("%s",argv[--sizeofargv]);
}
a) myprog friday tuesday sunday b) myprog friday tuesday
c) sunday tuesday friday myprog d) sunday tuesday friday
21.
Point out the error in the following program
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.
In the following program how would you print 50 using p?
main()
{
int a[]={10, 20, 30, 40, 50};
char *p;
p= (char*) a;
}
Ans. printf("\n%d",*((int*)p+4));
23.
Would the following program compile?
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.
According to ANSI specifications which is the correct way of declaring main()
when it receives command line arguments?
a) main(int argc, char *argv[]) b) main(argc,argv) int argc; char *argv[];
c) main() {int argc; char *argv[]; } d) None of the above
25.
What error would the following function give on compilation?
f(int a, int b)
{
int a;
a=20;
return a;
}
a) missing parenthesis in the return statement b) The function should be declare
d
31.
What is the output of the following program?
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.
1.
2.
3.
4.
5.
Printf("%d%d",i++,i++);
Compiler Dependent
4 4
4 3
3 4
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
1. Where the root dir should be located
1. Anywhere on System disk
2. Anywhere on Disk
3.
4.
5.
2.
3.
4.
5.
D.
In Main memory
At a fixed location on Disk
At fixed location on System Disk
Problem on Concurrency
Problem on Round Robin Algorithm
General
1. If x is odd, in which of the following y must be
even
1. X+Y=5
2. 2(X+Y)=7
3. 2X + Y =6
4. X+2Y=7
5.
2. 1000! How many digits? What is the most significant
and Least significant
digit
3.
4.
5.
E.
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
1. If table A has m rows and table B has n rows then
how many rows will the
following query return
SELECT A.A1,B.B1
FROM A,B
WHERE A.A3=B.B3
1. <=(m*n)
2. m*n
3. <=(m+n)
4. >=(m+n) and <=(m*n)
5. m+n
2. A Query optimizer optimizes according to which of
the following criteria
1. Execution time
2. Disk access
3. CPU usage
4. Communication time
5. None
3. Which of the following is not a characteristic of a
transaction
1. Atomicity
2. Consistency
3. Normalization
4. Isolation
5. Durability
4. The def. of Foreign key is there to support
1. Referential integrity
2. Constraint
3.
4.
5. None
5. Problem
Process A Process B
WRITELOCK(X) WRITELOCK(Y)
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
(This consisted of Two programs to be solved in 1
hour.)
A sparse matrix is a matrix in which a node with val=0 is not represented. The w
hole
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 a
nd
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 rela
ted 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.
one questions on ^ and & operations...which r repeated in a loop.
2.
one question on normal type conversion of float.
3.
macro question....#ifdefine.....#endif.
4.
one question on a union which has 2 fields....one is defined..value of the other
?
5.
what is the best data structure for NOTEPAD
6.
7.
" " " " WORD PROCESSOR.
ONE QUESTION ON CONTINUOUS LEFT AND RIGHT SHIFTING TWO CONTENTS OF
ARRAYS...AND & THEM...
8.
work out on conversions and bitwise operators
9.
one question on a program correction....it s answer is line 7.
Geodesic s on-campus Recruitment @ Salem !!!
CRITERIA:
(i) The Criteria given to us is to have an Aggregate of 70% with no pendingarrea
rs.
(ii) Only CSE,ECE and IT Departments were allowed to attend.
SELECTION:
Total attended - 196
Cleared Written - 11
SELECTION PROCEDURE:
The Preplacement Talk started for us by 9.00am in the morning. There were some i
nteresting
facts in it,so be sure to listen it. After the PPT,we are sent for the written t
est.
WRITTEN TEST:
Unlike other companies, Geodesic had a very different written pattern. There wer
e 2 Sections,
1) Algorithms and Logical Thinking
2) C Questions
1) Algorithms and Logical Thinking:
There were three questions in this sections.Each carries 5 marks. Ur Solution to
the problem
must be an optimal one.
q1) There was a plane which should satisfy the condt 0<B
</B
q2) There are m rows and n columns, these have choclates in it. 2 users play
a game
in turn, If player breaks a chocolate in a cell ,he can go either row wise or co
lumn wise and
the next player should play his turn.The one who is finally left with one square
is the loser. If
player1 doesn t break a small chocolate and gives his turn for player2,what is t
he optimal
stragedy for winning? What are the positions of losing??
q3) There were n people seated in a circle,every second person in the circle i
s
eliminated,again the circle is enclosed and the procedure is repeated. Describe
this as a
function and n should be decipted as a binary number.U should corelate n with
f(n).Find f(10)
and f(20)?
(Hint: This problem is a variant of jospheus problem)
2) C Questions
Here there were 7 questions which were splitted as 1,2 and 3 mark problems!!
q1) A Train is of length n meters which has individual compartments of size 1
or 2
meters in length. In how many possible ways that the length of the train is acco
mmodated
with 1 or 2m compartments. Write a function Train (n) which computes this? (3m)
q2) Give the Structure definition of link list and how will u detect a loop in t
he linklist?
Write a Separate function for that? (3m)
q3) Perform addition of two numbers without using + operator? (2m)
q4)
Consider the code snippet,
int n[] = {0014,010,2,4,8,12};
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 whi
ch
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, th
en 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 cant b opened
5. a for loop ques does not print array...condition not satisfied
a[10]={10,14,18,20}
6.another for loop ques prints correctly...condition satisfied
7.main()
{
function(x,y);
}
void function(int *x,int *y)
{
.....
}
the function does not work.
8.A d();
a j;
it works well
Fundamentals of Programming
1.The programming language that was designed for specifying algorithm
Address
ASCII
ALGOL
None of these options
2. _____ contains the addresses of all the records according to the contents of
the field
designed as the record key.
Index<------ans
Subscript
Array
File
3. _________ symbol is used for Processing of data.
Oval
Parallelogram<------ans
Rectangle
Diamond
4. __________ is the analysis tool used for planning program logic
Protocol
None of these options
PROLOG
Pseudocode
5. Machine language has two part format the first part is__________ and the seco
nd part is
__________
OPCODE,OPERAND<------ans
OPERAND,OPCODE
DATA CODE,OPERAND
OPERAND,CODEOP
6. Language Primarily used for internet-based applications
ADA
C++
JAVA;------ans
FORTRAN
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 Proc
essor
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 program
s 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 progr
ams 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 beco
mes =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);
}
}
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 */
This is pcsb paper.
1. #include <STDIO.H
* 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("%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)
{
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.
It is not "exact" Question; But the given Answers is:
a) PASS1 PASS2
b) PASS1 FAIL1
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.
define cond(a) a=e && a<=0
main()
{
char s== R ;
if( cond(s) )
printf("UPPER CASE");
else
printf("LOWER CASE");
}
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++?
Ans: increments Address
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
(D) None of these
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 Tuesda
y,
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
The difference of a number and its square is 870.What is the number?
(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
Which of the following points are collinear?
(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 inste
ad
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
(A) Consistent
13.
(B) Repeatable
To group users based on common access permission one should use
(A) User Groups
14.
(B) Roles
(C) Grants
(D) None of the above
PL/SQL uses which of the following
(A) No Binding
15.
(C) Atomic (D) Isolated
(B) Early Binding
(C) Late Binding
(D) Deferred Binding
Which of the constraint can be defined at the table level as well as at the
column level
(A) Unique
16.
(B) Not Null
(C) Check
(D) All the above
To change the default date format in a SQLPLUS Session you have to
(A)
Set the new format in the DATE_FORMAT key in the windows Registry.
(B)
Alter session to set NLS_DATE-FORMAT.
(C)
Change the Config.ora File for the date base.
(D)
Change the User Profile USER-DATE-FORMAT.
17.
Which of the following is not necessarily an advantages of using a package
rather than independent stored procedure in data base.
(A) Better performance.
(B) Optimized memory usage.
(C) Simplified Security implementation.
18.
(D) Encapsulation.
Integrity constrains are not checked at the time of
(A) DCL Statements.
(B) DML Statements.
(C) DDL Statements.
(D) It is checked all the above cases.
19.
Roll Back segment is not used in case of a
(A) DCL Statements. (B) DML Statements.
(C) DDL Statements.
(D) all of the
above.
20.
An Arc relationship is applicable when
(A) One child table has multiple parent relation, but for anyone instance of a c
hild
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.
What is true about the following C functions?
(A) Need not return any value.
(B) Should always return an integer.
(C) Should always return a float.
(D) Should always return more than one
value.
22.
enum number { a=-1, b=4, c,d,e,} what is the value of e?
(A) 7
23.
(B) 4
(C) 5
(D) 3
Which of the following about automatic variables within a function is correct?
(A) Its type must be declared before using the variable.
(C) They are not initialized to zero.
24.
(B) They are local.
(D) They are global.
....}
While(x==0);
26.
(D) While(1) {....}
Output of the following program is
main()
{
int i=0;
for(i=0;i<20;i++)
{
switch(i)
{
case 0:
i+=5;
case 1:
i+=2;
case 5:
i+=5;
default:
i+=4;
break;
}
}
}
(A) 5,9,13,17
27.
(B) 12,17,22
(C) 16,21
(D) syntax error.
What does the following function print?
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
What will be the result of the following program?
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
(B) Answer is: Second String
(C) Run time Error/Core Dump
29.
(D) None of these
Consider the following program
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
Given a piece of code
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}
Cadance Sample Question Paper
Technical
1.
In assembler relocatable code generated by ...!!??
{
t = v % u;
v = u;
u = t;
}
find the time complexity of the above program.
3.
x is passed by reference, y passed by value.
x = 3, y = 2;
foo(x, y)
var integer x, y;
{
x = x + 2;
y = y + 3;
}
main()
{
x = 5;
y = 5;
foo(x, y);
print (x, y);
}
output of the above pseudo code.
4.
How many flip flops you require for modulo 19 counter.
5.
ring counter s initial state is 01000. after how many clock cylces will it retur
n to the
initial state.
6.
some boolesn expression of the form x y z
the
simplified expression
7.
given 6 bit mantissa in 2s complement form and 4 bit exponent is in excess-4 for
m 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.
log( X**3 + Y**3) where x=3/4 y=1/4
log(3) , log(7) & log(2) is given ...
ans:-0.385
2.
last question of paper ..
sum of money of A & B =Rs.10
diffrence of A + B = Rs.9
ans : 50 pesa
3.
one paper is equlely folded 50 times... what is new thikness of paper..
ans: 2**50
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 f
rom the
top, and a fly is ont he middle of the opposite wall 1 feet from the bottom. wha
t 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 re
ach
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 wit
hout
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 dete
rmines
which virtual function to call. Since the static functions are not any way relat
ed to
objects, they cannot be declared as virtual.
2.
Can user-defined object be declared as static data member of another class?
Ans: Yes. The following code shows how to initialize a user-defined object.
#include
class test
{
int i ;
public :
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. W
e 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 iden
tifier
in the statement friend void fun ( sample, test ) ; of the class test. This is s
o 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 clas
s
sample before the definition of class test. The following statement is the forwa
rd
reference of class sample. Forward referencing is generally required when we mak
e a
class or a function as a friend.
4.
The istream_withassign class has been derived from the istream class and overloa
ded
assignment operator has been added to it. The _withassign classes are much like
their
base classes except that they include overloaded assignment operators. Using the
se
operators the objects of the _withassign classes can be copied. The istream, ost
ream,
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 declara
tion.
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 th
is
program p is declared as const char* which means that value stored at p will b
e
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 tha
t 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 othe
r 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 parame
ters
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.
How do I carry out conversion of one object of user-defined type to another?
Ans: To perform conversion from one user-defined type to another we need to prov
ide
conversion function. Following program demonstrates how to provide such conversi
on
function.
class circle
{
private :
int radius ;
public:
circle ( int r = 0 )
{
radius = r ;
}
};
class rectangle
{
private :
int length, breadth ;
public :
rectangle( int l, int b )
{
length = l ;
breadth = b ;
}
operator circle( )
{
return circle ( length ) ;
}
};
void main( )
{
rectangle r ( 20, 10 ) ;
circle c;
c=r;
}
Here, when the statement c = r ; is executed the compiler searches for an overlo
aded
assignment operator in the class circle which accepts the object of type rectang
le.
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 cl
ass.
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 conv
erts
to. Here the type of the object is circle and hence the name of the operator fun
ction 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 o
bjects
outside the class. A static member function called create( ) is used to create a
n object
of the class. In this function the condition is checked whether or not ptr is NU
LL, if it is
then an object is created dynamically and its address collected in ptr is return
ed. 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 tim
es
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 proper
ties 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 co
ut <<
e[0][1] ; would get converted into a call to the overloaded [ ] function as e.op
erator[ ]
( 0 ). 0 would get collected in i. The function would return a[i] that represent
s 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 strea
m data.
Formatting flags are a set of enum definitions. There are two types of formattin
g flags:
On/Off flags
Flags that work in-group
The On/Off flags are turned on using the setf( ) function and are turned off usi
ng the
unsetf( ) function. To set the On/Off flags, the one argument setf( ) function i
s used.
The flags working in groups are set through the two-argument setf( ) function. F
or
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 fla
g 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 behav
ior. The
solution is to call setf( ) as setf ( ios::hex, ios::basefield ). This call firs
t 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 f
unction
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( ) ;
}
18. When should I use unitbuf flag?
Ans: The unit buffering (unitbuf) flag should be turned on when we want to ensur
e
that each character is output as soon as it is inserted into an output stream. T
he same
can be done using unbuffered output but unit buffering provides a better perform
ance
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 direct
ly insert
the formatting instructions into the stream. We can create user-defined manipula
tors
but setf( ) function uses data members of ios class only. The flags put on throu
gh 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( ) m
ember
function of ostream class or tellg( ) member function of istream class. These fu
nctions
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 ta
ke
place in the file. The get pointer specifies the byte number in the file from wh
ere the
next reading should take place.
23. What do the nocreate and noreplace flag ensure when they are used for openin
g a
file?
Ans: nocreate and noreplace are file-opening modes. A bit in the ios class defin
es
these modes. The flag nocreate ensures that the file must exist before opening i
t. On
the other hand the flag noreplace ensures that while opening a file for output i
t 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 i
s 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( ) take
s only
first five characters and ignores rest of the characters. Some more variations o
f 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 delimite
r (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 termin
ated
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 t
he override
function of the derived class gets called?
Ans: While building an object of a derived class first the constructor of the ba
se 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 de
rived
class. Thus, if we call a virtual function when an object is still immature, obv
iously, 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 in
itialise 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 t
hat 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 cre
ating
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 th
e
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 prin
ts 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 allo
cated 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 objec
t
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 woul
d not
get called. Hence p holds a garbage address. Now if the memory is deal located u
sing
delete, the destructor would get called where we have tried to release the memor
y
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 c
reates an
object from a class template can get compiled. This is because the compiler mere
ly
checks whether the call matches the declaration (in case of function template) a
nd
whether the object definition matches class declaration (in case of class templa
te).
Since the function template and the class template definitions are not found, th
e
compiler leaves it to the linker to restore this. However, during linking, linke
r 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 th
e 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 funct
ion
getcount( ) is an inspector because it simply counts the number of elements in t
he
stack without changing the stack.
36. Namespaces:
The C++ language provides a single global namespace. This can cause problems wit
h
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 pr
ogram; 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 i
n the
program. It is possible to use the same name in separate namespaces without conf
lict
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 initiali
zed
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 efficienc
y. For
example, under DOS, the object would be aligned on a 2-byte boundary. As a resul
t,
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 t
he object
would be reported as 12 bytes. To force the alignment on a 1-byte boundary, writ
e the
following statement before the class declaration.
#pragma pack ( 1 )
38. Write a program that will convert an integer pointer to an integer and viceversa.
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-co
nst
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 functio
n 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 clas
s. It
gives an error that sample is undeclared identifier. friend void fun ( sample, t
est ) ;
This is so because the class sample is defined below the class test and we are u
sing 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 a
re
very long or complex. The following syntax is used to give an alias to a namespa
ce.
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 proper
ly
organize and store the data. Stacks, linked lists, arrays are examples of contai
ners.
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 c
alled.
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 th
e data
members name, age and salary. The store( ) function is used to write an object t
o 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.Functi
on
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 bee
n
used to store data since it contains the address of the current object. The func
tion
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 construct
or?
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 ca
ll
itself to make this copy. This process would go on and on until the compiler run
s 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 ca
lled.
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 f
or new
operator?
Ans: No! The this pointer is never passed to the overloaded operator new() membe
r
function because this function gets called before the object is created. Hence t
here 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 foll
owing
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 t
ypes 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 alloca
te
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 point
er?
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 po
inter
pointing to an int.
50. How do I write a code to catch multiple types of exceptions in one single ca
tch 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 cl
ass
sample. While catching the exception instead of four different catch blocks we c
an 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 an
y
thrown exception should get caught in the same catch block. When the exception i
s
thrown from the fun4( ) control reaches the catch block, ignoring the rest of th
e 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 construct
or
doesn t have any return type. However, by throwing an exception we can pass valu
e
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 th
e string
error.
52. How do I define the member function of a template class, which has to be def
ined
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 sa
mple 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. He
nce the
compiler does not mangle them. The following code snippet shows how to declare s
uch
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 it
s 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 r
ules of
inheritance:
1. Each base class not specified virtual will have its own sub-object representi
ng 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 separat
e copy of
data. Hence, to access data from class der we will have to mention the class nam
e.
For example, d1::data or d2::data.
2. If we want that only one sub-object should exist we must use the concept of v
irtual
base class. The single object of this will represent every base class of given n
ame that
is specified to be virtual
class. After making d1 and d2 as virtual base class if we create an object of de
r 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 virtua
l
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 const
ructor or
destructor the virtual function of the base class would get called even if the o
bject
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 eleme
nts 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 statem
ent 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 stat
ement
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 passe
d
as a parameter not as a calling object there would be no error. Thus in such cas
es
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 st
ored
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 s
trcpy( )
and strcat( ). Instead of using these functions we can use more easy and clean w
ay 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 variab
les
having different types in this memory. Following program shows how to achieve th
is.
#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 an
d 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 fami
liar
name given by the operating system. The printer is generally connected to the fi
rst
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 obj
ect is
created in a try block and an exception is thrown after the object is created, t
hen 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, t
he
values of d2 would get assigned to d1. You can check this out by printing the va
lues of
d1.
79. If a class contains a virtual function a pointer called VPTR is created. Thi
s VPTR
becomes a part of every object of that class. The first two bytes (in DOS) are o
ccupied
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 ;
}
80. Exception Handling in C++
In C++ we can handle run-time errors generated by c++ classes by using three new
keywords: throw, catch, and try. We also have to create an exception class. If d
uring
the course of execution of a member function of
this class a run-time error occurs, then this member function informs the applic
ation
that an error has occurred. This process of informing is called throwing an ex
ception.
The following code shows how to deal with exception handling.
class sample
{
public :
class errorclass
{
};
void fun( )
{
if ( some error occurs )
throw errorclass( ) // throws exception
}
};
//application
void main( )
{
try
{
sample s ;
s.fun( ) ;
}
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. F
or
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 tha
t
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 t
his
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
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(
all
outfunc( ) we need a pointer to the outer class. To
racted
offset of the inner class s object (base address of
ss of
inner class s object) from address of inner class s
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 )
{
) -> in ) ;
) from inner::infunc(). To c
get the pointer we have subt
outer class s object - addre
object.
}
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 d
ata is
placed. For example, suppose we wish to read the contents of the boot sector int
o a
structure. For this the byte arrangement of the
structure elements must match the arrangement of various fields in the boot sect
or 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 #prag
ma
takes effect at the first structure or union declaration after the #pragma is se
en.
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 bounda
ry.
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 acce
ss to
some selective functions of the class. Following program shows how to achieve th
is:
#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 proce
ss
called name mangling. Name mangling applies a decorated name to the function. Th
e
mangled name includes tokens that identify the functions return type and the ty
pes of
its arguments.
class test
{
public :
void fun ( int a, char b ) ;
void fun ( char *c, float y ) ;
};
void main( )
{
test s1 ;
s1.fun ( 65, A ) ;
s1.fun ( "Anil", 5.5f ) ;
}
At the time of resolving the calls to fun( ) function the linker would not be ab
le to find
the definition of the overloaded function fun( ) and it would report an error. I
f you look
at these errors you will see the mangled names like, (?fun@test@@QAEXJJ@Z) and (
?
fun@test@@QAEXMM@Z). Note that different compilers may use different name
mangling schemes.
92. How would you call a C function from C++ code?
Ans: Using extern "C".
The function prototype must be preceded by extern "C". More than one C functions
can be grouped inside braces as shown below:
extern "C"
{
void f( ) ;
void f1( ) ;
}
// In cfunc.c
#include
void f( )
{
printf ( "in f( )" ) ;
}
// In func.cpp
#include
extern "C" void f( ) ;
void main( )
{
f( ) ;
}
Ensure that both .c and .cpp files are in the same project.
93. How to restrict the number of floating-point digits displayed ?
Ans: When we display floating-point values, we can use the setprecision manipula
tor
to specify the desired number of digits to the right of the decimal point.
For example,
cout << setprecision ( 3 ) << 12.34678 ;
This statement would give the output as 12.347.
{
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 operat
or
function is no longer a member function of the class. It is a friend of the clas
s sample.
Thus the statement s2 = s1 * 2 ; would not take the form s2.operator * ( 2 ). Th
is
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-co
nst
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 li
ke a
pointer when the operator -> ( ) is called. The following program illustrates th
is.
#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 obje
ct 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 ca
n 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 obj
ect,
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 runti
me error
would occur. This is because we cannot call delete on statically allocated objec
ts. 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 cl
ass 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.
Why in a copy constructor an object is collected in a reference to object as
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 t
he 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 stu
ck up in
an infinite loop.
101.
What is Early Binding and Dynamic Binding?
Ans: The term binding refers to the connection between a function call and the a
ctual
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 Bindin
g: If
which function is to be called is decided at run time it is called as late or dy
namic
binding. Dynamic binding is so called because the actual function called at runtime
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.
When can we use the function ostrstream::freeze( )?
Ans: While outputting data to memory in the in-memory formatting we need to crea
te
an object of the class ostrstream. The constructor of ostrstream receives the ad
dress
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 w
e
want. If it falls short of memory, it will allocate more memory. If it cannot, i
t may
even move the block of memory. When the object goes out of scope, the heap stora
ge
is automatically released. This is a more flexible approach if we do not know ho
w
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 can
not
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 charac
ters
to it. Adding characters to a frozen ostrstream results in undefined behavior. I
n
addition, the ostrstream is no longer responsible for cleaning up the storage. Y
ou 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.
Enter Your Comments
1. How many butes does an array A(1:8,-2:2,1:5) require for storage if each elem
ent 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
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
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
#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
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
#include<stdio.h>
main()
{
char s1[]="Ramco";
program
program
program
program
program
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.
if(fp == fopen(\"dfas\",\"r\") = = NULL), what is the value of fp
a. NULL
b. 0
c. 1
d. 0 or 1
2.
#define sqr(x) x*x, what is value of j if j == 2 * sqr(3 + 4)
3.
#define FILENAME(extension) test_##extension, how will it print
FILENAME(back)
a. test_back
b. test_#back
c. test_##back
d. ??
4.
char *p == \"hello world\"
p[0] == \ H\ , what will be printf(\"%s\", p);
a. Hello world
b. hello world
c. H
d. compile error
5.
int fun(), how do u define pointer to this function ??
6.
what is ment by int (* xyz)[13]
7.
what is true from
a. base call ferernece is compatible with child class
b. child class reference is compatible with base class
c. no reference to class
d. ??
8.
class b
{
}
class a
{
class b
friend
}
then
a. a
b. b
c. a
d. b
9.
what is ture
can access all
can access all
can access all
can access all
#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
ratio becomes 5:7 what is containr capacity ? 30, 48 , 84, none
11.
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.
DI question where hotels project are given and no of rooms in each
hotels , investment , project yr . and company name
were asked to find min cost per room is for which hotel , which avg cost per roo
m
etc.
14.
Avg of 6 no is 8 what 7 th no shud be added to make avg 10;
15.
difference of cube of a no and its square is a perfect square , what is the
no. -> 5
16.
diff of three consecutive nos square and the nos is 214; find the nos :
Interview Technical
17.
Write a minimal C++ program .
18.
(a) Talk about yourself
(b) What are your strengths.
(c) Where do you think you have to improve.
(d) Where do you see yourself after 5 years
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 tha
n a
20.
What is an OS ?
21.
What is a Data Structure ?
22.
It is a an abstract data type where some operations can be defined and
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.
What is Object Oriented Analysis and design.
25.
How do u communicate between object and class.
26.
What is the role Software in the real life in current scenario.
27.
28.
What is extranet, intranet, internet
HR interview..
29.
Ok, what do your friends call u???
30.
how many friends do u have???
31.
Do u talk with girls???
32.
How many girl friends do u have???
33.
whatz the difference of a girlfriend from a girl who is a friend???
34.
what do u do on sundays???
35.
Do u like hyderabad???
36.
whatz so special about it???
37.
what places have u got to visit in hyd...???
38.
how many of them have u gone to???
Adope placement paper
The test predominantly consists of algorithm questions and a lot of questions on
trees.
Some questions are:
C test:
Q1) linked list using recursion.
Q2) Find if a number is divisible my 3, without using %,/ or *. You can use atoi
().
Q3) 2 integers A and B are given, find the no of bits that need to be flipped in
A to get B. ( xor
a and b and count the number of bits)
Q4) Write a Rotate function for rotating elements in an array, using a reverse f
unction.
Q5) Given 2 sorted arrays A and B with duplicate elements, get C= A -B and does
not have
3.
Why doesn t the following statement work?
char str[ ] = "Hello" ;
strcat ( str, ! ) ;
Ans: The string function strcat( ) concatenates strings and not a character. The
basic
difference between a string and a character is that a string is a collection of
characters, represented by an array of characters whereas a character is a singl
e
character. To make the above statement work writes the statement as shown below:
strcat ( str, "!" ) ;
4.
How do I know how many elements an array can hold?
Ans: The amount of memory an array can consume depends on the data type of an
array. In DOS environment, the amount of memory an array can consume depends on
the current memory model (i.e. Tiny, Small, Large, Huge, etc.). In general an ar
ray
cannot consume more than 64 kb. Consider following program, which shows the
maximum number of elements an array of type int, float and char can have in case
of
Small memory model.
main( )
{
int i[32767] ;
float f[16383] ;
char s[65535] ;
}
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 seg
ment
and offset locations in memory. The following program illustrates use of this fu
nction.
In this program from VDU memory we have read characters and its attributes of th
e
first row. The information stored in file is then further read and displayed usi
ng 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.
How do I compare character data stored at two different memory locations?
Ans: Sometimes in a program we require to compare memory ranges containing
strings. In such a situation we can use functions like memcmp( ) or memicmp( ).
The
basic difference between two functions is that memcmp( ) does a case-sensitive
comparison whereas memicmp( ) ignores case of characters. Following program
illustrates the use of both the functions.
#include
main( )
{
char *arr1 = "Kicit" ;
char *arr2 = "kicitNagpur" ;
int c ;
c = memcmp ( arr1, arr2, sizeof ( arr1 ) ) ;
if ( c == 0 )
printf ( "\nStrings arr1 and arr2 compared using memcmp are identical" ) ;
else
printf ( "\nStrings arr1 and arr2 compared using memcmp are not identical"
);
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 object
s.
Using variable-size data objects saves very little space. Variable size data obj
ects
usually have some overhead. Manipulation of fixed-size data objects is usually f
aster
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 big
ger
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 objec
ts. 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.
The Spawnl( ) function...
DOS is a single tasking operating system, thus only one program runs at a time.
The
Spawnl( ) function provides us with the capability of starting the execution of
one
program from within another program. The first program is called the parent proc
ess
and the second program that gets called from within the first program is called
a child
process. Once the second program starts execution, the first is put on hold unti
l the
second program completes execution. The first program is then restarted. The
following program demonstrates use of spawnl( ) function.
/* Mult.c */
int main ( int argc, char* argv[ ] )
{
int a[3], i, ret ;
if ( argc < 3 || argc > 3 )
{
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 tu
rn 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_W
AIT
as the mode of execution, path of .exe file to run as child process, total num
ber 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 proc
ess has
completed its execution. This parameter needs to be passed as the default parame
ter
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.
Are the following two statements identical?
char str[6] = "Kicit" ;
char *str = "Kicit" ;
Ans: No! Arrays are not pointers. An array is a single, pre-allocated chunk of
contiguous elements (all of the same type), fixed in size and location. A pointe
r on the
other hand, is a reference to any data element (of a particular type) located an
ywhere.
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 block
s
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 t
wo
memory buffers compared are identical. If the value returned is greater than 0 t
hen it
indicates that the first buffer is bigger than the second one. The value less th
an 0
indicate that the first buffer is less than the second buffer. The following cod
e 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 curren
t 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 st
ored
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 t
he
termination of program. If atexit( ) is called for more than one function then t
he
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" );
}
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 t
he 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 oth
er place
within the file.
25. The sizeof( ) function doesn?t return the size of the block of memory pointe
d to by a
pointer. Why?
Ans: The sizeof( ) operator does not know that malloc( ) has been used to alloca
te 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 it
s
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 ) ;
}
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 informati
on
contained in environment. The function getenv( ) can be used when we want to acc
ess
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 re
turned
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 strfti
me( )
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 an
other 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. Henc
e we
cannot use sizeof operator, as it cannot get the size of the array declared in a
nother
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 ru
ntime?
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 ) ;
}
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. Follow
ing
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 sto
res 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 prog
ram
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 fo
r 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 ab
ove
are regarded as trees (not the binary trees), then they are same despite the fac
t that
they are drawn differently. Also, an empty binary tree can exist, but there is n
o 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 respecti
vely.
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 woul
d 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 a
nd
an int to store the exponent form. The function returns the mantissa part as a d
ouble
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 terminati
on?
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 type
def.
The main difference is that the second declaration is of a slightly more abstrac
t 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 t
o the
strings. Each pointer points to an environment variable from the list of environ
ment
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 bu
ffer
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 stri
ng, 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 speci
fic
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 stan
dard
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 _getd
rive( )
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 sam
e?
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-coordi
nate
of the current cursor position respectively. Both the functions return an intege
r value.
The value returned by wherex( ) is the horizontal position of cursor and the val
ue
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-delet
e
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 illustrat
es 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 calcula
tes 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 e
lapsed
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 byte
s
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 thro
ugh
TCC. The compiler options include : displaying specific warning messages, genera
ting
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 fl
ags 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 pr
oblem:
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 curre
nt cursor
position to the end of line. The delline() function deletes the entire line at t
he 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 shou
ld
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 ab
out it.
We have three pegs: the starting peg, sp, the auxiliary peg ap, and the ending p
eg,
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 m
oved
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 t
he
structure syntax which is declared but not terminated with the statement termina
tor,
the semicolon. The compiler would not give any error message for it, as it assum
es
that main( ) function have a return type of struct syntax and hence would succes
sfully
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 wr
iting 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, be
cause,
computer stores the numbers in binary form. The C compiler follows an IEEE stand
ard
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 tha
t
the "binary point" (the binary analog of the decimal point) in the mantissa alwa
ys lies
to the right of most significant nonzero digit. In binary representation, this m
eans 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 manti
ssa.
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 o
rder
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 b
it, a
mantissa and an exponent for representing the power of 2. The sign bit denotes t
he
sign of the number: a 0 represents a positive value and a 1 denotes a negative v
alue.
The mantissa is represented in binary. Converting the floating-point number to i
ts
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. T
his
ensures that the stored exponent is always positive. The value of the bias is 12
7 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 expone
nt- 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 be
low:
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 sor
ted.
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 constant
ly
being swapped back and forth between external and internal storage. In practical
situations, quick sort is often the fastest available because of its low overhea
d 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. Selectio
n sort is
recommended for small files when records are large and for reverse situation ins
ertion
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 ele
ments.
Radix sort : It is reasonably efficient if the number of digits in the keys is n
ot 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 expec
ted to
be a multiple of 512 bytes, when a file gets stored often part of the cluster re
mains
unoccupied. This space goes waste unless the file size grows to occupy these was
ted
bytes. The
following program finds out how much space is wasted for all files in all the di
rectories
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 post
fix
form, or, sometimes reverse Polish form or suffix form. In this context, it is c
ustomary
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 multiplica
tion is
done first, so we convert it first, obtaining first A + ( BCx ) and then ABCx+ i
n postfix
form. The prefix form of this expression is +A x BC. The prefix and postfix form
s are
not related by taking mirror images or other such simple transformation. Also al
l
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 h
ierarchy.
As a result all the functions that you declare within a program are visible to e
ach
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
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 ad
dress
of the if statement in the main function, to which setjmp will return. The setjm
p
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 ze
ro. 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 lon
gjmp
with two arguments: the first is the buffer that contains the context to which w
e will
return. When the stack reverts back to this saved state, and the return statemen
t 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 re
turn
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. Essentiall
y,
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, i
s
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 t
he
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 t
he
comparison and are labeled accordingly. When the algorithm terminates, we put ei
ther
F (for failure) or the location where the target is found at the end of the appr
opriate
branch, which we call a leaf, and draw as a square. Leaves are also sometimes ca
lled
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 espe
cially
simple.
78. Suppose we have a floating-point number with higher precision say 12.1264876
87 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 str
ing 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 p
rogram
so desires, it may in turn spawn children of its own, which then execute and ret
urn
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 ancest
ry our
program should first locate its PSP, extract the parent process ID from it and t
hen 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 old
psp,
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 b
een
used to eliminate the path present prior to the file name. Do not run the progra
m 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 al
ong 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 employ
ing
multiway branching, such as trees, B-trees , and hash tables, will usually be su
perior.
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 un
it will
often prove superior. B-trees, together with various generalization and extensio
ns, can
be usefully applied to many problems concerned with external information retriev
al.
80. Variably Dimensioned Arrays
While dealing with Scientific or Engineering problems one is often required to m
ake
use of multi-dimensioned array. However, when it comes to passing multidimension
al
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 i
nstance,
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 mor
e
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 situ
ations.
This can lead to a wastage of lot of precious memory in most cases. Another solu
tion
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 eac
h
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 followin
g
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, al
ong
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 st
andard C
texts. They are usually used when we want to store assorted information which ca
n 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 f
or
hobby, and four for scheme (with one value used for those who are not desirous o
f
availing any of the schemes). We need ten bits altogether, which means we can pa
ck
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 inst
ead 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 prim
e
numbers smaller than 100 requires only 13 bytes. Had we implemented the same log
ic
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 si
mple
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 stru
cture.
There are many methods of implementing a stack (array, linked list, etc.). Infor
mation
hiding teaches that users should be able to push and pop the stack s elements wi
thout
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 informa
tion
hiding, would first show a traditional implementation of the stack data structur
e 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 throughou
t
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 positi
onal
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 sor
ter.
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 uni
t 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 thousa
ndth
place.
During each pass, each number is taken in the order in which it appears in parti
tions
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 number
s 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 name
s
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 class
es,
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 nam
e, 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 wi
sh 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( ) wh
ich 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 rec
eives
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 s
ub-trees
of any node should be equal. But, due to random insertions and deletions perform
ed
on a binary search tree, it often turns out to be far from ideal. A close approx
imation
to an ideal binary search tree is achievable if it can be ensured that the diffe
rence
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 a
nd 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 i
ts
inventors who are Adelson-Veilskii and Landi. A node in an AVL tree have a new f
ield
to store the "balance factor" of a node which denotes the difference of height b
etween
the left and the right sub-trees of the tree rooted at that node. And it can ass
ume 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 th
e 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 limita
tion
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 eleme
nt 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 add
ress
or location of an element is obtained by computing some arithmetic function. Has
hing
is usually used in file management. The general idea is of using the key to dete
rmine
the address of a record. For this, a function fun( ) is applied to each key, cal
led the
hash function. Some of the popular hash functions are: Division method, Midsq
uare
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 method
s 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 appl
ied
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 fu
nction
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 addi
ng an
extra link field to each table position.
86. The following program demonstrates how to get input from the user in graphic
s 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 e
lapsed
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 old
est
element is deleted. It may be required to delete an element with the highest pri
ority in
the given set of values and not only the oldest or the newest one. A data struct
ure
that supports efficient insertions of a new element and deletions of elements wi
th the
highest priority is known as priority queue. There are two types of priority que
ues: an
ascending priority queue is a collection of items into which items can be insert
ed
arbitrarily and from which only the smallest item can be removed. A descending o
rder
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 ch
aracter.
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 ch
aracter
and a null string?
Ans: A null pointer is a pointer which doesn t point anywhere. A NULL macro is u
sed 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 wh
ich we
all can recognize intuitively. The natural method of representing matrices in me
mory
as two-dimensional arrays may not be suitable for sparse matrices. That is one m
ay
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 colum
n
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 th
at
above array is arranged in increasing order of the row number of non-zero elemen
ts.
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 byte
s at
the bottom of the data segment, followed by the Borland copyright notice "Borlan
d 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 th
is
pointer will overwrite the first zero byte in the data segment. At program termi
nation,
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 tr
uly be
null, but may be a wild pointer that references these key areas in the data segm
ent.
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 a
s 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 (eithe
r simple
operands or sub expressions). If an operator is unary, then only one of its subt
rees is
nonempty, the one on the left or right according as the operator is written on t
he 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( ), s
in( ) etc.
Others are written on the right, such as the factorial function ()!. If the oper
ator is
written on the left, then in the expression tree we take its left subtree as emp
ty. If it
appears on the right, then its right subtree will be empty. An example of an exp
ression
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 g
et the
remainder of floating point division by using a function fmod( ). The fmod( ) fu
nction
divides the two float numbers passed to it as parameters and returns the remaind
er 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 nu
mber?
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 w
hen 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 rect
ified 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 equivalen
t 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 keyboar
d?
Ans: Yes. Although we usually use scanf( ) function to receive a single word str
ing and
gets( ) to receive a multi-word string from keyboard we can also use scanf( ) fu
nction
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 ^ ch
aracter.
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.
How can I write a general-purpose swap without using templates?
Ans: Given below is the program which uses the stringizing preprocessor directiv
e ##
for building a general purpose swap macro which can swap two integers, two float
s,
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 ?
Ans : Heap is a chunk of memory. When in a program memory is allocated
dynamically, the C run-time library gets the memory from a collection of unused
memory called the heap. The heap resides in a program s data segment. Therefore,
the amount of heap space available to the program is fixed, and can vary from on
e
program to another.
102.
How to obtain a path of the given file?
Ans: The function searchpath( ) searches for the specified file in the subdirect
ories 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.
Can we get the process identification number of the current program?
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 pr
ogram
illustrates the use of this macro.
#include
#include
void main( )
{
printf ( "The process identification number of this program is %X\n",
getpid( ) ) ;
}
104.
How do I write a function that takes variable number of arguments?
Ans: The following program demonstrates this.
#include
#include
void main( )
{
int i = 10 ;
float f = 2.5 ;
char *str = "Hello!" ;
vfpf ( "%d %f %s\n", i, f, str ) ;
106.
How to use function strdup( ) in a program?
Ans : The string function strdup( ) copies the given string to a new location. T
he
function uses malloc( ) function to allocate space required for the duplicated s
tring. 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.
On including a file twice I get errors reporting redefinition of function.
How can I avoid duplicate inclusion?
Ans: Redefinition errors can be avoided by using the following macro definition.
Include this definition in the header file.
#if !defined filename_h
#define filename_h
/* function definitions */
#endif
Replace filename_h with the actual header file name. For example, if name of fil
e to be
included is goto.h then replace filename_h with goto_h .
108.
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.
global variables in different files are
a:at compiletime
b) loading time
c) linking time
d)execution time
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.
which one will over flow given two programs
2 prog 1: prog2:
main() main()
{{
int fact; int fact=0
long int x; for(i=1;i<=n;i++)
fact=factoral(x); fact=fact*i;
}}
int factorial(long int x)
{
if(x>1) return(x*factorial(x-1);
}
a) program 1;
b) program 2;
c) both 1 &2
d) none
}
5.
variables of fuction call are allocated in
a) registers and stack
b) registers and heap
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)
2.
simplication of some boolean expression which is simple. Boolean Expression is A
+A B.
Ans:A+B
3.
Given inorder sequence and preorder sequence and asked to find out postorder
sequence.
4.
Some question on value of a static variable.
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 c
arries
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 assoc
iative 4)something
Ans: c
7.
Fastest IPC mechanism is
a)shared memory b)pipes c)named pipes d)semaphores
Ans:c
8.
Some page references are given. You are asked to implement it with Least Frequen
tly
Used algorithm.
9.
Some diagram is given. Iam describinmg the diagram. A 2*1 MUX is given. The inpu
ts
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 i
mpedence
Z, is connected in series.
You are asked to find out the value of Z? Note that 2C & Zare connected in serie
s.
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 ci
rcuit. 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 wav
e
form) from A(first wave form).
4.
#define SUM(a,b) a+b
main()
{
a=2;
b=3;
x=SUM(a,b)*2;
printf("x=%d\n",x);
}
Ans:8.
5.
number(int i)
{
number++;
printf("%d\n",number);
}
main()
{
static int i=0;
number(i);
}
Ans: I don t know.
6.
Some circuit is given. I can t describe the circuit. There are
3 resistors,3 capacitors & one inverter.. The question is
What is the value of the frequency such that the circuit oscillates.
A)f=RC
B)f=sqrt(3)/(Pi*R*C)
C)f=1/(Pi*R*C)
D)something
Ans:I don t know the answer.
7.
7)Question on flipflop. So gothrough all flipflops.
8.
8)There are 5 questions on Nmos & Pmos circuits.
This Paper is for Computer Science Students. THis paper is very easy. You can
definitely do it in one hour.
1.
The fastest memory is
(i) DRAM, (ii) ROM, (iii) SRAM, (iv) Main memory
Ans : SRAM
2.
Programing exceptions are
(i) Asynchronous, (ii) Synchronous, (iii) None
Ans : Asynchronous
3.
DSP which architecture is used
(i) MIMD, (ii) SIMD, (iii) Nueman, (iv) Harvard Architecture
Ans : Harvard Architecture
4.
C prog. for searching for an element in linked list
5.
main()
{
unsigned char i;
int sum;
for(i=0; i<300; i++)
sum+ = i;
printf("\nSum = %d\n", sum);
}
Ans : infinite loop
6.
void fn(int *p)
{
static int val = 100;
p = &val;
}
main()
{
int i=10;
printf("i=%d\n", i);
fn(&i);
printf("i=%d\n", i);
}
Ans : i=10 i=10
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.
Implement OR gate function with 2*1 MUX
Ans : A ___________
--------|2*1 MUX |
B | |--------o/p
--------| |
| ----------|_______|C
B=C
9.
Implement 4*1 MUX with 2*1 MUXES
10. Swapping without using a temporary variables. (2 methods)
(i) x = x+y;
y = x-y;
x = x-y;
(ii) x = x^y;
y = x^y;
x = x^y;
11. Count no of 1 s in a word without using bit by bit. (This question carries m
ore marks.
It is not a multiple choice
question.
12. Code 1 :
for(i=0; i<1000; i++)
for(j=0; j<100; j++)
x = y;
Code 2 :
for(i=0; i<100; i++)
for(j=0; j<1000; j++)
x = y;
Which code will execute faster
(i) Code 1 and Code 2 are of same speed,
(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 b
e y = (AB)
+ AB ( indicates bar)
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 wha
t i have
mentioned in the resume and about the embedded protocols.
In HR, they asked....
1. Tell me about ur self
Complexity of hastable
7.
What is Cpu timeslice?
8.
Aquestion on DMA
C programming
9.
One pointer diff is given like this:
int *(*p[10])(char *)
Explain the variable assignment
10.
For the following C program
void fn(int *a, int *b)
{
int *t;
t=a;
a=b;
b=t;
}
main()
{
int a=2;
int b=3;
fn(&a,&b);
printf("%d,%d", a,b);
}
What is the output?
a) Error at runtime
b) Compilation error
c) 2 3
d) 3 2
11.
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
variable will belong to
a) Every instance of class template will share the same copy of static variable
b) Every instance of class template will have its own copy of static variable.
c) Compilation error
d) Don t remember.
2.
What is template specialization ???
a) define a new template class for a specific data type.
b)c)d)
3.
How we will overload operator *+= such that
obj1 *+= obj2;
implies that
obj1=obj1*(obj1+obj2);
four choice were there last option was d) it is not possible I checked that opti
on.
4.
In C++ what does the operator overloading means.
a)
b)
c)
d)
5.
a) exec
2.
How image of one process can be copied to new born process
a) fork
3.
How can you list all the files used by a particular process
4.
How do u create a link of file
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");
}
Nautix C,C++ & Unix paper:
C++ paper:
1.
cin is an
a.function
b.object
c.class.
2.
I con t remember the ques but the ans is Virtual base class
3.
what is the use of scope resolution operator?
4.
Advantage of inline function?
5.
copy constructor is
ans:call by value.
6.
ques on vertual destructor?
7.
template one ques?
8.
one q on container class?
C paper
1.
How will u terminate the statement?
ans: ;
2.
select the wrong one
a. a+=1;
b. a*=2;
c. a**=1;(ans)
d. a>>=1;
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.
pick ut the wrong one
#typedef some stuff
{
--};
5.
one q s on do loop?
6.
pick the odd one
a.
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.
How will u do version maintaince?
sccs(source code control system)
2.
awk $2
3.
A program in shell
script?
find the o/p.
4.
Which signal u can t catch?
ans:sigkill
5.
Core dump is due to ?
ans:segmentation fault.
6.
Echo "todays date is
o/p = ?
date ";
7.
process synchronisation is done by ?
ans:s phore
Test Paper :9
Paper Type
Posted By
: Technical - C & C++
: admin
Texa - Placement sample question papers
1. if a 5-stage pipe-line is flushed and then we have to execute 5 and 12
instructions respectively then no. of cycles will be
a. 5 and 12
b. 6 and 13
c. 9 and 16
d.none
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");
}
}
}
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
Zenith Placement Pattern
There were 3 sections
1st Round Aptitude Contains 5 Sections which were quiet easy to answer.
Technical Questions
Questions were based on C, C++, DBMS and Oracle (SQL*plus and PL/SQL).
2nd Round - Technical Interview Questions from C, C++, Datastructures, DBMS and
Oracle
(SQL*plus and PL/SQL) Questions on projects done earlier were asked.
3rd Round - HR Interview Go through common HR Interview Questions and be prepare
d.
Preference may be given to .NET or J2EE professionals Getting through Tech Inter
view is
crucial, afterwards it will be easy to get placed in Zenith. Good Luck...
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 ?
ing NEVER
give a negative answer for a Ques like
Are u willing to go Abroad?say yes. they will try to change ur mind.don t give u
p.
I was asked a ques like
out of the 350 who took the online test. 101 students cleared the psychometry te
st, out
which 50 were chosen after the interview and GD.
6 students from my branch including me made it through. I became a member of thi
s
group 6 months back, and its been very helpful. I think this group was very inst
rumental
in helping me get through the test.
By the information posted by freshers who had recently taken up the YAHOO test,
I had
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 exercise
s
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 b
lanks 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 follo
wing the
blank. This was very difficult.
QUANTITATIVE (40 min):
This was the easiest section. Solve all the old questions from the previous pape
rs 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 si
mple
having a 5 delegates speaking different languages and questions based on them. A
nother
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 g
iven is
very less.
After I submitted my answers, I got the psychometry test on the screen. 150 ques
tions
with yes no can t say as the answers. A lot of students were eliminated from thi
s 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 ro
ot is less than
that of those on the right of the root?
Do you know C?
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 be
cause 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 et
c)
The interview panel was very cool and friendly. They did not intimidate us. Ther
e 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. J
ust maintain the
eye contact and look at every member of the panel. A couple of times they even h
elped me
get to the answer.
After this we were grouped together in to batches of 10 and GD was conducted. Th
e 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 c
hance to
speak. Rest of the time I was listening to others and agreeing or disagreeing wi
th 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 b
ottom 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.
WIPRO PAPER ON 16th AUGUST AT HYDERABAD
Hi, I am Mohammed Asrar Ahmed, MCA Final year student of Muffakham Jah College
of Engineering and Technology, Hyderabad . WIPRO recently visited our campus for
RECRUITMENT on 16-aug-2007 , Thursday.
I am very much glad to inform you all that I have been recruited by WIPRO after
being
rejected by INFOSYS in the final round. After the rejection from INFOSYS I was r
eally
very much dejected. But my PARENTS, my brothers and last but not the least my
FACULTIES have helped me a lot to come out of that shock, and to keep faith in m
yself.
And the FRESHERS SITE has also helped me a lot to make it into WIPRO. I thank my
EVER MERCYFUL ALLAH for giving me strength to overcome from that dejection and
work hard for WIPRO. Finally I would like to advise you all that if you are not
selected
in one then do not suppose that ALLAH closed the door for you but believe that H
E
would open HUNDRED DOORS for your SUCCESS.
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 num
ber
( something like that)
4) two numbers are in the ratio 5:7 and their product is 5680 find the differenc
e 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 pas
sage.
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 crac
k 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
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 explanati
on.
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 y
ou 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 SECURITYAUTHENTICAT
ION PROTOCOLS.
Finally I was given an HR FORM. And greeted me and I came out. Filled the form a
nd
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 P
PT
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, SR
KR
college, RVR & JC college , SSIT college, SVH college.
After written test almost 400 students are selected for other interviews. Some s
tudents
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 hou
rs
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 fin
d 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 g
irl drinks 4
liters of water and each boy drinks 7 liters of water and the coach drinks 9 lit
ers 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 inclu
de the
Coach also.
3.a problem of trains
120m long train crosses the pole after 2 sec. Find how much time it takes to cro
ss 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 a
re 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 differe
nt 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 p
erson
said the false answer and the statements of the all persons given and ask for th
e 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 sh
op 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 s
ome
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 choi
ces 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 int
o 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 an
d 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 func
tion
overloading ,object, class ,and also templates in detail at lest 6 minit and I s
topped.
HR;U must be identify the situation of the other person he is ready to understan
d 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 Ga
mes & 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 conti
nue 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 identi
fied
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 y
our
Degree I replaid BSC Computer Science. When I am giving the details he write som
e 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 proportio
n )
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 underline
d 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 i
ncreased
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 t
he years in
which there was a dramatic increase in the
use of new chemicals in this country. Clearly, then those modern aids to industr
y have no
adverse effects on the general health of society. Which of the following is an a
ssumption
underlying the conclusion of the passage above?
A) The increase in life expectancy in the United States was paralleled by corres
ponding
increases in other countries.
B) The growth in the average life expectancy in the United States cannot be attr
ibuted 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 ind
ustry
from 1940-1979.
2. There is a family of six persons P,Q,R,S,T and U.They are Lawyer, Doctor, Tea
cher,
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-la
w 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 fi
rst
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
5. I) C is father of N but N is not son of C.
II) M is daughter of B and sister of P.
III) P is brother of N.
Which of the following is can not be inferred from the information given?
a) N is brother of P
b) B has three children c) N is younger to P d)B has
Ans: c
6. If the class marks in frequency distribution weights of students be
128,137,146,155,164,173&182kgs then,the first class boundary is
A)121.5
B)122.5
C)123.5
D)124.5
7. 9 laboures can complete the construction of a wall in 18 days.How many less d
ays
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 t
he 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 w
as 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 di
fference
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 S
aloni is
Soni s cousin.Ragini s mother is Rajani.Ramani is the sister-in-law of Reshma.Wh
o 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 respectivel
y.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, di
vide it
by 2.If the number is odd,multiply it by 3,and add 1 to the result.Apply the sam
e 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 no
t 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 rem
aining 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
b) prints 111 c) prints garbage value d) error
Ans: a
2. what is the o/p
main()
{
char a[3][4]={ abcd, efgh, ijkl };
putchar(**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 wi
ll 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
b) /bin and /usr/bin c) /etc d) /tmp
Ans: b
6. which of the following is not a data structure
a) stack b) queue
Ans: d
c) tree d) none
7. If we declare a variable with which of the following keyword so that its valu
e 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)
10. The principal author of c++ is
a) Dennis Ritchie b) James Goslings c) Bjarne Stroustrup d) Grady Booch
Ans: c
11. main()
{
int i=2;
if(0==fork())
{
i+=2;
}
else
{
wait(0);
printf(%d,i);
}
}
a) i+=2 is executed only by child b) i+=2 is executed only by parent c) d)
Ans: b (not confirm)
12. The EIDE is connected to which part in a computer
a) sound card b) video card c) hard disk d)none
13. In batch file which of the following is used to display messages to the user
(just like
comments) those are not commands i.e., they will not execute
a) # b) ;
c) REM
d) HIDE
Ans: c
14. If an exception is uncaught by exception handler then ( some choices are giv
en like)
a) it will call exit b) it will call abort c) it will return to main d)
(d).none of these.
8. For each f the words given below a contextual usage is provided. Pick the wor
k from
the alternatives given that is most INAPPROPRIATE in the given context . A
comprehensive approach to headache management combined with the rise of new drug
s ,
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 p
hrase 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 meani
ng 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 wo
rk from
the alternatives given that is most INAPPROPRIATE in the given context .she is h
ot 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 wi
th
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 o
f
winning each play.after peter has won 4 times and parul has won 3 times ,the gam
e is
interrupted and they have to stop playing and share money . Whats the most fair a
mount
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 o
ne-one
mapping between digits and letters . E.g if you substitute 9 for the letter H, n
o 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 und
er
solar power and 40 mph under regular power .The trip to the nearest town takes 4
5
min using both solar and regular power ,wheras the return trip takes 50 min usin
g only
solar power . on the trip to the town ,find the distance driven using regular po
wer?
(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. Si
nce
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 grou
ps
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 s
ame
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 nav
e 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 upstrea
m 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 av
erage
speed of the bus was 20 kmph and that of the entire journey was 24 kmph. What wa
s 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% ar
e in
finance. If 40% of the subscriber who are corporate managers in finance are mone
y
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,
(B)3
(C)4
(D)5.
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 met
hod 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)ext
ra
memory is required. (D)no extra memory is required.
38. which of the following option of the ls command prints non-graph character i
n 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 gener
al 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
It
consists
of
1.
Verbal
2.
aptitude
50
questions,
3
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 b
ased on
anatomy, analogy and arranging the sentences in order. Not even a single questio
n was on
active to passive voice, direct to indirect speech and paragraph reading. They g
ave 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 (UN
IX
Shell Programming). Others are from C, C++, OS, Data structures, ADA and Compute
r
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 informatio
n 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:
I
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 t
echnical
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 ple
ase 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, be
cause
of which today I have 6 projects in my hand, 5 completed projects and another on
e 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. Ev
en I took
the printout of the programs). I explained my projects by showing the source cod
e.
He: very good. You have done good projects. If I ask you to write programs it wi
ll 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.
a
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)
a
query.
He: (smiled) you told you are weak in SQL. How come you wrote the perfect answer
?
Me:
He:
(smiled)
(Thought
for
a
while)
asked
an
aptitude
question.
Me: (shocked! Aptitude question in tech round!) Calculated something and explain
ed. (I
think
I
was
wrong.
So
lost
confidence)
(Friends please remember if you dont know the answer dont sit simply. Try to expla
in
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
I
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 for
m 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 m
ay 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 roun
d. We
were happy). I phoned my brother & took his help to fill the form. 2 cool HRs wer
e there
to
help
us.
After finishing the form filling process, we came down. Within 5 minutes HR call
ed 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 pl
aced in a
reputed company like WIPRO. After getting placed I will be tension free and I ca
n
concentrate
on
my
studies.
So
I
will
sir.
He:
are
Me:
(Told
He:
(Impressed)
you
with
confidence)
ok.
You
sure?
yes
may
sir.
leave.
Me: (With a smile on face) thank you sir.
At 10:00 they announced the list of students who got placed.
Ooh! Me and my 2 friends made it. We got selected for WIPRO.
Friends please dont be sad if you are still trying. One or the other day will be
yours. Please keep faith on God and dont stop working. I know how we feel when we
fail to get through. But take each and every thing as a good experience. They ar
e the
opportunities to gain knowledge. Keep on trying till you succeed. All the best.
Finally I would like to convey my thanks to my parents, my brother and my best
friends. They are the biggest support for me to win this battle. Also thanks to
my lecturers
Yogesh, Purushottam and monish Kumar. Thank you everyone.
VIT PAPER ON 25/08/2006 AT CHENNAI
I attended test for VIT Consultancy today(25/8/2006)
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 hav
e 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 sid
e 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 2
0 % what is
the net change ?
4 % decrease
7. A question on sets. There are some 20 Basketball players & 30 Football player
s, and 25
cricket players. 1 of them plays all the three games. 8 of them plays atleast tw
o 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.
28.a logic ckt is given and asked to identify the configuration.
ans: XOR.
29.multi vibrator with nor gates is given
ans: astable multi sqr wave opt.
30.4 stage ripple counter with delay(f/f) 10msec. How much time it takes for a s
tate to
change. 4*10=40.
31 impedence of a p lel resonant circiut at resonance:R.
32 .serial to parellel conversion is done by ans:shift register.
33. if the address bus id 20bits.then the memory space is 1Mb.
34.filtering can be done with:capacitor,iductor,both,none.
35.the config that is worst effected by low CMMR
ans:Non inverting amplifier.
36.two progs are given. one satrts counting frm 0 to MAX and the other stars frm
MAX to 0.
which one executes fast.may be Max to 0.Think of.it should be.
37. the fctn of datalink layer is:bit stuffing.
38.which of the following is not fctn of datalink layer: Encryption.
39.voltage levels of rs232x:+12,-12.
40.which of the following is not used for client/server. RPC,TCP/IP,MESSAGEQs No
ne
ans:may be none.
41. which of the following is true.
ans:the primary key in DataBAse design is very important.
42. SQL is a Non procedural query language.
43.Data structure used to implement a menu: doubly linked circular linked list.
44. some regular expression is given:WaW .may be it is context free grammar.
45.the feature of real time os is: fast context switching.
46.os implements protection with the help of hardware(like virtual addressing in
386/286 etc).
47. what is a real time system.
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 player
s. 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 eac
h 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.
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 tak
e 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 oth
ers 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
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)
-------------------------------TOTAL 60 QUE S 25-PROBLEMS & 35 FIGURES(figure series,we
have to find next coming figure)
HERE 13 PROB S ARE THERS.REMAINING ALSO ALMOST LIKE THIS .
1) A boy multiplied a number with 10 and got 100,insted of
dividing it . If he devided it what would be the answer?
(Ans is 1)
2)If 12 shell cup board requires 18ft of wall space then
30 " " " " how much wall space?
(Ans is 45)
3)The average salary of three employee is 95Rs.per week.
If one employee earns 115 and other earns 65 rupees.
how much will third be earn?
(Ans is 105Rs)
4)A company instaled 36 punching machines at the begining of
the year.In the spring they instaled 9 additional m/c s
and then discontinued 18 in the fall.How many were still
installed at the end of the year?
(Ans is 9)check
5)During a given week a programmer spend 1/4 of his time
preparing charts,3/8 of his time for coding,rest of his time
for debugging the programs.If he had 48 hrs during the week
how many hours did he spend debugging the program.
(Ans is 18hrs)
6)A 16 story building has 12000ft on each floor. Company A
rents 7 floors and company B rents 4 floors. What is the
number of square feet of unrented floor space?
(Ans is 60000 sqft)
7)A man owns 2/3 of a computer service buroue business and
sells 3/4 of his share for $75000.What is the value of the
business.
(Ans is 150,000)
A computer printer produces 176400 lines in a given day.
If the printer was in operation for 7hrs during the day
how many lines did it print per minute?
(Ans is 420)
9)From its total income a company spent $20000 for advertising
half of the remainder on salaries and had $6000 left.What
was the total income?
(Ans is $32000)
10)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 men .What % o
f all the employee went to the picnic?
(Ans is 33%)
11)The dimensions of certain IBM m/c are 48"*30". If the
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 fresher
s
batch. The aptitude was not so tough, but the buzzword was TIME ...they will gi
ve u
very little time to do these.u will be given one hour, and u need to answer 70 q
uestions.
There was no negative marking and sectional cutoff. They announced it prior to t
he
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.
Section 3: Comprehension.A paragraph in easy english is given.This should be
attempted last. Sec 3 & 4 consists ( 20 + 20 =40 )ques.So these section is the
decider.Try to solve quickly so u can attempt as much as possible before guesswo
rk.
Section 4: Logical & Analytical Reasoning!! Solve R.S.Agarwal thoroughly.All tho
se
series completion, odd man out, figures, missing no,venn diagram,small puzzles e
tc etc
given.
Section 5: Quantitative and Data Sufficiency.Solve R.S.Agarwal
quantitative.Knowledge of solving Time & work,profit & Loss,average, age
problems,percentage,Train ,Speed, Volume,Area etc will come handy.
They set a high cutoff.Only 29 cleared apti including myself from about 100.
Then in the same day we faced 3 interviews.
They call for technical interview
an in
his 20s, another was a middleaged
with .."Tell about yourself".then
a.They
asked to rate myself in all those
e 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,interfac
e,
exceptions, operator/method overloading,overriding,java thread and two ways of
implementation, arrays, stack related basic questions were asked.then they start
ed 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 an
d
asked "Lets get into Oracle." They asked if i know PL/SQL.I said no.They asked w
at is
subquery and asked to fetch the salary of the top 3 highest paid employees.It la
sted 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 ti
me 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
u are one of us
long 1.5 yr job
was getting so
best opportunit
would envy.
(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 inc
reases 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.
And some questions on ages.. some on profit and loss.
prepare frm R.S. agrawall.....it will be sufficient to clear..... beware time is
the factor.....
Logical Section:
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...
..
5.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
i think it (d)
6. Some green are blue. No blue are white.
(a) No green are white
(b) Some green are white
(c) No green are white
(d) None of the above
ans: b
Technical Interview
Now i am giving some idea about the technical inteview of mine....
which is a very friendly kind of....
i am giving some questions which they fired on me.....
Ques1: so. nikhil...... Tell me about urself?
This is the most obvious ques..every hr asked to make us comfortable
just give us general introuduction with ur achievements and qualification...
B
Ques2: he see my resume.....and asked how u maintain a good percentage throughou
t ur BE?
ans: sir.....i am a hard worker frm my childhood...
ques: what languages u have done?
ans: ..........