Вы находитесь на странице: 1из 177

Face Interviews Confidently!

Technical Aptitude Questions


Table of Contents
Data Structures Aptitude....................................................................................................3
C Aptitude ........................................................................................................................12
C++ Aptitude and OOPS..................................................................................................76
Quantitative Aptitude......................................................................................................105
UN! C"ncepts...............................................................................................................123
#D$%S C"ncepts...........................................................................................................137
SQ&..................................................................................................................................155
C"'puter Net("r)s........................................................................................................163
Operatin* S+ste's..........................................................................................................171
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2
Technical Aptitude Questions
Data Structures Aptitude
1. What is data structure?
A data structure is a way of organiing data that considers not only the ite!s
stored" but also their relationship to each other# Advance $nowledge about the
relationship between data ite!s allows designing of efficient algorith!s for the
!anipulation of data#
2. List out the areas in which data structures are applied extensively?
Co!piler Design"
%perating Syste!"
Database &anage!ent Syste!"
Statistical analysis pac$age"
'u!erical Analysis"
(raphics"
Artificial Intelligence"
Si!ulation
3. What are the major data structures used in the following areas : !"#$% &etwor'
data model ( )ierarchical data model.
)D*&S + Array ,i#e# Array of structures-
'etwor$ data !odel + (raph
.ierarchical data !odel + Trees
*. +f you are using , language to implement the heterogeneous lin'ed list% what pointer
type will you use?
The heterogeneous lin$ed list contains different data types in its nodes and we
need a lin$" pointer to connect the!# It is not possible to use ordinary pointers for this# So
we go for void pointer# /oid pointer is capable of storing pointer to any type as it is a
generic pointer type#

-. #inimum num.er of /ueues needed to implement the priority /ueue?
Two# %ne 0ueue is used for actual storing of data and another for storing
priorities#
0. What is the data structures used to perform recursion?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1
Data Structures Aptitude

Technical Aptitude Questions
Stac$# *ecause of its 2IF% ,2ast In First %ut- property it re!e!bers its 3caller4 so
$nows who! to return when the function has to return# )ecursion !a$es use of syste!
stac$ for storing the return addresses of the function calls#
1very recursive function has its e/uivalent iterative 2non3recursive4 function.
5ven when such e0uivalent iterative procedures are written" e6plicit stac$ is to be used#
5. What are the notations used in 1valuation of 6rithmetic 1xpressions using prefix and
postfix forms?
7olish and )everse 7olish notations#
7. ,onvert the expression 226 8 "4 9 , : 2! : 14 ; 2< 8 =44 to e/uivalent >refix and
>ostfix notations.
7refi6 'otation8
9 : ; <A*C : D5 < F(
7ostfi6 'otation8
A* < C ; D5 : : F( < 9
?. $orting is not possi.le .y using which of the following methods?
2a4 +nsertion
2.4 $election
2c4 1xchange
2d4 !eletion
,d- Deletion#
=sing insertion we can perfor! insertion sort" using selection we can perfor!
selection sort" using e6change we can perfor! the bubble sort ,and other si!ilar sorting
!ethods-# *ut no sorting !ethod can be done >ust using deletion#
1@. 6 .inary tree with 2@ nodes has null .ranches?
2?
2et us ta$e a tree with @ nodes ,nA@-
It will have only B ,ie"@<?- null branches# In general"
6 .inary tree with n nodes has exactly n+1 null nodes.
11. What are the methods availa.le in storing se/uential files ?
Straight !erging"
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
C
'ull *ranches
Technical Aptitude Questions
'atural !erging"
7olyphase sort"
Distribution of Initial runs#
12. )ow many different trees are possi.le with 1@ nodes ?
?D?C
For e6a!ple" consider a tree with 1 nodes,nA1-" it will have the !a6i!u!
co!bination of @ different ,ie" 2
1
: 1 A @- trees#
i ii iii iv v
In general8
+f there are n nodes% there exist 2
n
,n different trees.
13. List out few of the 6pplication of tree data3structure?
The !anipulation of Arith!etic e6pression"
Sy!bol Table construction"
Synta6 analysis#
1*. List out few of the applications that ma'e use of #ultilin'ed $tructures?
Sparse !atri6"
Inde6 generation#
1-. +n tree construction which is the suita.le efficient data structure?
2a4 6rray 2.4 Lin'ed list 2c4 $tac' 2d4 Aueue 2e4 none
,b- 2in$ed list
10. What is the type of the algorithm used in solving the 7 Aueens pro.lem?
*ac$trac$ing
15. +n an 6BL tree% at what condition the .alancing is to .e done?
If the 3pivotal value4 ,or the 3.eight factor4- is greater than ? or less than +?#
17. What is the .uc'et siCe% when the overlapping and collision occur at same time?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@
Technical Aptitude Questions
%ne# If there is only one entry possible in the buc$et" when the collision occurs"
there is no way to acco!!odate the colliding value# This results in the overlapping of
values#
1?. Draverse the given tree using +norder% >reorder and >ostorder traversals.
Inorder 8 D . * 5 A F C I ( E
7reorder8 A * D . 5 C F ( I E
7ostorder8 . D 5 * F I E ( C A
2@. Dhere are 7% 1-% 13% 1* nodes were there in * different trees. Which of them could
have formed a full .inary tree?
?@#
In general8
Dhere are 2
n
,1 nodes in a full .inary tree.
"y the method of elimination:
Full binary trees contain odd nu!ber of nodes# So there cannot be full
binary trees with F or ?C nodes" so re>ected# Gith ?1 nodes you can for! a complete
binary tree but not a full binary tree# So the correct answer is ?@#
N"te:
Full and Co!plete binary trees are different# 6ll full .inary trees are complete
.inary trees .ut not vice versa.
21. +n the given .inary tree% using array you can store the node * at which location?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
B
A
* C
D
5 F (
. I
E
(iven tree8
?
2 1
C
@
Technical Aptitude Questions
At location B
? 2 1 : : C : : @
)oot 2C? )C? 2C2 )C2 2C1 )C1 2CC )CC
where 2Cn !eans 2eft Child of node n and )Cn !eans )ight Child of node n
22. $ort the given values using Auic' $ort?
B@ HD H@ FD F@ BD @@ @D C@
Sorting ta$es place fro! the pivot value" which is the first value of the given
ele!ents" this is !ar$ed bold# The values at the left pointer and right pointer are indicated
using
2
and
)
respectively#
65 HD
2
H@ FD F@ BD @@ @D C@
)
Since pivot is not yet changed the sa!e process is continued after interchanging the
values at
2
and
)
positions
65 C@ H@
2
FD F@ BD @@ @D
)
HD
65 C@ @D FD
2
F@ BD @@
)
H@ HD
65 C@ @D @@ F@
2
BD
)
FD H@ HD
65 C@ @D @@ BD
)
F@
2
FD H@ HD
Ghen the 2 and ) pointers cross each other the pivot value is interchanged with the value
at right pointer# If the pivot is changed it !eans that the pivot has occupied its original
position in the sorted order ,shown in bold italics- and hence two different arrays are
for!ed" one fro! start of the original array to the pivot position:? and the other fro!
pivot position<? to end#
60
2
C@ @D @@
)
65 85
2
FD H@ HD
)
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
H
Technical Aptitude Questions
55
2
C@ @D
)
60 65 70
)
FD
2
H@ -5
50
2
C@
)
55 60 65 70 FD
2
H@
)
-5
In the ne6t pass we get the sorted for! of the array#
.5 50 55 60 65 70 75 -0 -5
23. <or the given graph% draw the !<$ and "<$?
"<$: A I ( . 7 5 & J E
!<$: A I . 7 5 J & E (
2*. ,lassify the )ashing <unctions .ased on the various methods .y which the 'ey value
is found.
Direct !ethod"
Subtraction !ethod"
&odulo:Division !ethod"
Digit:56traction !ethod"
&id:S0uare !ethod"
Folding !ethod"
7seudo:rando! !ethod#
2-. What are the types of ,ollision esolution Dechni/ues and the methods used in each
of the type?
%pen addressing ,closed hashing-"
The !ethods used include8
%verflow bloc$"
Closed addressing ,open hashing-
The !ethods used include8
2in$ed list"
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
F
A
. I
( 7
5
J
& E
The given graph8
Technical Aptitude Questions
*inary treeK
20. +n !"#$% what is the efficient data structure used in the internal storage
representation?
*< tree# *ecause in *< tree" all the data is stored only in leaf nodes" that !a$es
searching easier# This corresponds to the records that shall be stored in leaf nodes#
25. !raw the "3tree of order 3 created .y inserting the following data arriving in
se/uence : ?2 2* 0 5 11 7 22 * - 10 1? 2@ 57
27.Ef the following tree structure% which is% efficient considering space and
time complexities?
2a4 +ncomplete "inary Dree
2.4 ,omplete "inary Dree
2c4 <ull "inary Dree
,b- Co!plete *inary Tree#
"y the method of elimination:
Full binary tree loses its nature when operations of insertions and deletions
are done# For inco!plete binary trees" e6tra storage is re0uired and overhead of '=22
node chec$ing ta$es place# So co!plete binary tree is the better one since the property of
co!plete binary tree is !aintained even after operations li$e additions and deletions are
done on it#
2?. What is a spanning Dree?
A spanning tree is a tree associated with a networ$# All the nodes of the graph
appear on the tree once# A !ini!u! spanning tree is a spanning tree organied so that
the total edge weight between nodes is !ini!ied#
3@. !oes the minimum spanning tree of a graph give the shortest distance .etween any 2
specified nodes?
'o#
&ini!al spanning tree assures that the total weight of the tree is $ept at its
!ini!u!# *ut it doesnFt !ean that the distance between any two nodes involved in the
!ini!u!:spanning tree is !ini!u!#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
L
??
:
@ H ?L 2C
C
:
B
:
F
:
?B
:
2D 22
HF
L2
Technical Aptitude Questions
31. ,onvert the given graph with weighted edges to minimal spanning tree.
the e0uivalent !ini!al spanning tree is8
32. Which is the simplest file structure?
2a4 $e/uential
2.4 +ndexed
2c4 andom
,a- Se0uential
33. Whether Lin'ed List is linear or &on3linear data structure?
According to Access strategies 2in$ed list is a linear one#
According to Storage 2in$ed 2ist is a 'on:linear one#
3*. !raw a .inary Dree for the expression :
6 9 " 3 2, 8 !4 9 2> G A4
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?D
? 1
2
C
@
C?D
BDD
2DD
CDD
1?D
?C2?
2LF@
B?2
:
;
;
A
*
<
M
C
7 D
Q
?
2
1
C
@
C?D
B?2
2DD
1?D
Technical Aptitude Questions
3-. <or the following ,E"EL code% draw the "inary tree?
D? ST=D5'TN)5C#
D2 'A&5#
D1 FI)STN'A&5 7IC I,?D-#
D1 2ASTN'A&5 7IC I,?D-#
D2 J5A)N%FNST=DJ#
D1 FI)STNS5& 7IC II#
D1 S5C%'DNS5& 7IC II#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??
ST=D5'TN)5C
'A&5 J5A)N%FNST=DJ
FI)STN'A&5 2ASTN'A&5 FI)STNS5& S5C%'DNS5&
D?
D2 D2
D1 D1 D1 D1
Technical Aptitude Questions
C Aptitude
N"te / All the progra!s are tested under Turbo CMC<< co!pilers#
It is assu!ed that"
7rogra!s run under D%S environ!ent"
The underlying !achine is an 6FB syste!"
7rogra! is co!piled using Turbo CMC<< co!piler#
The progra! output !ay depend on the infor!ation based on this assu!ptions
,for e6a!ple sieof,int- AA 2 !ay be assu!ed-#
7redict the output or error,s- for the following8
1. void main24
H
int const 9 pI-J
printf2KLdK%8829p44J
M
Ans(er/
Co!piler error8 Cannot !odify a constant value#
01p2anati"n8
p is a pointer to a Oconstant integerO# *ut we tried to change the value of
the Oconstant integerO#
2. main24
H
char sN OIKmanKJ
int iJ
for2iI@JsN i OJi884
printf2KPnLcLcLcLcK%sN i O%92s8i4%92i8s4%iNsO4J
M
Ans(er/
!!!!
aaaa
nnnn
01p2anati"n8
sPiQ" ;,i<s-" ;,s<i-" iPsQ are all different ways of e6pressing the sa!e idea#
(enerally array na!e is the base address for that array# .ere s is the base address# i is the
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2
C Aptitude

Technical Aptitude Questions
inde6 nu!berMdisplace!ent fro! the base address# So" indirecting it with ; is sa!e as
sPiQ# iPsQ !ay be surprising# *ut in the case of C it is sa!e as sPiQ#
3. main24
H
float me I 1.1J
dou.le you I 1.1J
if2meIIyou4
printf2K+ love QK4J
else
printf2K+ hate QK4J
M
Ans(er/
I hate =
01p2anati"n8
For floating point nu!bers (float" double" long double) the values cannot
be predicted e6actly# Depending on the nu!ber of bytes" the precession with of the value
represented varies# Float ta$es C bytes and long double ta$es ?D bytes# So float stores D#L
with less precision than long double#
Rule of Thumb:
'ever co!pare or at:least be cautious when using floating point nu!bers
with relational operators (AA " R" S" SA" RA"!A ) #
*. main24
H
static int var I -J
printf2KLd K%var334J
if2var4
main24J
M
Ans(er/
@ C 1 2 ?
01p2anati"n/
Ghen static storage class is given" it is initialied once# The change in the
value of a static variable is retained even between the function calls# &ain is also treated
li$e any other ordinary function" which can be called recursively#
-. main24
H
int cN OIH2.7%3.*%*%0.5%-MJ
int j%9pIc%9/IcJ
for2jI@JjR-Jj884 H
printf2K Ld K%9c4J
88/J M
for2jI@JjR-Jj884H
printf2K Ld K%9p4J
88pJ M
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1
Technical Aptitude Questions
M
Ans(er/
2 2 2 2 2 2 1 C B @
01p2anati"n/
Initially pointer c is assigned to both p and q# In the first loop" since only
q is incre!ented and not c " the value 2 will be printed @ ti!es# In second loop p itself is
incre!ented# So the values 2 1 C B @ will be printed#
0. main24
H
extern int iJ
iI2@J
printf2KLdK%i4J
M
Ans(er/
Lin'er 1rror 8 =ndefined sy!bol TNiT
01p2anati"n/
e6tern storage class in the following declaration"
extern int i;
specifies to the co!piler that the !e!ory for i is allocated in so!e other progra! and
that address will be given to the current progra! at the ti!e of lin$ing# *ut lin$er finds
that no other variable of na!e i is available in any other progra! with !e!ory space
allocated for it# .ence a lin$er error has occurred #
5. main24
H
int iI31%jI31%'I@%lI2%mJ
mIi88((j88(('88SSl88J
printf2KLd Ld Ld Ld LdK%i%j%'%l%m4J
M
Ans(er/
D D ? 1 ?
01p2anati"n /
2ogical operations always give a result of 1 or 0 # And also the logical
A'D ,UU- operator has higher priority over the logical %) ,VV- operator# So the
e6pression 3i++ && ++ && !++" is e6ecuted first# The result of this e6pression is D
,:? UU :? UU D A D-# 'ow the e6pression is D VV 2 which evaluates to ? ,because %)
operator always gives ? e6cept for 3D VV D4 co!bination: for which it gives D-# So the value
of ! is ?# The values of other variables are also incre!ented by ?#
7. main24
H
char 9pJ
printf2KLd Ld K%siCeof29p4%siCeof2p44J
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?C
Technical Aptitude Questions
M
Ans(er/
? 2
01p2anati"n/
The sieof,- operator gives the nu!ber of bytes ta$en by its operand# 7 is
a character pointer" which needs one byte for storing its value ,a character-# .ence
sieof,;p- gives a value of ?# Since it needs two bytes to store the address of the character
pointer sieof,p- gives 2#
?. main24
H
int iI3J
switch2i4
H
default:printf2KCeroK4J
case 1: printf2KoneK4J
.rea'J
case 2:printf2KtwoK4J
.rea'J
case 3: printf2KthreeK4J
.rea'J
M
M
Ans(er /
three
01p2anati"n /
The default case can be placed anywhere inside the loop# It is e6ecuted
only when all other cases doesnTt !atch#
1@. main24
H
printf2KLxK%31RR*4J
M
Ans(er/
fffD
01p2anati"n /
:? is internally represented as all ?Ts# Ghen left shifted four ti!es the least
significant C bits are filled with DTs#The W6 for!at specifier specifies that the integer
value be printed as a he6adeci!al value#
11. main24
H
char stringNOIK)ello WorldKJ
display2string4J
M
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@
Technical Aptitude Questions
void display2char 9string4
H
printf2KLsK%string4J
M
Ans(er/
,ompiler 1rror : Type !is!atch in redeclaration of function display
01p2anati"n /
In third line" when the function #ispl$% is encountered" the co!piler
doesnTt $now anything about the function display# It assu!es the argu!ents and return
types to be integers" ,which is the default type-# Ghen it sees the actual function #ispl$%&
the argu!ents and type contradicts with what it has assu!ed previously# .ence a co!pile
ti!e error occurs#
12. main24
H
int cI3 32J
printf2KcILdK%c4J
M
Ans(er/
cA2X
01p2anati"n/
.ere unary !inus ,or negation- operator is used twice# Sa!e !aths rules
applies" ie# !inus ; !inusA plus#
'ote:
.owever you cannot give li$e ::2# *ecause :: operator can only be
applied to variables as a #e(rement operator ,eg#" i::-# 2 is a constant and not a variable#
13. Tdefine int char
main24
H
int iI0-J
printf2KsiCeof2i4ILdK%siCeof2i44J
M
Ans(er/
sieof,i-A?
01p2anati"n/
Since the Ydefine replaces the string int by the !acro (h$r
1*. main24
H
int iI1@J
iIUiV1*J
printf2KiILdK%i4J
M
Ans(er/
iAD
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?B
Technical Aptitude Questions
01p2anati"n/
In the e6pression )i*1+ " '%T ,!- operator has !ore precedence than 3 R4
sy!bol# ) is a unary logical operator# !i ,!?D- is D ,not of true is false-# DR?C is false
,ero-#
1-. TincludeRstdio.hV
main24
H
char sNOIHWaW%W.W%WcW%WPnW%WcW%WP@WMJ
char 9p%9str%9str1J
pI(sN3OJ
strIpJ
str1IsJ
printf2KLdK%889p 8 889str13324J
M
Ans(er/
HH
01p2anati"n/
p is pointing to character TZnT# str? is pointing to character TaT <<;p# Op is pointing
to TZnT and that is incre!ented by one#O the ASCII value of TZnT is ?D" which is then
incre!ented to ??# The value of <<;p is ??# <<;str?" str? is pointing to TaT that is
incre!ented by ? and it beco!es TbT# ASCII value of TbT is LF#
'ow perfor!ing ,?? < LF + 12-" we get HH,O&O-X
So we get the output HH 88 O&O ,Ascii is HH-#
10. TincludeRstdio.hV
main24
H
int aN2ON2ON2O I H H1@%2%3%*M% H-%0%5%7M MJ
int 9p%9/J
pI(aN2ON2ON2OJ
9/I999aJ
printf2KLd3333LdK%9p%9/4J
M
Ans(er/
So!e(arbage/alue:::?
01p2anati"n/
pAUaP2QP2QP2Q you declare only two 2D arrays" but you are trying to
access the third 2D,which you are not declared- it will print garbage values# ;0A;;;a
starting address of a is assigned integer pointer# 'ow 0 is pointing to starting address of a#
If you print ;0" it will print first ele!ent of 1D array#
15. TincludeRstdio.hV
main24
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?H
Technical Aptitude Questions
H
struct xx
H
int xI3J
char nameNOIKhelloKJ
MJ
struct xx 9sJ
printf2KLdK%s3Vx4J
printf2KLsK%s3Vname4J
M
Ans(er/
Co!piler 5rror
01p2anati"n/
Jou should not initialie variables in declaration
17. TincludeRstdio.hV
main24
H
struct xx
H
int xJ
struct yy
H
char sJ
struct xx 9pJ
MJ
struct yy 9/J
MJ
M
Ans(er/
Co!piler 5rror
01p2anati"n/
The structure yy is nested within structure 66# .ence" the ele!ents are of
yy are to be accessed through the instance of structure 66" which needs an instance of yy
to be $nown# If the instance is created after defining the structure the co!piler will not
$now about the instance relative to 66# .ence for nested structure yy you have to declare
!e!ber#
1?. main24
H
printf2KPna.K4J
printf2KP.siK4J
printf2KPrhaK4J
M
Ans(er/
hai
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?F
Technical Aptitude Questions
01p2anati"n/
Zn : newline
Zb : bac$space
Zr : linefeed
2@. main24
H
int iI-J
printf2KLdLdLdLdLdLdK%i88%i33%88i%33i%i4J
M
Ans(er/
C@@C@
01p2anati"n/
The argu!ents in a function call are pushed into the stac$ fro! left to
right# The evaluation is by popping out fro! the stac$# and the evaluation is fro! right to
left" hence the result#
21. Tdefine s/uare2x4 x9x
main24
H
int iJ
i I 0*Gs/uare2*4J
printf2KLdK%i4J
M
Ans(er/
BC
01p2anati"n/
the !acro call s0uare,C- will substituted by C;C so the e6pression beco!es
i A BCMC;C # Since M and ; has e0ual priority the e6pression will be evaluated as ,BCMC-;C
i#e# ?B;C A BC

22. main24
H
char 9pIKhai friendsK%9p1J
p1IpJ
while29pUIWP@W4 889p88J
printf2KLs LsK%p%p14J
M
Ans(er/
ib>!gs>foet
01p2anati"n/
<<;p<< will be parse in the given order
;p that is value at the location currently pointed by p will be ta$en
<<;p the retrieved value will be incre!ented
when X is encountered the location will be incre!ented that is p<< will be e6ecuted
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?L
Technical Aptitude Questions
.ence" in the while loop initial value pointed by p is 3h4" which is changed to 3i4 by
e6ecuting <<;p and pointer !oves to point" 3a4 which is si!ilarly changed to 3b4 and so
on# Si!ilarly blan$ space is converted to 3!4# Thus" we obtain value in p beco!es [ib>!
gs>foet\ and since p reaches 3ZD4 and p? points to p thus p?doesnot print anything#
23. Tinclude Rstdio.hV
Tdefine a 1@
main24
H
Tdefine a -@
printf2KLdK%a4J
M
Ans(er/
@D
01p2anati"n/
The preprocessor directives can be redefined anywhere in the progra!# So
the !ost recently assigned value will be ta$en#
2*. Tdefine clrscr24 1@@
main24
H
clrscr24J
printf2KLdPnK%clrscr244J
M
Ans(er/
?DD
01p2anati"n/
7reprocessor e6ecutes as a seperate pass before the e6ecution of the
co!piler# So te6tual replace!ent of clrscr,- to ?DD occurs#The input progra! to co!piler
loo$s li$e this 8
!ain,-
]
?DDX
printf,OWdZnO"?DD-X
^
'ote:
?DDX is an e6ecutable state!ent but with no action# So it doesnTt give any
proble!
2-. main24
H
printf2KLpK%main4J
M
Ans(er/
So!e address will be printed#
01p2anati"n/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2D
Technical Aptitude Questions
Function na!es are >ust addresses ,>ust li$e array na!es are addresses-#
!ain,- is also a function# So the address of function !ain will be printed# Wp in printf
specifies that the argu!ent is an address# They are printed as he6adeci!al nu!bers#
2H- !ain,-
]
clrscr,-X
^
clrscr,-X
Ans(er/
'o outputMerror
01p2anati"n/
The first clrscr,- occurs inside a function# So it beco!es a function call# In
the second clrscr,-X is a function declaration ,because it is not inside any
function-#
2F- enu! colors ]*2AC_"*2=5"()55'^
!ain,-
]

printf,OWd##Wd##WdO"*2AC_"*2=5"()55'-X

return,?-X
^
Ans(er/
D##?##2
01p2anati"n/
enu! assigns nu!bers starting fro! D" if not e6plicitly defined#
2L- void !ain,-
]
char far ;farther";farthestX

printf,OWd##WdO"sieof,farther-"sieof,farthest--X

^
Ans(er/
C##2
01p2anati"n/
the second pointer is of char type and not a far pointer
1D- !ain,-
]
int iACDD">A1DDX
printf,OWd##WdO-X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2?
Technical Aptitude Questions
^
Ans(er/
CDD##1DD
01p2anati"n/
printf ta$es the values of the first two assign!ents of the progra!# Any
nu!ber of printfTs !ay be given# All of the! ta$e only the first two
values# If !ore nu!ber of assign!ents given in the progra!"then printf
will ta$e garbage values#
1?- !ain,-
]
char ;pX
pAO.elloOX
printf,OWcZnO";U;p-X
^
Ans(er/
.
01p2anati"n/
; is a dereference operator U is a reference operator# They can be
applied any nu!ber of ti!es provided it is !eaningful# .ere p points to
the first character in the string O.elloO# ;p dereferences it and so its value
is .# Again U references it to an address and ; dereferences it to the value
.#
12- !ain,-
]
int iA?X
while ,iSA@-
]
printf,OWdO"i-X
if ,iR2-
goto hereX
i<<X
^
^
fun,-
]
here8
printf,O77O-X
^
Ans(er/
Co!piler error8 =ndefined label ThereT in function !ain
01p2anati"n/
2abels have functions scope" in other words The scope of the labels is
li!ited to functions # The label ThereT is available in function fun,- .ence it
is not visible in function !ain#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
22
Technical Aptitude Questions
11- !ain,-
]
static char na!esP@QP2DQA]OpascalO"OadaO"OcobolO"OfortranO"OperlO^X
int iX
char ;tX
tAna!esP1QX
na!esP1QAna!esPCQX
na!esPCQAtX
for ,iADXiSACXi<<-
printf,OWsO"na!esPiQ-X
^
Ans(er/
Co!piler error8 2value re0uired in function !ain
01p2anati"n/
Array na!es are pointer constants# So it cannot be !odified#
1C- void !ain,-
]
int iA@X
printf,OWdO"i<< < <<i-X
^
Ans(er/
%utput Cannot be predicted e6actly#
01p2anati"n/
Side effects are involved in the evaluation of i
1@- void !ain,-
]
int iA@X
printf,OWdO"i<<<<<i-X
^
Ans(er/
Co!piler 5rror
01p2anati"n/
The e6pression i<<<<<i is parsed as i << << < i which is an illegal
co!bination of operators#

1B- YincludeSstdio#hR
!ain,-
]
int iA?">A2X
switch,i-
]
case ?8 printf,O(%%DO-X
brea$X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
21
Technical Aptitude Questions
case >8 printf,O*ADO-X
brea$X
^
^
Ans(er/
Co!piler 5rror8 Constant e6pression re0uired in function !ain#
01p2anati"n/
The case state!ent can have only constant e6pressions ,this i!plies that
we cannot use variable na!es directly so an error-#
'ote:
5nu!erated types can be used in case state!ents#
1H- !ain,-
]
int iX
printf,OWdO"scanf,OWdO"Ui--X MM value ?D is given as input here
^
Ans(er/
?
01p2anati"n/
Scanf returns nu!ber of ite!s successfully read and not ?MD# .ere ?D is
given as input which should have been scanned successfully# So nu!ber
of ite!s read is ?#
1F- Ydefine f,g"g2- gYYg2
!ain,-
]
int var?2A?DDX
printf,OWdO"f,var"?2--X
^
Ans(er/
?DD
1L- !ain,-
]
int iADX

for,Xi<<Xprintf,OWdO"i-- X
printf,OWdO"i-X
^
Ans(er/
?
01p2anati"n/
before entering into the for loop the chec$ing condition is OevaluatedO#
.ere it evaluates to D ,false- and co!es out of the loop" and i is
incre!ented ,note the se!icolon after the for loop-#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2C
Technical Aptitude Questions
CD- YincludeSstdio#hR
!ain,-
]
char sPQA]TaT"TbT"TcT"TZnT"TcT"TZDT^X
char ;p";str";str?X
pAUsP1QX
strApX
str?AsX
printf,OWdO"<<;p < <<;str?:12-X
^
Ans(er/
&
01p2anati"n/
p is pointing to character TZnT#str? is pointing to character TaT <<;p
!eAnswer8Op is pointing to TZnT and that is incre!ented by one#O the ASCII
value of TZnT is ?D# then it is incre!ented to ??# the value of <<;p is ??# <
<;str? !eAnswer8Ostr? is pointing to TaT that is incre!ented by ? and it
beco!es TbT# ASCII value of TbT is LF# both ?? and LF is added and result is
subtracted fro! 12#
i#e# ,??<LF:12-AHH,O&O-X
C?- YincludeSstdio#hR
!ain,-
]
struct 66
]
int 6A1X
char na!ePQAOhelloOX
^X
struct 66 ;sA!alloc,sieof,struct 66--X
printf,OWdO"s:R6-X
printf,OWsO"s:Rna!e-X
^
Ans(er/
Co!piler 5rror
01p2anati"n/
Initialiation should not be done for structure !e!bers inside the structure
declaration
C2- YincludeSstdio#hR
!ain,-
]
struct 66
]
int 6X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2@
Technical Aptitude Questions
struct yy
]
char sX
struct 66 ;pX
^X
struct yy ;0X
^X
^
Ans(er/
Co!piler 5rror
01p2anati"n/
in the end of nested structure yy a !e!ber have to be declared#
C1- !ain,-
]
e6tern int iX
iA2DX
printf,OWdO"sieof,i--X
^
Ans(er/
2in$er error8 undefined sy!bol TNiT#
01p2anati"n/
e6tern declaration specifies that the variable i is defined so!ewhere else#
The co!piler passes the e6ternal variable to be resolved by the lin$er# So
co!piler doesnTt find an error# During lin$ing the lin$er searches for the
definition of i# Since it is not found the lin$er flags an error#
CC- !ain,-
]
printf,OWdO" out-X
^
int outA?DDX
Ans(er/
Co!piler error8 undefined sy!bol out in function !ain#
01p2anati"n/
The rule is that a variable is available for use fro! the point of declaration#
5ven though a is a global variable" it is not available for !ain# .ence an
error#
C@- !ain,-
]
e6tern outX
printf,OWdO" out-X
^
int outA?DDX
Ans(er/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2B
Technical Aptitude Questions
?DD
01p2anati"n/
This is the correct way of writing the previous progra!#

CB- !ain,-
]
show,-X
^
void show,-
]
printf,OIT! the greatestO-X
^
Ans(er/
Co!pier error8 Type !is!atch in redeclaration of show#
01p2anati"n/
Ghen the co!piler sees the function show it doesnTt $now anything about
it# So the default return type ,ie" int- is assu!ed# *ut when co!piler sees
the actual definition of show !is!atch occurs since it is declared as void#
.ence the error#
The solutions are as follows8
?# declare void show,- in !ain,- #
2# define show,- before !ain,-#
1# declare e6tern void show,- before the use of show,-#

CH- !ain, -
]
int aP2QP1QP2Q A ]]]2"C^"]H"F^"]1"C^^"]]2"2^"]2"1^"]1"C^^^X
printf,[Wu Wu Wu Wd Zn\"a";a";;a";;;a-X
printf,[Wu Wu Wu Wd Zn\"a<?";a<?";;a<?";;;a<?-X
^
Ans(er/
?DD" ?DD" ?DD" 2
??C" ?DC" ?D2" 1
01p2anati"n/
The given array is a 1:D one# It can also be viewed as a ?:D array#

2 C H F 1 C 2 2 2 1 1 C
?DD ?D2 ?DC ?DB ?DF ??D ??2 ??C ??B ??F ?2D ?22
thus" for the first printf state!ent a" ;a" ;;a give address of first ele!ent #
since the indirection ;;;a gives the value# .ence" the first line of the
output#
for the second printf a<? increases in the third di!ension thus points to
value at ??C" ;a<? incre!ents in second di!ension thus points to ?DC" ;;a
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2H
Technical Aptitude Questions
<? incre!ents the first di!ension thus points to ?D2 and ;;;a<? first gets
the value at first location and then incre!ents it by ?# .ence" the output#
CF- !ain, -
]
int aP Q A ]?D"2D"1D"CD"@D^">";pX
for,>ADX >S@X ><<-
]
printf,[Wd\ ";a-X
a<<X
^
p A aX
for,>ADX >S@X ><<-
]
printf,[Wd \ ";p-X
p<<X
^
^
Ans(er/
Co!piler error8 lvalue re0uired#
01p2anati"n/
5rror is in line with state!ent a<<# The operand !ust be an lvalue and
!ay be of any of scalar type for the any operator" array na!e only when
subscripted is an lvalue# Si!ply array na!e is a non:!odifiable lvalue#
CL- !ain, -
]
static int aP Q A ]D"?"2"1"C^X
int ;pP Q A ]a"a<?"a<2"a<1"a<C^X
int ;;ptr A pX
ptr<<X
printf,[Zn Wd Wd Wd\" ptr:p" ;ptr:a" ;;ptr-X
;ptr<<X
printf,[Zn Wd Wd Wd\" ptr:p" ;ptr:a" ;;ptr-X
;<<ptrX
printf,[Zn Wd Wd Wd\" ptr:p" ;ptr:a" ;;ptr-X
<<;ptrX
printf,[Zn Wd Wd Wd\" ptr:p" ;ptr:a" ;;ptr-X
^
Ans(er/
111
222
333
3**
01p2anati"n/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2F
Technical Aptitude Questions
2et us consider the array and the two pointers with so!e address
$
D ? 2 1 C
?DD ?D2 ?DC ?DB ?DF
p
?DD ?D2 ?DC ?DB ?DF
?DDD ?DD2 ?DDC ?DDB ?DDF
ptr
?DDD
2DDD
After e6ecution of the instruction ptr<< value in ptr beco!es ?DD2" if
scaling factor for integer is 2 bytes# 'ow ptr + p is value in ptr + starting
location of array p" ,?DD2 + ?DDD- M ,scaling factor- A ?" ;ptr + a A value at
address pointed by ptr + starting value of array a" ?DD2 has a value ?D2 so
the value is ,?D2 + ?DD-M,scaling factor- A ?" ;;ptr is the value stored in
the location pointed by the pointer of ptr A value pointed by value pointed
by ?DD2 A value pointed by ?D2 A ?# .ence the output of the firs printf is
?" ?" ?#
After e6ecution of ;ptr<< incre!ents value of the value in ptr by scaling
factor" so it beco!es?DDC# .ence" the outputs for the second printf are ptr
+ p A 2" ;ptr + a A 2" ;;ptr A 2#
After e6ecution of ;<<ptr incre!ents value of the value in ptr by scaling
factor" so it beco!es?DDC# .ence" the outputs for the third printf are ptr +
p A 1" ;ptr + a A 1" ;;ptr A 1#
After e6ecution of <<;ptr value in ptr re!ains the sa!e" the value pointed
by the value is incre!ented by the scaling factor# So the value in array p at
location ?DDB changes fro! ?DB ?D ?DF"# .ence" the outputs for the fourth
printf are ptr + p A ?DDB + ?DDD A 1" ;ptr + a A ?DF + ?DD A C" ;;ptr A C#
@D- !ain, -
]
char ;0X
int >X
for ,>ADX >S1X ><<- scanf,[Ws\ ",0<>--X
for ,>ADX >S1X ><<- printf,[Wc\ ";,0<>--X
for ,>ADX >S1X ><<- printf,[Ws\ ",0<>--X
^
01p2anati"n/
.ere we have only one pointer to type char and since we ta$e input in the
sa!e pointer thus we $eep writing over in the sa!e location" each ti!e
shifting the pointer value by ?# Suppose the inputs are &%=S5" T)AC_
and /I)T=A2# Then for the first input suppose the pointer starts at
location ?DD then the input one is stored as
& % = S 5 ZD
Ghen the second input is given the pointer is incre!ented as > value
beco!es ?" so the input is filled in !e!ory starting fro! ?D?#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
2L
Technical Aptitude Questions
& T ) A C _ ZD
The third input starts filling fro! the location ?D2
& T / I ) T = A 2 ZD
This is the final value stored #
The first printf prints the values at the position 0" 0<? and 0<2 A & T /
The second printf prints three strings starting fro! locations 0" 0<?" 0<2
i#e &T/I)T=A2" T/I)T=A2 and /I)T=A2#

@?- !ain, -
]
void ;vpX
char ch A 3g4" ;cp A [goofy\X
int > A 2DX
vp A UchX
printf,[Wc\" ;,char ;-vp-X
vp A U>X
printf,[Wd\";,int ;-vp-X
vp A cpX
printf,[Ws\",char ;-vp < 1-X
^
Ans(er/
g2Dfy
01p2anati"n/
Since a void pointer is used it can be type casted to any other type pointer#
vp A Uch stores address of char ch and the ne6t state!ent prints the value
stored in vp after type casting it to the proper data type pointer# the output
is 3g4# Si!ilarly the output fro! second printf is 32D4# The third printf
state!ent type casts it to print the string fro! the C
th
value hence the
output is 3fy4#
@2- !ain , -
]
static char ;sP Q A ][blac$\" [white\" [yellow\" [violet\^X
char ;;ptrP Q A ]s<1" s<2" s<?" s^" ;;;pX
p A ptrX
;;<<pX
printf,[Ws\";::;<<p < 1-X
^
Ans(er/
c$
01p2anati"n/
In this proble! we have an array of char pointers pointing to start of C
strings# Then we have ptr which is a pointer to a pointer of type char and a
variable p which is a pointer to a pointer to a pointer of type char# p hold
the initial value of ptr" i#e# p A s<1# The ne6t state!ent incre!ent value in
p by ? " thus now value of p A s<2# In the printf state!ent the e6pression
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1D
Technical Aptitude Questions
is evaluated ;<<p causes gets value s<? then the pre decre!ent is
e6ecuted and we get s<? + ? A s # the indirection operator now gets the
value fro! the array of s and adds 1 to the starting address# The string is
printed starting fro! this position# Thus" the output is 3c$4#
@1- !ain,-
]
int i" nX
char ;6 A [girl\X
n A strlen,6-X
;6 A 6PnQX
for,iADX iSnX <<i-
]
printf,[WsZn\"6-X
6<<X
^
^
Ans(er/
,blan$ space-
irl
rl
l
01p2anati"n/
.ere a string ,a pointer to char- is initialied with a value [girl\# The
strlen function returns the length of the string" thus n has a value C# The
ne6t state!ent assigns value at the nth location ,3ZD4- to the first location#
'ow the string beco!es [ZDirl\ # 'ow the printf state!ent prints the string
after each iteration it incre!ents it starting position# 2oop starts fro! D to
C# The first ti!e 6PDQ A 3ZD4 hence it prints nothing and pointer value is
incre!ented# The second ti!e it prints fro! 6P?Q i#e [irl\ and the third
ti!e it prints [rl\ and the last ti!e it prints [l\ and the loop ter!inates#
@C- int i">X
for,iADXiSA?DXi<<-
]
><A@X
assert,iS@-X
^
Ans(er/
)unti!e error8 Abnor!al progra! ter!ination#
assert failed ,iS@-" Sfile na!eR"Sline nu!berR
01p2anati"n/
asserts are used during debugging to !a$e sure that certain conditions are
satisfied# If assertion fails" the progra! will ter!inate reporting the sa!e#
After debugging use"
Yundef 'D5*=(
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1?
Technical Aptitude Questions
and this will disable all the assertions fro! the source code# Assertion
is a good debugging tool to !a$e use of#

@@- !ain,-
]
int iA:?X
<iX
printf,Oi A Wd" <i A Wd ZnO"i"<i-X
^
Ans(er/
i A :?" <i A :?
01p2anati"n/
=nary < is the only du!!y operator in C# Ghere:ever it co!es you can
>ust ignore it >ust because it has no effect in the e6pressions ,hence the
na!e du!!y operator-#
@B- Ghat are the files which are auto!atically opened when a C file is e6ecuted`
Ans(er/
stdin" stdout" stderr ,standard input"standard output"standard error-#
@H- what will be the position of the file !ar$er`
a8 fsee$,ptr"D"S55_NS5T-X
b8 fsee$,ptr"D"S55_NC=)-X
Ans(er /
a8 The S55_NS5T sets the file position !ar$er to the starting of the file#
b8 The S55_NC=) sets the file position !ar$er to the current position
of the file#
@F- !ain,-
]
char na!eP?DQ"sP?2QX
scanf,O ZOWP9ZOQZOO"s-X
^
.ow scanf will e6ecute`
Ans(er/
First it chec$s for the leading white space and discards it#Then it !atches
with a 0uotation !ar$ and then it reads all character upto another
0uotation !ar$#
@L- Ghat is the proble! with the following code seg!ent`
while ,,fgets,receiving array"@D"fileNptr-- !A 5%F-
X
Ans(er 3 01p2anati"n/
fgets returns a pointer# So the correct end of file chec$ is chec$ing for !A
'=22#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
12
Technical Aptitude Questions
BD- !ain,-
]
!ain,-X
^
Ans(er/
)unti!e error 8 Stac$ overflow#
01p2anati"n/
!ain function calls itself again and again# 5ach ti!e the function is called
its return address is stored in the call stac$# Since there is no condition to
ter!inate the function call" the call stac$ overflows at runti!e# So it
ter!inates the progra! and results in an error#
B?- !ain,-
]
char ;cptr"cX
void ;vptr"vX
cA?DX vADX
cptrAUcX vptrAUvX
printf,OWcWvO"c"v-X
^
Ans(er/
Co!piler error ,at line nu!ber C-8 sie of v is =n$nown#
01p2anati"n/
Jou can create a variable of type void ; but not of type void" since void is
an e!pty type# In the second line you are creating variable vptr of type
void ; and v of type void hence an error#
B2- !ain,-
]
char ;str?AOabcdOX
char str2PQAOabcdOX
printf,OWd Wd WdO"sieof,str?-"sieof,str2-"sieof,OabcdO--X
^
Ans(er/
2 @ @
01p2anati"n/
In first sieof" str? is a character pointer so it gives you the sie of the
pointer variable# In second sieof the na!e str2 indicates the na!e of the
array whose sie is @ ,including the TZDT ter!ination character-# The third
sieof is si!ilar to the second one#
B1- !ain,-
]
char notX
notA!2X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
11
Technical Aptitude Questions
printf,OWdO"not-X
^
Ans(er/
D
01p2anati"n/
! is a logical operator# In C the value D is considered to be the boolean
value FA2S5" and any non:ero value is considered to be the boolean
value T)=5# .ere 2 is a non:ero value so T)=5# !T)=5 is FA2S5 ,D-
so it prints D#
BC- Ydefine FA2S5 :?
Ydefine T)=5 ?
Ydefine '=22 D
!ain,- ]
if,'=22-
puts,O'=22O-X
else if,FA2S5-
puts,OT)=5O-X
else
puts,OFA2S5O-X
^
Ans(er/
T)=5
01p2anati"n8
The input progra! to the co!piler after processing by the preprocessor is"
!ain,-]
if,D-
puts,O'=22O-X
else if,:?-
puts,OT)=5O-X
else
puts,OFA2S5O-X
^
7reprocessor doesnTt replace the values given inside the double 0uotes#
The chec$ by if condition is boolean value false so it goes to else# In
second if :? is boolean value true hence OT)=5O is printed#
B@- !ain,-
]
int $A?X
printf,OWdAA? is OOWsO"$"$AA?`OT)=5O8OFA2S5O-X
^
Ans(er/
?AA? is T)=5
01p2anati"n/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1C
Technical Aptitude Questions
Ghen two strings are placed together ,or separated by white:space- they
are concatenated ,this is called as OstringiationO operation-# So the string
is as if it is given as OWdAA? is WsO# The conditional operator, `8 -
evaluates to OT)=5O#
BB- !ain,-
]
int yX
scanf,OWdO"Uy-X MM input given is 2DDD
if, ,yWCAAD UU yW?DD !A D- VV yW?DD AA D -
printf,OWd is a leap yearO-X
else
printf,OWd is not a leap yearO-X
^
Ans(er/
2DDD is a leap year
01p2anati"n/
An ordinary progra! to chec$ if leap year or not#
BH- Ydefine !a6 @
Ydefine int arr?P!a6Q
!ain,-
]
typedef char arr2P!a6QX
arr? listA]D"?"2"1"C^X
arr2 na!eAOna!eOX
printf,OWd WsO"listPDQ"na!e-X
^
Ans(er/
Co!piler error ,in the line arr? list A ]D"?"2"1"C^-
01p2anati"n/
arr2 is declared of type array of sie @ of characters# So it can be used to
declare the variable na!e of the type arr2# *ut it is not the case of arr?#
.ence an error#
Rule of Thumb:
Ydefines are used for te6tual replace!ent whereas typedefs are used for
declaring new types#
BF- int iA?DX
!ain,-
]
e6tern int iX
]
int iA2DX
]
const volatile unsigned iA1DX
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1@
Technical Aptitude Questions
printf,OWdO"i-X
^
printf,OWdO"i-X
^
printf,OWdO"i-X
^
Ans(er/
1D"2D"?D
01p2anati"n/
T]T introduces new bloc$ and thus new scope# In the inner!ost bloc$ i is
declared as"
const volatile unsigned
which is a valid declaration# i is assu!ed of type int# So printf prints 1D# In
the ne6t bloc$" i has value 2D and so printf prints 2D# In the outer!ost
bloc$" i is declared as e6tern" so no storage space is allocated for it# After
co!pilation is over the lin$er resolves it to global variable i ,since it is the
only variable visible there-# So it prints iTs value as ?D#
BL- !ain,-
]
int ;>X
]
int iA?DX
>AUiX
^
printf,OWdO";>-X
^
Ans(er/
?D
01p2anati"n8
The variable i is a bloc$ level variable and the visibility is inside that
bloc$ only# *ut the lifeti!e of i is lifeti!e of the function so it lives upto
the e6it of !ain function# Since the i is still allocated space" ;> prints the
value stored in i since > points i#
HD- !ain,-
]
int iA:?X
:iX
printf,Oi A Wd" :i A Wd ZnO"i":i-X
^
Ans(er/
i A :?" :i A ?
01p2anati"n/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1B
Technical Aptitude Questions
:i is e6ecuted and this e6ecution doesnTt affect the value of i# In printf first
you >ust print the value of i# After that the value of the e6pression :i A :,:?-
is printed#
H?- YincludeSstdio#hR
!ain,-
]
const int iACX
float >X
> A <<iX
printf,OWd WfO" i"<<>-X
^
Ans(er8
Co!piler error
01p2anati"n8
i is a constant# you cannot change the value of constant
H2- YincludeSstdio#hR
!ain,-
]
int aP2QP2QP2Q A ] ]?D"2"1"C^" ]@"B"H"F^ ^X
int ;p";0X
pAUaP2QP2QP2QX
;0A;;;aX
printf,OWd##WdO";p";0-X
^
Ans(er/
garbagevalue##?
01p2anati"n/
pAUaP2QP2QP2Q you declare only two 2D arrays# but you are trying to
access the third 2D,which you are not declared- it will print garbage
values# ;0A;;;a starting address of a is assigned integer pointer# now 0 is
pointing to starting address of a#if you print ;0 !eAnswer8it will print first
ele!ent of 1D array#
H1- YincludeSstdio#hR
!ain,-
]
register iA@X
char >PQA OhelloOX
printf,OWs WdO">"i-X
^
Ans(er/
hello @
01p2anati"n8
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1H
Technical Aptitude Questions
if you declare i as register co!piler will treat it as ordinary integer and it
will ta$e integer value# i value !ay be stored either in register or in
!e!ory#
HC- !ain,-
]
int iA@">AB"X
printf,OWdO"i<<<>-X
^
Ans(er/
??
01p2anati"n/
the e6pression i<<<> is treated as ,i<< < >-

HB- struct aaa]
struct aaa ;prevX
int iX
struct aaa ;ne6tX
^X
!ain,-
]
struct aaa abc"def"ghi">$lX
int 6A?DDX
abc#iADXabc#prevAU>$lX
abc#ne6tAUdefX
def#iA?Xdef#prevAUabcXdef#ne6tAUghiX
ghi#iA2Xghi#prevAUdefX
ghi#ne6tAU>$lX
>$l#iA1X>$l#prevAUghiX>$l#ne6tAUabcX
6Aabc#ne6t:Rne6t:Rprev:Rne6t:RiX
printf,OWdO"6-X
^
Ans(er/
2
01p2anati"n/
above all state!ents for! a double circular lin$ed listX
abc#ne6t:Rne6t:Rprev:Rne6t:Ri
this one points to OghiO node the value of at particular node is 2#
HH- struct point
]
int 6X
int yX
^X
struct point origin";ppX
!ain,-
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1F
Technical Aptitude Questions
]
ppAUoriginX
printf,Oorigin is,WdWd-ZnO",;pp-#6",;pp-#y-X
printf,Oorigin is ,WdWd-ZnO"pp:R6"pp:Ry-X
^
Ans(er/
origin is,D"D-
origin is,D"D-
01p2anati"n8
pp is a pointer to structure# we can access the ele!ents of the structure
either with arrow !ar$ or with indirection operator#
'ote:
Since structure point is globally declared 6 U y are initialied as eroes
HF- !ain,-
]
int iANlNabc,?D-X
printf,OWdZnO"::i-X
^
int NlNabc,int i-
]
return,i<<-X
^
Ans(er/
L
01p2anati"n/
return,i<<- it will first return i and then incre!ents# i#e# ?D will be
returned#
HL- !ain,-
]
char ;pX
int ;0X
long ;rX
pA0ArADX
p<<X
0<<X
r<<X
printf,OWp###Wp###WpO"p"0"r-X
^
Ans(er/
DDD?###DDD2###DDDC
01p2anati"n/
<< operator when applied to pointers incre!ents address according to
their corresponding data:types#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
1L
Technical Aptitude Questions
FD- !ain,-
]
char cAT T"6"convert,-X
getc,c-X
if,,cRATaT- UU ,cSATT--
6Aconvert,c-X
printf,OWcO"6-X
^
convert,-
]
return :12X
^
Ans(er/
Co!piler error
01p2anati"n/
declaration of convert and for!at of getc,- are wrong#
F?- !ain,int argc" char ;;argv-
]
printf,Oenter the characterO-X
getchar,-X
su!,argvP?Q"argvP2Q-X
^
su!,nu!?"nu!2-
int nu!?"nu!2X
]
return nu!?<nu!2X
^
Ans(er/
Co!piler error#
01p2anati"n/
argvP?Q U argvP2Q are strings# They are passed to the function su! without
converting it to integer values#
F2- Y include Sstdio#hR
int oneNdPQA]?"2"1^X
!ain,-
]
int ;ptrX
ptrAoneNdX
ptr<A1X
printf,OWdO";ptr-X
^
Ans(er8
garbage value
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
CD
Technical Aptitude Questions
01p2anati"n/
ptr pointer is pointing to out of the array range of oneNd#
F1- Y includeSstdio#hR
aaa,- ]
printf,OhiO-X
^
bbb,-]
printf,OhelloO-X
^
ccc,-]
printf,ObyeO-X
^
!ain,-
]
int ,;ptrP1Q-,-X
ptrPDQAaaaX
ptrP?QAbbbX
ptrP2QAcccX
ptrP2Q,-X
^
Ans(er8
bye
01p2anati"n/
ptr is array of pointers to functions of return type int#ptrPDQ is assigned to
address of the function aaa# Si!ilarly ptrP?Q and ptrP2Q for bbb and ccc
respectively# ptrP2Q,- is in effect of writing ccc,-" since ptrP2Q points to ccc#
F@- YincludeSstdio#hR
!ain,-
]
FI25 ;ptrX
char iX
ptrAfopen,O#cO"OrO-X
while,,iAfgetch,ptr--!A5%F-
printf,OWcO"i-X
^
Ans(er/
contents of #c followed by an infinite loop
01p2anati"n/
The condition is chec$ed against 5%F" it should be chec$ed against
'=22#
FB- !ain,-
]
int i ADX>ADX
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
C?
Technical Aptitude Questions
if,i UU ><<-
printf,OWd##WdO"i<<">-X
printf,OWd##Wd"i">-X
^
Ans(er/
D##D
01p2anati"n/
The value of i is D# Since this infor!ation is enough to deter!ine the truth
value of the boolean e6pression# So the state!ent following the if
state!ent is not e6ecuted# The values of i and > re!ain unchanged and get
printed#

FH- !ain,-
]
int iX
i A abc,-X
printf,OWdO"i-X
^
abc,-
]
NAI A ?DDDX
^
Ans(er/
?DDD
01p2anati"n/
'or!ally the return value fro! the function is through the infor!ation
fro! the accu!ulator# .ere NA. is the pseudo global variable denoting
the accu!ulator# .ence" the value of the accu!ulator is set ?DDD so the
function returns value ?DDD#
FF- int iX
!ain,-]
int tX
for , tACXscanf,OWdO"Ui-:tXprintf,OWdZnO"i--
printf,OWd::O"t::-X
^
MM If the inputs are D"?"2"1 find the oMp
Ans(er/
C::D
1::?
2::2
01p2anati"n/
2et us assu!e so!e 6A scanf,OWdO"Ui-:t the values during e6ecution
will be"
t i 6
C D :C
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
C2
Technical Aptitude Questions
1 ? :2
2 2 D

FL- !ain,-]
int aA DXint b A 2DXchar 6 A?Xchar y A?DX
if,a"b"6"y-
printf,OhelloO-X
^
Ans(er/
hello
01p2anati"n/
The co!!a operator has associativity fro! left to right# %nly the
right!ost value is returned and the other values are evaluated and ignored#
Thus the value of last variable y is returned to chec$ in if# Since it is a non
ero value if beco!es true so" OhelloO will be printed#
LD- !ain,-]
unsigned int iX
for,iA?XiR:2Xi::-
printf,Oc aptitudeO-X
^
01p2anati"n/
i is an unsigned integer# It is co!pared with a signed value# Since the both
types doesnTt !atch" signed is pro!oted to unsigned value# The unsigned
e0uivalent of :2 is a huge value so condition beco!es false and control
co!es out of the loop#
L?- In the following pg! add a st!t in the function fun such that the address of
TaT gets stored in T>T#
!ain,-]
int ; >X
void fun,int ;;-X
fun,U>-X
^
void fun,int ;;$- ]
int a ADX
M; add a st!t here;M
^
Ans(er/
;$ A Ua
01p2anati"n/
The argu!ent of the function is a pointer to a pointer#

L2- Ghat are the following notations of defining functions $nown as`
i# int abc,int a"float b-
]
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
C1
Technical Aptitude Questions
M; so!e code ;M
^
ii# int abc,a"b-
int aX float bX
]
M; so!e code;M
^
Ans(er/
i# A'SI C notation
ii# _ernighan U )itche notation
L1- !ain,-
]
char ;pX
pAOWdZnOX
p<<X
p<<X
printf,p:2"1DD-X
^
Ans(er/
1DD
01p2anati"n/
The pointer points to W since it is incre!ented twice and again
decre!ented by 2" it points to TWdZnT and 1DD is printed#
LC- !ain,-]
char aP?DDQX
aPDQATaTXaP?QQATbTXaP2QATcTXaPCQATdTX
abc,a-X
^
abc,char aPQ-]
a<<X
printf,OWcO";a-X
a<<X
printf,OWcO";a-X
^
01p2anati"n/
The base address is !odified only in function and as a result a points to TbT
then after incre!enting to TcT so bc will be printed#

L@- func,a"b-
int a"bX
]
return, aA ,aAAb- -X
^
!ain,-
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
CC
Technical Aptitude Questions
]
int process,-"func,-X
printf,OThe value of process is Wd !Zn O"process,func"1"B--X
^
process,pf"val?"val2-
int ,;pf- ,-X
int val?"val2X
]
return,,;pf- ,val?"val2--X
^
Ans(er/
The value if process is D !
01p2anati"n/
The function TprocessT has 1 para!eters : ?" a pointer to another function 2
and 1" integers# Ghen this function is invo$ed fro! !ain" the following
substitutions for for!al para!eters ta$e place8 func for pf" 1 for val? and B
for val2# This function returns the result of the operation perfor!ed by the
function TfuncT# The function func has two integer para!eters# The for!al
para!eters are substituted as 1 for a and B for b# since 1 is not e0ual to B"
aAAb returns D# therefore the function returns D which in turn is returned
by the function TprocessT#
LB- void !ain,-
]
static int iA@X
if,::i-]
!ain,-X
printf,OWd O"i-X
^
^
Ans(er/
D D D D
01p2anati"n/
The variable OIO is declared as static" hence !e!ory for I will be allocated
for only once" as it encounters the state!ent# The function !ain,- will be called
recursively unless I beco!es e0ual to D" and since !ain,- is recursively called" so
the value of static I ie#" D will be printed every ti!e the control is returned#
LH- void !ain,-
]
int $Aret,sieof,float--X
printf,OZn here value is WdO"<<$-X
^
int ret,int ret-
]
ret <A 2#@X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
C@
Technical Aptitude Questions
return,ret-X
^
Ans(er/
.ere value is H
01p2anati"n/
The int ret,int ret-" ie#" the function na!e and the argu!ent na!e can be
the sa!e#
Firstly" the function ret,- is called in which the sieof,float- ie#" C is
passed" after the first e6pression the value in ret will be B" as ret is integer hence
the value stored in ret will have i!plicit type conversion fro! float to int# The ret
is returned in !ain,- it is printed after and preincre!ent#

LF- void !ain,-
]
char aPQAO?21C@ZDOX
int iAstrlen,a-X
printf,Ohere in 1 WdZnO"<<i-X
^
Ans(er/
here in 1 B
01p2anati"n/
The char array TaT will hold the initialied string" whose length will be
counted fro! D till the null character# .ence the TIT will hold the value e0ual to @"
after the pre:incre!ent in the printf state!ent" the B will be printed#
LL- void !ain,-
]
unsigned giveitA:?X
int gotitX
printf,OWu O"<<giveit-X
printf,OWu ZnO"gotitA::giveit-X
^
Ans(er/
D B@@1@
01p2anati"n/
?DD- void !ain,-
]
int iX
char aPQAOZDOX
if,printf,OWsZnO"a--
printf,O%$ here ZnO-X
else
printf,OForget itZnO-X
^
Ans(er/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
CB
Technical Aptitude Questions
%$ here
01p2anati"n/
7rintf will return how !any characters does it print# .ence printing
a null character returns ? which !a$es the if state!ent true" thus
O%$ hereO is printed#

?D?- void !ain,-
]
void ;vX
int integerA2X
int ;iAUintegerX
vAiX
printf,OWdO",int;-;v-X
^
Ans(er/
Co!piler 5rror# Ge cannot apply indirection on type void;#
01p2anati"n/
/oid pointer is a generic pointer type# 'o pointer arith!etic can be
done on it# /oid pointers are nor!ally used for"
?# 7assing generic pointers to functions and returning such pointers#
2# As a inter!ediate pointer type#
1# =sed when the e6act pointer type will be $nown at a later point of
ti!e#
?D2- void !ain,-
]
int iAi<<">A><<"$A$<<X
printf,[WdWdWd\"i">"$-X
^
Ans(er/
(arbage values#
01p2anati"n/
6n identifier is availa.le to use in program code from the point of its
declaration.
So e6pressions such as i A i<< are valid state!ents# The i" > and $ are
auto!atic variables and so they contain so!e garbage value# =ar.age in
is gar.age out 2=+=E4#
?D1- void !ain,-
]
static int iAi<<" >A><<" $A$<<X
printf,[i A Wd > A Wd $ A Wd\" i" >" $-X
^
Ans(er/
i A ? > A ? $ A ?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
CH
Technical Aptitude Questions
01p2anati"n/
Since static variables are initialied to ero by default#
?DC- void !ain,-
]
while,?-]
if,printf,OWdO"printf,OWdO---
brea$X
else
continueX
^
^
Ans(er/
(arbage values
01p2anati"n/
The inner printf e6ecutes first to print so!e garbage value# The printf
returns no of characters printed and this value also cannot be predicted#
Still the outer printf prints so!ething and so returns a non:ero value# So
it encounters the brea$ state!ent and co!es out of the while state!ent#
?DC- !ain,-
]
unsigned int iA?DX
while,i::RAD-
printf,OWu O"i-X
^
Ans(er/
?D L F H B @ C 1 2 ? D B@@1@ B@@1CK##
01p2anati"n/
Since i is an unsigned integer it can never beco!e negative# So the
e6pression i:: RAD will always be true" leading to an infinite loop#
?D@- YincludeSconio#hR
!ain,-
]
int 6"yA2""aX
if,6AyW2- A2X
aA2X
printf,OWd Wd O""6-X
^
Ans(er/
(arbage:value D
01p2anati"n/
The value of yW2 is D# This value is assigned to 6# The condition reduces
to if ,6- or in other words if,D- and so goes uninitialied#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
CF
Technical Aptitude Questions
45u'6 #u2e/ ,hec$ all control paths to write bug free code#
?DB- !ain,-
]
int aP?DQX
printf,OWdO";a<?:;a<1-X
^
Ans(er/
C
01p2anati"n/
;a and :;a cancels out# The result is as si!ple as ? < 1 A C !
?DH- Ydefine prod,a"b- a;b
!ain,-
]
int 6A1"yACX
printf,OWdO"prod,6<2"y:?--X
^
Ans(er/
?D
01p2anati"n/
The !acro e6pands and evaluates to as8
6<2;y:? AR 6<,2;y-:? AR ?D
?DF- !ain,-
]
unsigned int iAB@DDDX
while,i<<!AD-X
printf,OWdO"i-X
^
Ans(er/
?
01p2anati"n/
'ote the se!icolon after the while state!ent# Ghen the value of i
beco!es D it co!es out of while loop# Due to post:incre!ent on i the
value of i while printing is ?#

?DL- !ain,-
]
int iADX
while,<,<i::-!AD-
i:Ai<<X
printf,OWdO"i-X
^
Ans(er/
:?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
CL
Technical Aptitude Questions
01p2anati"n/
Qnary 8 is the only dummy operator in ,# So it has no effect on the
e6pression and now the while loop is" while,i::!AD- which is false
and so brea$s out of while loop# The value +? is printed due to the post:
decre!ent operator#

??1- !ain,-
]
float fA@"gA?DX
enu!]iA?D">A2D"$A@D^X
printf,OWdZnO"<<$-X
printf,OWfZnO"fSS2-X
printf,OWlfZnO"fWg-X
printf,OWlfZnO"f!od,f"g--X
^
Ans(er/
2ine no @8 5rror8 2value re0uired
2ine no B8 Cannot apply leftshift to float
2ine no H8 Cannot apply !od to float
01p2anati"n/
5nu!eration constants cannot be !odified" so you cannot apply <<#
*it:wise operators and W operators cannot be applied on float values#
f!od,- is to find the !odulus values for floats as W operator is for ints#
??D- !ain,-
]
int iA?DX
void pascal f,int"int"int-X
f,i<<"i<<"i<<-X
printf,O WdO"i-X
^
void pascal f,integer 8i"integer8>"integer 8$-
]
write,i">"$-X
^
Ans(er/
Co!piler error8 un$nown type integer
Co!piler error8 undeclared function write
01p2anati"n/
7ascal $eyword doesn4t !ean that pascal code can be used# It !eans that
the function follows 7ascal argu!ent passing !echanis! in calling the functions#
???- void pascal f,int i"int >"int $-
]
printf,[Wd Wd Wd\"i" >" $-X
^
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@D
Technical Aptitude Questions
void cdecl f,int i"int >"int $-
]
printf,[Wd Wd Wd\"i" >" $-X
^
!ain,-
]
int iA?DX
f,i<<"i<<"i<<-X
printf,O WdZnO"i-X
iA?DX
f,i<<"i<<"i<<-X
printf,O WdO"i-X
^
Ans(er/
?D ?? ?2 ?1
?2 ?? ?D ?1
01p2anati"n/
7ascal argu!ent passing !echanis! forces the argu!ents to be called
fro! left to right# cdecl is the nor!al C argu!ent passing !echanis! where the
argu!ents are passed fro! right to left#

??2-# Ghat is the output of the progra! given below
!ain,-
]
signed char iADX
for,XiRADXi<<- X
printf,OWdZnO"i-X
^
Ans(er
:?2F
01p2anati"n
'otice the se!icolon at the end of the for loop# T.e initial value of
the i is set to D# The inner loop e6ecutes to incre!ent the value
fro! D to ?2H ,the positive range of char- and then it rotates to the
negative value of :?2F# The condition in the for loop fails and so
co!es out of the for loop# It prints the current value of i that is
:?2F#

??1- !ain,-
]
unsigned char iADX
for,XiRADXi<<- X
printf,OWdZnO"i-X
^
Ans(er
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@?
Technical Aptitude Questions
infinite loop
01p2anati"n
The difference between the previous 0uestion and this one is that the char
is declared to be unsigned# So the i<< can never yield negative value and iRAD
never beco!es false so that it can co!e out of the for loop#
??C- !ain,-
]
char iADX
for,XiRADXi<<- X
printf,OWdZnO"i-X

^
Ans(er/
*ehavior is i!ple!entation dependent#
01p2anati"n/
The detail if the char is signedMunsigned by default is
i!ple!entation dependent# If the i!ple!entation treats the char to be
signed by default the progra! will print +?2F and ter!inate# %n the other
hand if it considers char to be unsigned by default" it goes to infinite loop#
Rule:
Jou can write progra!s that have i!ple!entation dependent
behavior# *ut dont write progra!s that depend on such behavior#
??@- Is the following state!ent a declarationMdefinition# Find what does it !ean`
int ,;6-P?DQX
Ans(er
Definition#
6 is a pointer to array of,sie ?D- integers#
Apply cloc$:wise rule to find the !eaning of this definition#
??B-# Ghat is the output for the progra! given below
typedef enu! errorType]warning" error" e6ception"^errorX
!ain,-
]
error g?X
g?A?X
printf,OWdO"g?-X
^
Ans(er
Co!piler error8 &ultiple declaration for error
01p2anati"n
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@2
Technical Aptitude Questions
The na!e error is used in the two !eanings# %ne !eans that it is a
enu!erator constant with value ?# The another use is that it is a type na!e
,due to typedef- for enu! errorType# (iven a situation the co!piler
cannot distinguish the !eaning of error to $now in what sense the error is
used8
error g?X
g?AerrorX
MM which error it refers in each case`
Ghen the co!piler can distinguish between usages then it will not
issue error ,in pure technical ter!s" na!es can only be overloaded in
different na!espaces-#
N"te8 the e6tra co!!a in the declaration"
enu! errorType]warning" error" e6ception"^
is not an error# An e6tra co!!a is valid and is provided >ust for
progra!!er4s convenience#


??H- typedef struct error]int warning" error" e6ceptionX^errorX
!ain,-
]
error g?X
g?#error A?X
printf,OWdO"g?#error-X
^
Ans(er
?
01p2anati"n
The three usages of na!e errors can be distinguishable by the co!piler at
any instance" so valid ,they are in different na!espaces-#
Typedef struct error]int warning" error" e6ceptionX^errorX
This error can be used only by preceding the error by struct $ayword as in8
struct error so!e5rrorX
typedef struct error]int warning" error" e6ceptionX^errorX
This can be used only after # ,dot- or :R ,arrow- operator preceded by the variable
na!e as in 8
g?#error A?X
printf,OWdO"g?#error-X
typedef struct error]int warning" error" e6ceptionX^errorX
This can be used to define variables without using the preceding struct $eyword
as in8
error g?X
Since the co!piler can perfectly distinguish between these three usages" it is
perfectly legal and valid#
'ote
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@1
Technical Aptitude Questions
This code is given here to >ust e6plain the concept behind# In real
progra!!ing don4t use such overloading of na!es# It reduces the readability of
the code# 7ossible doesn4t !ean that we should use it!

??F- Yifdef so!ething
int so!eADX
Yendif
!ain,-
]
int thing A DX
printf,OWd WdZnO" so!e "thing-X
^
Ans(er/
Co!piler error 8 undefined sy!bol so!e
01p2anati"n/
This is a very si!ple e6a!ple for conditional co!pilation# The
na!e so!ething is not already $nown to the co!piler !a$ing the
declaration
int so!e A DX
effectively re!oved fro! the source code#
??L- Yif so!ething AA D
int so!eADX
Yendif
!ain,-
]
int thing A DX
printf,OWd WdZnO" so!e "thing-X
^
Ans(er
D D
01p2anati"n
This code is to show that preprocessor e6pressions are not the
sa!e as the ordinary e6pressions# If a na!e is not $nown the
preprocessor treats it to be e0ual to ero#
?2D-# Ghat is the output for the following progra!
!ain,-
]
int arr2DP1QP1QX
printf,OWdZnO" ,,arr2DAA; arr2D-UU,; arr2D AA arr2DPDQ-- -X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@C
Technical Aptitude Questions
^
Ans(er
?
01p2anati"n
This is due to the close relation between the arrays and pointers# '
di!ensional arrays are !ade up of ,':?- di!ensional arrays#
arr2D is !ade up of a 1 single arrays that contains 1 integers each #
The na!e arr2D refers to the beginning of all the 1 arrays# ;arr2D
refers to the start of the first ?D array ,of 1 integers- that is the
sa!e address as arr2D# So the e6pression ,arr2D AA ;arr2D- is true
,?-#
Si!ilarly" ;arr2D is nothing but ;,arr2D < D-" adding a ero
doesn4t change the valueM!eaning# Again arr2DPDQ is the another
way of telling ;,arr2D < D-# So the e6pression ,;,arr2D < D- AA
arr2DPDQ- is true ,?-#
Since both parts of the e6pression evaluates to true the result is
true,?- and the sa!e is printed#
?2?- void !ain,-
]
if,aD AA ,unsigned int-:?-
printf,[Jou can answer this if you $now how values are represented in
!e!ory\-X
^
Answer
Jou can answer this if you $now how values are represented in
!e!ory
56planation
a ,tilde operator or bit:wise negation operator- operates on D to
produce all ones to fill the space for an integer# +? is represented in
unsigned value as all ?4s and so both are e0ual#
?22- int swap,int ;a"int ;b-
]
;aA;a<;bX;bA;a:;bX;aA;a:;bX
^
!ain,-
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@@
arr2D
arr2DP?Q
arr2DP2Q
arr2DP1Q
Technical Aptitude Questions
]
int 6A?D"yA2DX
swap,U6"Uy-X
printf,O6A Wd y A WdZnO"6"y-X
^
Answer
6 A 2D y A ?D
56planation
This is one way of swapping two values# Si!ple chec$ing will help
understand this#
?21- !ain,-
]
char ;p A [ay0!\X
printf,[Wc\"<<;,p<<--X
^
Answer8
b
?2C- !ain,-
]
int iA@X
printf,OWdO"<<i<<-X
^
Ans(er/
Co!piler error8 2value re0uired in function !ain
01p2anati"n/
<<i yields an rvalue# For postfi6 << to operate an lvalue is
re0uired#
?2@- !ain,-
]
char ;p A [ay0!\X
char cX
c A <<;p<<X
printf,[Wc\"c-X
^
Ans(er/
b
01p2anati"n/
There is no difference between the e6pression <<;,p<<- and <
<;p<<# 7arenthesis >ust wor$s as a visual clue for the reader to see
which e6pression is first evaluated#
?2B-
int aaa,- ]printf,[.i\-X^
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@B
Technical Aptitude Questions
int bbb,-]printf,[hello\-X^
iny ccc,-]printf,[bye\-X^
!ain,-
]
int , ; ptrP1Q- ,-X
ptrPDQ A aaaX
ptrP?Q A bbbX
ptrP2Q AcccX
ptrP2Q,-X
^
Answer8
b%e
56planation8
int ,; ptrP1Q-,- says that ptr is an array of pointers to functions that ta$es
no argu!ents and returns the type int# *y the assign!ent ptrPDQ A aaaX it
!eans that the first function pointer in the array is initialied with the
address of the function aaa# Si!ilarly" the other two array ele!ents also
get initialied with the addresses of the functions bbb and ccc# Since ptrP2Q
contains the address of the function ccc" the call to the function ptrP2Q,- is
sa!e as calling ccc,-# So it results in printing ObyeO#
?2H-
!ain,-
]
int iA@X
printf,[Wd\"iA<<i AAB-X
^
Ans(er/
1
01p2anati"n/
The e6pression can be treated as i A ,<<iAAB-" because AA is of higher
precedence than A operator# In the inner e6pression" <<i is e0ual to B
yielding true,?-# .ence the result#
?2F- !ain,-
]
char pP QAOWdZnOX
pP?Q A TcTX
printf,p"B@-X
^
Ans(er/
A
01p2anati"n/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@H
Technical Aptitude Questions
Due to the assign!ent pP?Q A 3c4 the string beco!es" [WcZn\# Since this
string beco!es the for!at string for printf and ASCII value of B@ is 3A4"
the sa!e gets printed#

?2L- void , ; abc, int" void , ;def- ,- - - ,-X
Answer88
abc is a ptr to a function which ta$es 2 para!eters #,a-# an integer
variable#,b-# a ptrto a funtion which returns void# the return type of the
function is void#
01p2anati"n/
Apply the cloc$:wise rule to find the result#
?1D- !ain,-
]
while ,strc!p,[so!e\"\so!eZD\--
printf,[Strings are not e0ualZn\-X
^
Ans(er/
'o output
01p2anati"n/
5nding the string constant with ZD e6plicitly !a$es no difference# So
[so!e\ and [so!eZD\ are e0uivalent# So" strc!p returns D ,false- hence
brea$ing out of the while loop#
?1?- !ain,-
]
char str?PQ A ]3s4"4o4"4!4"4e4^X
char str2PQ A ]3s4"4o4"4!4"4e4"4ZD4^X
while ,strc!p,str?"str2--
printf,[Strings are not e0ualZn\-X
^
Ans(er/
[Strings are not e0ual\
[Strings are not e0ual\
K#
01p2anati"n/
If a string constant is initialied e6plicitly with characters" 3ZD4 is not
appended auto!atically to the string# Since str? doesn4t have null
ter!ination" it treats whatever the values that are in the following positions
as part of the string until it rando!ly reaches a 3ZD4# So str? and str2 are
not the sa!e" hence the result#

?12- !ain,-
]
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@F
Technical Aptitude Questions
int i A 1X
for ,Xi<<ADX- printf,[Wd\"i-X
^
Ans(er/
Co!piler 5rror8 2value re0uired#
01p2anati"n/
As we $now that incre!ent operators return rvalues and hence it
cannot appear on the left hand side of an assign!ent operation#

?11- void !ain,-
]
int ;!ptr" ;cptrX
!ptr A ,int;-!alloc,sieof,int--X
printf,[Wd\";!ptr-X
int ;cptr A ,int;-calloc,sieof,int-"?-X
printf,[Wd\";cptr-X
^
Ans(er/
garbage:value D
01p2anati"n/
The !e!ory space allocated by !alloc is uninitialied" whereas calloc
returns the allocated !e!ory space initialied to eros#
?1C- void !ain,-
]
static int iX
while,iSA?D-
,iR2-`i<<8i::X
printf,[Wd\" i-X
^
Ans(er/
12HBH
01p2anati"n/
Since i is static it is initialied to D# Inside the while loop the conditional
operator evaluates to false" e6ecuting i::# This continues till the integer
value rotates to positive value ,12HBH-# The while condition beco!es false
and hence" co!es out of the while loop" printing the i value#
?1@- !ain,-
]
int iA?D">A2DX
> A i" >`,i">-`i8>8>X
printf,OWd WdO"i">-X
^
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
@L
Technical Aptitude Questions
Ans(er/
?D ?D
01p2anati"n/
The Ternary operator , ` 8 - is e0uivalent for if:then:else state!ent# So the
0uestion can be written as8
if,i">-
]
if,i">-
> A iX
else
> A >X
^
else
> A >X
?1B- ?# const char ;aX
2# char; const aX
1# char const ;aX
:Differentiate the above declarations#
Ans(er/
?# TconstT applies to char ; rather than TaT , pointer to a constant char -
;aATFT 8 illegal
aAO.iO 8 legal
2# TconstT applies to TaT rather than to the value of a ,constant pointer to
char -
;aATFT 8 legal
aAO.iO 8 illegal
1# Sa!e as ?#
?1H- !ain,-
]
int iA@">A?DX
iAiUA>UU?DX
printf,OWd WdO"i">-X
^
Ans(er/
? ?D
01p2anati"n/
The e6pression can be written as iA,iUA,>UU?D--X The inner e6pression
,>UU?D- evaluates to ? because >AA?D# i is @# i A @U? is ?# .ence the
result#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
BD
Technical Aptitude Questions
?1F- !ain,-
]
int iAC">AHX
> A > VV i<< UU printf,OJ%= CA'O-X
printf,OWd WdO" i" >-X
^
Ans(er/
C ?
01p2anati"n/
Dhe .oolean expression needs to .e evaluated only till the truth value of
the expression is not 'nown. > is not e0ual to ero itself !eans that the
e6pression4s truth value is ?# *ecause it is followed by VV and true SS
2anything4 IV true where 2anything4 will not .e evaluated. So the
re!aining e6pression is not evaluated and so the value of i re!ains the
sa!e#
Si!ilarly when UU operator is involved in an e6pression" when any of the
operands beco!e false" the whole e6pression4s truth value beco!es false
and hence the re!aining e6pression will not be evaluated#
false (( 2anything4 IV false where 2anything4 will not .e evaluated.
?1L- !ain,-
]
register int aA2X
printf,OAddress of a A WdO"Ua-X
printf,O/alue of a A WdO"a-X
^
Ans(er/
Co!pier 5rror8 TUT on register variable
#u2e t" #e'e'6er/
3 7address "8 9 "perat"r cann"t 6e app2ied "n re*ister varia62es.
?CD- !ain,-
]
float iA?#@X
switch,i-
]
case ?8 printf,O?O-X
case 28 printf,O2O-X
default 8 printf,ODO-X
^
^
Ans(er/
Co!piler 5rror8 switch e6pression not integral
01p2anati"n/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
B?
Technical Aptitude Questions
$witch statements can .e applied only to integral types.
?C?- !ain,-
]
e6tern iX
printf,OWdZnO"i-X
]
int iA2DX
printf,OWdZnO"i-X
^
^
Ans(er/
2in$er 5rror 8 =nresolved e6ternal sy!bol i
01p2anati"n/
The identifier i is available in the inner bloc$ and so using e6tern has no
use in resolving it#
?C2- !ain,-
]
int aA2";f?";f2X
f?Af2AUaX
;f2<A;f2<Aa<A2#@X
printf,OZnWd Wd WdO"a";f?";f2-X
^
Ans(er/
?B ?B ?B
01p2anati"n/
f? and f2 both refer to the sa!e !e!ory location a# So changes through f?
and f2 ulti!ately affects only the value of a#
?C1- !ain,-
]
char ;pAO(%%DOX
char aP QAO(%%DOX
printf,OZn sieof,p- A Wd" sieof,;p- A Wd" strlen,p- A WdO" sieof,p-"
sieof,;p-" strlen,p--X
printf,OZn sieof,a- A Wd" strlen,a- A WdO" sieof,a-" strlen,a--X
^
Ans(er/
sieof,p- A 2" sieof,;p- A ?" strlen,p- A C
sieof,a- A @" strlen,a- A C
01p2anati"n/
sieof,p- AR sieof,char;- AR 2
sieof,;p- AR sieof,char- AR ?
Si!ilarly"
sieof,a- AR sie of the character array AR @
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
B2
Technical Aptitude Questions
When siCeof operator is applied to an array it returns the siCeof the array
and it is not the sa!e as the sieof the pointer variable# .ere the sieof,a-
where a is the character array and the sie of the array is @ because the
space necessary for the ter!inating '=22 character should also be ta$en
into account#
?CC- Ydefine DI&, array" type- sieof,array-Msieof,type-
!ain,-
]
int arrP?DQX
printf,[The di!ension of the array is Wd\" DI&,arr" int--X
^
Ans(er/
?D
01p2anati"n/
The sie of integer array of ?D ele!ents is ?D ; sieof,int-# The !acro
e6pands to sieof,arr-Msieof,int- AR ?D ; sieof,int- M sieof,int- AR ?D#
?C@- int DI&,int arrayPQ-
]
return sieof,array-Msieof,int -X
^
!ain,-
]
int arrP?DQX
printf,[The di!ension of the array is Wd\" DI&,arr--X
^
Ans(er/
?
01p2anati"n/
6rrays cannot .e passed to functions as arguments and only the pointers
can .e passed# So the argu!ent is e0uivalent to int ; array ,this is one of
the very few places where PQ and ; usage are e0uivalent-# The return
state!ent beco!es" sieof,int ;-M sieof,int- that happens to be e0ual in
this case#
?CB- !ain,-
]
static int aP1QP1QA]?"2"1"C"@"B"H"F"L^X
int i">X
static ;pPQA]a"a<?"a<2^X
for,iADXiS1Xi<<-
]
for,>ADX>S1X><<-
printf,OWdZtWdZtWdZtWdZnO";,;,p<i-<>-"
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
B1
Technical Aptitude Questions
;,;,><p-<i-";,;,i<p-<>-";,;,p<>-<i--X
^
^
Ans(er/
? ? ? ?
2 C 2 C
1 H 1 H
C 2 C 2
@ @ @ @
B F B F
H 1 H 1
F B F B
L L L L
01p2anati"n/
;,;,p<i-<>- is e0uivalent to pPiQP>Q#
?CH- !ain,-
]
void swap,-X
int 6A?D"yAFX
swap,U6"Uy-X
printf,O6AWd yAWdO"6"y-X
^
void swap,int ;a" int ;b-
]
;a 9A ;b" ;b 9A ;a" ;a 9A ;bX
^
Ans(er/
6A?D yAF
01p2anati"n/
=sing 9 li$e this is a way to swap two variables without using a te!porary
variable and that too in a single state!ent#
Inside !ain,-" void swap,-X !eans that swap is a function that !ay ta$e
any nu!ber of argu!ents ,not no argu!ents- and returns nothing# So this
doesn4t issue a co!piler error by the call swap,U6"Uy-X that has two
argu!ents#
This convention is historically due to pre:A'SI style ,referred to as
_ernighan and )itchie style- style of function declaration# In that style" the
swap function will be defined as follows"
void swap,-
int ;a" int ;b
]
;a 9A ;b" ;b 9A ;a" ;a 9A ;bX
^
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
BC
Technical Aptitude Questions
where the argu!ents follow the ,-# So naturally the declaration for swap
will loo$ li$e" void swap,- which !eans the swap can ta$e any nu!ber of
argu!ents#
?CF- !ain,-
]
int i A 2@HX
int ;i7tr A UiX
printf,OWd WdO" ;,,char;-i7tr-" ;,,char;-i7tr<?- -X
^
Ans(er/
? ?
01p2anati"n/
The integer value 2@H is stored in the !e!ory as" DDDDDDD? DDDDDDD?" so
the individual bytes are ta$en by casting it to char ; and get printed#
?CL- !ain,-
]
int i A 2@FX
int ;i7tr A UiX
printf,OWd WdO" ;,,char;-i7tr-" ;,,char;-i7tr<?- -X
^
Ans(er/
2 ?
01p2anati"n/
The integer value 2@H can be represented in binary as" DDDDDDD?
DDDDDDD?# )e!e!ber that the I'T52 !achines are 3s!all:endian4
!achines# $mall3endian means that the lower order .ytes are stored in the
higher memory addresses and the higher order .ytes are stored in lower
addresses# The integer value 2@F is stored in !e!ory as8 DDDDDDD?
DDDDDD?D#
?@D- !ain,-
]
int iA1DDX
char ;ptr A UiX
;<<ptrA2X
printf,OWdO"i-X
^
Ans(er/
@@B
01p2anati"n/
The integer value 1DD in binary notation is8 DDDDDDD? DD?D??DD# It is
stored in !e!ory ,s!all:endian- as8 DD?D??DD DDDDDDD?# )esult of the
e6pression ;<<ptr A 2 !a$es the !e!ory representation as8 DD?D??DD
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
B@
Technical Aptitude Questions
DDDDDD?D# So the integer corresponding to it is DDDDDD?D DD?D??DD AR
@@B#
?@?- Yinclude Sstdio#hR
!ain,-
]
char ; str A OhelloOX
char ; ptr A strX
char least A ?2HX
while ,;ptr<<-
least A ,;ptrSleast - `;ptr 8leastX
printf,OWdO"least-X
^
Ans(er/
D
01p2anati"n/
After 3ptr4 reaches the end of the string the value pointed by 3str4 is 3ZD4#
So the value of 3str4 is less than that of 3least4# So the value of 3least4
finally is D#
?@2- Declare an array of ' pointers to functions returning pointers to functions
returning pointers to characters`
Ans(er/
,char;,;-, -- ,;ptrP'Q-, -X
?@1- !ain,-
]
struct student
]
char na!eP1DQX
struct date dobX
^studX
struct date
]
int day"!onth"yearX
^X
scanf,OWsWdWdWdO" stud#rollno" Ustudent#dob#day"
Ustudent#dob#!onth" Ustudent#dob#year-X
^
Ans(er/
Co!piler 5rror8 =ndefined structure date
01p2anati"n/
Inside the struct definition of 3student4 the !e!ber of type struct date is
given# The co!piler doesn4t have the definition of date structure ,forward
reference is not allowed in C in this case- so it issues an error#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
BB
Technical Aptitude Questions
?@C- !ain,-
]
struct dateX
struct student
]
char na!eP1DQX
struct date dobX
^studX
struct date
]
int day"!onth"yearX
^X
scanf,OWsWdWdWdO" stud#rollno" Ustudent#dob#day" Ustudent#dob#!onth"
Ustudent#dob#year-X
^
Ans(er/
Co!piler 5rror8 =ndefined structure date
01p2anati"n/
%nly declaration of struct date is available inside the structure definition
of 3student4 but to have a variable of type struct date the definition of the
structure is re0uired#
?@@- There were ?D records stored in [so!efile#dat\ but the following progra! printed
?? na!es# Ghat went wrong`
void !ain,-
]
struct student
]
char na!eP1DQ" rollnoPBQX
^studX
FI25 ;fp A fopen,[so!efile#dat\"\r\-X
while,!feof,fp--
]
fread,Ustud" sieof,stud-" ? " fp-X
puts,stud#na!e-X
^
^
01p2anati"n/
fread reads ?D records and prints the na!es successfully# It will
return 5%F only when fread tries to read another record and fails
reading 5%F ,and returning 5%F-# So it prints the last record
again# After this only the condition feof,fp- beco!es false" hence
co!es out of the while loop#
?@B- Is there any difference between the two declarations"
?# int foo,int ;arrPQ- and
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
BH
Technical Aptitude Questions
2# int foo,int ;arrP2Q-
Ans(er/
'o
01p2anati"n/
Functions can only pass pointers and not arrays# The nu!bers that are
allowed inside the PQ is >ust for !ore readability# So there is no difference
between the two declarations#
?@H- Ghat is the subtle error in the following code seg!ent`
void fun,int n" int arrPQ-
]
int ;pADX
int iADX
while,i<<Sn-
p A UarrPiQX
;p A DX
^
Ans(er 3 01p2anati"n/
If the body of the loop never e6ecutes p is assigned no address# So
p re!ains '=22 where ;p AD !ay result in proble! ,!ay rise to
runti!e error ['=22 pointer assign!ent\ and ter!inate the
progra!-#
?@F- Ghat is wrong with the following code`
int ;foo,-
]
int ;s A !alloc,sieof,int-?DD-X
assert,s !A '=22-X
return sX
^
Ans(er 3 01p2anati"n/
assert !acro should be used for debugging and finding out bugs# The
chec$ s !A '=22 is for errorMe6ception handling and for that assert
shouldn4t be used# A plain if and the corresponding re!edy state!ent has
to be given#
?@L- Ghat is the hidden bug with the following state!ent`
assert,val<< !A D-X
Ans(er 3 01p2anati"n/
Assert !acro is used for debugging and re!oved in release version# In
assert" the e6perssion involves side:effects# So the behavior of the code
beco!es different in case of debug version and the release version thus
leading to a subtle bug#
#u2e t" #e'e'6er/
!onFt use expressions that have side3effects in assert statements.
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
BF
Technical Aptitude Questions
?BD- void !ain,-
]
int ;i A D6CDDX MM i points to the address CDD
;i A DX MM set the value of !e!ory location pointed by iX
^
Ans(er/
=ndefined behavior
01p2anati"n/
The second state!ent results in undefined behavior because it points to
so!e location whose value !ay not be available for !odification# Dhis
type of pointer in which the non3availa.ility of the implementation of the
referenced location is 'nown as Wincomplete typeW#
?B?- Ydefine assert,cond- if,!,cond-- Z
,fprintf,stderr" Oassertion failed8 Ws" file Ws" line Wd ZnO"Ycond"Z
NNFI25NN"NN2I'5NN-" abort,--
void !ain,-
]
int i A ?DX
if,iAAD-
assert,i S ?DD-X
else
printf,OThis state!ent beco!es else for if in assert !acroO-X
^
Answer8
'o output
01p2anati"n/
The else part in which the printf is there beco!es the else for if in the assert
!acro# .ence nothing is printed#
The solution is to use conditional operator instead of if state!ent"
Ydefine assert,cond- ,,cond-`,D-8 ,fprintf ,stderr" Oassertion failed8 Z Ws" file Ws"
line Wd ZnO"Ycond" NNFI25NN"NN2I'5NN-" abort,---
'ote8
.owever this proble! of [!atching with nearest else\ cannot be solved
by the usual !ethod of placing the if state!ent inside a bloc$ li$e this"
Ydefine assert,cond- ] Z
if,!,cond-- Z
,fprintf,stderr" Oassertion failed8 Ws" file Ws" line Wd ZnO"Ycond"Z
NNFI25NN"NN2I'5NN-" abort,-- Z
^
?B2- Is the following code legal`
struct a
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
BL
Technical Aptitude Questions
]
int 6X
struct a bX
^
Answer8
'o
01p2anati"n/
Is it not legal for a structure to contain a !e!ber that is of the sa!e
type as in this case# *ecause this will cause the structure declaration to be
recursive without end#
?B1- Is the following code legal`
struct a
]
int 6X
struct a ;bX
^
Ans(er/
Jes#
01p2anati"n/
;b is a pointer to type struct a and so is legal# The co!piler $nows" the
sie of the pointer to a structure even before the sie of the structure
is deter!ined,as you $now the pointer to any type is of sa!e sie-# This
type of structures is $nown as 3self:referencing4 structure#
?BC- Is the following code legal`
typedef struct a
]
int 6X
aType ;bX
^aType
Ans(er/
'o
01p2anati"n/
The typena!e aType is not $nown at the point of declaring the structure
,forward references are not !ade for typedefs-#
?B@- Is the following code legal`
typedef struct a aTypeX
struct a
]
int 6X
aType ;bX
^X
Ans(er/
Jes
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
HD
Technical Aptitude Questions
01p2anati"n/
The typena!e aType is $nown at the point of declaring the structure"
because it is already typedefined#
?BB- Is the following code legal`
void !ain,-
]
typedef struct a aTypeX
aType so!e/ariableX
struct a
]
int 6X
aType ;bX
^X
^
Ans(er/
'o
01p2anati"n/
Ghen the declaration"
typedef struct a aTypeX
is encountered body of struct a is not $nown# This is $nown as 3inco!plete
types4#

?BH- void !ain,-
]
printf,[sieof ,void ;- A Wd Zn[" sieof, void ;--X
printf,[sieof ,int ;- A Wd Zn\" sieof,int ;--X
printf,[sieof ,double ;- A Wd Zn\" sieof,double ;--X
printf,[sieof,struct un$nown ;- A Wd Zn\" sieof,struct un$nown ;--X
^
Ans(er /
sieof ,void ;- A 2
sieof ,int ;- A 2
sieof ,double ;- A 2
sieof,struct un$nown ;- A 2
01p2anati"n/
The pointer to any type is of sa!e sie#
?BF- char inputStringP?DDQ A ]D^X
To get string input fro! the $eyboard which one of the following is better`
?- gets,inputString-
2- fgets,inputString" sieof,inputString-" fp-
Ans(er 3 01p2anati"n/
The second one is better because gets,inputString- doesnTt $now the sie
of the string passed and so" if a very big input ,here" !ore than ?DD chars-
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
H?
Technical Aptitude Questions
the charactes will be written past the input string# Ghen fgets is used with
stdin perfor!s the sa!e operation as gets but is safe#
?BL- Ghich version do you prefer of the following two"
?- printf,[Ws\"str-X MM or the !ore curt one
2- printf,str-X
Ans(er 3 01p2anati"n/
7refer the first one# If the str contains any for!at characters li$e Wd then
it will result in a subtle bug#
?HD- void !ain,-
]
int iA?D" >A2X
int ;ipA Ui" ;>p A U>X
int $ A ;ipM;>pX
printf,[Wd\"$-X
^
Ans(er/
Co!piler 5rror8 [=ne6pected end of file in co!!ent started in line @\#
01p2anati"n/
The progra!!er intended to divide two integers" but by the
[!a6i!u! !unch\ rule" the co!piler treats the operator
se0uence M and ; as M; which happens to be the starting of
co!!ent# To force what is intended by the progra!!er"
int $ A ;ipM ;>pX
MM give space e6plicity separating M and ;
MMor
int $ A ;ipM,;>p-X
MM put braces to force the intention
will solve the proble!#
?H?- void !ain,-
]
char chX
for,chADXchSA?2HXch<<-
printf,[Wc Wd Zn[" ch" ch-X
^
Ans(er/
I!ple!entaion dependent
01p2anati"n/
The char type !ay be signed or unsigned by default# If it is signed then
ch<< is e6ecuted after ch reaches ?2H and rotates bac$ to :?2F# Thus ch is
always s!aller than ?2H#
?H2- Is this code legal`
int ;ptrX
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
H2
Technical Aptitude Questions
ptr A ,int ;- D6CDDX
Ans(er/
Jes
01p2anati"n/
The pointer ptr will point at the integer in the !e!ory location D6CDD#
?H1- !ain,-
]
char aPCQAO.522%OX
printf,OWsO"a-X
^
Ans(er/
Co!piler error8 Too !any initialiers
01p2anati"n/
The array a is of sie C but the string constant re0uires B bytes to get
stored#
?HC- !ain,-
]
char aPCQAO.522OX
printf,OWsO"a-X
^
Ans(er/
.522Wb!ab!b```baa!
01p2anati"n/
The character array has the !e!ory >ust enough to hold the string
[.522\ and doesnt have enough space to store the ter!inating null
character# So it prints the .522 correctly and continues to print garbage
values till it accidentally co!es across a '=22 character#
?H@- !ain,-
]
int aA?D";>X
void ;$X
>A$AUaX
><<X
$<<X
printf,OZn Wu Wu O">"$-X
^
Ans(er/
Co!piler error8 Cannot incre!ent a void pointer
01p2anati"n/
/oid pointers are generic pointers and they can be used only when the
type is not $nown and as an inter!ediate address storage type# 'o pointer
arith!etic can be done on it and you cannot apply indirection operator ,;-
on void pointers#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
H1
Technical Aptitude Questions
?HB- !ain,-
]
e6tern int iX
] int iA2DX
]
const volatile unsigned iA1DX printf,OWdO"i-X
^
printf,OWdO"i-X
^
printf,OWdO"i-X
^
int iX
?HH- 7rintf can be i!ple!ented by using NNNNNNNNNN list#
Ans(er/
/ariable length argu!ent lists
?HF- char ;so!eFun,-
]
char ;te!p A [string constantOX
return te!pX
^
int !ain,-
]
puts,so!eFun,--X
^
Answer8
string constant
01p2anati"n8
The progra! suffers no proble! and gives the output correctly because the
character constants are stored in codeMdata area and not allocated in stac$" so this doesn4t
lead to dangling pointers#
?HL- char ;so!eFun?,-
]
char te!pP Q A [stringOX
return te!pX
^
char ;so!eFun2,-
]
char te!pP Q A ]3s4" 3t4"4r4"4i4"4n4"4g4^X
return te!pX
^
int !ain,-
]
puts,so!eFun?,--X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
HC
Technical Aptitude Questions
puts,so!eFun2,--X
^
Answer8
(arbage values#
01p2anati"n8
*oth the functions suffer fro! the proble! of dangling pointers# In so!eFun?,-
te!p is a character array and so the space for it is allocated in heap and is initialied with
character string [string\# This is created dyna!ically as the function is called" so is also
deleted dyna!ically on e6iting the function so the string data is not available in the
calling function !ain,- leading to print so!e garbage values# The function so!eFun2,-
also suffers fro! the sa!e proble! but the proble! can be easily identified in this case#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
H@
Technical Aptitude Questions
C<< Aptitude and %%7S
'ote 8 All the progra!s are tested under Turbo C<< 1#D" C#@ and &icrosoft /C<< B#D
co!pilers#
It is assu!ed that"
7rogra!s run under Gindows environ!ent"
The underlying !achine is an 6FB based syste!"
7rogra! is co!piled using Turbo CMC<< co!piler#
The progra! output !ay depend on the infor!ation based on this assu!ptions
,for e6a!ple sieof,int- AA 2 !ay be assu!ed-#
?- class Sa!ple
]
public8
int ;ptrX
Sa!ple,int i-
]
ptr A new int,i-X
^
aSa!ple,-
]
delete ptrX
^
void 7rint/al,-
]
cout SS OThe value is O SS ;ptrX
^
^X
void So!eFunc,Sa!ple 6-
]
cout SS OSay i a! in so!eFunc O SS endlX
^
int !ain,-
]
Sa!ple s?A ?DX
So!eFunc,s?-X
s?#7rint/al,-X
^
Ans(er/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
HB
C++ Aptitude
and OOPS

Technical Aptitude Questions
Say i a! in so!eFunc
'ull pointer assign!ent,)un:ti!e error-
01p2anati"n8
As the ob>ect is passed by value to So!eFunc the destructor of the ob>ect is
called when the control returns fro! the function# So when 7rint/al is called it !eets up
with ptr that has been freed#The solution is to pass the Sa!ple ob>ect by reference to
So!eFunc8
void So!eFunc,Sa!ple U6-
]
cout SS OSay i a! in so!eFunc O SS endlX
^
because when we pass ob>ects by refernece that ob>ect is not destroyed# while returning
fro! the function#
2- Ghich is the para!eter that is added to every non:static !e!ber function when it is
called`
Ans(er/
3this4 pointer
1- class base
]
public8
int bvalX
base,-] bvalADX^
^X
class deri8public base
]
public8
int dvalX
deri,-] dvalA?X^
^X
void So!eFunc,base ;arr"int sie-
]
for,int iADX iSsieX i<<"arr<<-
coutSSarr:RbvalX
coutSSendlX
^
int !ain,-
]
base *aseArrP@QX
So!eFunc,*aseArr"@-X
deri DeriArrP@QX
So!eFunc,DeriArr"@-X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
HH
Technical Aptitude Questions
^
Ans(er/
DDDDD
D?D?D
01p2anati"n/
The function So!eFunc e6pects two argu!ents#The first one is a pointer to an
array of base class ob>ects and the second one is the sieof the array#The first call of
so!eFunc calls it with an array of bae ob>ects" so it wor$s correctly and prints the bval of
all the ob>ects# Ghen So!efunc is called the second ti!e the argu!ent passed is the
pointeer to an array of derived class ob>ects and not the array of base class ob>ects# *ut
that is what the function e6pects to be sent# So the derived class pointer is pro!oted to
base class pointer and the address is sent to the function# So!eFunc,- $nows nothing
about this and >ust treats the pointer as an array of base class ob>ects# So when arr<< is
!et" the sie of base class ob>ect is ta$en into consideration and is incre!ented by
sieof,int- bytes for bval ,the deri class ob>ects have bval and dval as !e!bers and so is
of sie RA sieof,int-<sieof,int- -#
C- class base
]
public8
void baseFun,-] coutSSOfro! baseOSSendlX^
^X
class deri8public base
]
public8
void baseFun,-] coutSS Ofro! derivedOSSendlX^
^X
void So!eFunc,base ;base%b>-
]
base%b>:RbaseFun,-X
^
int !ain,-
]
base base%b>ectX
So!eFunc,Ubase%b>ect-X
deri deri%b>ectX
So!eFunc,Uderi%b>ect-X
^
Ans(er/
fro! base
fro! base
01p2anati"n/
As we have seen in the previous case" So!eFunc e6pects a pointer to a base class#
Since a pointer to a derived class ob>ect is passed" it treats the argu!ent only as a base
class pointer and the corresponding base function is called#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
HF
Technical Aptitude Questions
@- class base
]
public8
virtual void baseFun,-] coutSSOfro! baseOSSendlX^
^X
class deri8public base
]
public8
void baseFun,-] coutSS Ofro! derivedOSSendlX^
^X
void So!eFunc,base ;base%b>-
]
base%b>:RbaseFun,-X
^
int !ain,-
]
base base%b>ectX
So!eFunc,Ubase%b>ect-X
deri deri%b>ectX
So!eFunc,Uderi%b>ect-X
^
Ans(er/
fro! base
fro! derived
01p2anati"n/
)e!e!ber that baseFunc is a virtual function# That !eans that it supports run:
ti!e poly!orphis!# So the function corresponding to the derived class ob>ect is called#
void !ain,-
]
int a" ;pa" UraX
pa A UaX
ra A aX
cout SSOaAOSSa SSO;paAOSS;pa SSOraOSSra X
^
M;
Answer 8
Co!piler 5rror8 TraT"reference !ust be initialied
56planation 8
7ointers are different fro! references# %ne of the !ain
differences is that the pointers can be both initialied and assigned"
whereas references can only be initialied# So this code issues an error#
;M
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
HL
Technical Aptitude Questions
const int sie A @X
void print,int ;ptr-
]
coutSSptrPDQX
^
void print,int ptrPsieQ-
]
coutSSptrPDQX
^
void !ain,-
]
int aPsieQ A ]?"2"1"C"@^X
int ;b A new int,sie-X
print,a-X
print,b-X
^
M;
Answer8
Co!piler 5rror 8 function Tvoid print,int ;-T already has a body
56planation8
Arrays cannot be passed to functions" only pointers ,for arrays" base addresses-
can be passed# So the argu!ents int ;ptr and int prtPsieQ have no difference
as function argu!ents# In other words" both the functoins have the sa!e signature and
so cannot be overloaded#
;M
class so!e]
public8
aso!e,-
]
coutSSOso!eTs destructorOSSendlX
^
^X
void !ain,-
]
so!e sX
s#aso!e,-X
^
M;
Answer8
so!eTs destructor
so!eTs destructor
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
FD
Technical Aptitude Questions
56planation8
Destructors can be called e6plicitly# .ere Ts#aso!e,-T e6plicitly calls the
destructor of TsT# Ghen !ain,- returns" destructor of s is called again"
hence the result#
;M
Yinclude Siostrea!#hR
class fig2d
]
int di!?X
int di!2X
public8
fig2d,- ] di!?A@X di!2ABX^
virtual void operatorSS,ostrea! U rhs-X
^X
void fig2d88operatorSS,ostrea! Urhs-
]
rhs SSthis:Rdi!?SSO OSSthis:Rdi!2SSO OX
^
M;class fig1d 8 public fig2d
]
int di!1X
public8
fig1d,- ] di!1AHX^
virtual void operatorSS,ostrea! Urhs-X
^X
void fig1d88operatorSS,ostrea! Urhs-
]
fig2d88operator SS,rhs-X
rhsSSthis:Rdi!1X
^
;M
void !ain,-
]
fig2d ob>?X
MM fig1d ob>2X
ob>? SS coutX
MM ob>2 SS coutX
^
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
F?
Technical Aptitude Questions
M;
Answer 8
@ B
56planation8
In this progra!" the SS operator is overloaded with ostrea! as argu!ent#
This enables the TcoutT to be present at the right:hand:side# 'or!ally" TcoutT
is i!ple!ented as global function" but it doesnTt !ean that TcoutT is not possible
to be overloaded as !e!ber function#
%verloading SS as virtual !e!ber function beco!es handy when the class in which
it is overloaded is inherited" and this beco!es available to be overrided# This is as
opposed
to global friend functions" where friendTs are not inherited#
;M
class op%verload]
public8
bool operatorAA,op%verload te!p-X
^X
bool op%verload88operatorAA,op%verload te!p-]
if,;this AA te!p -]
coutSSOThe both are sa!e ob>ectsZnOX
return trueX
^
else]
coutSSOThe both are differentZnOX
return falseX
^
^
void !ain,-]
op%verload a?" a2X
a?A Aa2X
^
Answer 8
)unti!e 5rror8 Stac$ %verflow
56planation 8
Eust li$e nor!al functions" operator functions can be called recursively# This
progra! >ust illustrates that point" by calling the operator AA function recursively" leading
to an infinite loop#
class co!ple6]
double reX
double i!X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
F2
Technical Aptitude Questions
public8
co!ple6,- 8 re,?-"i!,D#@- ]^
bool operatorAA,co!ple6 Urhs-X
operator int,-]^
^X
bool co!ple688operator AA ,co!ple6 Urhs-]
if,,this:Rre AA rhs#re- UU ,this:Ri! AA rhs#i!--
return trueX
else
return falseX
^
int !ain,-]
co!ple6 c?X
coutSS c?X
^
Answer 8 (arbage value
56planation8
The progra!!er wishes to print the co!ple6 ob>ect using output
re:direction operator"which he has not defined for his lass#*ut the co!piler instead of
giving an error sees the conversion function
and converts the user defined ob>ect to standard ob>ect and prints
so!e garbage value#
class co!ple6]
double reX
double i!X
public8
co!ple6,- 8 re,D-"i!,D- ]^
co!ple6,double n- ] reAn"i!AnX^X
co!ple6,int !"int n- ] reA!"i!AnX^
void print,- ] coutSSreX coutSSi!X^
^X
void !ain,-]
co!ple6 c1X
double iA@X
c1 A iX
c1#print,-X
^
Answer8
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
F1
Technical Aptitude Questions
@"@
56planation8
Though no operatorA function ta$ing co!ple6" double is defined" the double on
the rhs is converted into a te!porary ob>ect using the single argu!ent constructor ta$ing
double and assigned to the lvalue#
void !ain,-
]
int a" ;pa" UraX
pa A UaX
ra A aX
cout SSOaAOSSa SSO;paAOSS;pa SSOraOSSra X
^
Answer 8
Co!piler 5rror8 TraT"reference !ust be initialied
56planation 8
7ointers are different fro! references# %ne of the !ain
differences is that the pointers can be both initialied and assigned"
whereas references can only be initialied# So this code issues an error#
4r+ it :"urse28
?- Deter!ine the output of the TC<<T Codelet#
class base
]
public 8
out,-
]
coutSSObase OX
^
^X
class deri]
public 8 out,-
]
coutSSOderi OX
^
^X
void !ain,-
] deri dpP1QX
base ;bp A ,base;-dpX
for ,int iADX iS1Xi<<-
,bp<<-:Rout,-X
^
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
FC
Technical Aptitude Questions
2- Eustify the use of virtual constructors and destructors in C<<#
1- 5ach C<< ob>ect possesses the C !e!ber fns",which can be declared by the
progra!!er e6plicitly or by the i!ple!entation if they are not available-# Ghat are
those C functions`
C- Ghat is wrong with this class declaration`
class so!ething
]
char ;strX
public8
so!ething,-]
st A new charP?DQX ^
aso!ething,-
]
delete strX
^
^X
@- Inheritance is also $nown as :::::::: relationship# Containership as NNNNNNNN
relationship#
B- Ghen is it necessary to use !e!ber:wise initialiation list ,also $nown as header
initialiation list- in C<<`
H- Ghich is the only operator in C<< which can be overloaded but '%T inherited#
F- Is there anything wrong with this C<< class declaration`
class te!p
]
int value?X
!utable int value2X
public 8
void fun,int val-
const]
,,te!p;- this-:Rvalue? A ?DX
value2 A ?DX
^
^X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
F@
Technical Aptitude Questions
1. What is a modifier?
Ans(er/
A !odifier" also called a !odifying function is a !e!ber function that changes the
value of at least one data !e!ber# In other words" an operation that !odifies the state of
an ob>ect# &odifiers are also $nown as 3!utators4#
2. What is an accessor?
Ans(er/
An accessor is a class operation that does not !odify the state of an ob>ect# The
accessor functions need to be declared as const operations
3. !ifferentiate .etween a template class and class template.
Ans(er/
4e'p2ate c2ass/
A generic definition or a para!eteried class not instantiated until the client
provides the needed infor!ation# It4s >argon for plain te!plates#
C2ass te'p2ate/
A class te!plate specifies how individual classes can be constructed !uch li$e
the way a class specifies how individual ob>ects can be constructed# It4s >argon for plain
classes#
*. When does a name clash occur?
Ans(er/
A na!e clash occurs when a na!e is defined in !ore than one place# For
e6a!ple#" two different class libraries could give two different classes the sa!e na!e# If
you try to use !any class libraries at the sa!e ti!e" there is a fair chance that you will be
unable to co!pile or lin$ the progra! because of na!e clashes#
-. !efine namespace.
Ans(er/
It is a feature in c<< to !ini!ie na!e collisions in the global na!e space# This
na!espace $eyword assigns a distinct na!e to a library that allows other libraries to use
the sa!e identifier na!es without creating any na!e collisions# Further!ore" the
co!piler uses the na!espace signature for differentiating the definitions#
0. What is the use of XusingF declaration.
Ans(er/
A using declaration !a$es it possible to use a na!e fro! a na!espace without the
scope operator#
5. What is an +terator class?
Ans(er/
A class that is used to traverse through the ob>ects !aintained by a container
class# There are five categories of iterators8
input iterators"
output iterators"
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
FB
Technical Aptitude Questions
forward iterators"
bidirectional iterators"
rando! access#
An iterator is an entity that gives access to the contents of a container ob>ect
without violating encapsulation constraints# Access to the contents is granted on a one:at:
a:ti!e basis in order# The order can be storage order ,as in lists and 0ueues- or so!e
arbitrary order ,as in array indices- or according to so!e ordering relation ,as in an
ordered binary tree-# The iterator is a construct" which provides an interface that" when
called" yields either the ne6t ele!ent in the container" or so!e value denoting the fact that
there are no !ore ele!ents to e6a!ine# Iterators hide the details of access to and update
of the ele!ents of a container class#
The si!plest and safest iterators are those that per!it read:only access to the
contents of a container class# The following code frag!ent shows how an iterator !ight
appear in code8
contNiter8Anew contNiterator,-X
68AcontNiter#ne6t,-X
while 6MAnone do
###
s,6-X
###
68AcontNiter#ne6t,-X
endX
In this e6a!ple" contNiter is the na!e of the iterator# It is created on the first line by
instantiation of contNiterator class" an iterator class defined to iterate over so!e container
class" cont# Succesive ele!ents fro! the container are carried to 6# The loop ter!inates
when 6 is bound to so!e e!pty value# ,.ere" none-In the !iddle of the loop" there is s,6-
an operation on 6" the current ele!ent fro! the container# The ne6t ele!ent of the
container is obtained at the botto! of the loop#
?. List out some of the EE!"#$ availa.le.
Ans(er/
(5&ST%'5M%7A2 of (e!stone syste!s#
%'T%S of %ntos#
%b>ectivity of %b>ectivity inc#
/ersant of /ersant ob>ect technology#
%b>ect store of %b>ect Design#
A)D5'T of A)D5'T software#
7%5T of 7%5T software#
1@. List out some of the o.ject3oriented methodologies.
Ans(er/
%b>ect %riented Develop!ent ,%%D- ,*ooch ?LL?"?LLC-#
%b>ect %riented Analysis and Design ,%%AMD- ,Coad and Jourdon ?LL?-#
%b>ect &odelling Techni0ues ,%&T- ,)u!baugh ?LL?-#
%b>ect %riented Software 5ngineering ,%b>ectory- ,Eacobson ?LL2-#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
FH
Technical Aptitude Questions
%b>ect %riented Analysis ,%%A- ,Shlaer and &ellor ?LL2-#
The Fusion &ethod ,Cole!an ?LL?-#
11. What is an incomplete type?
Ans(er/
Inco!plete types refers to pointers in which there is non availability of the
i!ple!entation of the referenced location or it points to so!e location whose value is not
available for !odification#
01a'p2e/
int ;iAD6CDD MM i points to address CDD
;iADX MMset the value of !e!ory location pointed by i#
Inco!plete types are otherwise called uninitialied pointers#
12. What is a dangling pointer?
Ans(er/
A dangling pointer arises when you use the address of an ob>ect after its lifeti!e
is over#
This !ay occur in situations li$e returning addresses of the auto!atic variables fro! a
function or using the address of the !e!ory bloc$ after it is freed#
13. !ifferentiate .etween the message and method.
Ans(er/
%essa*e %et5"d
%b>ects co!!unicate by sending !essages 7rovides response to a !essage#
to each other#
A !essage is sent to invo$e a !ethod# It is an i!ple!entation of an operation#
1*. What is an adaptor class or Wrapper class?
Ans(er/
A class that has no functionality of its own# Its !e!ber functions hide the use of a
third party software co!ponent or an ob>ect with the non:co!patible interface or a non:
ob>ect: oriented i!ple!entation#
1-. What is a &ull o.ject?
Ans(er/
It is an ob>ect of so!e class whose purpose is to indicate that a real ob>ect of that
class does not e6ist# %ne co!!on use for a null ob>ect is a return value fro! a !e!ber
function that is supposed to return an ob>ect with so!e specified properties but cannot
find such an ob>ect#
10. What is class invariant?
Ans(er/
A class invariant is a condition that defines all valid states for an ob>ect# It is a
logical condition to ensure the correct wor$ing of a class# Class invariants !ust hold
when an ob>ect is created" and they !ust be preserved under all operations of the class# In
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
FF
Technical Aptitude Questions
particular all class invariants are both preconditions and post:conditions for all operations
or !e!ber functions of the class#
15. What do you mean .y $tac' unwinding?
Ans(er/
It is a process during e6ception handling when the destructor is called for all local
ob>ects between the place where the e6ception was thrown and where it is caught#

17. !efine precondition and post3condition to a mem.er function.
Ans(er/
Prec"nditi"n/
A precondition is a condition that !ust be true on entry to a !e!ber function# A
class is used correctly if preconditions are never false# An operation is not responsible for
doing anything sensible if its precondition fails to hold#
For e6a!ple" the interface invariants of stac' class say nothing about pushing yet
another ele!ent on a stac$ that is already full# Ge say that isful24 is a precondition of the
push operation#
P"st,c"nditi"n/
A post:condition is a condition that !ust be true on e6it fro! a !e!ber function
if the precondition was valid on entry to that function# A class is i!ple!ented correctly if
post:conditions are never false#
For e6a!ple" after pushing an ele!ent on the stac$" we $now that isempty24 !ust
necessarily hold# This is a post:condition of the push operation#
1?. What are the conditions that have to .e met for a condition to .e an invariant of the
class?
Ans(er/
The condition should hold at the end of every constructor#
The condition should hold at the end of every !utator,non:const- operation#

2@. What are proxy o.jects?
Ans(er/
%b>ects that stand for other ob>ects are called pro6y ob>ects or surrogates#
01a'p2e/
te!plateSclass TR
class Array2D
]
public8
class Array?D
]
public8
TU operatorPQ ,int inde6-X
const TU operatorPQ ,int inde6- constX
###
^X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
FL
Technical Aptitude Questions
Array?D operatorPQ ,int inde6-X
const Array?D operatorPQ ,int inde6- constX
###
^X

The following then beco!es legal8
Array2DSfloatRdata,?D"2D-X
########
coutSSdataP1QPBQX MM fine
.ere dataP1Q yields an Array?D ob>ect and the operator PQ invocation on that
ob>ect yields the float in position,1"B- of the original two di!ensional array# Clients of
the Array2D class need not be aware of the presence of the Array?D class# %b>ects of this
latter class stand for one:di!ensional array ob>ects that" conceptually" do not e6ist for
clients of Array2D# Such clients progra! as if they were using real" live" two:di!ensional
arrays# 5ach Array?D ob>ect stands for a one:di!ensional array that is absent fro! a
conceptual !odel used by the clients of Array2D# In the above e6a!ple" Array?D is a
pro6y class# Its instances stand for one:di!ensional arrays that" conceptually" do not
e6ist#

21. &ame some pure o.ject oriented languages#
Ans(er/
S!alltal$"
Eava"
5iffel"
Sather#
22. &ame the operators that cannot .e overloaded.
Ans(er/
sieof # #; #:R 88 `8
23. What is a node class?
Ans(er/
A node class is a class that"
relies on the base class for services and i!ple!entation"
provides a wider interface to te users than its base class"
relies pri!arily on virtual functions in its public interface
depends on all its direct and indirect base class
can be understood only in the conte6t of the base class
can be used as base for further derivation
can be used to create ob>ects#
A node class is a class that has added new services or functionality beyond the services
inherited fro! its base class#
2*. What is an orthogonal .ase class?
Ans(er/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
LD
Technical Aptitude Questions
If two base classes have no overlapping !ethods or data they are said to be
independent of" or orthogonal to each other# %rthogonal in the sense !eans that two
classes operate in different di!ensions and do not interfere with each other in any way#
The sa!e derived class !ay inherit such classes with no difficulty#
2-. What is a container class? What are the types of container classes?
Ans(er/
A container class is a class that is used to hold ob>ects in !e!ory or e6ternal
storage# A container class acts as a generic holder# A container class has a predefined
behavior and a well:$nown interface# A container class is a supporting class whose
purpose is to hide the topology used for !aintaining the list of ob>ects in !e!ory# Ghen
a container class contains a group of !i6ed ob>ects" the container is called a
heterogeneous containerX when the container is holding a group of ob>ects that are all the
sa!e" the container is called a ho!ogeneous container#
20. What is a protocol class?
Ans(er/
An abstract class is a protocol class if8
it neither contains nor inherits fro! classes that contain !e!ber data" non:virtual
functions" or private ,or protected- !e!bers of any $ind#
it has a non:inline virtual destructor defined with an e!pty i!ple!entation"
all !e!ber functions other than the destructor including inherited functions" are
declared pure virtual functions and left undefined#
25. What is a mixin class?
Ans(er/
A class that provides so!e but not all of the i!ple!entation for a virtual base
class is often called !i6in# Derivation done >ust for the purpose of redefining the virtual
functions in the base classes is often called !i6in inheritance# &i6in classes typically
donTt share co!!on bases#
27. What is a concrete class?
Ans(er/
A concrete class is used to define a useful ob>ect that can be instantiated as an
auto!atic variable on the progra! stac$# The i!ple!entation of a concrete class is
defined# The concrete class is not intended to be a base class and no atte!pt to !ini!ie
dependency on other classes in the i!ple!entation or behavior of the class#
2?.What is the handle class?
Ans(er/
A handle is a class that !aintains a pointer to an ob>ect that is progra!!atically
accessible through the public interface of the handle class#
01p2anati"n/
In case of abstract classes" unless one !anipulates the ob>ects of these classes
through pointers and references" the benefits of the virtual functions are lost# =ser code
!ay beco!e dependent on details of i!ple!entation classes because an abstract type
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
L?
Technical Aptitude Questions
cannot be allocated statistically or on the stac$ without its sie being $nown# =sing
pointers or references i!plies that the burden of !e!ory !anage!ent falls on the user#
Another li!itation of abstract class ob>ect is of fi6ed sie# Classes however are used to
represent concepts that re0uire varying a!ounts of storage to i!ple!ent the!#
A popular techni0ue for dealing with these issues is to separate what is used as a single
ob>ect in two parts8 a handle providing the user interface and a representation holding all
or !ost of the ob>ectTs state# The connection between the handle and the representation is
typically a pointer in the handle# %ften" handles have a bit !ore data than the si!ple
representation pointer" but not !uch !ore# .ence the layout of the handle is typically
stable" even when the representation changes and also that handles are s!all enough to
!ove around relatively freely so that the user needn4t use the pointers and the references#

3@. What is an action class?
Ans(er/
The si!plest and !ost obvious way to specify an action in C<< is to write a
function# .owever" if the action has to be delayed" has to be trans!itted TelsewhereT
before being perfor!ed" re0uires its own data" has to be co!bined with other actions" etc
then it often beco!es attractive to provide the action in the for! of a class that can
e6ecute the desired action and provide other services as well# &anipulators used with
iostrea!s is an obvious e6a!ple#
01p2anati"n/
A co!!on for! of action class is a si!ple class containing >ust one virtual
function#
class Action
]
public8
virtual int doNit, int -ADX
virtual aAction, -X
^
(iven this" we can write code say a !e!ber that can store actions for later
e6ecution without using pointers to functions" without $nowing anything about the
ob>ects involved" and without even $nowing the na!e of the operation it invo$es# For
e6a!ple8
class writeNfile 8 public Action
]
FileU fX
public8
int doNit,int-
]
return fwrite, -#suceed, -X
^
^X
class errorN!essage8 public Action
]
responseNbo6 db,!essage#cstr, -"OContinueO"OCancelO"O)etryO-X
switch ,db#getresponse, --
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
L2
Technical Aptitude Questions
]
case D8 return DX
case ?8 abort,-X
case 28 currentNoperation#redo, -Xreturn ?X
^
^X
A user of the Action class will be co!pletely isolated fro! any $nowledge of
derived classes such as writeNfile and errorN!essage#
31. When can you tell that a memory lea' will occur?
Ans(er/
A !e!ory lea$ occurs when a progra! loses the ability to free a bloc$ of
dyna!ically allocated !e!ory#
32.What is a parameteriCed type?
Ans(er/
A te!plate is a para!eteried construct or type containing generic code that can
use or !anipulate any type# It is called para!eteried because an actual type is a
para!eter of the code body# 7oly!orphis! !ay be achieved through para!eteried
types# This type of poly!orphis! is called para!eteric poly!orphis!# 7ara!eteric
poly!orphis! is the !echanis! by which the sa!e code is used on different types
passed as para!eters#
33. !ifferentiate .etween a deep copy and a shallow copy?
Ans(er/
Deep copy involves using the contents of one ob>ect to create another instance of
the sa!e class# In a deep copy" the two ob>ects !ay contain ht sa!e infor!ation but the
target ob>ect will have its own buffers and resources# the destruction of either ob>ect will
not affect the re!aining ob>ect# The overloaded assign!ent operator would create a deep
copy of ob>ects#
Shallow copy involves copying the contents of one ob>ect into another instance of
the sa!e class thus creating a !irror i!age# %wing to straight copying of references and
pointers" the two ob>ects will share the sa!e e6ternally contained contents of the other
ob>ect to be unpredictable#
01p2anati"n/
=sing a copy constructor we si!ply copy the data values !e!ber by !e!ber#
This !ethod of copying is called shallow copy# If the ob>ect is a si!ple class" co!prised
of built in types and no pointers this would be acceptable# This function would use the
values and the ob>ects and its behavior would not be altered with a shallow copy" only the
addresses of pointers that are !e!bers are copied and not the value the address is
pointing to# The data values of the ob>ect would then be inadvertently altered by the
function# Ghen the function goes out of scope" the copy of the ob>ect with all its data is
popped off the stac$#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
L1
Technical Aptitude Questions
If the ob>ect has any pointers a deep copy needs to be e6ecuted# Gith the deep
copy of an ob>ect" !e!ory is allocated for the ob>ect in free store and the ele!ents
pointed to are copied# A deep copy is used for ob>ects that are returned fro! a function#
3*. What is an opa/ue pointer?
Ans(er/
A pointer is said to be opa0ue if the definition of the type to which it points to is
not included in the current translation unit# A translation unit is the result of !erging an
i!ple!entation file with all its headers and header files#
3-. What is a smart pointer?
Ans(er/
A s!art pointer is an ob>ect that acts" loo$s and feels li$e a nor!al pointer but
offers !ore functionality# In C<<" s!art pointers are i!ple!ented as template classes
that encapsulate a pointer and override standard pointer operators# They have a nu!ber of
advantages over regular pointers# They are guaranteed to be initialied as either null
pointers or pointers to a heap ob>ect# Indirection through a null pointer is chec$ed# 'o
delete is ever necessary# %b>ects are auto!atically freed when the last pointer to the! has
gone away# %ne significant proble! with these s!art pointers is that unli$e regular
pointers" they donTt respect inheritance# S!art pointers are unattractive for poly!orphic
code# (iven below is an e6a!ple for the i!ple!entation of s!art pointers#
01a'p2e/
te!plate Sclass IR
class s!artNpointer
]
public8
s!artNpointer,-X MM !a$es a null pointer
s!artNpointer,const IU 6- MM !a$es pointer to copy of 6
IU operator ;, -X
const IU operator;, - constX
I; operator:R,- constX
s!artNpointer,const s!artNpointer SIR U-X
const s!artNpointer SIR U operator A,const s!artNpointerSIRU-X
as!artNpointer,-X
private8
MM###
^X
This class i!ple!ent a s!art pointer to an ob>ect of type I# The ob>ect itself is
located on the heap# .ere is how to use it8
s!artNpointer Se!ployeeR pA e!ployee,O.arrisO"?111-X
2i$e other overloaded operators" p will behave li$e a regular pointer"
coutSS;pX
p:RraiseNsalary,D#@-X
30. What is reflexive association?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
LC
Technical Aptitude Questions
Ans(er/
The Tis:aT is called a refle6ive association because the refle6ive association per!its
classes to bear the is:a association not only with their super:classes but also with
the!selves# It differs fro! a Tspecialies:fro!T as Tspecialies:fro!T is usually used to
describe the association between a super:class and a sub:class# For e6a!ple8
7rinter is:a printer#
35. What is slicing?
Ans(er/
Slicing !eans that the data added by a subclass are discarded when an ob>ect of
the subclass is passed or returned by value or fro! a function e6pecting a base class
ob>ect#
01p2anati"n/
Consider the following class declaration8
class base
]
###
baseU operator A,const baseU-X
base ,const baseU-X
^
void fun, -
]
base eA!X
eA!X
^
As base copy functions donTt $now anything about the derived only the base part
of the derived is copied# This is co!!only referred to as slicing# %ne reason to pass
ob>ects of classes in a hierarchy is to avoid slicing# %ther reasons are to preserve
poly!orphic behavior and to gain efficiency#
37. What is name mangling?
Ans(er/
'a!e !angling is the process through which your c<< co!pilers give each
function in your progra! a uni0ue na!e# In C<<" all progra!s have at:least a few
functions with the sa!e na!e# 'a!e !angling is a concession to the fact that lin$er
always insists on all function na!es being uni0ue#
01a'p2e/
In general" !e!ber na!es are !ade uni0ue by concatenating the na!e of the
!e!ber with that of the class e#g# given the declaration8
class *ar
]
public8
int ivalX
###
^X
ival beco!es so!ething li$e8
MM a possible !e!ber na!e !angling
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
L@
Technical Aptitude Questions
ivalNN1*ar
Consider this derivation8
class Foo 8 public *ar
]
public8
int ivalX
###
^
The internal representation of a Foo ob>ect is the concatenation of its base and
derived class !e!bers#
MM 7seudo C<< code
MM Internal representation of Foo
class Foo
]
public8
int ivalNN1*arX
int ivalNN1FooX
###
^X
=na!biguous access of either ival !e!bers is achieved through na!e !angling#
&e!ber functions" because they can be overloaded" re0uire an e6tensive !angling to
provide each with a uni0ue na!e# .ere the co!piler generates the sa!e na!e for the two
overloaded instances,Their argu!ent lists !a$e their instances uni0ue-#

3?. What are proxy o.jects?
Ans(er/
%b>ects that points to other ob>ects are called pro6y ob>ects or surrogates# Its an
ob>ect that provides the sa!e interface as its server ob>ect but does not have any
functionality# During a !ethod invocation" it routes data to the true server ob>ect and
sends bac$ the return value to the ob>ect#
*@. !ifferentiate .etween declaration and definition in ,88.
Ans(er/
A declaration introduces a na!e into the progra!X a definition provides a uni0ue
description of an entity ,e#g# type" instance" and function-# Declarations can be repeated in
a given scope" it introduces a na!e in a given scope# There !ust be e6actly one definition
of every ob>ect" function or class used in a C<< progra!#
A declaration is a definition unless8
it declares a function without specifying its body"
it contains an e6tern specifier and no initialier or function body"
it is the declaration of a static class data !e!ber without a class definition"
it is a class na!e definition"
it is a typedef declaration#
A definition is a declaration unless8
it defines a static class data !e!ber"
it defines a non:inline !e!ber function#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
LB
Technical Aptitude Questions
*1. What is cloning?
Ans(er/
An ob>ect can carry out copying in two ways i#e# it can set itself to be a copy of
another ob>ect" or it can return a copy of itself# The latter process is called cloning#
*2. !escri.e the main characteristics of static functions.
Ans(er/
The !ain characteristics of static functions include"
It is without the a this pointer"
It canTt directly access the non:static !e!bers of its class
It canTt be declared const" volatile or virtual#
It doesnTt need to be invo$ed through an ob>ect of its class" although for
convenience" it !ay#
*3. Will the inline function .e compiled as the inline function always? Yustify.
Ans(er/
An inline function is a re0uest and not a co!!and# .ence it wonTt be co!piled as
an inline function always#
01p2anati"n/
Inline:e6pansion could fail if the inline function contains loops" the address of an
inline function is used" or an inline function is called in a co!ple6 e6pression# The rules
for inlining are co!piler dependent#
**. !efine a way other than using the 'eyword inline to ma'e a function inline.
Ans(er/
The function !ust be defined inside the class#
*-. )ow can a W::W operator .e used as unary operator?
Ans(er/
The scope operator can be used to refer to !e!bers of the global na!espace#
*ecause the global na!espace doesn4t have a na!e" the notation 88 !e!ber:na!e refers
to a !e!ber of the global na!espace# This can be useful for referring to !e!bers of
global na!espace whose na!es have been hidden by na!es declared in nested local
scope# =nless we specify to the co!piler in which na!espace to search for a declaration"
the co!piler si!ple searches the current scope" and any scopes in which the current
scope is nested" to find the declaration for the na!e#
*0. What is placement new?
Ans(er/
Ghen you want to call a constructor directly" you use the place!ent new#
So!eti!es you have so!e raw !e!ory thatTs already been allocated" and you need to
construct an ob>ect in the !e!ory you have# %perator newTs special version place!ent
new allows you to do it#
class Gidget
]
public 8
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
LH
Technical Aptitude Questions
Gidget,int widgetsie-X
###
Gidget; ConstructNwidgetNintNbuffer,void ;buffer"int widgetsie-
]
return new,buffer- Gidget,widgetsie-X
^
^X
This function returns a pointer to a Gidget ob>ect thatTs constructed within the
buffer passed to the function# Such a function !ight be useful for applications using
shared !e!ory or !e!ory:!apped IM%" because ob>ects in such applications !ust be
placed at specific addresses or in !e!ory allocated by special routines#
--./
1. What do you mean .y analysis and design?
6nalysis:
*asically" it is the process of deter!ining what needs to be done before
how it should be done# In order to acco!plish this" the developer refers the e6isting
syste!s and docu!ents# So" si!ply it is an art of discovery#
!esign:
It is the process of adoptingMchoosing the one a!ong the !any" which best
acco!plishes the users needs# So" si!ply" it is co!pro!ising !echanis!#
2. What are the steps involved in designing?
*efore getting into the design the designer should go through the S)S prepared
by the Syste! Analyst#
The !ain tas$s of design are Architectural Design and Detailed Design#
In Architectural Design we find what are the !ain !odules in the proble!
do!ain#
In Detailed Design we find what should be done within each !odule#
3. What are the main underlying concepts of o.ject orientation?
%b>ects" !essages" class" inheritance and poly!orphis! are the !ain concepts of
ob>ect orientation#
*. What do u meant .y K$"+K of an o.ject?
S*I stands for State" *ehavior and Identity# Since every ob>ect has the above
three#
$tate:
It is >ust a value to the attribute of an ob>ect at a particular ti!e#
"ehaviour8
It describes the actions and their reactions of that ob>ect#
+dentity8
An ob>ect has an identity that characteries its own e6istence# The identity
!a$es it possible to distinguish any ob>ect in an una!biguous way" and independently
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
LF
Technical Aptitude Questions
fro! its state#
-. !ifferentiate persistent ( non3persistent o.jects?
7ersistent refers to an ob>ectTs ability to transcend ti!e or space# A persistent
ob>ect storesMsaves its state in a per!anent storage syste! with out losing the infor!ation
represented by the ob>ect#
A non:persistent ob>ect is said to be transient or ephe!eral# *y default ob>ects are
considered as non:persistent#
0. What do you meant .y active and passive o.jects?
Active ob>ects are one which instigate an interaction which owns a thread and
they are responsible for handling control to other ob>ects# In si!ple words it can be
referred as client#
7assive ob>ects are one" which passively waits for the !essage to be processed# It
waits for another ob>ect that re0uires its services# In si!ple words it can be referred as
server#
Diagra!8
client server
,Active- ,7assive-
5. What is meant .y software development method`
Software develop!ent !ethod describes how to !odel and build software
syste!s in a reliable and reproducible way# To put it si!ple" !ethods that are used to
represent onesT thin$ing using graphical notations#
7. What are models and meta models?
#odel:
+t is a co!plete description of so!ething ,i#e# syste!-#
#eta model:
It describes the !odel ele!ents" synta6 and se!antics of the notation that
allows their !anipulation#
?. What do you meant .y static and dynamic modeling?
Static !odeling is used to specify structure of the ob>ects that e6ist in the proble!
do!ain# These are e6pressed using class" o.ject and Q$1,6$1 diagrams#
*ut Dyna!ic !odeling refers representing the ob>ect interactions during runti!e#
It is represented by se/uence" activity" colla.oration and statechart diagrams#
1@. )ow to represent the interaction .etween the modeling elements?
#odel element is >ust a notation to represent ,(raphically- the entities that e6ist
in the proble! do!ain# e#g# for !odeling ele!ent is class notation" ob>ect notation etc#
)elationships are used to represent the interaction between the !odeling
ele!ents#
The following are the )elationships#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
LL
Technical Aptitude Questions
6ssociation: ItsT >ust a se!antic connection two classes#
e#g#8
6ggregation: ItsT the relationship between two classes which are related in the fashion
that master and slave# The !aster ta$es full rights than the slave# Since the slave
wor$s under the !aster# It is represented as line with dia!ond in the !aster area#
e68
car contains wheels" etc#

car
,ontainment: This relationship is applied when the part contained with in the whole
part" dies when the whole part dies#
It is represented as dar$ed dia!ond at the whole part#
e6a!ple8
class A]
MMso!e code
^X
class *
]
A aaX MM an ob>ect of class AX
MM so!e code for class *X
^X
In the above e6a!ple we see that an ob>ect of class A is instantiated with in the
class *# so the ob>ect class A dies when the ob>ect class * dies#we can represnt it in
diagra! li$e this#
=eneraliCation: This relationship used when we want represents a class" which
captures the co!!on states of ob>ects of different classes# It is represented as arrow
line pointed at the class" which has captured the co!!on states#



!ependency: It is the relationship between dependent and independent classes# Any
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?DD
car wheels
class A class *
uses
class A class *
class A
class * class C
Technical Aptitude Questions
change in the independent class will affect the states of the dependent class#
DIA()A&8
class A class *
11. Why generaliCation is very strong?
5ven though (eneraliation satisfies Structural" Interface" *ehaviour properties#
It is !athe!atically very strong" as it is Antisy!!etric and Transitive#
6ntisymmetric: e!ployee is a person" but not all persons are e!ployees#
&athe!atically all As4 are *" but all *s4 not A#
Dransitive: AAR*" *ARc then AARc#
A# Sales!an#
*# 5!ployee#
C# 7erson#
'ote: All the other relationships satisfy all the properties li$e Structural
properties" Interface properties" *ehaviour properties#
12. !ifferentiate 6ggregation and containment?
Aggregation is the relationship between the whole and a part# Ge can addMsubtract
so!e properties in the part ,slave- side# It wonTt affect the whole part#
*est e6a!ple is Car" which contains the wheels and so!e e6tra parts# 5ven
though the parts are not there we can call it as car#
*ut" in the case of contain!ent the whole part is affected when the part within
that got affected# The hu!an body is an apt e6a!ple for this relationship# Ghen the
whole body dies the parts ,heart etc- are died#
13. ,an lin' and 6ssociation applied interchangea.ly?
'o" Jou cannot apply the lin$ and Association interchangeably# Since lin$ is used
represent the relationship between the two ob>ects#
*ut Association is used represent the relationship between the two classes#
lin$ 88 student8Abhilash course8&CA
Association88 student course
1*. what is meant .y Kmethod3warsK?
*efore ?LLC there were different !ethodologies li$e )u!baugh" *ooch"
Eacobson" &eyer etc who followed their own notations to !odel the syste!s# The
developers were in a dile!!a to choose the !ethod which best acco!plishes their needs#
This particular span was called as O!ethod:warsO
1-. Whether unified method and unified modeling language are same or different?
=nified !ethod is convergence of the )u!baugh and *ooch#
=nified !odeling lang# is the fusion of )u!baugh" *ooch and Eacobson as well
as *etrand &eyer ,whose contribution is Ose0uence diagra!O-# ItsT the superset of all the
!ethodologies#
10. Who were the three famous amigos and what was their contri.ution to the o.ject
community?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?D?
Technical Aptitude Questions
The Three a!igos na!ely"
Yames um.augh 2E#D4: A veteran in analysis who ca!e up with an idea about the
ob>ects and their )elationships ,in particular Associations-#
=rady "ooch: A veteran in design who ca!e up with an idea about partitioning of
syste!s into subsyste!s#

+var Yaco.son 2E.jectory4: The father of =S5CAS5S" who described about the user
and syste! interaction#
15. !ifferentiate the class representation of "ooch% um.augh and Q#L?
If you loo$ at the class representaiton of )u!baugh and =&2" It is so!e what
si!ilar and both are very easy to draw#
Represent$tion: -0T 102#
/i$3r$m:

*ooch8 In this !ethod classes are represented as OCloudsO which are not very easy
to draw as for as the developerTs view is concern#
/i$3r$m:
17. What is an Q$1,6$1? Why it is needed?
A =se Case is a description of a set of se0uence of actions that a syste! perfor!s
that yields an observable result of value to a particular action#
In SSAD process SAR In %%AD =S5CAS5# It is represented elliptically#
Represent$tion:
1?. Who is an 6ctor?
An Actor is so!eone or so!ething that !ust interact with the syste!#In addition
to that an Actor initiates the process,that is =S5CAS5-#
It is represented as a stic$!an li$e this#
/i$3r$m:
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?D2
Technical Aptitude Questions
2@. What is guard condition?
(uard condition is one" which acts as a firewall# The access fro! a particular
ob>ect can be !ade only when the particular condition is !et#
For 56a!ple"
custo!er chec$ custo!er nu!ber AT&#
.ere the ob>ect on the custo!er accesses the AT& facility only when the guard condition
is !et#
21. !ifferentiate the following notations?
+: :o.j1 :o.j2

++: :o.j1 :o.j2
In the above representation I" ob>? sends !essage to ob>2# *ut in the case of II the
data is transferred fro! ob>? to ob>2#
22. Q$1,6$1 is an implementation independent notation. )ow will the designer give the
implementation details of a particular Q$1,6$1 to the programmer?
This can be acco!plished by specifying the relationship called Orefine!ent\
which tal$s about the two different abstraction of the sa!e thing#
%r e6a!ple"
calculate pay calculate
class? class2 class1
23. $uppose a class acts an 6ctor in the pro.lem domain% how to represent it in the static
model?
In this scenario you can use [stereotype\# Since stereotype is >ust a string that
gives e6tra se!antic to the particular entityM!odel ele!ent# It is given with in the SS RR#
class A
SS ActorRR
attributes
!ethods#
2*. Why does the function arguments are called as KsignaturesK?
The argu!ents distinguish functions with the sa!e na!e ,functional
poly!orphis!-# The na!e alone does not necessarily identify a uni0ue function#
.owever" the na!e and its argu!ents ,signatures- will uni0uely identify a function#
In real life we see suppose" in class there are two guys with sa!e na!e" but they
can be easily identified by their signatures# The sa!e concept is applied here#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?D1
Technical Aptitude Questions
e68
class person
]
public8
char getse6,-X
void setse6,char-X
void setse6,int-X
^X
In the above e6a!ple we see that there is a function setse6,- with sa!e na!e but
with different signature#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?DC
Technical Aptitude Questions
Quantitative Aptitude
01ercise 1
S"2ve t5e 8"22"(in* and c5ec) (it5 t5e ans(ers *iven at t5e end.
?# It was calculated that H@ !en could co!plete a piece of wor$ in 2D days# Ghen
wor$ was scheduled to co!!ence" it was found necessary to send 2@ !en to
another pro>ect# .ow !uch longer will it ta$e to co!plete the wor$`
2# A student divided a nu!ber by 2M1 when he re0uired to !ultiply by 1M2# Calculate
the percentage of error in his result#
1# A dishonest shop$eeper professes to sell pulses at the cost price" but he uses a
false weight of L@Dg!# for a $g# .is gain is KW#
C# A software engineer has the capability of thin$ing ?DD lines of code in five
!inutes and can type ?DD lines of code in ?D !inutes# .e ta$es a brea$ for five
!inutes after every ten !inutes# .ow !any lines of codes will he co!plete typing
after an hour`
@# A !an was engaged on a >ob for 1D days on the condition that he would get a
wage of )s# ?D for the day he wor$s" but he have to pay a fine of )s# 2 for each
day of his absence# If he gets )s# 2?B at the end" he was absent for wor$ for ###
days#
B# A contractor agreeing to finish a wor$ in ?@D days" e!ployed H@ !en each
wor$ing F hours daily# After LD days" only 2MH of the wor$ was co!pleted#
Increasing the nu!ber of !en by NNNNNNNN each wor$ing now for ?D hours daily"
the wor$ can be co!pleted in ti!e#
H# what is a percent of b divided by b percent of a`
,a- a ,b- b ,c- ? ,d- ?D ,d- ?DD
F# A !an bought a horse and a cart# If he sold the horse at ?D W loss and the cart at
2D W gain" he would not lose anythingX but if he sold the horse at @W loss and the
cart at @W gain" he would lose )s# ?D in the bargain# The a!ount paid by hi! was
)s#NNNNNNN for the horse and )s#NNNNNNNN for the cart#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?D@
Quantitative Aptitude
Technical Aptitude Questions
L# A tennis !ar$er is trying to put together a tea! of four players for a tennis
tourna!ent out of seven available# !ales : a" b and cX fe!ales + !" n" o and p# All
players are of e0ual ability and there !ust be at least two !ales in the tea!# For a
tea! of four" all players !ust be able to play with each other under the following
restrictions8
b should not play with !"
c should not play with p" and
a should not play with o#
Ghich of the following state!ents !ust be false`
?# b and p cannot be selected together
2# c and o cannot be selected together
1# c and n cannot be selected together#
?D:?2# The following figure depicts three views of a cube# *ased on this" answer
0uestions ?D:?2#
B @ C
? 22 1 B
?D# The nu!ber on the face opposite to the face carrying ? is NNNNNNN #
??# The nu!ber on the faces ad>acent to the face !ar$ed @ are NNNNNNN #
?2# Ghich of the following pairs does not correctly give the nu!bers on the opposite
faces#
,?- B"@ ,2- C"? ,1- ?"1 ,C- C"2
?1# Five far!ers have H" L" ??" ?1 U ?C apple trees" respectively in their orchards#
2ast year" each of the! discovered that every tree in their own orchard bore
e6actly the sa!e nu!ber of apples# Further" if the third far!er gives one apple to
the first" and the fifth gives three to each of the second and the fourth" they would
all have e6actly the sa!e nu!ber of apples# Ghat were the yields per tree in the
orchards of the third and fourth far!ers`
?C# Five boys were cli!bing a hill# E was following .# ) was >ust ahead of (# _ was
between ( U .# They were cli!bing up in a colu!n# Gho was the second`
?@:?F Eohn is undecided which of the four novels to buy# .e is considering a spy
thriller" a &urder !ystery" a (othic ro!ance and a science fiction novel# The
boo$s are written by )oth$o" (or$y" *urchfield and .opper" not necessary in that
order" and published by .eron" 7iegon" *lue>a and sparrow" not necessary in that
order#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?DB
2 1 2
Technical Aptitude Questions
? ,?- The boo$ by )oth$o is published by Sparrow#
2 ,2- The Spy thriller is published by .eron#
,1- The science fiction novel is by *urchfield and is not published by *lue>a#
1 ,C-The (othic ro!ance is by .opper#
C
?@# 7igeon publishes NNNNNNNNNNNN#
?B# The novel by (or$y NNNNNNNNNNNNNNNN#
?H# Eohn purchases boo$s by the authors whose na!es co!e first and third in
alphabetical order# .e does not buy the boo$s NNNNNN#
?F# %n the basis of the first paragraph and state!ent ,2-" ,1- and ,C- only" it is
possible to deduce that
?# )oth$o wrote the !urder !ystery or the spy thriller
2# Sparrow published the !urder !ystery or the spy thriller
1# The boo$ by *urchfield is published by Sparrow#
?L# If a light flashes every B seconds" how !any ti!es will it flash in c of an hour`
2D# If point 7 is on line seg!ent A*" then which of the following is always true`
,?- A7 A 7* ,2- A7 R 7* ,1- 7* R A7 ,C- A* R A7 ,@- A* R A7 < 7*
2?# All !en are vertebrates# So!e !a!!als are vertebrates# Ghich of the following
conclusions drawn fro! the above state!ent is correct#
All !en are !a!!als
All !a!!als are !en
So!e vertebrates are !a!!als#
'one
22# Ghich of the following state!ents drawn fro! the given state!ents are correct`
(iven8
All watches sold in that shop are of high standard# So!e of the .&T watches are
sold in that shop#
a- All watches of high standard were !anufactured by .&T#
b- So!e of the .&T watches are of high standard#
c- 'one of the .&T watches is of high standard#
d- So!e of the .&T watches of high standard are sold in that shop#
21:2H#
?# Ashland is north of 5ast 2iverpool and west of Coshocton#
2# *owling green is north of Ashland and west of Frederic$town#
1# Dover is south and east of Ashland#
C# 5ast 2iverpool is north of Frederic$town and east of Dover#
@# Frederic$town is north of Dover and west of Ashland#
B# Coshocton is south of Frederic$town and west of Dover#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?DH
Technical Aptitude Questions
21# Ghich of the towns !entioned is furthest of the north + west
,a- Ashland ,b- *owling green ,c- Coshocton
,d- 5ast 2iverpool ,e- Frederic$town
2C# Ghich of the following !ust be both north and east of Frederic$town`
,a- Ashland ,b- Coshocton ,c- 5ast 2iverpool
I a only II b only III c only I/ a U b / a U c
2@# Ghich of the following towns !ust be situated both south and west of at least one
other town`
A# Ashland only
*# Ashland and Frederic$town
C# Dover and Frederic$town
D# Dover" Coshocton and Frederic$town
5# Coshocton" Dover and 5ast 2iverpool#
2B# Ghich of the following state!ents" if true" would !a$e the infor!ation in the
nu!bered state!ents !ore specific`
,a- Coshocton is north of Dover#
,b- 5ast 2iverpool is north of Dover
,c- Ashland is east of *owling green#
,d- Coshocton is east of Frederic$town
,e- *owling green is north of Frederic$town
2H# Ghich of the nu!bered state!ents gives infor!ation that can be deduced fro!
one or !ore of the other state!ents`
,A- ? ,*- 2 ,C- 1 ,D- C ,5- B
2F# 5ight friends .arsha" Fa$is" *ala>i" 5swar" Dhinesh" Chandra" (eetha" and
Ah!ed are sitting in a circle facing the center# *ala>i is sitting between (eetha
and Dhinesh# .arsha is third to the left of *ala>i and second to the right of
Ah!ed# Chandra is sitting between Ah!ed and (eetha and *ala>i and 5shwar are
not sitting opposite to each other# Gho is third to the left of Dhinesh`
2L# If every alternative letter starting fro! * of the 5nglish alphabet is written in
s!all letter" rest all are written in capital letters" how the !onth [ Septe!ber\ be
written#
,?- Sept5&b5r ,2- S5pTe&*5r ,1- Septe!be)
,C- Septe&ber ,@- 'one of the above#
1D# The length of the side of a s0uare is represented by 6<2# The length of the side of
an e0uilateral triangle is 26# If the s0uare and the e0uilateral triangle have e0ual
peri!eter" then the value of 6 is NNNNNNN#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?DF
Technical Aptitude Questions
1?# It ta$es &r# _arthi$ y hours to co!plete typing a !anuscript# After 2 hours" he
was called away# Ghat fractional part of the assign!ent was left inco!plete`
12# Ghich of the following is larger than 1M@`
,?- d ,2- 1LM@D ,1- HM2@ ,C- 1M?D ,@- @LM?DD
11# The nu!ber that does not have a reciprocal is NNNNNNNNNNNN#
1C# There are 1 persons Sudhir" Arvind" and (auri# Sudhir lent cars to Arvind and
(auri as !any as they had already# After so!e ti!e Arvind gave as !any cars to
Sudhir and (auri as !any as they have# After so!eti!e (auri did the sa!e thing#
At the end of this transaction each one of the! had 2C# Find the cars each
originally had#
1@# A !an bought a horse and a cart# If he sold the horse at ?D W loss and the cart at
2D W gain" he would not lose anythingX but if he sold the horse at @W loss and the
cart at @W gain" he would lose )s# ?D in the bargain# The a!ount paid by hi! was
)s#NNNNNNN for the horse and )s#NNNNNNNN for the cart#

.ns4ers:
?# Ans(er/
1D days#
01p2anati"n/
"efore:
%ne day wor$ A ? M 2D
%ne !an4s one day wor$ A ? M , 2D ; H@-
&ow:
'o# %f wor$ers A @D
%ne day wor$ A @D ; ? M , 2D ; H@-
The total no# of days re0uired to co!plete the wor$ A ,H@ ; 2D- M @D A 1D
2# Ans(er/
D W
01p2anati"n/
Since 16 M 2 A 6 M ,2 M 1-
1# Ans(er/
@#1 W
01p2anati"n/
.e sells L@D gra!s of pulses and gains @D gra!s#
If he sells ?DD gra!s of pulses then he will gain ,@D M L@D- ;?DD A @#2B
C# Ans(er/
2@D lines of codes
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?DL
Technical Aptitude Questions
@# Ans(er/
H days
01p2anati"n/
The e0uation portraying the given proble! is8
?D ; 6 + 2 ; ,1D + 6- A 2?B where 6 is the nu!ber of wor$ing days#
Solving this we get 6 A 21
'u!ber of days he was absent was H ,1D:21- days#
B# Ans(er/
?@D !en#
01p2anati"n/
%ne day4s wor$ A 2 M ,H ; LD-
%ne hour4s wor$ A 2 M ,H ; LD ; F-
%ne !an4s wor$ A 2 M ,H ; LD ; F ; H@-
The re!aining wor$ ,@MH- has to be co!pleted within BD days" because the
total nu!ber of days allotted for the pro>ect is ?@D days#
So we get the e0uation
,2 ; ?D ; 6 ; BD- M ,H ; LD ; F ; H@- A @MH where 6 is the nu!ber of !en
wor$ing after the LD
th
day#
Ge get 6 A 22@
Since we have H@ !en already" it is enough to add only ?@D !en#
H# Ans(er/
,c- ?
01p2anati"n/
a percent of b 8 ,aM?DD- ; b
b percent of a 8 ,bM?DD- ; a
a percent of b divided by b percent of a 8 ,,a M ?DD -;b- M ,bM?DD- ; a -- A ?
F# Ans(er/
Cost price of horse A )s# CDD U the cost price of cart A 2DD#
01p2anati"n/,
2et 6 be the cost price of the horse and y be the cost price of the cart#
In the first sale there is no loss or profit# ,i#e#- The loss obtained is e0ual to the
gain#
Therefore ,?DM?DD- ; 6 A ,2DM?DD- ; y
I A 2 ; y :::::::::::::::::,?-
In the second sale" he lost )s# ?D# ,i#e#- The loss is greater than the profit by )s#
?D#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??D
Technical Aptitude Questions
Therefore ,@ M ?DD- ; 6 A ,@ M ?DD- ; y < ?D :::::::,2-
Substituting ,?- in ,2- we get
,?D M ?DD- ; y A ,@ M ?DD- ; y < ?D
,@ M ?DD- ; y A ?D
% 5 600
Fro! ,?- 2 ; 2DD A x 5 +00
L# Ans(er/
1#
01p2anati"n/
Since inclusion of any !ale player will re>ect a fe!ale fro! the tea!#
Since there should be four !e!ber in the tea! and only three !ales are available"
the girl" n should included in the tea! always irrespective of others selection#
?D# Ans(er/
@
??# Ans(er/
?"2"1 U C
?2# Ans(er/
*
?1# Ans(er/
?? U L apples per tree#
01p2anati"n/
2et a" b" c" d U e be the total nu!ber of apples bored per year in A" *" C"
D U 5 3s orchard# (iven that a < ? A b < 1 A c + ? A d < 1 A e + B
*ut the 0uestion is to find the nu!ber of apples bored per tree in C and D 3s
orchard# If is enough to consider c + ? A d < 1#
Since the nu!ber of trees in C4s orchard is ?? and that of D4s orchard is
?1# 2et 6 and y be the nu!ber of apples bored per tree in C U d 3s orchard
respectively#
Therefore ?? 6 + ? A ?1 y < 1
*y trial and error !ethod" we get the value for 6 and y as ?? and L
?C# Ans(er/
(#
01p2anati"n/
The order in which they are cli!bing is ) + ( + _ + . + E
?@ + ?F
Ans(er/
'ovel 'a!e Author 7ublisher
Spy thriller )ath$o .eron
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
???
Technical Aptitude Questions
&urder !ystery (or$y 7iegon
(othic ro!ance *urchfield *lue>a
Science fiction .opper Sparrow
01p2anati"n/
(iven
'ovel 'a!e Author 7ublisher
Spy thriller )ath$o .eron
&urder !ystery (or$y 7iegon
(othic ro!ance *urchfield *lue>a
Science fiction .opper Sparrow
Since *lue>a doesn4t publish the novel by *urchfield and .eron publishes
the novel spy thriller" 7iegon publishes the novel by *urchfield#
Since .opper writes (othic ro!ance and .eron publishes the novel spy
thriller" *lue>a publishes the novel by .opper#
Since .eron publishes the novel spy thriller and .eron publishes the novel
by (or$y" (or$y writes Spy thriller and )ath$o writes &urder !ystery#
?L# Ans(er/
C@? ti!es#
01p2anati"n/
There are BD !inutes in an hour#
In c of an hour there are ,BD ; c- !inutes A C@ !inutes#
In c of an hour there are ,BD ; C@- seconds A 2HDD seconds#
2ight flashed for every B seconds#
In 2HDD seconds 2HDDMB A C@D ti!es#
The count start after the first flash" the light will flashes C@? ti!es in c of
an hour#
2D# Ans(er/
,C-
01p2anati"n/
7
A *
Since p is a point on the line seg!ent A*" A* R A7
2?# Ans(er/ ,c-
22# Ans(er/ ,b- U ,d-#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??2
Technical Aptitude Questions
Ah!ed
21 : 2H#Ans(er/
Fa$is Chandra
2F# Ans(er/ Fa$is
01p2anati"n/ )arsha =eetha
5swar *ala>i
Dhinesh
678 Ans(er/
,@-#
01p2anati"n/
Since every alternative letter starting fro! * of the 5nglish alphabet is
written in s!all letter" the letters written in s!all letter are b" d" f###
In the first two answers the letter 5 is written in both s!all U capital
letters" so they are not the correct answers# *ut in third and fourth answers the
letter is written in s!all letter instead capital letter" so they are not the answers8

908 Ans(er/
6 A C
01p2anati"n/
Since the side of the s0uare is 6 < 2" its peri!eter A C ,6 < 2- A C6 < F
Since the side of the e0uilateral triangle is 26" its peri!eter A 1 ; 26 A B6
Also" the peri!eters of both are e0ual#
,i#e#- C6 < F A B6
,i#e#- 26 A F 6 A C#
1?# Ans(er/
@ ,y + 2- M y#
01p2anati"n/
To type a !anuscript $arthi$ too$ y hours#
Therefore his speed in typing A ?My#
.e was called away after 2 hours of typing#
Therefore the wor$ co!pleted A ?My ; 2#
Therefore the re!aining wor$ to be co!pleted A ? + 2My#
,i#e#- wor$ to be co!pleted A ,y:2-My
12# Ans(er/
,2-
11# Ans(er/
?
01p2anati"n/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??1
Technical Aptitude Questions
%ne is the only nu!ber e6ists without reciprocal because the reciprocal of
one is one itself#
1C# Ans(er/
Sudhir had 1L cars" Arvind had 2? cars and (auri had ?2 cars#
01p2anati"n/
Sudhir Arvind (auri
Finally 2C 2C 2C
*efore (auri4s transaction ?2 ?2 CF
*efore Arvind4s transaction B C2 2C
*efore Sudhir4 s transaction 1L 2? ?2
1@# Ans(er/
Cost price of horse8 )s# CDD U
Cost price of cart8 )s# 2DD
01p2anati"n/
2et 6 be the cost of horse U y be the cost of the cart#
?D W of loss in selling horse A 2D W of gain in selling the cart
Therefore ,?D M ?DD- ; 6 A ,2D ; ?DD- ; y
6 A 2y :::::::::::,?-
@ W of loss in selling the horse is ?D !ore than the @ W gain in selling the
cart#
Therefore ,@ M ?DD- ; 6 : ?D A ,@ M ?DD- ; y
@6 : ?DDD A @y
Substituting ,?-
?Dy : ?DDD A @y
@y A ?DDD
y A 2DD
6 A CDD fro! ,?-
01ercise 2.1
:or the follo4in3& fin# the next term in the series
?# B" 2C" BD"?2D" 2?D
a- 11B b- 1BB c- 11D d- BBD
Ans(er 8 a- 11B
01p2anati"n 8 The series is ?#2#1" 2#1#C" 1#C#@" C#@#B" @#B#H" ##### , T#T !eans product-
2# ?" @" ?1" 2@
Ans(er 8 C?
01p2anati"n 8 The series is of the for! D92<?92" ?92<292"###
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??C
Technical Aptitude Questions
1# D" @" F" ?H
Ans(er 8 2C
01p2anati"n 8 ?92:?" 292<?" 192:?" C92<?" @92:?
C# ?" F" L" BC" 2@ ,.int 8 5very successive ter!s are related-
Ans(er 8 2?B
01p2anati"n 8 ?92" 291" 192" C91" @92" B91
@# F"2C"?2"1B"?F"@C

Ans(er 8 2H
B# H?"HB"BL"HC"BH"H2
Ans(er 8 BH
H# @"L"?B"2L"@C
Ans(er 8 ?D1
01p2anati"n 8 @;2:?ALX L;2:2A?BX ?B;2:1A2LX 2L;2:CA@CX @C;2:@A?D1
F# ?"2"C"?D"?B"CD"BC ,Successive ter!s are related-
Ans(er 8 2DD
01p2anati"n 8 The series is powers of 2 ,29D"29?"##-#
All digits are less than F# 5very second nu!ber is in octal nu!ber syste!#
?2F should follow BC# ?2F base ?D A 2DD base F#
01ercise 2.2
:in# the o## m$n out8
?# 1"@"H"?2"?1"?H"?L
Ans(er 8 ?2
01p2anati"n 8 All but ?2 are odd nu!bers
2# 2"@"?D"?H"2B"1H"@D"BC
Ans(er 8 BC
01p2anati"n 8 2<1A@X @<@A?DX ?D<HA?HX ?H<LA2BX 2B<??A1HX 1H<?1A@DX @D<?@AB@X
1# ?D@"F@"BD"1D"D":C@":LD
Ans(er 8 D
01p2anati"n 8 ?D@:2DAF@X F@:2@ABDX BD:1DA1DX 1D:1@A:@X :@:CDA:C@X :C@:C@A:LDX
01ercise 3
;ol<e the follo4in38
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??@
Technical Aptitude Questions
?# Ghat is the nu!ber of eros at the end of the product of the nu!bers fro! ? to ?DD`
Ans(er 8 ?2H
2# A fast typist can type so!e !atter in 2 hours and a slow typist can type the sa!e in 1
hours# If both type co!binely" in how !uch ti!e will they finish`
Ans(er 8 ? hr ?2 !in
01p2anati"n / The fast typistTs wor$ done in ? hr A ?M2
The slow typistTs wor$ done in ? hr A ?M1
If they wor$ co!binely" wor$ done in ? hr A ?M2<?M1 A @MB
So" the wor$ will be co!pleted in BM@ hours# i#e#" ?<?M@ hours A ?hr ?2 !in
1# (avas$arTs average in his first @D innings was @D# After the @?st innings" his average
was @?# .ow !any runs did he score in his @?st innings# ,supposing that he lost his
wic$et in his @?st innings-
Ans(er 8 ?D?
01p2anati"n 8 Total score after @D innings A @D;@D A 2@DD
Total score after @? innings A @?;@? A 2BD?
So" runs !ade in the @?st innings A 2BD?:2@DD A ?D?
If he had not lost his wic$et in his @?st innings" he would have scored an
unbeaten @D in his @?st innings#
C# %ut of FD coins" one is counterfeit# Ghat is the !ini!u! nu!ber of weighings needed
to find out the counterfeit coin`
Ans(er 8 C
@# Ghat can you conclude fro! the state!ent 8 All green are blue" all blue are red# `
,i- so!e blue are green
,ii- so!e red are green
,iii- so!e green are not red
,iv- all red are blue
,a- i or ii but not both
,b- i U ii only
,c- iii or iv but not both
,d- iii U iv
Ans(er 8 ,b-
B# A rectangular plate with length F inches" breadth ?? inches and thic$ness 2 inches is
available# Ghat is the length of the circular rod with dia!eter F inches and e0ual to the
volu!e of the rectangular plate`
Ans(er 8 1#@ inches
01p2anati"n 8 /olu!e of the circular rod ,cylinder- A /olu!e of the rectangular
plate
,22MH-;C;C;h A F;??;2
h A HM2 A 1#@
H# Ghat is the su! of all nu!bers between ?DD and ?DDD which are divisible by ?C `
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??B
Technical Aptitude Questions
Ans(er 8 1@1L2
01p2anati"n 8 The nu!ber closest to ?DD which is greater than ?DD and divisible
by ?C is ??2" which is the first ter! of the series which has to be su!!ed#
The nu!ber closest to ?DDD which is less than ?DDD and divisible by ?C is
LLC" which is the last ter! of the series#
??2 < ?2B < #### < LLC A ?C,F<L< ### < H?- A 1@1L2
F# If s,a- denotes s0uare root of a" find the value of s,?2<s,?2<s,?2< ###### upto infinity#
Ans(er 8 C
01p2anati"n 8 2et 6 A s,?2<s,?2<s,?2<#####
Ge can write 6 A s,?2<6-# i#e#" 692 A ?2 < 6# Solving this 0uadratic e0uation" we
get 6 A :1 or 6AC# Su! cannot be :ve and hence su! A C#
L# A cylindrical container has a radius of eight inches with a height of three inches#
Co!pute how !any inches should be added to either the radius or height to give the sa!e
increase in volu!e`
Ans(er 8 ?BM1 inches
01p2anati"n 8 2et 6 be the a!ount of increase# The volu!e will increase by the
sa!e a!ount if the radius increased or the height is increased#
So" the effect on increasing height is e0ual to the effect on increasing the radius#
i#e#" ,22MH-;F;F;,1<6- A ,22MH-;,F<6-;,F<6-;1
Solving the 0uadratic e0uation we get the 6 A D or ?BM1# The possible increase
would be by ?BM1 inches#
?D# Gith >ust si6 weights and a balance scale" you can weigh any unit nu!ber of $gs fro!
? to 1BC# Ghat could be the si6 weights`
Ans(er 8 ?" 1" L" 2H" F?" 2C1 ,All powers of 1-
??# Diophantus passed one si6th of his life in childhood" one twelfth in youth" and one
seventh !ore as a bachelorX five years after his !arriage a son was born who died four
years before his father at half his final age# .ow old is Diophantus`
Ans(er 8 FC years
01p2anati"n 8 6MB < 6M?2 < 6MH < @ < 6M2 < C A 6
?2 # If ti!e at this !o!ent is L 7#&#" what will be the ti!e 21LLLLLLLL2 hours later`
Ans(er 8 ? 7#&#
01p2anati"n 8 2C billion hours later" it would be L 7#&# and F hours before that it
would be ? 7#&#
?1# .ow big will an angle of one and a half degree loo$ through a glass that !agnifies
things three ti!es`
Ans(er 8 ? ?M2 degrees
01p2anati"n 8 The !agnifying glass cannot increase the !agnitude of an angle#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??H
Technical Aptitude Questions
?C# Divide C@ into four parts such that when 2 is added to the first part" 2 is subtracted
fro! the second part" 2 is !ultiplied by the third part and the fourth part is divided by
two" all result in the sa!e nu!ber#
Ans(er8 F" ?2" @" 2D
01p2anati"n8 a < b < c < d AC@X a<2 A b:2 A 2c A dM2X aAb:CX c A ,b:2-M2X d A
2,b:2-X b:C < b < ,b:2-M2 < 2,b:2- A C@X
?@# I drove BD $! at 1D $!ph and then an additional BD $! at @D $!ph# Co!pute !y
average speed over !y ?2D $!#
Ans(er 8 1H ?M2
01p2anati"n 8 Ti!e re0d for the first BD $! A ?2D !in#X Ti!e re0d for the second
BD $! A H2 !in#X Total ti!e re0d A ?L2 !in
Avg speed A ,BD;?2D-M?L2 A 1H ?M2
Auestions 10 and 15 are .ased on the following :
Five e6ecutives of 5uropean Corporation hold a Conference in )o!e
&r# A converses in Spanish U Italian
&r# *" a spaniard" $nows 5nglish also
&r# C $nows 5nglish and belongs to Italy
&r# D converses in French and Spanish
&r# 5 " a native of Italy $nows French
?B# Ghich of the following can act as interpreter if &r# C U &r# D wish to converse
a- only &r# A b- %nly &r# * c- &r# A U &r# * d- Any of the other three
Ans(er 8 d- Any of the other three#
01p2anati"n 8 Fro! the data given" we can infer the following#
A $nows Spanish" Italian
* $nows Spanish" 5nglish
C $nows Italian" 5nglish
D $nows Spanish" French
5 $nows Italian" French
To act as an interpreter between C and D" a person has to $now one of the
co!binations ItalianUSpanish" ItalianUFrench" 5nglishUSpanish" 5nglishUFrench
A" *" and 5 $now atleast one of the co!binations#

?H# If a Bth e6ecutive is brought in" to be understood by !a6i!u! nu!ber of original
five he should be fluent in
a- 5nglish U French b- Italian U Spanish c- 5nglish U French d- French U
Italian
Ans(er 8 b- Italian U Spanish
01p2anati"n 8 'o of e6ecutives who $now
i- 5nglish is 2
ii- Spanish is 1
iii- Italian is 1
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??F
Technical Aptitude Questions
iv- French is 2
Italian U Spanish are spo$en by the !a6i!u! no of e6ecutives# So" if the Bth
e6ecutive is fluent in Italian U Spanish" he can co!!unicate with all the original five
because everybody $nows either Spanish or Italian#
?F# Ghat is the su! of the first 2@ natural odd nu!bers`
Ans(er 8 B2@
01p2anati"n 8 The su! of the first n natural odd nos is s0uare,n-#
?<1 A C A s0uare,2- ?<1<@ A L A s0uare,1-
?L# The su! of any seven consecutive nu!bers is divisible by
a- 2 b- H c- 1 d- ??
01ercise 3
Tr% the follo4in38
?# There are seventy cler$s wor$ing in a co!pany" of which 1D are fe!ales# Also" 1D
cler$s are !arriedX 2C cler$s are above 2@ years of ageX ?L !arried cler$s are
above 2@ years" of which H are !alesX ?2 !ales are above 2@ years of ageX and ?@
!ales are !arried# .ow !any bachelor girls are there and how !any of these are
above 2@`
2# A !an sailed off fro! the 'orth 7ole# After covering 2"DDD !iles in one direction
he turned Gest" sailed 2"DDD !iles" turned 'orth and sailed ahead another 2"DDD
!iles till he !et his friend# .ow far was he fro! the 'orth 7ole and in what
direction`
1# .ere is a series of co!!ents on the ages of three persons E" )" S by the!selves#
S 8 The difference between )Ts age and !ine is three years#
E 8 ) is the youngest#
) 8 5ither I a! 2C years old or E 2@ or S 2B#
E 8 All are above 2C years of age#
S 8 I a! the eldest if and only if ) is not the youngest#
) 8 S is elder to !e#
E 8 I a! the eldest#
) 8 S is not 2H years old#
S 8 The su! of !y age and ETs is two !ore than twice )Ts age#
%ne of the three had been telling a lie throughout whereas others had spo$en the
truth# Deter!ine the ages of S"E")#
C# In a group of five people" what is the probability of finding two persons with the
sa!e !onth of birth`
@# A father and his son go out for a Twal$:and:runT every !orning around a trac$
for!ed by an e0uilateral triangle# The fatherTs wal$ing speed is 2 !ph and his
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
??L
Technical Aptitude Questions
running speed is @ !ph# The sonTs wal$ing and running speeds are twice that of
his father# *oth start together fro! one ape6 of the triangle" the son going
cloc$wise and the father anti:cloc$wise# Initially the father runs and the son wal$s
for a certain period of ti!e# Thereafter" as soon as the father starts wal$ing" the
son starts running# *oth co!plete the course in C@ !inutes# For how long does the
father run` Ghere do the two cross each other`
B# The Director of &edical Services was on his annual visit to the 5'T .ospital#
Ghile going through the out patientsT records he ca!e across the following data
for a particular day 8 O 5ar consultations C@X 'ose @DX Throat HDX 5ar and 'ose
1DX 'ose and Throat 2DX 5ar and Throat 1DX 5ar" 'ose and Throat ?DX Total
patients ?DD#O Then he ca!e to the conclusion that the records were bogus# Gas
he right`
H# A!ongst )a!" Sha! and (obind are a doctor" a lawyer and a police officer# They
are !arried to )adha" (ita and Sita ,not in order-# 5ach of the wives have a
profession# (obindTs wife is an artist# )a! is not !arried to (ita# The lawyerTs
wife is a teacher# )adha is !arried to the police officer# Sita is an e6pert coo$#
GhoTs who`
F# Ghat should co!e ne6t`
?" 2" C" ?D" ?B" CD" BC"
Auestions ?312 are .ased on the following :
Three adults + )oberto" Sarah and /ic$y + will be traveling in a van with five
children + Freddy" .illary" Eonathan" 2upe" and &arta# The van has a driver4s seat
and one passenger seat in the front" and two benches behind the front seats" one
beach behind the other# 5ach bench has roo! for e6actly three people# 5veryone
!ust sit in a seat or on a bench" and seating is sub>ect to the following restrictions8
An adult !ust sit on each bench#
5ither )oberto or Sarah !ust sit in the driver4s seat#
Eonathan !ust sit i!!ediately beside &arta#
L# %f the following" who can sit in the front passenger seat `
,a- Eonathan ,b- 2upe ,c- )oberto ,d- Sarah ,e- /ic$y
?D# Ghich of the following groups of three can sit together on a bench`
,a- Freddy" Eonathan and &arta ,b- Freddy" Eonathan and /ic$y
,c- Freddy" Sarah and /ic$y ,d- .illary" 2upe and Sarah
,e- 2upe" &arta and )oberto
??# If Freddy sits i!!ediately beside /ic$y" which of the following cannot be true `
a# Eonathan sits i!!ediately beside Sarah
b# 2upe sits i!!ediately beside /ic$y
c# .illary sits in the front passenger seat
d# Freddy sits on the sa!e bench as .illary
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2D
Technical Aptitude Questions
e# .illary sits on the sa!e bench as )oberto
?2# If Sarah sits on a bench that is behind where Eonathan is sitting" which of the
following !ust be true `
a# .illary sits in a seat or on a bench that is in front of where &arta is sitting
b# 2upe sits in a seat or on a bench that is in front of where Freddy is sitting
c# Freddy sits on the sa!e bench as .illary
d# 2upe sits on the sa!e bench as Sarah
e# &arta sits on the sa!e bench as /ic$y
?1# &a$e si6 s0uares of the sa!e sie using twelve !atch:stic$s# ,.int 8 Jou will
need an adhesive to arrange the re0uired figure-
?C# A far!er has two rectangular fields# The larger field has twice the length and C
ti!es the width of the s!aller field# If the s!aller field has area _" then the are of
the larger field is greater than the area of the s!aller field by what a!ount`
,a- B_ ,b- F_ ,c- ?2_ ,d- H_
?@# 'ine e0ual circles are enclosed in a s0uare whose area is 1Bs0 units# Find the area
of each circle#
?B# There are L cards# Arrange the! in a 1;1 !atri6# Cards are of C colors# They are
red" yellow" blue" green# Conditions for arrange!ent8 one red card !ust be in first
row or second row# 2 green cards should be in 1
rd
colu!n# Jellow cards !ust be
in the 1 corners only# Two blue cards !ust be in the 2nd row# At least one green
card in each row#
?H# Is less than w` and w are real nu!bers#
,I-
2
A 2@
,II- w A L
To answer the 0uestion"
a- 5ither I or II is sufficient
b- *oth I and II are sufficient but neither of the! is alone sufficient
c- I U II are sufficient
d- *oth are not sufficient
?F# A spea$s truth HDW of the ti!eX * spea$s truth FDW of the ti!e# Ghat is the
probability that both are contradicting each other`
?L# In a fa!ily H children donTt eat spinach" B donTt eat carrot" @ donTt eat beans" C
donTt eat spinach U carrots" 1 donTt eat carrot U beans" 2 donTt eat beans U
spinach# %ne doesnTt eat all 1# Find the no# of children#
2D# Anna" *ena" Catherina and Diana are at their !onthly business !eeting# Their
occupations are author" biologist" che!ist and doctor" but not necessarily in that
order# Diana >ust told the neighbour" who is a biologist that Catherina was on her
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2?
Technical Aptitude Questions
way with doughnuts# Anna is sitting across fro! the doctor and ne6t to the
che!ist# The doctor was thin$ing that *ena was a good na!e for parentTs to
choose" but didnTt say anything# Ghat is each personTs occupation`
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?22
Technical Aptitude Questions
='II Concepts
S5CTI%' : I
FI25 &A'A(5&5'T I' ='II
1. )ow are devices represented in Q&+Z?
All devices are represented by files called special files that are located
inMdev directory# Thus" device files and other files are na!ed and accessed in the sa!e
way# A Tregular fileT is >ust an ordinary data file in the dis$# A Tbloc$ special fileT
represents a device with characteristics si!ilar to a dis$ ,data transfer in ter!s of bloc$s-#
A Tcharacter special fileT represents a device with characteristics si!ilar to a $eyboard
,data transfer is by strea! of bits in se0uential order-#
2. What is WinodeW?
All ='II files have its description stored in a structure called TinodeT# The inode
contains info about the file:sie" its location" ti!e of last access" ti!e of last !odification"
per!ission and so on# Directories are also represented as files and have an associated
inode# In addition to descriptions about the file" the inode contains pointers to the data
bloc$s of the file# If the file is large" inode has indirect pointer to a bloc$ of pointers to
additional data bloc$s ,this further aggregates for larger files-# A bloc$ is typically F$#
Inode consists of the following fields8
File owner identifier
File type
File access per!issions
File access ti!es
'u!ber of lin$s
File sie
2ocation of the file data
3. "rief a.out the directory representation in Q&+Z
A =ni6 directory is a file containing a correspondence between filena!es and
inodes# A directory is a special file that the $ernel !aintains# %nly $ernel !odifies
directories" but processes can read directories# The contents of a directory are a list of
filena!e and inode nu!ber pairs# Ghen new directories are created" $ernel !a$es two
entries na!ed T#T ,refers to the directory itself- and T##T ,refers to parent directory-#
Syste! call for creating directory is !$dir ,pathna!e" !ode-#
*. What are the Qnix system calls for +GE?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?21
UNIX Concepts

Technical Aptitude Questions
open,pathna!e"flag"!ode- : open file
creat,pathna!e"!ode- : create file
close,filedes- : close an open file
read,filedes"buffer"bytes- : read data fro! an open file
write,filedes"buffer"bytes- : write data to an open file
lsee$,filedes"offset"fro!- : position an open file
dup,filedes- : duplicate an e6isting file descriptor
dup2,oldfd"newfd- : duplicate to a desired file descriptor
fcntl,filedes"c!d"arg- : change properties of an open file
ioctl,filedes"re0uest"arg- : change the behaviour of an open file
The difference between fcntl anf ioctl is that the for!er is intended for any open file"
while the latter is for device:specific operations#
-. )ow do you change <ile 6ccess >ermissions?
5very file has following attributes8
ownerTs user ID , ?B bit integer -
ownerTs group ID , ?B bit integer -
File access !ode word
Tr w 6 :r w 6: r w 6T
,user per!ission:group per!ission:others per!ission-
r:read" w:write" 6:e6ecute
To change the access !ode" we use ch!od,filena!e"!ode-#
56a!ple ?8
To change !ode of !yfile to Trw:rw:r::T ,ie# read" write per!ission for user :
read"write per!ission for group : only read per!ission for others- we give the args as8
ch!od,!yfile"DBBC- #
5ach operation is represented by discrete values
TrT is C
TwT is 2
T6T is ?
Therefore" for TrwT the value is B,C<2-#
56a!ple 28
To change !ode of !yfile to Trw6r::r::T we give the args as8
ch!od,!yfile"DHCC-#
0. What are lin's and sym.olic lin's in Q&+Z file system?
A lin$ is a second na!e ,not a file- for a file# 2in$s can be used to assign !ore
than one na!e to a file" but cannot be used to assign a directory !ore than one na!e or
lin$ filena!es on different co!puters#
Sy!bolic lin$ TisT a file that only contains the na!e of another file#%peration on
the sy!bolic lin$ is directed to the file pointed by the it#*oth the li!itations of lin$s are
eli!inated in sy!bolic lin$s#
Co!!ands for lin$ing files are8
2in$ ln filena!e? filena!e2
Sy!bolic lin$ ln :s filena!e? filena!e2
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2C
Technical Aptitude Questions
5. What is a <+<E?
FIF% are otherwise called as Tna!ed pipesT# FIF% ,first:in:first:out- is a special
file which is said to be data transient# %nce data is read fro! na!ed pipe" it cannot be
read again# Also" data can be read only in the order written# It is used in interprocess
co!!unication where a process writes to one end of the pipe ,producer- and the other
reads fro! the other end ,consu!er-#
7. )ow do you create special files li'e named pipes and device files?
The syste! call !$nod creates special files in the following se0uence#
?# $ernel assigns new inode"
2# sets the file type to indicate that the file is a pipe" directory or special file"
1# If it is a device file" it !a$es the other entries li$e !a>or" !inor device nu!bers#
For e6a!ple8
If the device is a dis$" !a>or device nu!ber refers to the dis$ controller and !inor
device nu!ber is the dis$#

?. !iscuss the mount and unmount system calls
The privileged !ount syste! call is used to attach a file syste! to a directory of
another file syste!X the un!ount syste! call detaches a file syste!# Ghen you !ount
another file syste! on to your directory" you are essentially splicing one directory tree
onto a branch in another directory tree# The first argu!ent to !ount call is the !ount
point" that is " a directory in the current file na!ing syste!# The second argu!ent is the
file syste! to !ount to that point# Ghen you insert a cdro! to your uni6 syste!Ts drive"
the file syste! in the cdro! auto!atically !ounts to MdevMcdro! in your syste!#
1@. )ow does the inode map to data .loc' of a file?
Inode has ?1 bloc$ addresses# The first ?D are direct bloc$ addresses of the first
?D data bloc$s in the file# The ??th address points to a one:level inde6 bloc$# The ?2th
address points to a two:level ,double in:direction- inde6 bloc$# The ?1th address points to
a three:level,triple in:direction-inde6 bloc$# This provides a very large !a6i!u! file sie
with efficient access to large files" but also s!all files are accessed directly in one dis$
read#
11. What is a shell?
A shell is an interactive user interface to an operating syste! services that allows an user
to enter co!!ands as character strings or through a graphical user interface# The shell
converts the! to syste! calls to the %S or for$s off a process to e6ecute the co!!and#
Syste! call results and other infor!ation fro! the %S are presented to the user through
an interactive interface# Co!!only used shells are sh"csh"$s etc#
S5CTI%' : II
7)%C5SS &%D52 and I7C
1. "rief a.out the initial process se/uence while the system .oots up.
Ghile booting" special process called the TswapperT or TschedulerT is created with
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2@
Technical Aptitude Questions
7rocess:ID D# The swapper !anages !e!ory allocation for processes and influences
C7= allocation# The swapper inturn creates 1 children8
the process dispatcher"
vhand and
dbflush
with IDs ?"2 and 1 respectively#
This is done by e6ecuting the file MetcMinit# 7rocess dispatcher gives birth to the
shell# =ni6 $eeps trac$ of all the processes in an internal data structure called the 7rocess
Table ,listing co!!and is ps :el-#
2. What are various +!s associated with a process?
=ni6 identifies each process with a uni0ue integer called 7rocessID# The process
that e6ecutes the re0uest for creation of a process is called the Tparent processT whose 7ID
is T7arent 7rocess IDT# 5very process is associated with a particular user called the TownerT
who has privileges over the process# The identification for the user is T=serIDT# %wner is
the user who e6ecutes the process# 7rocess also has T5ffective =ser IDT which deter!ines
the access privileges for accessing resources li$e files#
getpid,- :process id
getppid,- :parent process id
getuid,- :user id
geteuid,- :effective user id
3. 1xplain for'24 system call.
The efor$,-T used to create a new process fro! an e6isting process# The new
process is called the child process" and the e6isting process is called the parent# Ge can
tell which is which by chec$ing the return value fro! efor$,-T# The parent gets the childTs
pid returned to hi!" but the child gets D returned to hi!#
*. >redict the output of the following program code
!ain,-
]
for$,-X
printf,O.ello Gorld!O-X
^
Ans(er/
.ello Gorld!.ello Gorld!
01p2anati"n8
The for$ creates a child that is a duplicate of the parent process# The child begins
fro! the for$,-#All the state!ents after the call to for$,- will be e6ecuted twice#,once by
the parent process and other by child-# The state!ent before for$,- is e6ecuted only by
the parent process#
-. >redict the output of the following program code
!ain,-
]
for$,-X for$,-X for$,-X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2B
Technical Aptitude Questions
printf,O.ello Gorld!O-X
^
Ans(er/
O.ello GorldO will be printed F ti!es#
01p2anati"n8
29n ti!es where n is the nu!ber of calls to for$,-
0. List the system calls used for process management:
;%stem ($lls /es(ription
for$,- To create a new process
e6ec,- To e6ecute a new progra! in a process
wait,- To wait until a created process co!pletes its e6ecution
e6it,- To e6it fro! a process e6ecution
getpid,- To get a process identifier of the current process
getppid,- To get parent process identifier
nice,- To bias the e6isting priority of a process
br$,- To increaseMdecrease the data seg!ent sie of a process
5. )ow can you getGset an environment varia.le from a program?
(etting the value of an environ!ent variable is done by using egetenv,-T#
Setting the value of an environ!ent variable is done by using eputenv,-T#
7. )ow can a parent and child process communicate?
A parent and child can co!!unicate through any of the nor!al inter:process
co!!unication sche!es ,pipes" soc$ets" !essage 0ueues" shared !e!ory-" but also have
so!e special ways to co!!unicate that ta$e advantage of their relationship as a parent
and child# %ne of the !ost obvious is that the parent can get the e6it status of the child#
?. What is a Com.ie?
Ghen a progra! for$s and the child finishes before the parent" the $ernel still
$eeps so!e of its infor!ation about the child in case the parent !ight need it : for
e6a!ple" the parent !ay need to chec$ the childTs e6it status# To be able to get this
infor!ation" the parent calls ewait,-TX In the interval between the child ter!inating and the
parent calling ewait,-T" the child is said to be a eo!bieT ,If you do epsT" the child will have
a efT in its status field to indicate this#-
1@. What are the process states in Qnix?
As a process e6ecutes it changes state according to its circu!stances# =ni6
processes have the following states8
)unning 8 The process is either running or it is ready to run #
Gaiting 8 The process is waiting for an event or for a resource#
Stopped 8 The process has been stopped" usually by receiving a signal#
fo!bie 8 The process is dead but have not been re!oved fro! the process table#
11. What )appens when you execute a program?
Ghen you e6ecute a progra! on your ='II syste!" the syste! creates a special
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2H
Technical Aptitude Questions
environ!ent for that progra!# This environ!ent contains everything needed for the
syste! to run the progra! as if no other progra! were running on the syste!# 5ach
process has process conte6t" which is everything that is uni0ue about the state of the
progra! you are currently running# 5very ti!e you e6ecute a progra! the ='II syste!
does a for$" which perfor!s a series of operations to create a process conte6t and then
e6ecute your progra! in that conte6t# The steps include the following8
Allocate a slot in the process table" a list of currently running progra!s $ept by
='II#
Assign a uni0ue process identifier ,7ID- to the process#
iCopy the conte6t of the parent" the process that re0uested the spawning of the new
process#
)eturn the new 7ID to the parent process# This enables the parent process to e6a!ine
or control the process directly#
After the for$ is co!plete" ='II runs your progra!#
12. What )appens when you execute a command?
Ghen you enter TlsT co!!and to loo$ at the contents of your current wor$ing
directory" ='II does a series of things to create an environ!ent for ls and the run it8 The
shell has ='II perfor! a for$# This creates a new process that the shell will use to run
the ls progra!# The shell has ='II perfor! an e6ec of the ls progra!# This replaces the
shell progra! and data with the progra! and data for ls and then starts running that new
progra!# The ls progra! is loaded into the new process conte6t" replacing the te6t and
data of the shell# The ls progra! perfor!s its tas$" listing the contents of the current
directory#
13. What is a !aemon?
A dae!on is a process that detaches itself fro! the ter!inal and runs"
disconnected" in the bac$ground" waiting for re0uests and responding to the!# It can also
be defined as the bac$ground process that does not belong to a ter!inal session# &any
syste! functions are co!!only perfor!ed by dae!ons" including the send!ail dae!on"
which handles !ail" and the ''T7 dae!on" which handles =S5'5T news# &any other
dae!ons !ay e6ist# So!e of the !ost co!!on dae!ons are8
init8 Ta$es over the basic running of the syste! when the $ernel has finished the boot
process#
inetd8 )esponsible for starting networ$ services that do not have their own stand:
alone dae!ons# For e6a!ple" inetd usually ta$es care of inco!ing rlogin" telnet" and
ftp connections#
cron8 )esponsible for running repetitive tas$s on a regular schedule#
1*. What is WpsW command for?
The ps co!!and prints the process status for so!e or all of the running
processes# The infor!ation given are the process identification nu!ber ,7ID-"the a!ount
of ti!e that the process has ta$en to e6ecute so far etc#
1-. )ow would you 'ill a process?
The $ill co!!and ta$es the 7ID as one argu!entX this identifies which process to
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2F
Technical Aptitude Questions
ter!inate# The 7ID of a process can be got using TpsT co!!and#
10. What is an advantage of executing a process in .ac'ground?
The !ost co!!on reason to put a process in the bac$ground is to allow you to do
so!ething else interactively without waiting for the process to co!plete# At the end of
the co!!and you add the special bac$ground sy!bol" U# This sy!bol tells your shell to
e6ecute the given co!!and in the bac$ground#
56a!ple8 cp ;#; ##Mbac$upU ,cp is for copy-
15. )ow do you execute one program from within another?
The syste! calls used for low:level process creation are e6eclp,- and e6ecvp,-#
The e6eclp call overlays the e6isting progra! with the new one " runs that and e6its# The
original progra! gets bac$ control only when an error occurs#
e6eclp,path"fileNna!e"argu!ents##-X MMlast argu!ent !ust be '=22
A variant of e6eclp called e6ecvp is used when the nu!ber of argu!ents is not $nown in
advance#
e6ecvp,path"argu!entNarray-X MMargu!ent array should be ter!inated by '=22
17. What is +>,? What are the various schemes availa.le?
The ter! I7C ,Inter:7rocess Co!!unication- describes various ways by which
different process running on so!e operating syste! co!!unicate between each other#
/arious sche!es available are as follows8
>ipes:
%ne:way co!!unication sche!e through which different process can
co!!unicate# The proble! is that the two processes should have a co!!on
ancestor ,parent:child relationship-# .owever this proble! was fi6ed with the
introduction of na!ed:pipes ,FIF%-#
#essage Aueues :
&essage 0ueues can be used between related and unrelated processes
running on a !achine#
$hared #emory:
This is the fastest of all I7C sche!es# The !e!ory to be shared is !apped
into the address space of the processes ,that are sharing-# The speed achieved is
attributed to the fact that there is no $ernel involve!ent# *ut this sche!e needs
synchroniation#
/arious for!s of synchronisation are !ute6es" condition:variables" read:write
loc$s" record:loc$s" and se!aphores#
S5CTI%' : III
&5&%)J &A'A(5&5'T
1. What is the difference .etween $wapping and >aging?
$wapping:
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?2L
Technical Aptitude Questions
Ghole process is !oved fro! the swap device to the !ain !e!ory for
e6ecution# 7rocess sie !ust be less than or e0ual to the available !ain !e!ory# It is
easier to i!ple!entation and overhead to the syste!# Swapping syste!s does not handle
the !e!ory !ore fle6ibly as co!pared to the paging syste!s#
>aging:
%nly the re0uired !e!ory pages are !oved to !ain !e!ory fro! the
swap device for e6ecution# 7rocess sie does not !atter# (ives the concept of the virtual
!e!ory#
It provides greater fle6ibility in !apping the virtual address space into the
physical !e!ory of the !achine# Allows !ore nu!ber of processes to fit in the !ain
!e!ory si!ultaneously# Allows the greater process sie than the available physical
!e!ory# De!and paging syste!s handle the !e!ory !ore fle6ibly#
2. What is major difference .etween the )istoric Qnix and the new "$! release of Qnix
$ystem B in terms of #emory #anagement?
.istoric =ni6 uses Swapping + entire process is transferred to the !ain !e!ory
fro! the swap device" whereas the =ni6 Syste! / uses De!and 7aging + only the part
of the process is !oved to the !ain !e!ory# .istoric =ni6 uses one Swap Device and
=ni6 Syste! / allow !ultiple Swap Devices#
3. What is the main goal of the #emory #anagement?
It decides which process should reside in the !ain !e!ory"
&anages the parts of the virtual address space of a process which is non:core
resident"
&onitors the available !ain !e!ory and periodically write the processes into the
swap device to provide !ore processes fit in the !ain !e!ory si!ultaneously#
*. What is a #ap?
A &ap is an Array" which contains the addresses of the free space in the swap
device that are allocatable resources" and the nu!ber of the resource units available there#
This allows First:Fit allocation of contiguous bloc$s of a resource# Initially the
&ap contains one entry + address ,bloc$ offset fro! the starting of the swap area- and the
total nu!ber of resources#
_ernel treats each unit of &ap as a group of dis$ bloc$s# %n the allocation and
freeing of the resources _ernel updates the &ap for accurate infor!ation#
-. What scheme does the [ernel in Qnix $ystem B follow while choosing a swap device
among the multiple swap devices?
_ernel follows )ound )obin sche!e choosing a swap device a!ong the !ultiple
swap devices in =ni6 Syste! /#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1D
? ?D"DDD
Address =nits
Technical Aptitude Questions
0. What is a egion?
A )egion is a continuous area of a process4s address space ,such as te6t" data and
stac$-# The $ernel in a 3)egion Table4 that is local to the process !aintains region#
)egions are sharable a!ong the process#
5. What are the events done .y the [ernel after a process is .eing swapped out from the
main memory?
Ghen _ernel swaps the process out of the pri!ary !e!ory" it perfor!s the
following8
_ernel decre!ents the )eference Count of each region of the process# If the
reference count beco!es ero" swaps the region out of the !ain !e!ory"
_ernel allocates the space for the swapping process in the swap device"
_ernel loc$s the other swapping process while the current swapping operation
is going on"
The _ernel saves the swap address of the region in the region table#
7. +s the >rocess .efore and after the swap are the same? =ive reason.
7rocess before swapping is residing in the pri!ary !e!ory in its original for!#
The regions ,te6t" data and stac$- !ay not be occupied fully by the process" there !ay be
few e!pty slots in any of the regions and while swapping _ernel do not bother about the
e!pty slots while swapping the process out#
After swapping the process resides in the swap ,secondary !e!ory- device# The
regions swapped out will be present but only the occupied region slots but not the e!pty
slots that were present before assigning#
Ghile swapping the process once again into the !ain !e!ory" the _ernel
referring to the 7rocess &e!ory &ap" it assigns the !ain !e!ory accordingly ta$ing
care of the e!pty slots in the regions#
?. What do you mean .y u3area 2user area4 or u3.loc'?
This contains the private data that is !anipulated only by the _ernel# This is local
to the 7rocess" i#e# each process is allocated a u:area#
1@. What are the entities that are swapped out of the main memory while swapping the
process out of the main memory?
All !e!ory space occupied by the process" process4s u:area" and _ernel stac$ are
swapped out" theoretically#
7ractically" if the process4s u:area contains the Address Translation Tables for the
process then _ernel i!ple!entations do not swap the u:area#
11. What is <or' swap?
for$,- is a syste! call to create a child process# Ghen the parent process calls
for$,- syste! call" the child process is created and if there is short of !e!ory then the
child process is sent to the read:to:run state in the swap device" and return to the user
state without swapping the parent process# Ghen the !e!ory will be available the child
process will be swapped into the !ain !e!ory#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1?
Technical Aptitude Questions
12. What is 1xpansion swap?
At the ti!e when any process re0uires !ore !e!ory than it is currently allocated"
the _ernel perfor!s 56pansion swap# To do this _ernel reserves enough space in the
swap device# Then the address translation !apping is ad>usted for the new virtual address
space but the physical !e!ory is not allocated# At last _ernel swaps the process into the
assigned space in the swap device# 2ater when the _ernel swaps the process into the
!ain !e!ory this assigns !e!ory according to the new address translation !apping#
13. )ow the $wapper wor's?
The swapper is the only process that swaps the processes# The Swapper operates
only in the _ernel !ode and it does not uses Syste! calls instead it uses internal _ernel
functions for swapping# It is the archetype of all $ernel process#
1*. What are the processes that are not .othered .y the swapper? =ive eason.
fo!bie process8 They do not ta$e any up physical !e!ory#
7rocesses loc$ed in !e!ories that are updating the region of the process#
_ernel swaps only the sleeping processes rather than the 3ready:to:run4
processes" as they have the higher probability of being scheduled than the
Sleeping processes#
1-. What are the re/uirements for a swapper to wor'?
The swapper wor$s on the highest scheduling priority# Firstly it will loo$ for any
sleeping process" if not found then it will loo$ for the ready:to:run process for swapping#
*ut the !a>or re0uire!ent for the swapper to wor$ the ready:to:run process !ust be
core:resident for at least 2 seconds before swapping out# And for swapping in the process
!ust have been resided in the swap device for at least 2 seconds# If the re0uire!ent is not
satisfied then the swapper will go into the wait state on that event and it is awa$en once
in a second by the _ernel#
10. What are the criteria for choosing a process for swapping into memory from the
swap device?
The resident ti!e of the processes in the swap device" the priority of the processes
and the a!ount of ti!e the processes had been swapped out#
15. What are the criteria for choosing a process for swapping out of the memory to the
swap device?
The process4s !e!ory resident ti!e"
7riority of the process and
The nice value#
17. What do you mean .y nice value?
'ice value is the value that controls ]incre!ents or decre!ents^ the priority of
the process# This value that is returned by the nice ,- syste! call# The e0uation for using
nice value is8
>riority I 2\recent ,>Q usage]Gconstant4 8 2.ase3 priority4 8 2nice value4
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?12
Technical Aptitude Questions
%nly the ad!inistrator can supply the nice value# The nice ,- syste! call wor$s
for the running process only# 'ice value of one process cannot affect the nice value of the
other process#
1?. What are conditions on which deadloc' can occur while swapping the processes?
All processes in the !ain !e!ory are asleep#
All 3ready:to:run4 processes are swapped out#
There is no space in the swap device for the new inco!ing process that are
swapped out of the !ain !e!ory#
There is no space in the !ain !e!ory for the new inco!ing process#
2@. What are conditions for a machine to support !emand >aging?
&e!ory architecture !ust based on 7ages"
The !achine !ust support the 3restartable4 instructions#
21. What is Xthe principle of localityF?
It4s the nature of the processes that they refer only to the s!all subset of the total
data space of the process# i#e# the process fre0uently calls the sa!e subroutines or
e6ecutes the loop instructions#
22. What is the wor'ing set of a process?
The set of pages that are referred by the process in the last 3n4" references" where
3n4 is called the window of the wor$ing set of the process#
23. What is the window of the wor'ing set of a process?
The window of the wor$ing set of a process is the total nu!ber in which the
process had referred the set of pages in the wor$ing set of the process#
2*. What is called a page fault?
7age fault is referred to the situation when the process addresses a page in the
wor$ing set of the process but the process fails to locate the page in the wor$ing set# And
on a page fault the $ernel updates the wor$ing set by reading the page fro! the secondary
device#
2-. What are data structures that are used for !emand >aging?
_ernel contains C data structures for De!and paging# They are"
7age table entries"
Dis$ bloc$ descriptors"
7age fra!e data table ,pfdata-"
Swap:use table#

20. What are the .its that support the demand paging?
/alid" )eference" &odify" Copy on write" Age# These bits are the part of the page
table entry" which includes physical address of the page and protection bits#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?11
Technical Aptitude Questions
7age address
Age Copy on write &odify )eference /alid 7rotection
25. )ow the [ernel handles the for'24 system call in traditional Qnix and in the $ystem B
Qnix% while swapping?
_ernel in traditional =ni6" !a$es the duplicate copy of the parent4s address space
and attaches it to the child4s process" while swapping# _ernel in Syste! / =ni6"
!anipulates the region tables" page table" and pfdata table entries" by incre!enting the
reference count of the region table of shared regions#
27. !ifference .etween the for'24 and vfor'24 system call?
During the for$,- syste! call the _ernel !a$es a copy of the parent process4s
address space and attaches it to the child process#
*ut the vfor$,- syste! call do not !a$es any copy of the parent4s address space"
so it is faster than the for$,- syste! call# The child process as a result of the vfor$,-
syste! call e6ecutes e6ec,- syste! call# The child process fro! vfor$,- syste! call
e6ecutes in the parent4s address space ,this can overwrite the parent4s data and stac$ -
which suspends the parent process until the child process e6its#
2?. What is "$$2"loc' $tarted .y $ym.ol4?
A data representation at the !achine level" that has initial values when a progra!
starts and tells about how !uch space the $ernel allocates for the un:initialied data#
_ernel initialies it to ero at run:ti!e#
3@. What is >age3$tealer process?
This is the _ernel process that !a$es roo!s for the inco!ing pages" by swapping
the !e!ory pages that are not the part of the wor$ing set of a process# 7age:Stealer is
created by the _ernel at the syste! initialiation and invo$es it throughout the lifeti!e of
the syste!# _ernel loc$s a region when a process faults on a page in the region" so that
page stealer cannot steal the page" which is being faulted in#
31. &ame two paging states for a page in memory?
The two paging states are8
The page is aging and is not yet eligible for swapping"
The page is eligible for swapping but not yet eligible for reassign!ent to other virtual
address space#
32. What are the phases of swapping a page from the memory?
7age stealer finds the page eligible for swapping and places the page nu!ber
in the list of pages to be swapped#
_ernel copies the page to a swap device when necessary and clears the valid
bit in the page table entry" decre!ents the pfdata reference count" and places
the pfdata table entry at the end of the free list if its reference count is D#
33. What is page fault? +ts types?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1C
Technical Aptitude Questions
7age fault refers to the situation of not having a page in the !ain !e!ory when
any process references it#
There are two types of page fault 8
/alidity fault"
7rotection fault#
3*. +n what way the <ault )andlers and the +nterrupt handlers are different?
Fault handlers are also an interrupt handler with an e6ception that the interrupt
handlers cannot sleep# Fault handlers sleep in the conte6t of the process that caused the
!e!ory fault# The fault refers to the running process and no arbitrary processes are put to
sleep#
3-. What is validity fault?
If a process referring a page in the !ain !e!ory whose valid bit is not set" it
results in validity fault#
The valid bit is not set for those pages8
that are outside the virtual address space of a process"
that are the part of the virtual address space of the process but no physical address is
assigned to it#
30. What does the swapping system do if it identifies the illegal page for swapping?
If the dis$ bloc$ descriptor does not contain any record of the faulted page" then
this causes the atte!pted !e!ory reference is invalid and the $ernel sends a
\$egmentation violation] signal to the offending process# This happens when the
swapping syste! identifies any invalid !e!ory reference#
35. What are states that the page can .e in% after causing a page fault?
%n a swap device and not in !e!ory"
%n the free page list in the !ain !e!ory"
In an e6ecutable file"
&ar$ed [de!and ero\"
&ar$ed [de!and fill\#
37. +n what way the validity fault handler concludes?
It sets the valid bit of the page by clearing the !odify bit#
It recalculates the process priority#
3?. 6t what mode the fault handler executes?
At the _ernel &ode#
*@. What do you mean .y the protection fault?
7rotection fault refers to the process accessing the pages" which do not have the
access per!ission# A process also incur the protection fault when it atte!pts to write a
page whose copy on write bit was set during the for$,- syste! call#
*1. )ow the [ernel handles the copy on write .it of a page% when the .it is set?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1@
Technical Aptitude Questions
In situations li$e" where the copy on write bit of a page is set and that page is
shared by !ore than one process" the _ernel allocates new page and copies the content to
the new page and the other processes retain their references to the old page# After
copying the _ernel updates the page table entry with the new page nu!ber# Then _ernel
decre!ents the reference count of the old pfdata table entry#
In cases li$e" where the copy on write bit is set and no processes are sharing the
page" the _ernel allows the physical page to be reused by the processes# *y doing so" it
clears the copy on write bit and disassociates the page fro! its dis$ copy ,if one e6ists-"
because other process !ay share the dis$ copy# Then it re!oves the pfdata table entry
fro! the page:0ueue as the new copy of the virtual page is not on the swap device# It
decre!ents the swap:use count for the page and if count drops to D" frees the swap space#
*2. <or which 'ind of fault the page is chec'ed first?
The page is first chec$ed for the validity fault" as soon as it is found that the page
is invalid ,valid bit is clear-" the validity fault handler returns i!!ediately" and the
process incur the validity page fault# _ernel handles the validity fault and the process will
incur the protection fault if any one is present#
*3. +n what way the protection fault handler concludes?
After finishing the e6ecution of the fault handler" it sets the modify and protection
bits and clears the copy on write bit# It recalculates the process:priority and chec$s for
signals#
**. )ow the [ernel handles .oth the page stealer and the fault handler?
The page stealer and the fault handler thrash because of the shortage of the
!e!ory# If the su! of the wor$ing sets of all processes is greater that the physical
!e!ory then the fault handler will usually sleep because it cannot allocate pages for a
process# This results in the reduction of the syste! throughput because _ernel spends too
!uch ti!e in overhead" rearranging the !e!ory in the frantic pace#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1B
Technical Aptitude Questions
)D*&S Concepts
1. What is data.ase?
A database is a logically coherent collection of data with so!e inherent !eaning"
representing so!e aspect of real world and which is designed" built and populated with
data for a specific purpose#
2. What is !"#$?
It is a collection of progra!s that enables user to create and !aintain a database#
In other words it is general:purpose software that provides the users with the processes of
defining" constructing and manipulating the database for various applications#
3. What is a !ata.ase system?
The database and D*&S software together is called as Database syste!#
*. 6dvantages of !"#$?
)edundancy is controlled#
=nauthorised access is restricted#
7roviding !ultiple user interfaces#
5nforcing integrity constraints#
7roviding bac$up and recovery#
-. !isadvantage in <ile >rocessing $ystem?
Data redundancy U inconsistency#
Difficult in accessing data#
Data isolation#
Data integrity#
Concurrent access is not possible#
Security 7roble!s#
0. !escri.e the three levels of data a.straction?
The are three levels of abstraction8
>hysical level: The lowest level of abstraction describes how data are stored#
Logical level: The ne6t higher level of abstraction" describes what data are stored in
database and what relationship a!ong those data#
Biew level: The highest level of abstraction describes only part of entire database#
5. !efine the Kintegrity rulesK
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1H
RDBMS Concepts

Technical Aptitude Questions
There are two Integrity rules#
1ntity +ntegrity: States that [7ri!ary $ey cannot have '=22 value\
eferential +ntegrity: States that [Foreign _ey can be either a '=22 value
or should be 7ri!ary _ey value of other relation#
7. What is extension and intension?
1xtension :
It is the nu!ber of tuples present in a table at any instance# This is ti!e
dependent#
+ntension :
It is a constant value that gives the na!e" structure of table and the
constraints laid on it#
?. What is $ystem ? What are its two major su.systems?
Syste! ) was designed and developed over a period of ?LHC:HL at I*& San Eose
)esearch Center# It is a prototype and its purpose was to de!onstrate that it is possible to
build a )elational Syste! that can be used in a real life environ!ent to solve real life
proble!s" with perfor!ance at least co!parable to that of e6isting syste!#
Its two subsyste!s are
)esearch Storage
Syste! )elational Data Syste!#
1@. )ow is the data structure of $ystem different from the relational structure?
=nli$e )elational syste!s in Syste! )
Do!ains are not supported
5nforce!ent of candidate $ey uni0ueness is optional
5nforce!ent of entity integrity is optional
)eferential integrity is not enforced
11. What is !ata +ndependence?
Data independence !eans that [the application is independent of the storage
structure and access strategy of data\# In other words" The ability to !odify the sche!a
definition in one level should not affect the sche!a definition in the ne6t higher level#
Two types of Data Independence8
7hysical Data Independence8 &odification in physical level should not
affect the logical level#
2ogical Data Independence8 &odification in logical level should affect the
view level#
&ED1: Logical !ata +ndependence is more difficult to achieve
12. What is a view? )ow it is related to data independence?
A view !ay be thought of as a virtual table" that is" a table that does not really
e6ist in its own right but is instead derived fro! one or !ore underlying base table# In
other words" there is no stored file that direct represents the view instead a definition of
view is stored in data dictionary#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1F
Technical Aptitude Questions
(rowth and restructuring of base tables is not reflected in views# Thus the view
can insulate users fro! the effects of restructuring and growth in the database# .ence
accounts for logical data independence#
13. What is !ata #odel?
A collection of conceptual tools for describing data" data relationships data
se!antics and constraints#
1*. What is 13 model?
This data !odel is based on real world that consists of basic ob>ects called entities
and of relationship a!ong these ob>ects# 5ntities are described in a database by a set of
attributes#
1-. What is E.ject Eriented model?
This !odel is based on collection of ob>ects# An ob>ect contains values stored in
instance variables with in the ob>ect# An ob>ect also contains bodies of code that operate
on the ob>ect# These bodies of code are called !ethods# %b>ects that contain sa!e types
of values and the sa!e !ethods are grouped together into classes#
10. What is an 1ntity?
It is a TthingT in the real world with an independent e6istence#
15. What is an 1ntity type?
It is a collection ,set- of entities that have sa!e attributes#
17. What is an 1ntity set?
It is a collection of all entities of particular entity type in the database#
1?. What is an 1xtension of entity type?
The collections of entities of a particular entity type are grouped together into an
entity set#
2@. What is Wea' 1ntity set?
An entity set !ay not have sufficient attributes to for! a pri!ary $ey" and its
pri!ary $ey co!pro!ises of its partial $ey and pri!ary $ey of its parent entity" then it is
said to be Gea$ 5ntity set#
21. What is an attri.ute?
It is a particular property" which describes the entity#
22. What is a elation $chema and a elation?
A relation Sche!a denoted by ),A?" A2" K" An- is !ade up of the relation na!e
) and the list of attributes Ai that it contains# A relation is defined as a set of tuples# 2et r
be the relation which contains set tuples ,t?" t2" t1" ###" tn-# 5ach tuple is an ordered list of
n:values tA,v?"v2" ###" vn-#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?1L
Technical Aptitude Questions
23. What is degree of a elation?
It is the nu!ber of attribute of its relation sche!a#
2*. What is elationship?
It is an association a!ong two or !ore entities#
2-. What is elationship set?
The collection ,or set- of si!ilar relationships#
20. What is elationship type?
)elationship type defines a set of associations or a relationship set a!ong a given
set of entity types#

25. What is degree of elationship type?
It is the nu!ber of entity type participating#
2-. What is !!L 2!ata !efinition Language4?
A data base sche!a is specifies by a set of definitions e6pressed by a special
language called DD2#
20. What is B!L 2Biew !efinition Language4?
It specifies user views and their !appings to the conceptual sche!a#
25. What is $!L 2$torage !efinition Language4?
This language is to specify the internal sche!a# This language !ay specify the
!apping between two sche!as#
27. What is !ata $torage 3 !efinition Language?
The storage structures and access !ethods used by database syste! are specified
by a set of definition in a special type of DD2 called data storage:definition language#
2?. What is !#L 2!ata #anipulation Language4?
This language that enable user to access or !anipulate data as organised by
appropriate data !odel#
>rocedural !#L or Low level: D&2 re0uires a user to specify what data are needed
and how to get those data#
&on3>rocedural !#L or )igh level: D&2 re0uires a user to specify what data are
needed without specifying how to get those data#
31. What is !#L ,ompiler?
It translates D&2 state!ents in a 0uery language into low:level instruction that
the 0uery evaluation engine can understand#
32. What is Auery evaluation engine?
It e6ecutes low:level instruction generated by co!piler#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?CD
Technical Aptitude Questions
33. What is !!L +nterpreter?
It interprets DD2 state!ents and record the! in tables containing !etadata#
3*. What is ecord3at3a3time?
The 2ow level or 7rocedural D&2 can specify and retrieve each record fro! a set
of records# This retrieve of a record is said to be )ecord:at:a:ti!e#
3-. What is $et3at3a3time or $et3oriented?
The .igh level or 'on:procedural D&2 can specify and retrieve !any records in
a single D&2 state!ent# This retrieve of a record is said to be Set:at:a:ti!e or Set:
oriented#
30. What is elational 6lge.ra?
It is procedural 0uery language# It consists of a set of operations that ta$e one or
two relations as input and produce a new relation#
35. What is elational ,alculus?
It is an applied predicate calculus specifically tailored for relational databases
proposed by 5#F# Codd# 5#g# of languages based on it are DS2 A27.A" Q=52#
37. )ow does Duple3oriented relational calculus differ from domain3oriented relational
calculus
The tuple:oriented calculus uses a tuple variables i#e#" variable whose only
per!itted values are tuples of that relation# 5#g# Q=52
The do!ain:oriented calculus has do!ain variables i#e#" variables that range over the
underlying do!ains instead of over relation# 5#g# I22" D5D=C5#
3?. What is normaliCation?
It is a process of analysing the given relation sche!as based on their Functional
Dependencies ,FDs- and pri!ary $ey to achieve the properties
&ini!iing redundancy
&ini!iing insertion" deletion and update ano!alies#
*@. What is <unctional !ependency?
A Functional dependency is denoted by I J between two sets of attributes I
and J that are subsets of ) specifies a constraint on the possible tuple that can for! a
relation state r of )# The constraint is for any two tuples t? and t2 in r if t?PIQ A t2PIQ
then they have t?PJQ A t2PJQ# This !eans the value of I co!ponent of a tuple uni0uely
deter!ines the value of co!ponent J#
*1. When is a functional dependency < said to .e minimal?
5very dependency in F has a single attribute for its right hand side#
Ge cannot replace any dependency I A in F with a dependency J A where J is a
proper subset of I and still have a set of dependency that is e0uivalent to F#
Ge cannot re!ove any dependency fro! F and still have set of dependency that is
e0uivalent to F#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?C?
Technical Aptitude Questions
*2. What is #ultivalued dependency?
&ultivalued dependency denoted by I J specified on relation sche!a )"
where I and J are both subsets of )" specifies the following constraint on any relation r
of )8 if two tuples t? and t2 e6ist in r such that t?PIQ A t2PIQ then t1 and tC should also
e6ist in r with the following properties
t1P6Q A tCPIQ A t?PIQ A t2PIQ
t1PJQ A t?PJQ and tCPJQ A t2PJQ
t1PfQ A t2PfQ and tCPfQ A t?PfQ
where Pf A ,):,I = J-- Q

*3. What is Lossless join property?
It guarantees that the spurious tuple generation does not occur with respect to
relation sche!as after deco!position#
**. What is 1 &< 2&ormal <orm4?
The do!ain of attribute !ust include only ato!ic ,si!ple" indivisible- values#
*-. What is <ully <unctional dependency?
It is based on concept of full functional dependency# A functional dependency
I J is full functional dependency if re!oval of any attribute A fro! I !eans that the
dependency does not hold any !ore#
*0. What is 2&<?
A relation sche!a ) is in 2'F if it is in ?'F and every non:pri!e attribute A in )
is fully functionally dependent on pri!ary $ey#
*5. What is 3&<?
A relation sche!a ) is in 1'F if it is in 2'F and for every FD I A either of the
following is true
I is a Super:$ey of )#
A is a pri!e attribute of )#
In other words" if every non pri!e attribute is non:transitively dependent on
pri!ary $ey#
*7. What is ",&< 2"oyce3,odd &ormal <orm4?
A relation sche!a ) is in *C'F if it is in 1'F and satisfies an additional
constraint that for every FD I A" I !ust be a candidate $ey#

*?. What is *&<?
A relation sche!a ) is said to be in C'F if for every &ultivalued dependency
I J that holds over )" one of following is true
I is subset or e0ual to ,or- IJ A )#
I is a super $ey#
-@. What is -&<?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?C2
Technical Aptitude Questions
A )elation sche!a ) is said to be @'F if for every >oin dependency ])?" )2" ###"
)n^ that holds )" one the following is true
)i A ) for so!e i#
The >oin dependency is i!plied by the set of FD" over ) in which the left side is $ey
of )#
-1. What is !omain3[ey &ormal <orm?
A relation is said to be in D_'F if all constraints and dependencies that should
hold on the the constraint can be enforced by si!ply enforcing the do!ain
constraint and $ey constraint on the relation#

-2. What are partial% alternate%% artificial% compound and natural 'ey?
>artial [ey:
It is a set of attributes that can uni0uely identify wea$ entities and that are
related to sa!e owner entity# It is so!eti!e called as Discri!inator#
6lternate [ey:
All Candidate _eys e6cluding the 7ri!ary _ey are $nown as Alternate
_eys#
6rtificial [ey8
If no obvious $ey" either stand alone or co!pound is available" then the
last resort is to si!ply create a $ey" by assigning a uni0ue nu!ber to each record or
occurrence# Then this is $nown as developing an artificial $ey#
,ompound [ey/
If no single data ele!ent uni0uely identifies occurrences within a
construct" then co!bining !ultiple ele!ents to create a uni0ue identifier for the construct
is $nown as creating a co!pound $ey#
&atural [ey/
Ghen one of the data ele!ents stored within a construct is utilied as the
pri!ary $ey" then it is called the natural $ey#
-3. What is indexing and what are the different 'inds of indexing?
Inde6ing is a techni0ue for deter!ining how 0uic$ly specific data can be found#
Types8
*inary search style inde6ing
*:Tree inde6ing
Inverted list inde6ing
&e!ory resident table
Table inde6ing
-*. What is system catalog or catalog relation? )ow is .etter 'nown as?
A )D*&S !aintains a description of all the data that it contains" infor!ation
about every relation and inde6 that it contains# This infor!ation is stored in a collection
of relations !aintained by the syste! called !etadata# It is also called data dictionary#
--. What is meant .y /uery optimiCation?
The phase that identifies an efficient e6ecution plan for evaluating a 0uery that
has the least esti!ated cost is referred to as 0uery opti!iation#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?C1
Technical Aptitude Questions
-0. What is join dependency and inclusion dependency?
Yoin !ependency:
A Eoin dependency is generaliation of &ultivalued dependency#A
ED ])?" )2" ###" )n^ is said to hold over a relation ) if )?" )2" )1" ###" )n is a lossless:
>oin deco!position of ) # There is no set of sound and co!plete inference rules for ED#
+nclusion !ependency:
An Inclusion Dependency is a state!ent of the for! that so!e colu!ns of
a relation are contained in other colu!ns# A foreign $ey constraint is an e6a!ple of
inclusion dependency#
-5. What is dura.ility in !"#$?
%nce the D*&S infor!s the user that a transaction has successfully co!pleted"
its effects should persist even if the syste! crashes before all its changes are reflected on
dis$# This property is called durability#
-7. What do you mean .y atomicity and aggregation?
6tomicity:
5ither all actions are carried out or none are# =sers should not have to
worry about the effect of inco!plete transactions# D*&S ensures this by undoing the
actions of inco!plete transactions#
6ggregation:
A concept which is used to !odel a relationship between a collection of
entities and relationships# It is used when we need to e6press a relationship a!ong
relationships#
-?. What is a >hantom !eadloc'?
In distributed deadloc$ detection" the delay in propagating local infor!ation
!ight cause the deadloc$ detection algorith!s to identify deadloc$s that do not really
e6ist# Such situations are called phanto! deadloc$s and they lead to unnecessary aborts#
0@. What is a chec'point and When does it occur?
A Chec$point is li$e a snapshot of the D*&S state# *y ta$ing chec$points" the
D*&S can reduce the a!ount of wor$ to be done during restart in the event of
subse0uent crashes#
01. What are the different phases of transaction?
Different phases are
Analysis phase
)edo 7hase
=ndo phase
02. What do you mean .y flat file data.ase?
It is a database in which there are no progra!s or user access languages# It has no
cross:file capabilities but is user:friendly and provides user:interface !anage!ent#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?CC
Technical Aptitude Questions
03. What is Ktransparent !"#$K?
It is one" which $eeps its 7hysical Structure hidden fro! user#
0*. "rief theory of &etwor'% )ierarchical schemas and their properties
'etwor$ sche!a uses a graph data structure to organie records e6a!ple for such
a database !anage!ent syste! is CTC( while a hierarchical sche!a uses a tree data
structure e6a!ple for such a syste! is I&S#
0-. What is a /uery?
A 0uery with respect to D*&S relates to user co!!ands that are used to interact
with a data base# The 0uery language can be classified into data definition language and
data !anipulation language#
00. What do you mean .y ,orrelated su./uery?
Sub0ueries" or nested 0ueries" are used to bring bac$ a set of rows to be used by
the parent 0uery# Depending on how the sub0uery is written" it can be e6ecuted once for
the parent 0uery or it can be e6ecuted once for each row returned by the parent 0uery# If
the sub0uery is e6ecuted for each row of the parent" this is called a correlated su./uery#
A correlated sub0uery can be easily identified if it contains any references to the
parent sub0uery colu!ns in its G.5)5 clause# Colu!ns fro! the sub0uery cannot be
referenced anywhere else in the parent 0uery# The following e6a!ple de!onstrates a
non:correlated sub0uery#
5#g# Select ; Fro! C=ST Ghere T?DMD1M?LLDT I' ,Select %DAT5 Fro! %)D5)
Ghere C=ST#C'=& A %)D5)#C'=&-
05. What are the primitive operations common to all record management systems?
Addition" deletion and !odification#
07. &ame the .uffer in which all the commands that are typed in are stored
=>#it" *uffer
0?. What are the unary operations in elational 6lge.ra?
7)%E5CTI%' and S525CTI%'#
5@. 6re the resulting relations of >E!Q,D and YE+& operation the same?
'o#
>E!Q,D8 Concatenation of every row in one relation with every row in
another#
YE+&8 Concatenation of rows fro! one relation and related rows fro! another#
51. What is !"#$ [1&1L?
Two i!portant pieces of )D*&S architecture are the $ernel" which is the
software" and the data dictionary" which consists of the syste!:level data structures used
by the $ernel to !anage the database
Jou !ight thin$ of an )D*&S as an operating syste! ,or set of subsyste!s-"
designed specifically for controlling data accessX its pri!ary functions are storing"
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?C@
Technical Aptitude Questions
retrieving" and securing data# An )D*&S !aintains its own list of authoried users and
their associated privilegesX !anages !e!ory caches and pagingX controls loc$ing for
concurrent resource usageX dispatches and schedules user re0uestsX and !anages space
usage within its table:space structures
#
52. &ame the su.3systems of a !"#$
IM%" Security" 2anguage 7rocessing" 7rocess Control" Storage &anage!ent"
2ogging and )ecovery" Distribution Control" Transaction Control" &e!ory &anage!ent"
2oc$ &anage!ent
53. Which part of the !"#$ ta'es care of the data dictionary? )ow
Data dictionary is a set of tables and database ob>ects that is stored in a special
area of the database and !aintained e6clusively by the $ernel#
5*. What is the jo. of the information stored in data3dictionary?
The infor!ation in the data dictionary validates the e6istence of the ob>ects"
provides access to the!" and !aps the actual physical storage location#
5-. &ot only !"#$ ta'es care of locating data it also
deter!ines an opti!al access path to store or retrieve the data
50. )ow do you communicate with an !"#$?
Jou co!!unicate with an )D*&S using Structured Query 2anguage ,SQ2-
55. !efine $AL and state the differences .etween $AL and other conventional
programming Languages
SQ2 is a nonprocedural language that is designed specifically for data access
operations on nor!alied relational database structures# The pri!ary difference between
SQ2 and other conventional progra!!ing languages is that SQ2 state!ents specify what
data operations should be perfor!ed rather than how to perfor! the!#
57. &ame the three major set of files on dis' that compose a data.ase in Eracle
There are three !a>or sets of files on dis$ that co!pose a database# All the files
are binary# These are
Database files
Control files
)edo logs
The !ost i!portant of these are the database files where the actual data resides#
The control files and the redo logs support the functioning of the architecture itself#
All three sets of files !ust be present" open" and available to %racle for any data
on the database to be useable# Githout these files" you cannot access the database" and the
database ad!inistrator !ight have to recover so!e or all of the database using a bac$up" if
there is one#
5?. What is an Eracle +nstance?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?CB
Technical Aptitude Questions
The %racle syste! processes" also $nown as %racle bac$ground processes"
provide functions for the user processesgfunctions that would otherwise be done by the
user processes the!selves
%racle database:wide syste! !e!ory is $nown as the S(A" the system glo.al
area or shared glo.al area# The data and control structures in the S(A are shareable" and
all the %racle bac$ground processes and user processes can use the!#
The co!bination of the S(A and the %racle bac$ground processes is $nown as an
Eracle instance
7@. What are the four Eracle system processes that must always .e up and running for
the data.ase to .e usea.le
The four %racle syste! processes that !ust always be up and running for the
database to be useable include !"W ,Database Griter-" L=W ,2og Griter-" $#E&
,Syste! &onitor-" and >#E& ,7rocess &onitor-#
71. What are data.ase files% control files and log files. )ow many of these files should a
data.ase have at least? Why?
!ata.ase <iles
The database files hold the actual data and are typically the largest in sie#
Depending on their sies" the tables ,and other ob>ects- for all the user accounts can go in
one database filegbut thatTs not an ideal situation because it does not !a$e the database
structure very fle6ible for controlling access to storage for different users" putting the
database on different dis$ drives" or bac$ing up and restoring >ust part of the database#
Jou !ust have at least one database file but usually" !ore than one files
are used# In ter!s of accessing and using the data in the tables and other ob>ects" the
nu!ber ,or location- of the files is i!!aterial#
The database files are fi6ed in sie and never grow bigger than the sie at
which they were created
,ontrol <iles
The control files and redo logs support the rest of the architecture# Any
database !ust have at least one control file" although you typically have !ore than one to
guard against loss# The control file records the na!e of the database" the date and ti!e it
was created" the location of the database and redo logs" and the synchroniation
infor!ation to ensure that all three sets of files are always in step# 5very ti!e you add a
new database or redo log file to the database" the infor!ation is recorded in the control
files#
edo Logs
Any database !ust have at least two redo logs# These are the >ournals for
the databaseX the redo logs record all changes to the user ob>ects or syste! ob>ects# If any
type of failure occurs" the changes recorded in the redo logs can be used to bring the
database to a consistent state without losing any co!!itted transactions# In the case of
non:data loss failure" %racle can apply the infor!ation in the redo logs auto!atically
without intervention fro! the D*A#
The redo log files are fi6ed in sie and never grow dyna!ically fro! the
sie at which they were created#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?CH
Technical Aptitude Questions
72. What is EW+!?
The )%GID is a uni0ue database:wide physical address for every row on every
table# %nce assigned ,when the row is first inserted into the database-" it never changes
until the row is deleted or the table is dropped#
The )%GID consists of the following three co!ponents" the co!bination of
which uni0uely identifies the physical storage location of the row#
%racle database file nu!ber" which contains the bloc$ with the rows
%racle bloc$ address" which contains the row
The row within the bloc$ ,because each bloc$ can hold !any rows-
The )%GID is used internally in inde6es as a 0uic$ !eans of retrieving rows
with a particular $ey value# Application developers also use it in SQ2 state!ents as a
0uic$ way to access a row once they $now the )%GID
73. What is Eracle "loc'? ,an two Eracle "loc's have the same address?
%racle Ofor!atsO the database files into a nu!ber of %racle bloc$s when they are
first createdg!a$ing it easier for the )D*&S software to !anage the files and easier to
read data into the !e!ory areas#
The bloc$ sie should be a !ultiple of the operating syste! bloc$ sie# )egardless
of the bloc$ sie" the entire bloc$ is not available for holding dataX %racle ta$es up so!e
space to !anage the contents of the bloc$# This bloc$ header has a !ini!u! sie" but it
can grow#
These %racle bloc$s are the s!allest unit of storage# Increasing the %racle bloc$
sie can i!prove perfor!ance" but it should be done only when the database is first
created#
5ach %racle bloc$ is nu!bered se0uentially for each database file starting at ?#
Two bloc$s can have the sa!e bloc$ address if they are in different database files#
7*. What is data.ase Drigger?
A database trigger is a 72MSQ2 bloc$ that can defined to auto!atically e6ecute
for insert" update" and delete state!ents against a table# The trigger can e defined to
e6ecute once for the entire state!ent or once for every row that is inserted" updated" or
deleted# For any one table" there are twelve events for which you can define database
triggers# A database trigger can call database procedures that are also written in 72MSQ2#
7-. &ame two utilities that Eracle provides% which are use for .ac'up and recovery.
Along with the )D*&S software" %racle provides two utilities that you can use
to bac$ up and restore the database# These utilities are 1xport and +mport#
The 1xport utility du!ps the definitions and data for the specified part of the
database to an operating syste! binary file# The +mport utility reads the file produced by
an e6port" recreates the definitions of ob>ects" and inserts the data
If 56port and I!port are used as a !eans of bac$ing up and recovering the
database" all the changes !ade to the database cannot be recovered since the e6port was
perfor!ed# The best you can do is recover the database to the ti!e when the e6port was
last perfor!ed#
70. What are stored3procedures? 6nd what are the advantages of using them.
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?CF
Technical Aptitude Questions
Stored procedures are database ob>ects that perfor! a user defined operation# A
stored procedure can have a set of co!pound SQ2 state!ents# A stored procedure
e6ecutes the SQ2 co!!ands and returns the result to the client# Stored procedures are
used to reduce networ$ traffic#
75. )ow are exceptions handled in >LG$AL? =ive some of the internal exceptionsW name
72MSQ2 e6ception handling is a !echanis! for dealing with run:ti!e errors
encountered during procedure e6ecution# =se of this !echanis! enables e6ecution to
continue if the error is not severe enough to cause procedure ter!ination#
The e6ception handler !ust be defined within a subprogra! specification# 5rrors
cause the progra! to raise an e6ception with a transfer of control to the e6ception:handler
bloc$# After the e6ception handler e6ecutes" control returns to the bloc$ in which the
handler was defined# If there are no !ore e6ecutable state!ents in the bloc$" control
returns to the caller#
Qser3!efined 1xceptions
72MSQ2 enables the user to define e6ception handlers in the declarations
area of subprogra! specifications# =ser acco!plishes this by na!ing an e6ception as in
the following e6a!ple8
otNfailure 5IC57TI%'X
In this case" the e6ception na!e is otNfailure. Code associated with this handler is written
in the 5IC57TI%' specification area as follows8
5IC57TI%'
when %TNFAI2=)5 then
outNstatusNcode 8A gNoutNstatusNcodeX
outN!sg 8A gNoutN!sgX
The following is an e6a!ple of a subprogra! e6ception8
5IC57TI%'
when '%NDATANF%='D then
gNoutNstatusNcode 8A TFAI2TX
)AIS5 otNfailureX
Githin this e6ception is the )AIS5 state!ent that transfers control bac$ to the otNfailure
e6ception handler# This techni0ue of raising the e6ception is used to invo$e all user:
defined e6ceptions#
$ystem3!efined 1xceptions
56ceptions internal to 72MSQ2 are raised auto!atically upon error#
'%NDATANF%='D is a syste!:defined e6ception# Table below gives a co!plete list of
internal e6ceptions#
>LG$AL internal exceptions.
01cepti"n Na'e Orac2e 0rr"r
C=)S%)NA2)5ADJN%75' %)A:DB@??
D=7N/A2N%'NI'D5I %)A:DDDD?
I'/A2IDNC=)S%) %)A:D?DD?
I'/A2IDN'=&*5) %)A:D?H22
2%(I'ND5'I5D %)A:D?D?H
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?CL
Technical Aptitude Questions
'%NDATANF%='D %)A:D?CD1
'%TN2%((5DN%' %)A:D?D?2
7)%()A&N5))%) %)A:DB@D?
ST%)A(5N5))%) %)A:DB@DD
TI&5%=TN%'N)5S%=)C5 %)A:DDD@?
T%%N&A'JN)%GS %)A:D?C22
T)A'SACTI%'N*AC_5DN%=T %)A:DDDB?
/A2=5N5))%) %)A:DB@D2
f5)%NDI/ID5 %)A:D?CHB
In addition to this list of e6ceptions" there is a catch:all e6ception na!ed
ED)1$ that traps all errors for which specific error handling has not been established#
77. !oes >LG$AL support KoverloadingK? 1xplain
The concept of overloading in 72MSQ2 relates to the idea that you can define
procedures and functions with the sa!e na!e# 72MSQ2 does not loo$ only at the
referenced na!e" however" to resolve a procedure or function call# The count and data
types of for!al para!eters are also considered#
72MSQ2 also atte!pts to resolve any procedure or function calls in locally defined
pac$ages before loo$ing at globally defined pac$ages or internal functions# To further
ensure calling the proper procedure" you can use the dot notation# 7refacing a procedure
or function na!e with the pac$age na!e fully 0ualifies any procedure or function
reference#
7?. Da.les derived from the 1!
a- Are totally unnor!alised
b- Are always in ?'F
c- Can be further denor!alised
d- &ay have !ulti:valued attributes
,b- Are always in ?'F
?@. $purious tuples may occur due to
i. "ad normaliCation
ii. Dheta joins
iii. Qpdating ta.les from join
a- i U ii b- ii U iii
c- i U iii d- ii U iii
,a- i U iii because theta >oins are >oins !ade on $eys that are not pri!ary $eys#
?1. 6 " , is a set of attri.utes. Dhe functional dependency is as follows
6" 3V "
6, 3V ,
, 3V "
a- is in ?'F
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@D
Technical Aptitude Questions
b- is in 2'F
c- is in 1'F
d- is in *C'F
,a- is in ?'F since ,AC-
<
A ] A" *" C^ hence AC is the pri!ary $ey# Since C
* is a FD given" where neither C is a _ey nor * is a pri!e attribute" this it is not in 1'F#
Further * is not functionally dependent on $ey AC thus it is not in 2'F# Thus the given
FDs is in ?'F#
?2. +n mapping of 1! to !<!
a- entities in 5)D should correspond to an e6isting entityMstore in DFD
b- entity in DFD is converted to attributes of an entity in 5)D
c- relations in 5)D has ? to ? correspondence to processes in DFD
d- relationships in 5)D has ? to ? correspondence to flows in DFD
,a- entities in 5)D should correspond to an e6isting entityMstore in DFD
?3. 6 dominant entity is the entity
a- on the ' side in a ? 8 ' relationship
b- on the ? side in a ? 8 ' relationship
c- on either side in a ? 8 ? relationship
d- nothing to do with ? 8 ? or ? 8 ' relationship
,b- on the ? side in a ? 8 ' relationship
?*. $elect W&ED)W% ,Q$DE#1 <rom ,Q$D^!DL$ Where 1=+E& I W&W Erder "y
,Q$DE#1 Qnion $elect W16$DW% ,Q$DE#1 <rom ,Q$D^!DL$ Where 1=+E&
I W1W Erder "y ,Q$DE#1
The above is
a- 'ot an error
b- 5rror : the string in single 0uotes T'%)T.T and TS%=T.T
c- 5rror : the string should be in double 0uotes
d- 5rror : %)D5) *J clause
,d- 5rror : the %)D5) *J clause# Since %)D5) *J clause cannot be used in
='I%'S
?-. What is $torage #anager?
It is a progra! !odule that provides the interface between the low:level data
stored in database" application progra!s and 0ueries sub!itted to the syste!#

?0. What is "uffer #anager?
It is a progra! !odule" which is responsible for fetching data fro! dis$ storage
into !ain !e!ory and deciding what data to be cache in !e!ory#
?5. What is Dransaction #anager?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@?
Technical Aptitude Questions
It is a progra! !odule" which ensures that database" re!ains in a consistent state
despite syste! failures and concurrent transaction e6ecution proceeds without
conflicting#
?7. What is <ile #anager?
It is a progra! !odule" which !anages the allocation of space on dis$ storage
and data structure used to represent infor!ation stored on a dis$#
??. What is 6uthoriCation and +ntegrity manager?
It is the progra! !odule" which tests for the satisfaction of integrity constraint
and chec$s the authority of user to access data#

1@@. What are stand3alone procedures?
7rocedures that are not part of a pac$age are $nown as stand:alone because they
independently defined# A good e6a!ple of a stand:alone procedure is one written in a
SQ2;For!s application# These types of procedures are not available for reference fro!
other %racle tools# Another li!itation of stand:alone procedures is that they are co!piled
at run ti!e" which slows e6ecution#
1@1. What are cursors give different types of cursors.
72MSQ2 uses cursors for all database infor!ation accesses state!ents# The
language supports the use two types of cursors
+mplicit
1xplicit
1@2. What is cold .ac'up and hot .ac'up 2in case of Eracle4?
,old "ac'up:
It is copying the three sets of files ,database files" redo logs" and
control file- when the instance is shut down# This is a straight file copy" usually fro! the
dis$ directly to tape# Jou !ust shut down the instance to guarantee a consistent copy#
If a cold bac$up is perfor!ed" the only option available in the event of
data file loss is restoring all the files fro! the latest bac$up# All wor$ perfor!ed on the
database since the last bac$up is lost#
)ot "ac'up:
So!e sites ,such as worldwide airline reservations syste!s- cannot
shut down the database while !a$ing a bac$up copy of the files# The cold bac$up is not
an available option#
So different !eans of bac$ing up database !ust be used g the hot
bac$up# Issue a SQ2 co!!and to indicate to %racle" on a tablespace:by:tablespace basis"
that the files of the tablespace are to bac$ed up# The users can continue to !a$e full use
of the files" including !a$ing changes to the data# %nce the user has indicated that heMshe
wants to bac$ up the tablespace files" heMshe can use the operating syste! to copy those
files to the desired bac$up destination#
The database !ust be running in A)C.I/52%( !ode for the hot
bac$up option#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@2
Technical Aptitude Questions
If a data loss failure does occur" the lost database files can be restored
using the hot bac$up and the online and offline redo logs created since the bac$up was
done# The database is restored to the !ost consistent state without any loss of co!!itted
transactions#
1@3. What are 6rmstrong rules? )ow do we say that they are complete andGor sound
The well:$nown inference rules for FDs
)efle6ive rule 8
If J is subset or e0ual to I then I J#
Aug!entation rule8
If I J then If Jf#
Transitive rule8
If ]I J" J f^ then I f#
Deco!position rule 8
If I Jf then I J#
=nion or Additive rule8
If ]I J" I f^ then I Jf#
7seudo Transitive rule 8
If ]I J" GJ f^ then GI f#
%f these the first three are $nown as A!strong )ules# They are sound because it
is enough if a set of FDs satisfy these three# They are called co!plete because using these
three rules we can generate the rest all inference rules#
1@*. )ow can you find the minimal 'ey of relational schema?
&ini!al $ey is one which can identify each tuple of the given relation sche!a
uni0uely# For finding the !ini!al $ey it is re0uired to find the closure that is the set of all
attributes that are dependent on any given set of attributes under the given set of
functional dependency#
.l3o8 ? Deter!ining I
<
" closure for I" given set of FDs F
?# Set I
<
A I
2# Set %ld I
< A
I
<
1# For each FD J f in F and if J belongs to I
<
then add f
to I
<
C# )epeat steps 2 and 1 until %ld I
<
A I
<
.l3o8?? Deter!ining !ini!al _ for relation sche!a )" given set of FDs F
?# Set _ to ) that is !a$e _ a set of all attributes in )
2# For each attribute A in _
a# Co!pute ,_ + A-
<
with respect to F
b# If ,_ + A-
<
A ) then set _ A ,_ + A-
<
1@-. What do you understand .y dependency preservation?
(iven a relation ) and a set of FDs F" dependency preservation states that
the closure of the union of the pro>ection of F on each deco!posed relation )i is e0ual to
the closure of F# i#e#"
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@1
Technical Aptitude Questions
,,
)?
,F-- = K = ,
)n
,F---
<
A F
<

if deco!position is not dependency preserving" then so!e dependency is lost in the
deco!position#

1@0. What is meant .y >roactive% etroactive and $imultaneous Qpdate.
>roactive Qpdate:
The updates that are applied to database before it beco!es
effective in real world #
etroactive Qpdate:
The updates that are applied to database after it beco!es effective
in real world #
$imulatneous Qpdate:
The updates that are applied to database at the sa!e ti!e when it
beco!es effective in real world #
1@5. What are the different types of YE+& operations?
1/ui Yoin: This is the !ost co!!on type of >oin which involves only
e0uality co!parisions# The disadvantage in this type of >oin is that there
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@C
Technical Aptitude Questions
SQ2
1. Which is the su.set of $AL commands used to manipulate Eracle !ata.ase
structures% including ta.les?
Data Definition 2anguage ,DD2-
2. What operator performs pattern matching?
2I_5 operator
3. What operator tests column for the a.sence of data?
IS '=22 operator
*. Which command executes the contents of a specified file?
STA)T Sfilena!eR or bSfilena!eR
-. What is the parameter su.stitution sym.ol used with +&$1D +&DE command?
U
0. Which command displays the $AL command in the $AL .uffer% and then executes it?
)='
5. What are the wildcards used for pattern matching?
N for single character substitution and W for !ulti:character substitution
7. $tate true or false. 1Z+$D$% $E#1% 6&_ are operators in $AL.
True
?. $tate true or false. UI% RV% ;I all denote the same operation.
True
1@. What are the privileges that can .e granted on a ta.le .y a user to others?
Insert" update" delete" select" references" inde6" e6ecute" alter" all
11. What command is used to get .ac' the privileges offered .y the =6&D command?
)5/%_5
12. Which system ta.les contain information on privileges granted and privileges
o.tained?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@@
SQL
Technical Aptitude Questions
=S5)NTA*N7)I/SN&AD5" =S5)NTA*N7)I/SN)5CD
13. Which system ta.le contains information on constraints on all the ta.les created?
=S5)NC%'ST)AI'TS
1*. DQ&,6D1 D6"L1 1#>J
!1L1D1 <E# 1#>J
Will the outputs of the a.ove two commands differ?
*oth will result in deleting all the rows in the table 5&7#
1-. What is the difference .etween DQ&,6D1 and !1L1D1 commands?
T)='CAT5 is a DD2 co!!and whereas D525T5 is a D&2 co!!and# .ence
D525T5 operation can be rolled bac$" but T)='CAT5 operation cannot be rolled bac$#
G.5)5 clause can be used with D525T5 and not with T)='CAT5#
10. What command is used to create a ta.le .y copying the structure of another ta.le?
Ans(er /
C)5AT5 TA*25 ## AS S525CT co!!and
01p2anati"n /
To copy only the structure" the G.5)5 clause of the S525CT co!!and should
contain a FA2S5 state!ent as in the following#
C)5AT5 TA*25 '5GTA*25 AS S525CT ; F)%& 5IISTI'(TA*25
G.5)5 ?A2X
If the G.5)5 condition is true" then all the rows or rows satisfying the condition
will be copied to the new table#
15. What will .e the output of the following /uery?
$1L1,D 1>L6,12D6&$L6D12LD+#2D+#2WUU 6D)1& UUW%WUW4% WUW4%
W6&W% W99W4%W9W%WDEQ"L1W4 <E# !Q6LJ
T)%=*25T.5T)%=*25
17. What will .e the output of the following /uery?
$1L1,D !1,E!12D6&$L6D12W6W%W123*-057?@W%W1111111111W4% W1W%W_1$W% W&EW 4J
Ans(er /
'%
01p2anati"n /
The 0uery chec$s whether a given string is a nu!erical digit#
1?. What does the following /uery do?
$1L1,D $6L 8 &BL2,E##%@4 <E# 1#>J
This displays the total salary of all e!ployees# The null values in the co!!ission
colu!n will be replaced by D and added to salary#
2@. Which date function is used to find the difference .etween two dates?
&%'T.SN*5TG55'
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@B
Technical Aptitude Questions
21. Why does the following command give a compilation error?
!E> D6"L1 (D6"L1^&6#1J
/ariable na!es should start with an alphabet# .ere the table na!e starts with an
TUT sy!bol#
22. What is the advantage of specifying W+D) =6&D E>D+E& in the =6&D
command?
The privilege receiver can further grant the privileges heMshe has obtained fro!
the owner to any other user#
23. What is the use of the !E> option in the 6LD1 D6"L1 command?
It is used to drop constraints specified on the table#
2*. What is the value of XcommF and XsalF after executing the following /uery if the initial
value of XsalF is 1@@@@?
Q>!6D1 1#> $1D $6L I $6L 8 1@@@% ,E## I $6L9@.1J
sal A ??DDD" co!! A ?DDD
2-. What is the use of !1$, in $AL?
Ans(er /
D5SC has two purposes# It is used to describe a sche!a as well as to retrieve
rows fro! table in descending order#
01p2anati"n /
The 0uery S525CT ; F)%& 5&7 %)D5) *J 5'A&5 D5SC will display the
output sorted on 5'A&5 in descending order#
20. What is the use of ,6$,6!1 ,E&$D6+&D$?
Ghen this clause is used with the D)%7 co!!and" a parent table can be dropped
even when a child table e6ists#
25. Which function is used to find the largest integer less than or e/ual to a specific
value?
F2%%)
27. What is the output of the following /uery?
$1L1,D DQ&,2123*.-057%324 <E# !Q6LJ
?2DD
;@2 A @1>R?>;
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@H
Technical Aptitude Questions
. SC;0%AS
Da.le 1 : S4UD0S
7'A&5 ,/A)C.A)-" S72AC5 ,/A)C.A)-" C%=)S5 ,/A)C.A)-" CC%ST
,'=&*5)-
Da.le 2 : SO<4=A#0
7'A&5 ,/A)C.A)-" TIT25 ,/A)C.A)-" D5/I' ,/A)C.A)-" SC%ST
,'=&*5)-" DC%ST ,'=&*5)-" S%2D ,'=&*5)-
Da.le 3 : P#O>#A%%0#
7'A&5 ,/A)C.A)-" D%* ,DAT5-" D%E ,DAT5-" S5I ,C.A)-" 7)%F?
,/A)C.A)-" 7)%F2 ,/A)C.A)-" SA2 ,'=&*5)-
2>B>'/ :
7'A&5 + 7rogra!!er 'a!e" S72AC5 + Study 7lace" CC%ST + Course Cost" D5/I'
+ Developed in" SC%ST + Software Cost" DC%ST + Develop!ent Cost" 7)%F? +
7roficiency ?
QU0#0S /
1. <ind out the selling cost average for pac'ages developed in Eracle.
2. !isplay the names% ages and experience of all programmers.
3. !isplay the names of those who have done the >=!,6 course.
*. What is the highest num.er of copies sold .y a pac'age?
-. !isplay the names and date of .irth of all programmers .orn in 6pril.
0. !isplay the lowest course fee.
5. )ow many programmers have done the !,6 course.
7. )ow much revenue has .een earned through the sale of pac'ages developed in ,.
?. !isplay the details of software developed .y a'esh.
1@. )ow many programmers studied at >entafour.
11. !isplay the details of pac'ages whose sales crossed the -@@@ mar'.
12. <ind out the num.er of copies which should .e sold in order to recover the
development cost of each pac'age.
13. !isplay the details of pac'ages for which the development cost has .een
recovered.
1*. What is the price of costliest software developed in B"?
1-. )ow many pac'ages were developed in Eracle ?
10. )ow many programmers studied at >6=6D)+?
15. )ow many programmers paid 1@@@@ to 1-@@@ for the course?
17. What is the average course fee?
1?. !isplay the details of programmers 'nowing ,.
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@F
Technical Aptitude Questions
2@. )ow many programmers 'now either , or >ascal?
21. )ow many programmers donFt 'now , and ,88?
22. )ow old is the oldest male programmer?
23. What is the average age of female programmers?
2*. ,alculate the experience in years for each programmer and display along with
their names in descending order.
2-. Who are the programmers who cele.rate their .irthdays during the current
month?
20. )ow many female programmers are there?
25. What are the languages 'nown .y the male programmers?
27. What is the average salary?
2?. )ow many people draw -@@@ to 5-@@?
3@. !isplay the details of those who donFt 'now ,% ,88 or >ascal.
31. !isplay the costliest pac'age developed .y each programmer.
32. >roduce the following output for all the male programmers
>rogrammer
#r. 6rvind : has 1- years of experience
C>D;:
?# S525CT A/(,SC%ST- F)%& S%FTGA)5 G.5)5 D5/I' A T%)AC25TX
2# S525CT 7'A&5"T)='C,&%'T.SN*5TG55',SJSDAT5"D%*-M?2-
OA(5O" T)='C,&%'T.SN*5TG55',SJSDAT5"D%E-M?2- O5I75)I5'C5O
F)%& 7)%()A&&5)X
1# S525CT 7'A&5 F)%& ST=DI5S G.5)5 C%=)S5 A T7(DCATX
C# S525CT &AI,S%2D- F)%& S%FTGA)5X
@# S525CT 7'A&5" D%* F)%& 7)%()A&&5) G.5)5 D%* 2I_5 TWA7)
WTX
B# S525CT &I',CC%ST- F)%& ST=DI5SX
H# S525CT C%='T,;- F)%& ST=DI5S G.5)5 C%=)S5 A TDCATX
F# S525CT S=&,SC%ST;S%2D:DC%ST- F)%& S%FTGA)5 ()%=7 *J
D5/I' .A/I'( D5/I' A TCTX
L# S525CT ; F)%& S%FTGA)5 G.5)5 7'A&5 A T)A_5S.TX
?D# S525CT ; F)%& ST=DI5S G.5)5 S72AC5 A T75'TAF%=)TX
??# S525CT ; F)%& S%FTGA)5 G.5)5 SC%ST;S%2D:DC%ST R @DDDX
?2# S525CT C5I2,DC%STMSC%ST- F)%& S%FTGA)5X
?1# S525CT ; F)%& S%FTGA)5 G.5)5 SC%ST;S%2D RA DC%STX
?C# S525CT &AI,SC%ST- F)%& S%FTGA)5 ()%=7 *J D5/I' .A/I'(
D5/I' A T/*TX
?@# S525CT C%='T,;- F)%& S%FTGA)5 G.5)5 D5/I' A T%)AC25TX
?B# S525CT C%='T,;- F)%& ST=DI5S G.5)5 S72AC5 A T7)A(AT.ITX
?H# S525CT C%='T,;- F)%& ST=DI5S G.5)5 CC%ST *5TG55' ?DDDD
A'D ?@DDDX
?F# S525CT A/(,CC%ST- F)%& ST=DI5SX
?L# S525CT ; F)%& 7)%()A&&5) G.5)5 7)%F? A TCT %) 7)%F2 A TCTX
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?@L
Technical Aptitude Questions
2D# S525CT ; F)%& 7)%()A&&5) G.5)5 7)%F? I' ,TCT"T7ASCA2T- %)
7)%F2 I' ,TCT"T7ASCA2T-X
2?# S525CT ; F)%& 7)%()A&&5) G.5)5 7)%F? '%T I' ,TCT"TC<<T- A'D
7)%F2 '%T I' ,TCT"TC<<T-X
22# S525CT T)='C,&AI,&%'T.SN*5TG55',SJSDAT5"D%*-M?2-- F)%&
7)%()A&&5) G.5)5 S5I A T&TX
21# S525CT T)='C,A/(,&%'T.SN*5TG55',SJSDAT5"D%*-M?2-- F)%&
7)%()A&&5) G.5)5 S5I A TFTX
2C# S525CT 7'A&5" T)='C,&%'T.SN*5TG55',SJSDAT5"D%E-M?2-
F)%& 7)%()A&&5) %)D5) *J 7'A&5 D5SCX
2@# S525CT 7'A&5 F)%& 7)%()A&&5) G.5)5 T%NC.A),D%*"T&%'T-
A T%NC.A),SJSDAT5"T&%'T-X
2B# S525CT C%='T,;- F)%& 7)%()A&&5) G.5)5 S5I A TFTX
2H# S525CT DISTI'CT,7)%F?- F)%& 7)%()A&&5) G.5)5 S5I A T&TX
2F# S525CT A/(,SA2- F)%& 7)%()A&&5)X
2L# S525CT C%='T,;- F)%& 7)%()A&&5) G.5)5 SA2 *5TG55' @DDD
A'D H@DDX
1D# S525CT ; F)%& 7)%()A&&5) G.5)5 7)%F? '%T I' ,TCT"TC<
<T"T7ASCA2T- A'D 7)%F2 '%T I' ,TCT"TC<<T"T7ASCA2T-X
1?# S525CT 7'A&5"TIT25"SC%ST F)%& S%FTGA)5 G.5)5 SC%ST I'
,S525CT &AI,SC%ST- F)%& S%FTGA)5 ()%=7 *J 7'A&5-X
12#S525CT T&r#T VV 7'A&5 VV T : has T VV
T)='C,&%'T.SN*5TG55',SJSDAT5"D%E-M?2- VV T years of e6perienceT
[7rogra!!er\ F)%& 7)%()A&&5) G.5)5 S5I A T&T ='I%' S525CT
T&s#T VV 7'A&5 VV T : has T VV T)='C ,&%'T.SN*5TG55'
,SJSDAT5"D%E-M?2- VV T years of e6perienceT [7rogra!!er\ F)%&
7)%()A&&5) G.5)5 S5I A TFTX
. SC;0%A /
Da.le 1 : />ET
D57T'% ,'%T '=22 " '=&*5),2--" D'A&5 ,/A)C.A)2,?C--"
2%C ,/A)C.A)2,?1-
Da.le 2 : >0E
5&7'% ,'%T '=22 " '=&*5),C--" 5'A&5 ,/A)C.A)2,?D--"
E%* ,/A)C.A)2,L--" &() ,'=&*5),C--" .I)5DAT5 ,DAT5-"
SA2 ,'=&*5),H"2--" C%&& ,'=&*5),H"2--" D57T'% ,'=&*5),2--
&() is the e!pno of the e!ployee who! the e!ployee reports to# D57T'% is a foreign
$ey#
QU0#0S
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?BD
Technical Aptitude Questions
1. List all the employees who have at least one person reporting to them.
2. List the employee details if and only if more than 1@ employees are present in
department no 1@.
3. List the name of the employees with their immediate higher authority.
*. List all the employees who do not manage any one.
-. List the employee details whose salary is greater than the lowest salary of an
employee .elonging to deptno 2@.
0. List the details of the employee earning more than the highest paid manager.
5. List the highest salary paid for each jo..
7. <ind the most recently hired employee in each department.
?. +n which year did most people join the company? !isplay the year and the num.er of
employees.
1@. Which department has the highest annual remuneration .ill?
11. Write a /uery to display a X9F against the row of the most recently hired employee.
12. Write a correlated su.3/uery to list out the employees who earn more than the
average salary of their department.
13. <ind the nth maximum salary.
1*. $elect the duplicate records 2ecords% which are inserted% that already exist4 in the
1#> ta.le.
1-. Write a /uery to list the length of service of the employees 2of the form n years and m
months4.
C>D;:
?# S525CT DISTI'CT,A#5'A&5- F)%& 5&7 A" 5&7 * G.5)5 A#5&7'% A
*#&()X or S525CT 5'A&5 F)%& 5&7 G.5)5 5&7'% I' ,S525CT &()
F)%& 5&7-X
2# S525CT ; F)%& 5&7 G.5)5 D57T'% I' ,S525CT D57T'% F)%& 5&7
()%=7 *J D57T'% .A/I'( C%='T,5&7'%-R?D A'D D57T'%A?D-X
1# S525CT A#5'A&5 O5&72%J55O" *#5'A&5 O)57%)TS T%O F)%& 5&7 A"
5&7 * G.5)5 A#&()A*#5&7'%X
C# S525CT ; F)%& 5&7 G.5)5 5&7'% I' , S525CT 5&7'% F)%& 5&7
&I'=S S525CT &() F)%& 5&7-X
@# S525CT ; F)%& 5&7 G.5)5 SA2 R , S525CT &I',SA2- F)%& 5&7
()%=7 *J D57T'% .A/I'( D57T'%A2D-X
B# S525CT ; F)%& 5&7 G.5)5 SA2 R , S525CT &AI,SA2- F)%& 5&7
()%=7 *J E%* .A/I'( E%* A T&A'A(5)T -X
H# S525CT E%*" &AI,SA2- F)%& 5&7 ()%=7 *J E%*X
F# S525CT ; F)%& 5&7 G.5)5 ,D57T'%" .I)5DAT5- I' ,S525CT D57T'%"
&AI,.I)5DAT5- F)%& 5&7 ()%=7 *J D57T'%-X
L# S525CT T%NC.A),.I)5DAT5"TJJJJT- OJ5A)O" C%='T,5&7'%- O'%# %F
5&72%J55SO F)%& 5&7 ()%=7 *J T%NC.A),.I)5DAT5"TJJJJT- .A/I'(
C%='T,5&7'%- A ,S525CT &AI,C%='T,5&7'%-- F)%& 5&7 ()%=7 *J
T%NC.A),.I)5DAT5"TJJJJT--X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?B?
Technical Aptitude Questions
?D# S525CT D57T'%" 27AD,S=&,?2;,SA2<'/2,C%&&"D---"?@-
OC%&75'SATI%'O F)%& 5&7 ()%=7 *J D57T'% .A/I'(
S=&, ?2;,SA2<'/2,C%&&"D--- A ,S525CT
&AI,S=&,?2;,SA2<'/2,C%&&"D---- F)%& 5&7 ()%=7 *J D57T'%-X
??# S525CT 5'A&5" .I)5DAT5" 27AD,T;T"F- O)5C5'T2J .I)5DO F)%& 5&7
G.5)5 .I)5DAT5 A ,S525CT &AI,.I)5DAT5- F)%& 5&7- ='I%' S525CT
5'A&5 'A&5" .I)5DAT5" 27AD,T T"?@- O)5C5'T2J .I)5DO F)%& 5&7
G.5)5 .I)5DAT5 !A ,S525CT &AI,.I)5DAT5- F)%& 5&7-X
?2# S525CT 5'A&5"SA2 F)%& 5&7 5 G.5)5 SA2 R ,S525CT A/(,SA2-
F)%& 5&7 F G.5)5 5#D57T'% A F#D57T'%-X
?1# S525CT 5'A&5" SA2 F)%& 5&7 A G.5)5 U' A ,S525CT C%='T
,DISTI'CT,SA2-- F)%& 5&7 * G.5)5 A#SA2SA*#SA2-X
?C# S525CT ; F)%& 5&7 A G.5)5 A#5&7'% I' ,S525CT 5&7'% F)%& 5&7
()%=7 *J 5&7'% .A/I'( C%='T,5&7'%-R?- A'D A#)%GID!A&I'
,)%GID--X
?@# S525CT 5'A&5
O5&72%J55O"T%NC.A),T)='C,&%'T.SN*5TG55',SJSDAT5".I)5DAT5-M?
2--VVT J5A)S TVV T%NC.A),T)='C,&%D,&%'T.SN*5TG55' ,SJSDAT5"
.I)5DAT5-"?2---VVT &%'T.S T O25'(T. %F S5)/IC5O F)%& 5&7X
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?B2
Technical Aptitude Questions
Co!puter 'etwor$s
1. What are the two types of transmission technology availa.le?
,i- *roadcast and ,ii- point:to:point
2. What is su.net?
A generic ter! for section of a large networ$s usually separated by a bridge or
router#
3. !ifference .etween the communication and transmission.
Trans!ission is a physical !ove!ent of infor!ation and concern issues li$e bit
polarity" synchronisation" cloc$ etc#
Co!!unication !eans the !eaning full e6change of infor!ation between two
co!!unication !edia#
*. What are the possi.le ways of data exchange?
,i- Si!ple6 ,ii- .alf:duple6 ,iii- Full:duple6#
-. What is $6>?
Series of interface points that allow other co!puters to co!!unicate with the
other layers of networ$ protocol stac$#
0. What do you meant .y Ktriple ZK in &etwor's?
The function of 7AD ,7ac$et Asse!bler Disasse!bler- is described in a
docu!ent $nown as I#1# The standard protocol has been defined between the ter!inal
and the 7AD" called I#2FX another standard protocol e6ists between hte 7AD and the
networ$" called I#2L# Together" these three reco!!endations are often called Otriple IO
5. What is frame relay% in which layer it comes?
Fra!e relay is a pac$et switching technology# It will operate in the data lin$ layer#
7. What is terminal emulation% in which layer it comes?
Telnet is also called as ter!inal e!ulation# It belongs to application layer#
?. What is "eaconing?
The process that allows a networ$ to self:repair networ$s proble!s# The stations
on the networ$ notify the other stations on the ring when they are not receiving the
trans!issions# *eaconing is used in To$en ring and FDDI networ$s#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?B1
Computer Networks

Technical Aptitude Questions
1@. What is redirector?
)edirector is software that intercepts file or prints IM% re0uests and translates the!
into networ$ re0uests# This co!es under presentation layer#
11. What is &1D"+E$ and &1D"1Q+?
'5T*I%S is a progra!!ing interface that allows IM% re0uests to be sent to and
received fro! a re!ote co!puter and it hides the networ$ing hardware fro! applications#
'5T*5=I is 'et*I%S e6tended user interface# A transport protocol designed by
!icrosoft and I*& for the use on s!all subnets#
12. What is 6+!?
A !ethod for providing fault tolerance by using !ultiple hard dis$ drives#
13. What is passive topology?
Ghen the co!puters on the networ$ si!ply listen and receive the signal" they are
referred to as passive because they don4t a!plify the signal in any way# 56a!ple for
passive topology : linear bus#
1*. What is "router?
.ybrid devices that co!bine the features of both bridges and routers#
1-. What is cladding?
A layer of a glass surrounding the center fiber of glass inside a fiber:optic cable#
10. What is point3to3point protocol
A co!!unications protocol used to connect co!puters to re!ote networ$ing
services including Internet service providers#
15. )ow =ateway is different from outers?
A gateway operates at the upper levels of the %SI !odel and translates
infor!ation between two co!pletely different networ$ architectures or data for!ats
17. What is attenuation?
The degeneration of a signal over distance on a networ$ cable is called
attenuation#
1?. What is #6, address?
The address for a device as it is identified at the &edia Access Control ,&AC-
layer in the networ$ architecture# &AC address is usually stored in )%& on the networ$
adapter card and is uni0ue#
2@. !ifference .etween .it rate and .aud rate.
*it rate is the nu!ber of bits trans!itted during one second whereas baud rate
refers to the nu!ber of signal units per second that are re0uired to represent those bits#
.aud rate I .it rate G &
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?BC
Technical Aptitude Questions
where ' is no:of:bits represented by each signal shift#
21. What is "andwidth?
5very line has an upper li!it and a lower li!it on the fre0uency of signals it can
carry# This li!ited range is called the bandwidth#
22. What are the types of Dransmission media?
Signals are usually trans!itted over so!e trans!ission !edia that are broadly
classified in to two categories#
a4 =uided #edia:
These are those that provide a conduit fro! one device to another that
include twisted:pair" coa6ial cable and fiber:optic cable# A signal traveling along any of
these !edia is directed and is contained by the physical li!its of the !ediu!# Twisted:
pair and coa6ial cable use !etallic that accept and transport signals in the for! of
electrical current# %ptical fiber is a glass or plastic cable that accepts and transports
signals in the for! of light#
.4 Qnguided #edia:
This is the wireless !edia that transport electro!agnetic waves without
using a physical conductor# Signals are broadcast either through air# This is done through
radio co!!unication" satellite co!!unication and cellular telephony#
23. What is >roject 7@2?
It is a pro>ect started by I555 to set standards to enable interco!!unication
between e0uip!ent fro! a variety of !anufacturers# It is a way for specifying functions
of the physical layer" the data lin$ layer and to so!e e6tent the networ$ layer to allow for
interconnectivity of !a>or 2A'
protocols#
It consists of the following8
FD2#? is an internetwor$ing standard for co!patibility of different 2A's and &A's
across protocols#
FD2#2 2ogical lin$ control ,22C- is the upper sublayer of the data lin$ layer which is
non:architecture:specific" that is re!ains the sa!e for all I555:defined 2A's#
&edia access control ,&AC- is the lower sublayer of the data lin$ layer that contains
so!e distinct !odules each carrying proprietary infor!ation specific to the 2A'
product being used# The !odules are 5thernet 2A' ,FD2#1-" To$en ring 2A'
,FD2#C-" To$en bus 2A' ,FD2#@-#
FD2#B is distributed 0ueue dual bus ,DQD*- designed to be used in &A's#
2*. What is >rotocol !ata Qnit?
The data unit in the 22C level is called the protocol data unit ,7D=-# The 7D=
contains of four fields a destination service access point ,DSA7-" a source service access
point ,SSA7-" a control field and an infor!ation field# DSA7" SSA7 are addresses used
by the 22C to identify the protocol stac$s on the receiving and sending !achines that are
generating and using the data# The control field specifies whether the 7D= fra!e is a
infor!ation fra!e ,I : fra!e- or a supervisory fra!e ,S : fra!e- or a unnu!bered fra!e
,= : fra!e-#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?B@
Technical Aptitude Questions
2-. What are the different type of networ'ing G internetwor'ing devices?
epeater:
Also called a regenerator" it is an electronic device that operates only at
physical layer# It receives the signal in the networ$ before it beco!es wea$" regenerates
the original bit pattern and puts the refreshed copy bac$ in to the lin$#
"ridges:
These operate both in the physical and data lin$ layers of 2A's of sa!e
type# They divide a larger networ$ in to s!aller seg!ents# They contain logic that allow
the! to $eep the traffic for each seg!ent separate and thus are repeaters that relay a
fra!e only the side of the seg!ent containing the intended recipent and control
congestion#
outers:
They relay pac$ets a!ong !ultiple interconnected networ$s ,i#e# 2A's of
different type-# They operate in the physical" data lin$ and networ$ layers# They contain
software that enable the! to deter!ine which of the several possible paths is the best for
a particular trans!ission#
=ateways:
They relay pac$ets a!ong networ$s that have different protocols ,e#g#
between a 2A' and a GA'-# They accept a pac$et for!atted for one protocol and
convert it to a pac$et for!atted for another protocol before forwarding it# They operate in
all seven layers of the %SI !odel#

20. What is +,#>?
IC&7 is Internet Control &essage 7rotocol" a networ$ layer protocol of the
TC7MI7 suite used by hosts and gateways to send notification of datagra! proble!s bac$
to the sender# It uses the echo test M reply to test whether a destination is reachable and
responding# It also handles both control and error !essages#
25. What are the data units at different layers of the D,> G +> protocol suite?
The data unit created at the application layer is called a !essage" at the transport
layer the data unit created is called either a seg!ent or an user datagra!" at the networ$
layer the data unit created is called the datagra!" at the data lin$ layer the datagra! is
encapsulated in to a fra!e and finally trans!itted as signals along the trans!ission
!edia#
27. What is difference .etween 6> and 6>?
The address resolution protocol ,A)7- is used to associate the 12 bit I7 address
with the CF bit physical address" used by a host or a router to find the physical address of
another host on its networ$ by sending a A)7 0uery pac$et that includes the I7 address
of the receiver#
The reverse address resolution protocol ,)A)7- allows a host to discover its
Internet address when it $nows only its physical address#
2?. What is the minimum and maximum length of the header in the D,> segment and +>
datagram?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?BB
Technical Aptitude Questions
The header should have a !ini!u! length of 2D bytes and can have a !a6i!u!
length of BD bytes#

3@. What is the range of addresses in the classes of internet addresses?
Class A D#D#D#D : ?2H#2@@#2@@#2@@
Class * ?2F#D#D#D : ?L?#2@@#2@@#2@@
Class C ?L2#D#D#D : 221#2@@#2@@#2@@
Class D 22C#D#D#D : 21L#2@@#2@@#2@@
Class 5 2CD#D#D#D : 2CH#2@@#2@@#2@@
31. What is the difference .etween D<D> and <D> application layer protocols?
The Trivial File Transfer 7rotocol ,TFT7- allows a local host to obtain files fro!
a re!ote host but does not provide reliability or security# It uses the funda!ental pac$et
delivery services offered by =D7#
The File Transfer 7rotocol ,FT7- is the standard !echanis! provided by TC7 M I7
for copying a file fro! one host to another# It uses the services offer by TC7 and so is
reliable and secure# It establishes two connections ,virtual circuits- between the hosts" one
for data transfer and another for control infor!ation#
32. What are major types of networ's and explain?
Server:based networ$
7eer:to:peer networ$
7eer:to:peer networ$" co!puters can act as both servers sharing resources and as
clients using the resources#
Server:based networ$s provide centralied control of networ$ resources and rely
on server co!puters to provide security and networ$ ad!inistration
33. What are the important topologies for networ's?
"Q$ topology:
In this each co!puter is directly connected to pri!ary networ$ cable in a
single line#
6dvantages:
Ine6pensive" easy to install" si!ple to understand" easy to e6tend#
$D6 topology:
In this all co!puters are connected using a central hub#
6dvantages:
Can be ine6pensive" easy to install and reconfigure and easy to trouble
shoot physical proble!s#
+&= topology:
In this all co!puters are connected in loop#
6dvantages:
All co!puters have e0ual access to networ$ !edia" installation can be
si!ple" and signal does not degrade as !uch as in other topologies because each
co!puter regenerates it#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?BH
Technical Aptitude Questions
3*. What is mesh networ'?
A networ$ in which there are !ultiple networ$ lin$s between co!puters to
provide !ultiple paths for data to travel#
3-. What is difference .etween .ase.and and .road.and transmission?
In a baseband trans!ission" the entire bandwidth of the cable is consu!ed by a
single signal# In broadband trans!ission" signals are sent on !ultiple fre0uencies"
allowing !ultiple signals to be sent si!ultaneously#
30. 1xplain -3*33 rule?
In a 5thernet networ$" between any two points on the networ$ "there can be no
!ore than five networ$ seg!ents or four repeaters" and of those five seg!ents only three
of seg!ents can be populated#
35. What #6Q?
In to$en )ing " hub is called &ultistation Access =nit,&A=-#
37. What is the difference .etween routa.le and non3 routa.le protocols?
)outable protocols can wor$ with a router and can be used to build large
networ$s# 'on:)outable protocols are designed to wor$ on s!all" local networ$s and
cannot be used with a router
3?. Why should you care a.out the E$+ eference #odel?
It provides a fra!ewor$ for discussing networ$ operations and design#
*@. What is logical lin' control?
%ne of two sublayers of the data lin$ layer of %SI reference !odel" as defined by
the I555 FD2 standard# This sublayer is responsible for !aintaining the lin$ between
co!puters when they are sending data across the physical networ$ connection#
*1. What is virtual channel?
/irtual channel is nor!ally a connection fro! one source to one destination"
although !ulticast connections are also per!itted# The other na!e for virtual channel is
virtual circuit#
*2. What is virtual path?
Along any trans!ission path fro! a given source to a given destination" a group
of virtual circuits can be grouped together into what is called path#
*3. What is pac'et filter?
7ac$et filter is a standard router e0uipped with so!e e6tra functionality# The e6tra
functionality allows every inco!ing or outgoing pac$et to be inspected# 7ac$ets !eeting
so!e criterion are forwarded nor!ally# Those that fail the test are dropped#
**. What is traffic shaping?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?BF
Technical Aptitude Questions
%ne of the !ain causes of congestion is that traffic is often busy# If hosts could be
!ade to trans!it at a unifor! rate" congestion would be less co!!on# Another open loop
!ethod to help !anage congestion is forcing the pac$et to be trans!itted at a !ore
predictable rate# This is called traffic shaping#
*-. What is multicast routing?
Sending a !essage to a group is called !ulticasting" and its routing algorith! is
called !ulticast routing#
*0. What is region?
Ghen hierarchical routing is used" the routers are divided into what we will call
regions" with each router $nowing all the details about how to route pac$ets to
destinations within its own region" but $nowing nothing about the internal structure of
other regions#
*5. What is silly window syndrome?
It is a proble! that can ruin TC7 perfor!ance# This proble! occurs when data are
passed to the sending TC7 entity in large bloc$s" but an interactive application on the
receiving side reads ? byte at a ti!e#
*7. What are !igrams and Drigrams?
The !ost co!!on two letter co!binations are called as digra!s# e#g# th" in" er" re
and an# The !ost co!!on three letter co!binations are called as trigra!s# e#g# the" ing"
and" and ion#
*?. 1xpand +!16.
ID5A stands for International Data 5ncryption Algorith!#
-@. What is wide3mouth frog?
Gide:!outh frog is the si!plest $nown $ey distribution center ,_DC-
authentication protocol#
-1. What is #ail =ateway?
It is a syste! that perfor!s a protocol translation between different electronic
!ail delivery protocols#
-2. What is +=> 2+nterior =ateway >rotocol4?
It is any routing protocol used within an autono!ous syste!#
-3. What is 1=> 21xterior =ateway >rotocol4?
It is the protocol the routers in neighboring autono!ous syste!s use to identify
the set of networ$s that can be reached within or via each autono!ous syste!#
-*. What is autonomous system?
It is a collection of routers under the control of a single ad!inistrative authority
and that uses a co!!on Interior (ateway 7rotocol#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?BL
Technical Aptitude Questions
--. What is "=> 2"order =ateway >rotocol4?
It is a protocol used to advertise the set of networ$s that can be reached with in an
autono!ous syste!# *(7 enables this infor!ation to be shared with the autono!ous
syste!# This is newer than 5(7 ,56terior (ateway 7rotocol-#
-0. What is =ateway3to3=ateway protocol?
It is a protocol for!erly used to e6change routing infor!ation between Internet
core routers#
-5. What is &BD 2&etwor' Birtual Derminal4?
It is a set of rules defining a very si!ple virtual ter!inal interaction# The '/T is
used in the start of a Telnet session#
-7. What is a #ulti3homed )ost?
It is a host that has a !ultiple networ$ interfaces and that re0uires !ultiple I7
addresses is called as a &ulti:ho!ed .ost#
-?. What is [er.eros?
It is an authentication service developed at the &assachusetts Institute of
Technology# _erberos uses encryption to prevent intruders fro! discovering passwords
and gaining unauthoried access to files#
0@. What is E$><?
It is an Internet routing protocol that scales well" can route traffic along !ultiple
paths" and uses $nowledge of an InternetTs topology to !a$e accurate routing decisions#
01. What is >roxy 6>?
It is using a router to answer A)7 re0uests# This will be done when the
originating host believes that a destination is local" when in fact is lies beyond router#
02. What is $L+> 2$erial Line +nterface >rotocol4?
It is a very si!ple protocol used for trans!ission of I7 datagra!s across a serial
line#
03. What is +> 2outing +nformation >rotocol4?
It is a si!ple protocol used to e6change infor!ation between the routers#
0*. What is source route?
It is a se0uence of I7 addresses identifying the route a datagra! !ust follow# A
source route !ay optionally be included in an I7 datagra! header#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?HD
Technical Aptitude Questions
%perating Syste!s
Following are a few basic 0uestions that cover the essentials of %S8
1. 1xplain the concept of eentrancy.
It is a useful" !e!ory:saving techni0ue for !ultiprogra!!ed ti!esharing
syste!s# A eentrant >rocedure is one in which !ultiple users can share a single copy of
a progra! during the sa!e period# )eentrancy has 2 $ey aspects8 The progra! code
cannot !odify itself" and the local data for each user process !ust be stored separately#
Thus" the per!anent part is the code" and the te!porary part is the pointer bac$ to the
calling progra! and local variables used by that progra!# 5ach e6ecution instance is
called activation# It e6ecutes the code in the per!anent part" but has its own copy of local
variablesMpara!eters# The te!porary part associated with each activation is the activation
record# (enerally" the activation record is $ept on the stac$#
'ote8 A reentrant procedure can be interrupted and called by an interrupting
progra!" and still e6ecute correctly on returning to the procedure#
2. 1xplain "eladyWs 6nomaly.
Also called FIF% ano!aly# =sually" on increasing the nu!ber of fra!es allocated
to a processT virtual !e!ory" the process e6ecution is faster" because fewer page faults
occur# So!eti!es" the reverse happens" i#e#" the e6ecution ti!e increases even when !ore
fra!es are allocated to the process# This is *eladyTs Ano!aly# This is true for certain
page reference patterns#
3. What is a .inary semaphore? What is its use?
A binary se!aphore is one" which ta$es only D and ? as values# They are used to
i!ple!ent !utual e6clusion and synchronie concurrent processes#
*. What is thrashing?
It is a pheno!enon in virtual !e!ory sche!es when the processor spends !ost of
its ti!e swapping pages" rather than e6ecuting instructions# This is due to an inordinate
nu!ber of page faults#
-. List the ,offmanWs conditions that lead to a deadloc'.
&utual 56clusion8 %nly one process !ay use a critical resource at a ti!e#
.old U Gait8 A process !ay be allocated so!e resources while waiting for others#
'o 7re:e!ption8 'o resource can be forcible re!oved fro! a process holding it#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?H?
Operating Systems

Technical Aptitude Questions
Circular Gait8 A closed chain of processes e6ist such that each process holds at least
one resource needed by another process in the chain#
0. What are short3% long3 and medium3term scheduling?
2ong ter! scheduler deter!ines which progra!s are ad!itted to the syste! for
processing# It controls the degree of multiprogramming# %nce ad!itted" a >ob beco!es a
process#
&ediu! ter! scheduling is part of the swapping function# This relates to
processes that are in a bloc$ed or suspended state# They are swapped out of real:!e!ory
until they are ready to e6ecute# The swapping:in decision is based on !e!ory:
!anage!ent criteria#
Short ter! scheduler" also $now as a dispatcher e6ecutes !ost fre0uently" and
!a$es the finest:grained decision of which process should e6ecute ne6t# This scheduler is
invo$ed whenever an event occurs# It !ay lead to interruption of one process by
pree!ption#
5. What are turnaround time and response time?
Turnaround ti!e is the interval between the sub!ission of a >ob and its
co!pletion# )esponse ti!e is the interval between sub!ission of a re0uest" and the first
response to that re0uest#
7. What are the typical elements of a process image?
=ser data8 &odifiable part of user space# &ay include progra! data" user stac$ area"
and progra!s that !ay be !odified#
=ser progra!8 The instructions to be e6ecuted#
Syste! Stac$8 5ach process has one or !ore 2IF% stac$s associated with it# =sed to
store para!eters and calling addresses for procedure and syste! calls#
7rocess control *loc$ ,7C*-8 Info needed by the %S to control processes#
?. What is the Dranslation Loo'aside "uffer 2DL"4?
In a cached syste!" the base addresses of the last few referenced pages is
!aintained in registers called the T2* that aids in faster loo$up# T2* contains those
page:table entries that have been !ost recently used# 'or!ally" each virtual !e!ory
reference causes 2 physical !e!ory accesses:: one to fetch appropriate page:table entry"
and one to fetch the desired data# =sing T2* in:between" this is reduced to >ust one
physical !e!ory access in cases of T2*:hit#
1@. What is the resident set and wor'ing set of a process?
)esident set is that portion of the process i!age that is actually in real:!e!ory at
a particular instant# Gor$ing set is that subset of resident set that is actually needed for
e6ecution# ,)elate this to the variable:window sie !ethod for swapping techni0ues#-
11. When is a system in safe state?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?H2
Technical Aptitude Questions
The set of dispatchable processes is in a safe state if there e6ists at least one
te!poral order in which all processes can be run to co!pletion without resulting in a
deadloc$#
12. What is cycle stealing?
Ge encounter cycle stealing in the conte6t of Direct &e!ory Access ,D&A-#
5ither the D&A controller can use the data bus when the C7= does not need it" or it !ay
force the C7= to te!porarily suspend operation# The latter techni0ue is called cycle
stealing# 'ote that cycle stealing can be done only at specific brea$ points in an
instruction cycle#
13. What is meant .y arm3stic'iness?
If one or a few processes have a high access rate to data on one trac$ of a storage
dis$" then they !ay !onopolie the device by repeated re0uests to that trac$# This
generally happens with !ost co!!on device scheduling algorith!s ,2IF%" SSTF" C:
SCA'" etc-# .igh:density !ultisurface dis$s are !ore li$ely to be affected by this than
low density ones#
1*. What are the stipulations of ,2 level security?
C2 level security provides for8
Discretionary Access Control
Identification and Authentication
Auditing
)esource reuse
1-. What is .usy waiting?
The repeated e6ecution of a loop of code while waiting for an event to occur is
called busy:waiting# The C7= is not engaged in any real productive activity during this
period" and the process does not progress toward co!pletion#
10. 1xplain the popular multiprocessor thread3scheduling strategies.
Load $haring: 7rocesses are not assigned to a particular processor# A global 0ueue of
threads is !aintained# 5ach processor" when idle" selects a thread fro! this 0ueue#
'ote that load .alancing refers to a sche!e where wor$ is allocated to processors on
a !ore per!anent basis#
=ang $cheduling: A set of related threads is scheduled to run on a set of processors at
the sa!e ti!e" on a ?:to:? basis# Closely related threads M processes !ay be scheduled
this way to reduce synchroniation bloc$ing" and !ini!ie process switching# (roup
scheduling predated this strategy#
!edicated processor assignment: 7rovides i!plicit scheduling defined by assign!ent
of threads to processors# For the duration of progra! e6ecution" each progra! is
allocated a set of processors e0ual in nu!ber to the nu!ber of threads in the progra!#
7rocessors are chosen fro! the available pool#
!ynamic scheduling: The nu!ber of thread in a progra! can be altered during the
course of e6ecution#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?H1
Technical Aptitude Questions
15. When does the condition WrendeCvousW arise?
In !essage passing" it is the condition in which" both" the sender and receiver are
bloc$ed until the !essage is delivered#
17. What is a trap and trapdoor?
Trapdoor is a secret undocu!ented entry point into a progra! used to grant
access without nor!al !ethods of access authentication# A trap is a software interrupt"
usually the result of an error condition#
1?. What are local and glo.al page replacements?
2ocal replace!ent !eans that an inco!ing page is brought in only to the relevant
processT address space# (lobal replace!ent policy allows any page fra!e fro! any
process to be replaced# The latter is applicable to variable partitions !odel only#
2@. !efine latency% transfer and see' time with respect to dis' +GE.
See$ ti!e is the ti!e re0uired to !ove the dis$ ar! to the re0uired trac$#
)otational delay or latency is the ti!e it ta$es for the beginning of the re0uired sector to
reach the head# Su! of see$ ti!e ,if any- and latency is the access ti!e# Ti!e ta$en to
actually transfer a span of data is transfer ti!e#
21. !escri.e the "uddy system of memory allocation.
Free !e!ory is !aintained in lin$ed lists" each of e0ual sied bloc$s# Any such
bloc$ is of sie 29$# Ghen so!e !e!ory is re0uired by a process" the bloc$ sie of ne6t
higher order is chosen" and bro$en into two# 'ote that the two such pieces differ in
address only in their $th bit# Such pieces are called buddies# Ghen any used bloc$ is
freed" the %S chec$s to see if its buddy is also free# If so" it is re>oined" and put into the
original free:bloc$ lin$ed:list#
22. What is time3stamping?
It is a techni0ue proposed by 2a!port" used to order events in a distributed
syste! without the use of cloc$s# This sche!e is intended to order events consisting of
the trans!ission of !essages# 5ach syste! TiT in the networ$ !aintains a counter Ci#
5very ti!e a syste! trans!its a !essage" it incre!ents its counter by ? and attaches the
ti!e:sta!p Ti to the !essage# Ghen a !essage is received" the receiving syste! T>T sets
its counter C> to ? !ore than the !a6i!u! of its current value and the inco!ing ti!e:
sta!p Ti# At each site" the ordering of !essages is deter!ined by the following rules8 For
!essages 6 fro! site i and y fro! site >" 6 precedes y if one of the following conditions
holds####,a- if TiST> or ,b- if TiAT> and iS>#
23. )ow are the waitGsignal operations for monitor different from those for semaphores?
If a process in a !onitor signal and no tas$ is waiting on the condition variable"
the signal is lost# So this allows easier progra! design# Ghereas in se!aphores" every
operation affects the value of the se!aphore" so the wait and signal operations should be
perfectly balanced in the progra!#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?HC
Technical Aptitude Questions
2*. +n the context of memory management% what are placement and replacement
algorithms?
7lace!ent algorith!s deter!ine where in available real:!e!ory to load a
progra!# Co!!on !ethods are first:fit" ne6t:fit" best:fit# )eplace!ent algorith!s are
used when !e!ory is full" and one process ,or part of a process- needs to be swapped out
to acco!!odate a new progra!# The replace!ent algorith! deter!ines which are the
partitions to be swapped out#
2-. +n loading programs into memory% what is the difference .etween load3time dynamic
lin'ing and run3time dynamic lin'ing?
For load:ti!e dyna!ic lin$ing8 2oad !odule to be loaded is read into !e!ory#
Any reference to a target e6ternal !odule causes that !odule to be loaded and the
references are updated to a relative address fro! the start base address of the application
!odule#
Gith run:ti!e dyna!ic loading8 So!e of the lin$ing is postponed until actual
reference during e6ecution# Then the correct !odule is loaded and lin$ed#
20. What are demand3 and pre3paging?
Gith de!and paging" a page is brought into !e!ory only when a location on that
page is actually referenced during e6ecution# Gith pre:paging" pages other than the one
de!anded by a page fault are brought in# The selection of such pages is done based on
co!!on access patterns" especially for secondary !e!ory devices#
25. >aging a memory management function% while multiprogramming a processor
management function% are the two interdependent?
Jes#
27. What is page canni.aliCing?
7age swapping or page replace!ents are called page cannibaliing#
2?. What has triggered the need for multitas'ing in >,s?
Increased speed and !e!ory capacity of !icroprocessors together with the support
fir virtual !e!ory and
(rowth of client server co!puting
3@. What are the four layers that Windows &D have in order to achieve independence?
.ardware abstraction layer
_ernel
Subsyste!s
Syste! Services#
31. What is $#>?
To achieve !a6i!u! efficiency and reliability a !ode of operation $nown as
sy!!etric !ultiprocessing is used# In essence" with S&7 any process or threads can be
assigned to any processor#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?H@
Technical Aptitude Questions
32. What are the 'ey o.ject oriented concepts used .y Windows &D?
5ncapsulation
%b>ect class and instance
33. +s Windows &D a full .lown o.ject oriented operating system? =ive reasons.
'o Gindows 'T is not so" because its not i!ple!ented in ob>ect oriented
language and the data structures reside within one e6ecutive co!ponent and are not
represented as ob>ects and it does not support ob>ect oriented capabilities #
3*. What is a draw.ac' of #BD?
It does not have the features li$e
ability to support !ultiple processors
virtual storage
source level debugging
3-. What is process spawning?
Ghen the %S at the e6plicit re0uest of another process creates a process" this
action is called process spawning#
30. )ow many jo.s can .e run concurrently on #BD?
?@ >obs
35. List out some reasons for process termination.
'or!al co!pletion
Ti!e li!it e6ceeded
&e!ory unavailable
*ounds violation
7rotection error
Arith!etic error
Ti!e overrun
IM% failure
Invalid instruction
7rivileged instruction
Data !isuse
%perator or %S intervention
7arent ter!ination#
37. What are the reasons for process suspension?
swapping
interactive user re0uest
ti!ing
parent process re0uest
3?. What is process migration?
It is the transfer of sufficient a!ount of the state of process fro! one !achine to
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?HB
Technical Aptitude Questions
the target !achine
*@. What is mutant?
In Gindows 'T a !utant provides $ernel !ode or user !ode !utual e6clusion
with the notion of ownership#
*1. What is an idle thread?
The special thread a dispatcher will e6ecute when no ready thread is found#
*2. What is <t!is'?
It is a fault tolerance dis$ driver for Gindows 'T#
*3. Ghat are the possible threads a thread can have`
)eady
Standby
)unning
Gaiting
Transition
Ter!inated#
**. What are rings in Windows &D?
Gindows 'T uses protection !echanis! called rings provides by the process to
i!ple!ent separation between the user !ode and $ernel !ode#
*-. What is 1xecutive in Windows &D?
In Gindows 'T" e6ecutive refers to the operating syste! code that runs in $ernel
!ode#
*0. What are the su.3components of +GE manager in Windows &D?
'etwor$ redirectorM Server
Cache !anager#
File syste!s
'etwor$ driver
Device driver
*5. What are !!'s? &ame an operating system that includes this feature.
DD$s are device driver $its" which are e0uivalent to SD_s for writing device
drivers# Gindows 'T includes DD$s#
*7. What level of security does Windows &D meets?
C2 level security#
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved
?HH

Вам также может понравиться