You are on page 1of 177

Downloaded from : http://www.placementpapers.net - Indias No.

1 Placement Portal
Face Interviews Confdently!
Technical Aptitude Questions
Table of Contents
Data Structures Aptitude.............................................................................3
C Aptitude..................................................................................................12
C++ Aptitude and OOPS.............................................................................75
Quantitative Aptitude...............................................................................104
UNIX Concepts.........................................................................................121
RDBMS Concepts.....................................................................................135
SQL..........................................................................................................153
Computer Networks.................................................................................161
Operating Systems...................................................................................169
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2
Technical Aptitude Questions
Data Structures Aptitude
1. What is data structure?
A data structure is a way of organizing data that considers not only the items
stored, but also their relationship to each other. Advance nowledge about the
relationship between data items allows designing of efficient algorithms for the
manipulation of data.
2. List out the areas in which data structures are applied extensively?
!ompiler Design,
"perating System,
Database #anagement System,
Statistical analysis pacage,
$umerical Analysis,
%raphics,
Artificial &ntelligence,
Simulation
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 model ) %raph
,ierarchical data model ) Trees
*. +f you are using , language to implement the heterogeneous lin'ed list% what pointer
type will you use?
The heterogeneous lined list contains different data types in its nodes and we
need a lin, pointer to connect them. &t 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 .ueue is used for actual storing of data and another for storing
priorities.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/
Data Structures
Aptitude

Technical Aptitude Questions
0. What is the data structures used to perform recursion?
Stac. (ecause of its 0&1" *0ast &n 1irst "ut+ property it remembers its 2caller3 so
nows whom to return when the function has to return. 'ecursion maes use of system
stac for storing the return addresses of the function calls.
1very recursive function has its e/uivalent iterative 2non3recursive4 function.
4ven when such e.uivalent iterative procedures are written, e5plicit stac is to be used.
5. What are the notations used in 1valuation of 6rithmetic 1xpressions using prefix and
postfix forms?
6olish and 'everse 6olish notations.
7. ,onvert the expression 226 8 "4 9 , : 2! : 14 ; 2< 8 =44 to e/uivalent >refix and
>ostfix notations.
6refi5 $otation7
8 9 : ;A(! 9 D4 ; 1%
6ostfi5 $otation7
A( ; ! : D4 9 9 1% ; 8
?. $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 perform insertion sort, using selection we can perform
selection sort, using e5change we can perform the bubble sort *and other similar sorting
methods+. (ut no sorting method can be done =ust using deletion.
1@. 6 .inary tree with 2@ nodes has null .ranches?
2>
0et us tae a tree with ? nodes *n@?+
&t will have only A *ie,?;>+ null branches. &n 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 ?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
B
$ull (ranches
Technical Aptitude Questions
Straight merging,
$atural merging,
6olyphase sort,
Distribution of &nitial runs.
12. )ow many different trees are possi.le with 1@ nodes ?
>C>B
1or e5ample, consider a tree with / nodes*n@/+, it will have the ma5imum
combination of ? different *ie, 2
/
9 / @ ?+ trees.
i ii iii iv v
&n general7
+f there are n nodes% there exist 2
n
-n different trees.
13. List out few of the 6pplication of tree data3structure?
The manipulation of Arithmetic e5pression,
Symbol Table construction,
Synta5 analysis.
1*. List out few of the applications that ma'e use of #ultilin'ed $tructures?
Sparse matri5,
&nde5 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+ 0ined list
10. What is the type of the algorithm used in solving the 7 Aueens pro.lem?
(actracing
15. +n an 6BL tree% at what condition the .alancing is to .e done?
&f the 2pivotal value3 *or the 2,eight factor3+ 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) - ll !ight" !e"erved
?
Technical Aptitude Questions
"ne. &f there is only one entry possible in the bucet, when the collision occurs,
there is no way to accommodate the colliding value. This results in the overlapping of
values.
1?. Draverse the given tree using +norder% >reorder and >ostorder traversals.
&norder 7 D , ( 4 A 1 ! & % D
6reorder7 A ( D , 4 ! 1 % & D
6ostorder7 , D 4 ( 1 & D % ! A
2@. Dhere are 7% 1-% 13% 1* nodes were there in * different trees. Which of them could
have formed a full .inary tree?
>?.
&n general7
Dhere are 2
n
-1 nodes in a full .inary tree.
"y the method of elimination:
1ull binary trees contain odd number of nodes. So there cannot be full
binary trees with E or >B nodes, so re=ected. Fith >/ nodes you can form a complete
binary tree but not a full binary tree. So the correct answer is >?.
Note:
1ull and !omplete 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) - ll !ight" !e"erved
A
A
( !
D
4 1 %
, &
D
%iven tree7
>
2 /
B
?
Technical Aptitude Questions
At location A
> 2 / 9 9 B 9 9 ?
'oot 0!> '!> 0!2 '!2 0!/ '!/ 0!B '!B
where 0!n means 0eft !hild of node n and '!n means 'ight !hild of node n
22. $ort the given values using Auic' $ort?
A? GC G? EC E? AC ?? ?C B?
Sorting taes place from the pivot value, which is the first value of the given
elements, this is mared bold. The values at the left pointer and right pointer are indicated
using
0
and
'
respectively.
65 GC
0
G? EC E? AC ?? ?C B?
'
Since pivot is not yet changed the same process is continued after interchanging the
values at
0
and
'
positions
65 B? G?
0
EC E? AC ?? ?C
'
GC
65 B? ?C EC
0
E? AC ??
'
G? GC
65 B? ?C ?? E?
0
AC
'
EC G? GC
65 B? ?C ?? AC
'
E?
0
EC G? GC
Fhen the 0 and ' pointers cross each other the pivot value is interchanged with the value
at right pointer. &f the pivot is changed it means that the pivot has occupied its original
position in the sorted order *shown in bold italics+ and hence two different arrays are
formed, one from start of the original array to the pivot position9> and the other from
pivot position;> to end.
60
0
B? ?C ??
'
65 85
0
EC G? GC
'
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
G
Technical Aptitude Questions
55
0
B? ?C
'
60 65 70
'
EC
0
G? 85
50
0
B?
'
55 60 65 70 EC
0
G?
'
85
&n the ne5t pass we get the sorted form of the array.
45 50 55 60 65 70 75 80 85
23. <or the given graph% draw the !<$ and "<$?
"<$: A H % , 6 4 # I D
!<$: A H , 6 4 I # D %
2*. ,lassify the )ashing <unctions .ased on the various methods .y which the 'ey value
is found.
Direct method,
Subtraction method,
#odulo9Division method,
Digit945traction method,
#id9S.uare method,
1olding method,
6seudo9random method.
2-. What are the types of ,ollision esolution Dechni/ues and the methods used in each
of the type?
"pen addressing *closed hashing+,
The methods used include7
"verflow bloc,
!losed addressing *open hashing+
The methods used include7
0ined list,
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
E
A
, H
% 6
4
I
# D
The given graph7
Technical Aptitude Questions
(inary treeJ
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 maes
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+ !omplete (inary Tree.
"y the method of elimination:
1ull binary tree loses its nature when operations of insertions and deletions
are done. 1or incomplete binary trees, e5tra storage is re.uired and overhead of $<00
node checing taes place. So complete binary tree is the better one since the property of
complete binary tree is maintained even after operations lie 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 minimum spanning tree is a spanning tree organized so that the
total edge weight between nodes is minimized.
3@. !oes the minimum spanning tree of a graph give the shortest distance .etween any 2
specified nodes?
$o.
#inimal spanning tree assures that the total weight of the tree is ept at its
minimum. (ut it doesnFt mean that the distance between any two nodes involved in the
minimum9spanning tree is minimum.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
K
>>
9
? G >K 2B
B
9
A
9
E
9
>A
9
2C 22
GE
K2
Technical Aptitude Questions
31. ,onvert the given graph with weighted edges to minimal spanning tree.
the e.uivalent minimal spanning tree is7
32. Which is the simplest file structure?
2a4 $e/uential
2.4 +ndexed
2c4 andom
*a+ Se.uential
33. Whether Lin'ed List is linear or &on3linear data structure?
According to Access strategies 0ined list is a linear one.
According to Storage 0ined 0ist is a $on9linear 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) - ll !ight" !e"erved
>C
> /
2
B
?
B>C
ACC
2CC
BCC
/>C
>B2>
2KE?
A>2
9
:
:
A
(
;
L
!
6 D
Q
>
2
/
B
?
B>C
A>2
2CC
/>C
Technical Aptitude Questions
3-. <or the following ,E"EL code% draw the "inary tree?
C> ST<D4$TM'4!.
C2 $A#4.
C/ 1&'STM$A#4 6&! H*>C+.
C/ 0ASTM$A#4 6&! H*>C+.
C2 I4A'M"1MST<DI.
C/ 1&'STMS4# 6&! HH.
C/ S4!"$DMS4# 6&! HH.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>
ST<D4$TM'4!
$A#4 I4A'M"1MST<DI
1&'STM$A#4 0ASTM$A#4 1&'STMS4# S4!"$DMS4#
C>
C2 C2
C/ C/ C/ C/
Technical Aptitude Questions
! Aptitude
Note : All the programs are tested under Turbo !L!;; compilers.
&t is assumed that,
6rograms run under D"S environment,
The underlying machine is an 5EA system,
6rogram is compiled using Turbo !L!;; compiler.
The program output may depend on the information based on this assumptions
*for e5ample sizeof*int+ @@ 2 may be assumed+.
6redict the output or error*s+ for the following7
1. void main24
H
int const 9 pI-J
printf2KLdK%8829p44J
M
Answer:
!ompiler error7 !annot modify a constant value.
Explanation7
p is a pointer to a Nconstant integerN. (ut we tried to change the value of
the Nconstant integerN.
2. main24
H
char sN OIKmanKJ
int iJ
for2iI@JsN i OJi884
printf2KPnLcLcLcLcK%sN i O%92s8i4%92i8s4%iNsO4J
M
Answer:
mmmm
aaaa
nnnn
Explanation7
sOiP, :*i;s+, :*s;i+, iOsP are all different ways of e5pressing the same idea.
%enerally array name is the base address for that array. ,ere s is the base address. i is the
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2
C Aptitude

Technical Aptitude Questions
inde5 numberLdisplacement from the base address. So, indirecting it with : is same as
sOiP. iOsP may be surprising. (ut in the case of ! it is same as sOiP.
3. main24
H
float me I 1.1J
dou.le you I 1.1J
if2meIIyou4
printf2K+ love QK4J
else
printf2K+ hate QK4J
M
Answer:
& hate <
Explanation7
1or floating point numbers (float, double, long double) the values cannot
be predicted e5actly. Depending on the number of bytes, the precession with of the value
represented varies. 1loat taes B bytes and long double taes >C bytes. So float stores C.K
with less precision than long double.
Rule of Thumb:
$ever compare or at9least be cautious when using floating point numbers
with relational operators (@@ , Q, R, R@, Q@,S@ ) .
*. main24
H
static int var I -J
printf2KLd K%var334J
if2var4
main24J
M
Answer:
? B / 2 >
Explanation:
Fhen static storage class is given, it is initialized once. The change in the
value of a static variable is retained even between the function calls. #ain is also treated
lie 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) - ll !ight" !e"erved
>/
Technical Aptitude Questions
M
Answer:
2 2 2 2 2 2 / B A ?
Explanation:
&nitially pointer c is assigned to both p and q. &n the first loop, since only
q is incremented and not c , the value 2 will be printed ? times. &n second loop p itself is
incremented. So the values 2 / B A ? will be printed.
0. main24
H
extern int iJ
iI2@J
printf2KLdK%i4J
M
Answer:
Lin'er 1rror 7 <ndefined symbol TMiT
Explanation:
e5tern storage class in the following declaration,
extern int i;
specifies to the compiler that the memory for i is allocated in some other program and
that address will be given to the current program at the time of lining. (ut liner finds
that no other variable of name i is available in any other program with memory space
allocated for it. ,ence a liner 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
Answer:
C C > / >
Explanation :
0ogical 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
e5pression 2i++ && ++ && !++" is e5ecuted first. The result of this e5pression is C
*9> UU 9> UU C @ C+. $ow the e5pression is C VV 2 which evaluates to > *because "'
operator always gives > e5cept for 2C VV C3 combination9 for which it gives C+. So the value
of m is >. The values of other variables are also incremented by >.
7. main24
H
char 9pJ
printf2KLd Ld K%siCeof29p4%siCeof2p44J
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>B
Technical Aptitude Questions
M
Answer:
> 2
Explanation:
The sizeof*+ operator gives the number of bytes taen by its operand. 6 is a
character pointer, which needs one byte for storing its value *a character+. ,ence
sizeof*:p+ gives a value of >. Since it needs two bytes to store the address of the character
pointer sizeof*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
Answer :
three
Explanation :
The default case can be placed anywhere inside the loop. &t is e5ecuted
only when all other cases doesnTt match.
1@. main24
H
printf2KLxK%31RR*4J
M
Answer:
fffC
Explanation :
9> is internally represented as all >Ts. Fhen left shifted four times the least
significant B bits are filled with CTs.The W5 format specifier specifies that the integer
value be printed as a he5adecimal value.
11. main24
H
char stringNOIK)ello WorldKJ
display2string4J
M
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?
Technical Aptitude Questions
void display2char 9string4
H
printf2KLsK%string4J
M
Answer:
,ompiler 1rror : Type mismatch in redeclaration of function display
Explanation :
&n third line, when the function #ispl$% is encountered, the compiler
doesnTt now anything about the function display. &t assumes the arguments and return
types to be integers, *which is the default type+. Fhen it sees the actual function #ispl$%&
the arguments and type contradicts with what it has assumed previously. ,ence a compile
time error occurs.
12. main24
H
int cI3 32J
printf2KcILdK%c4J
M
Answer:
c@2X
Explanation:
,ere unary minus *or negation+ operator is used twice. Same maths rules
applies, ie. minus : minus@ plus.
'ote:
,owever you cannot give lie 992. (ecause 99 operator can only be
applied to variables as a #e(rement operator *eg., i99+. 2 is a constant and not a variable.
13. Tdefine int char
main24
H
int iI0-J
printf2KsiCeof2i4ILdK%siCeof2i44J
M
Answer:
sizeof*i+@>
Explanation:
Since the Ydefine replaces the string int by the macro (h$r
1*. main24
H
int iI1@J
iIUiV1*J
printf2KiILdK%i4J
M
Answer:
i@C
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>A
Technical Aptitude Questions
Explanation:
&n the e5pression )i*1+ , $"T *S+ operator has more precedence than 2 Q3
symbol. ) is a unary logical operator. Si *S>C+ is C *not of true is false+. CQ>B is false
*zero+.
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
Answer:
GG
Explanation:
p is pointing to character TZnT. str> is pointing to character TaT ;;:p. Np is pointing
to TZnT and that is incremented by one.N the AS!&& value of TZnT is >C, which is then
incremented to >>. The value of ;;:p is >>. ;;:str>, str> is pointing to TaT that is
incremented by > and it becomes TbT. AS!&& value of TbT is KE.
$ow performing *>> ; KE ) /2+, we get GG*N#N+X
So we get the output GG 77 N#N *Ascii is GG+.
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
Answer:
Some%arbage-alue999>
Explanation:
p@UaO2PO2PO2P 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. :.@:::a
starting address of a is assigned integer pointer. $ow . is pointing to starting address of a.
&f you print :., it will print first element of /D array.
15. TincludeRstdio.hV
main24
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>G
Technical Aptitude Questions
H
struct xx
H
int xI3J
char nameNOIKhelloKJ
MJ
struct xx 9sJ
printf2KLdK%s3Vx4J
printf2KLsK%s3Vname4J
M
Answer:
!ompiler 4rror
Explanation:
Iou should not initialize 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
Answer:
!ompiler 4rror
Explanation:
The structure yy is nested within structure 55. ,ence, the elements are of
yy are to be accessed through the instance of structure 55, which needs an instance of yy
to be nown. &f the instance is created after defining the structure the compiler will not
now about the instance relative to 55. ,ence for nested structure yy you have to declare
member.
1?. main24
H
printf2KPna.K4J
printf2KP.siK4J
printf2KPrhaK4J
M
Answer:
hai
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>E
Technical Aptitude Questions
Explanation:
Zn 9 newline
Zb 9 bacspace
Zr 9 linefeed
2@. main24
H
int iI-J
printf2KLdLdLdLdLdLdK%i88%i33%88i%33i%i4J
M
Answer:
B??B?
Explanation:
The arguments in a function call are pushed into the stac from left to
right. The evaluation is by popping out from the stac. and the evaluation is from right to
left, hence the result.
21. Tdefine s/uare2x4 x9x
main24
H
int iJ
i I 0*Gs/uare2*4J
printf2KLdK%i4J
M
Answer:
AB
Explanation:
the macro call s.uare*B+ will substituted by B:B so the e5pression becomes
i @ ABLB:B . Since L and : has e.ual priority the e5pression will be evaluated as *ABLB+:B
i.e. >A:B @ AB

22. main24
H
char 9pIKhai friendsK%9p1J
p1IpJ
while29pUIWP@W4 889p88J
printf2KLs LsK%p%p14J
M
Answer:
ib=Sgs=foet
Explanation:
;;:p;; will be parse in the given order
:p that is value at the location currently pointed by p will be taen
;;:p the retrieved value will be incremented
when X is encountered the location will be incremented that is p;; will be e5ecuted
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>K
Technical Aptitude Questions
,ence, in the while loop initial value pointed by p is 2h3, which is changed to 2i3 by
e5ecuting ;;:p and pointer moves to point, 2a3 which is similarly changed to 2b3 and so
on. Similarly blan space is converted to 2S3. Thus, we obtain value in p becomes [ib=S
gs=foet\ and since p reaches 2ZC3 and p> points to p thus p>doesnot print anything.
23. Tinclude Rstdio.hV
Tdefine a 1@
main24
H
Tdefine a -@
printf2KLdK%a4J
M
Answer:
?C
Explanation:
The preprocessor directives can be redefined anywhere in the program. So
the most recently assigned value will be taen.
2*. Tdefine clrscr24 1@@
main24
H
clrscr24J
printf2KLdPnK%clrscr244J
M
Answer:
>CC
Explanation:
6reprocessor e5ecutes as a seperate pass before the e5ecution of the
compiler. So te5tual replacement of clrscr*+ to >CC occurs.The input program to compiler
loos lie this 7
main*+
]
>CCX
printf*NWdZnN,>CC+X
^
'ote:
>CCX is an e5ecutable statement but with no action. So it doesnTt give any
problem
2-. main24
H
printf2KLpK%main4J
M
Answer:
Some address will be printed.
Explanation:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2C
Technical Aptitude Questions
1unction names are =ust addresses *=ust lie array names are addresses+.
main*+ is also a function. So the address of function main will be printed. Wp in printf
specifies that the argument is an address. They are printed as he5adecimal numbers.
2G+ main*+
]
clrscr*+X
^
clrscr*+X
Answer:
$o outputLerror
Explanation:
The first clrscr*+ occurs inside a function. So it becomes a function call. &n
the second clrscr*+X is a function declaration *because it is not inside any
function+.
2E+ enum colors ](0A!_,(0<4,%'44$^
main*+
]

printf*NWd..Wd..WdN,(0A!_,(0<4,%'44$+X

return*>+X
^
Answer:
C..>..2
Explanation:
enum assigns numbers starting from C, if not e5plicitly defined.
2K+ void main*+
]
char far :farther,:farthestX

printf*NWd..WdN,sizeof*farther+,sizeof*farthest++X

^
Answer:
B..2
Explanation:
the second pointer is of char type and not a far pointer
/C+ main*+
]
int i@BCC,=@/CCX
printf*NWd..WdN+X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2>
Technical Aptitude Questions
^
Answer:
BCC../CC
Explanation:
printf taes the values of the first two assignments of the program. Any
number of printfTs may be given. All of them tae only the first two values.
&f more number of assignments given in the program,then printf will tae
garbage values.
/>+ main*+
]
char :pX
p@N,elloNX
printf*NWcZnN,:U:p+X
^
Answer:
,
Explanation:
: is a dereference operator U is a reference operator. They can be
applied any number of times provided it is meaningful. ,ere p points to
the first character in the string N,elloN. :p dereferences it and so its value
is ,. Again U references it to an address and : dereferences it to the value
,.
/2+ main*+
]
int i@>X
while *iR@?+
]
printf*NWdN,i+X
if *iQ2+
goto hereX
i;;X
^
^
fun*+
]
here7
printf*N66N+X
^
Answer:
!ompiler error7 <ndefined label ThereT in function main
Explanation:
0abels have functions scope, in other words The scope of the labels is
limited to functions . The label ThereT is available in function fun*+ ,ence it
is not visible in function main.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
22
Technical Aptitude Questions
//+ main*+
]
static char namesO?PO2CP@]NpascalN,NadaN,NcobolN,NfortranN,NperlN^X
int iX
char :tX
t@namesO/PX
namesO/P@namesOBPX
namesOBP@tX
for *i@CXiR@BXi;;+
printf*NWsN,namesOiP+X
^
Answer:
!ompiler error7 0value re.uired in function main
Explanation:
Array names are pointer constants. So it cannot be modified.
/B+ void main*+
]
int i@?X
printf*NWdN,i;; ; ;;i+X
^
Answer:
"utput !annot be predicted e5actly.
Explanation:
Side effects are involved in the evaluation of i
/?+ void main*+
]
int i@?X
printf*NWdN,i;;;;;i+X
^
Answer:
!ompiler 4rror
Explanation:
The e5pression i;;;;;i is parsed as i ;; ;; ; i which is an illegal
combination of operators.

/A+ YincludeRstdio.hQ
main*+
]
int i@>,=@2X
switch*i+
]
case >7 printf*N%""DN+X
breaX
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2/
Technical Aptitude Questions
case =7 printf*N(ADN+X
breaX
^
^
Answer:
!ompiler 4rror7 !onstant e5pression re.uired in function main.
Explanation:
The case statement can have only constant e5pressions *this implies that
we cannot use variable names directly so an error+.
'ote:
4numerated types can be used in case statements.
/G+ main*+
]
int iX
printf*NWdN,scanf*NWdN,Ui++X LL value >C is given as input here
^
Answer:
>
Explanation:
Scanf returns number of items successfully read and not >LC. ,ere >C is
given as input which should have been scanned successfully. So number of
items read is >.
/E+ Ydefine f*g,g2+ gYYg2
main*+
]
int var>2@>CCX
printf*NWdN,f*var,>2++X
^
Answer:
>CC
/K+ main*+
]
int i@CX

for*Xi;;Xprintf*NWdN,i++ X
printf*NWdN,i+X
^
Answer:
>
Explanation:
before entering into the for loop the checing condition is NevaluatedN.
,ere it evaluates to C *false+ and comes out of the loop, and i is
incremented *note the semicolon after the for loop+.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2B
Technical Aptitude Questions
BC+ YincludeRstdio.hQ
main*+
]
char sOP@]TaT,TbT,TcT,TZnT,TcT,TZCT^X
char :p,:str,:str>X
p@UsO/PX
str@pX
str>@sX
printf*NWdN,;;:p ; ;;:str>9/2+X
^
Answer:
#
Explanation:
p is pointing to character TZnT.str> is pointing to character TaT ;;:p
meAnswer7Np is pointing to TZnT and that is incremented by one.N the AS!&&
value of TZnT is >C. then it is incremented to >>. the value of ;;:p is >>. ;
;:str> meAnswer7Nstr> is pointing to TaT that is incremented by > and it
becomes TbT. AS!&& value of TbT is KE. both >> and KE is added and result is
subtracted from /2.
i.e. *>>;KE9/2+@GG*N#N+X
B>+ YincludeRstdio.hQ
main*+
]
struct 55
]
int 5@/X
char nameOP@NhelloNX
^X
struct 55 :s@malloc*sizeof*struct 55++X
printf*NWdN,s9Q5+X
printf*NWsN,s9Qname+X
^
Answer:
!ompiler 4rror
Explanation:
&nitialization should not be done for structure members inside the structure
declaration
B2+ YincludeRstdio.hQ
main*+
]
struct 55
]
int 5X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2?
Technical Aptitude Questions
struct yy
]
char sX
struct 55 :pX
^X
struct yy :.X
^X
^
Answer:
!ompiler 4rror
Explanation:
in the end of nested structure yy a member have to be declared.
B/+ main*+
]
e5tern int iX
i@2CX
printf*NWdN,sizeof*i++X
^
Answer:
0iner error7 undefined symbol TMiT.
Explanation:
e5tern declaration specifies that the variable i is defined somewhere else.
The compiler passes the e5ternal variable to be resolved by the liner. So
compiler doesnTt find an error. During lining the liner searches for the
definition of i. Since it is not found the liner flags an error.
BB+ main*+
]
printf*NWdN, out+X
^
int out@>CCX
Answer:
!ompiler error7 undefined symbol out in function main.
Explanation:
The rule is that a variable is available for use from the point of declaration.
4ven though a is a global variable, it is not available for main. ,ence an
error.
B?+ main*+
]
e5tern outX
printf*NWdN, out+X
^
int out@>CCX
Answer:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2A
Technical Aptitude Questions
>CC
Explanation:
This is the correct way of writing the previous program.

BA+ main*+
]
show*+X
^
void show*+
]
printf*N&Tm the greatestN+X
^
Answer:
!ompier error7 Type mismatch in redeclaration of show.
Explanation:
Fhen the compiler sees the function show it doesnTt now anything about
it. So the default return type *ie, int+ is assumed. (ut when compiler sees
the actual definition of show mismatch occurs since it is declared as void.
,ence the error.
The solutions are as follows7
>. declare void show*+ in main*+ .
2. define show*+ before main*+.
/. declare e5tern void show*+ before the use of show*+.

BG+ main* +
]
int aO2PO/PO2P @ ]]]2,B^,]G,E^,]/,B^^,]]2,2^,]2,/^,]/,B^^^X
printf*[Wu Wu Wu Wd Zn\,a,:a,::a,:::a+X
printf*[Wu Wu Wu Wd Zn\,a;>,:a;>,::a;>,:::a;>+X
^
Answer:
>CC, >CC, >CC, 2
>>B, >CB, >C2, /
Explanation:
The given array is a /9D one. &t can also be viewed as a >9D array.

2 B G E / B 2 2 2 / / B
>CC >C2 >CB >CA >CE >>C >>2 >>B >>A >>E >2C >22
thus, for the first printf statement a, :a, ::a give address of first element .
since the indirection :::a gives the value. ,ence, the first line of the
output.
for the second printf a;> increases in the third dimension thus points to
value at >>B, :a;> increments in second dimension thus points to >CB, ::a
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2G
Technical Aptitude Questions
;> increments the first dimension thus points to >C2 and :::a;> first gets
the value at first location and then increments it by >. ,ence, the output.
BE+ main* +
]
int aO P @ ]>C,2C,/C,BC,?C^,=,:pX
for*=@CX =R?X =;;+
]
printf*[Wd\ ,:a+X
a;;X
^
p @ aX
for*=@CX =R?X =;;+
]
printf*[Wd \ ,:p+X
p;;X
^
^
Answer:
!ompiler error7 lvalue re.uired.
Explanation:
4rror is in line with statement a;;. The operand must be an lvalue and
may be of any of scalar type for the any operator, array name only when
subscripted is an lvalue. Simply array name is a non9modifiable lvalue.
BK+ main* +
]
static int aO P @ ]C,>,2,/,B^X
int :pO P @ ]a,a;>,a;2,a;/,a;B^X
int ::ptr @ pX
ptr;;X
printf*[Zn Wd Wd Wd\, ptr9p, :ptr9a, ::ptr+X
:ptr;;X
printf*[Zn Wd Wd Wd\, ptr9p, :ptr9a, ::ptr+X
:;;ptrX
printf*[Zn Wd Wd Wd\, ptr9p, :ptr9a, ::ptr+X
;;:ptrX
printf*[Zn Wd Wd Wd\, ptr9p, :ptr9a, ::ptr+X
^
Answer:
111
222
333
3**
Explanation:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2E
Technical Aptitude Questions
0et us consider the array and the two pointers with some address
$
C > 2 / B
>CC >C2 >CB >CA >CE
p
>CC >C2 >CB >CA >CE
>CCC >CC2 >CCB >CCA >CCE
ptr
>CCC
2CCC
After e5ecution of the instruction ptr;; value in ptr becomes >CC2, if
scaling factor for integer is 2 bytes. $ow ptr ) p is value in ptr ) starting
location of array p, *>CC2 ) >CCC+ L *scaling factor+ @ >, :ptr ) a @ value at
address pointed by ptr ) starting value of array a, >CC2 has a value >C2 so
the value is *>C2 ) >CC+L*scaling factor+ @ >, ::ptr is the value stored in
the location pointed by the pointer of ptr @ value pointed by value pointed
by >CC2 @ value pointed by >C2 @ >. ,ence the output of the firs printf is
>, >, >.
After e5ecution of :ptr;; increments value of the value in ptr by scaling
factor, so it becomes>CCB. ,ence, the outputs for the second printf are ptr
) p @ 2, :ptr ) a @ 2, ::ptr @ 2.
After e5ecution of :;;ptr increments value of the value in ptr by scaling
factor, so it becomes>CCB. ,ence, the outputs for the third printf are ptr )
p @ /, :ptr ) a @ /, ::ptr @ /.
After e5ecution of ;;:ptr value in ptr remains the same, the value pointed
by the value is incremented by the scaling factor. So the value in array p at
location >CCA changes from >CA >C >CE,. ,ence, the outputs for the fourth
printf are ptr ) p @ >CCA ) >CCC @ /, :ptr ) a @ >CE ) >CC @ B, ::ptr @ B.
?C+ main* +
]
char :.X
int =X
for *=@CX =R/X =;;+ scanf*[Ws\ ,*.;=++X
for *=@CX =R/X =;;+ printf*[Wc\ ,:*.;=++X
for *=@CX =R/X =;;+ printf*[Ws\ ,*.;=++X
^
Explanation:
,ere we have only one pointer to type char and since we tae input in the
same pointer thus we eep writing over in the same location, each time
shifting the pointer value by >. Suppose the inputs are #"<S4, T'A!_
and -&'T<A0. Then for the first input suppose the pointer starts at
location >CC then the input one is stored as
# " < S 4 ZC
Fhen the second input is given the pointer is incremented as = value
becomes >, so the input is filled in memory starting from >C>.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
2K
Technical Aptitude Questions
# T ' A ! _ ZC
The third input starts filling from the location >C2
# T - & ' T < A 0 ZC
This is the final value stored .
The first printf prints the values at the position ., .;> and .;2 @ # T -
The second printf prints three strings starting from locations ., .;>, .;2
i.e #T-&'T<A0, T-&'T<A0 and -&'T<A0.

?>+ main* +
]
void :vpX
char ch @ 2g3, :cp @ [goofy\X
int = @ 2CX
vp @ UchX
printf*[Wc\, :*char :+vp+X
vp @ U=X
printf*[Wd\,:*int :+vp+X
vp @ cpX
printf*[Ws\,*char :+vp ; /+X
^
Answer:
g2Cfy
Explanation:
Since a void pointer is used it can be type casted to any other type pointer.
vp @ Uch stores address of char ch and the ne5t statement prints the value
stored in vp after type casting it to the proper data type pointer. the output
is 2g3. Similarly the output from second printf is 22C3. The third printf
statement type casts it to print the string from the B
th
value hence the
output is 2fy3.
?2+ main * +
]
static char :sO P @ ][blac\, [white\, [yellow\, [violet\^X
char ::ptrO P @ ]s;/, s;2, s;>, s^, :::pX
p @ ptrX
::;;pX
printf*[Ws\,:99:;;p ; /+X
^
Answer:
c
Explanation:
&n this problem we have an array of char pointers pointing to start of B
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 @ s;/. The ne5t statement increment value in
p by > , thus now value of p @ s;2. &n the printf statement the e5pression
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/C
Technical Aptitude Questions
is evaluated :;;p causes gets value s;> then the pre decrement is
e5ecuted and we get s;> ) > @ s . the indirection operator now gets the
value from the array of s and adds / to the starting address. The string is
printed starting from this position. Thus, the output is 2c3.
?/+ main*+
]
int i, nX
char :5 @ [girl\X
n @ strlen*5+X
:5 @ 5OnPX
for*i@CX iRnX ;;i+
]
printf*[WsZn\,5+X
5;;X
^
^
Answer:
*blan space+
irl
rl
l
Explanation:
,ere a string *a pointer to char+ is initialized with a value [girl\. The
strlen function returns the length of the string, thus n has a value B. The
ne5t statement assigns value at the nth location *2ZC3+ to the first location.
$ow the string becomes [ZCirl\ . $ow the printf statement prints the string
after each iteration it increments it starting position. 0oop starts from C to
B. The first time 5OCP @ 2ZC3 hence it prints nothing and pointer value is
incremented. The second time it prints from 5O>P i.e [irl\ and the third
time it prints [rl\ and the last time it prints [l\ and the loop terminates.
?B+ int i,=X
for*i@CXiR@>CXi;;+
]
=;@?X
assert*iR?+X
^
Answer:
'untime error7 Abnormal program termination.
assert failed *iR?+, Rfile nameQ,Rline numberQ
Explanation:
asserts are used during debugging to mae sure that certain conditions are
satisfied. &f assertion fails, the program will terminate reporting the same.
After debugging use,
Yundef $D4(<%
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/>
Technical Aptitude Questions
and this will disable all the assertions from the source code. Assertion
is a good debugging tool to mae use of.

??+ main*+
]
int i@9>X
;iX
printf*Ni @ Wd, ;i @ Wd ZnN,i,;i+X
^
Answer:
i @ 9>, ;i @ 9>
Explanation:
<nary ; is the only dummy operator in !. Fhere9ever it comes you can
=ust ignore it =ust because it has no effect in the e5pressions *hence the
name dummy operator+.
?A+ Fhat are the files which are automatically opened when a ! file is e5ecuted`
Answer:
stdin, stdout, stderr *standard input,standard output,standard error+.
?G+ what will be the position of the file marer`
a7 fsee*ptr,C,S44_MS4T+X
b7 fsee*ptr,C,S44_M!<'+X
Answer :
a7 The S44_MS4T sets the file position marer to the starting of the file.
b7 The S44_M!<' sets the file position marer to the current position
of the file.
?E+ main*+
]
char nameO>CP,sO>2PX
scanf*N ZNWO8ZNPZNN,s+X
^
,ow scanf will e5ecute`
Answer:
1irst it checs for the leading white space and discards it.Then it matches
with a .uotation mar and then it reads all character upto another
.uotation mar.
?K+ Fhat is the problem with the following code segment`
while **fgets*receiving array,?C,fileMptr++ S@ 4"1+
X
Answer & Explanation:
fgets returns a pointer. So the correct end of file chec is checing for S@
$<00.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/2
Technical Aptitude Questions
AC+ main*+
]
main*+X
^
Answer:
'untime error 7 Stac overflow.
Explanation:
main function calls itself again and again. 4ach time the function is called
its return address is stored in the call stac. Since there is no condition to
terminate the function call, the call stac overflows at runtime. So it
terminates the program and results in an error.
A>+ main*+
]
char :cptr,cX
void :vptr,vX
c@>CX v@CX
cptr@UcX vptr@UvX
printf*NWcWvN,c,v+X
^
Answer:
!ompiler error *at line number B+7 size of v is <nnown.
Explanation:
Iou can create a variable of type void : but not of type void, since void is
an empty type. &n the second line you are creating variable vptr of type
void : and v of type void hence an error.
A2+ main*+
]
char :str>@NabcdNX
char str2OP@NabcdNX
printf*NWd Wd WdN,sizeof*str>+,sizeof*str2+,sizeof*NabcdN++X
^
Answer:
2 ? ?
Explanation:
&n first sizeof, str> is a character pointer so it gives you the size of the
pointer variable. &n second sizeof the name str2 indicates the name of the
array whose size is ? *including the TZCT termination character+. The third
sizeof is similar to the second one.
A/+ main*+
]
char notX
not@S2X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
//
Technical Aptitude Questions
printf*NWdN,not+X
^
Answer:
C
Explanation:
S is a logical operator. &n ! the value C is considered to be the boolean
value 1A0S4, and any non9zero value is considered to be the boolean
value T'<4. ,ere 2 is a non9zero value so T'<4. ST'<4 is 1A0S4 *C+
so it prints C.
AB+ Ydefine 1A0S4 9>
Ydefine T'<4 >
Ydefine $<00 C
main*+ ]
if*$<00+
puts*N$<00N+X
else if*1A0S4+
puts*NT'<4N+X
else
puts*N1A0S4N+X
^
Answer:
T'<4
Explanation7
The input program to the compiler after processing by the preprocessor is,
main*+]
if*C+
puts*N$<00N+X
else if*9>+
puts*NT'<4N+X
else
puts*N1A0S4N+X
^
6reprocessor doesnTt replace the values given inside the double .uotes.
The chec by if condition is boolean value false so it goes to else. &n
second if 9> is boolean value true hence NT'<4N is printed.
A?+ main*+
]
int @>X
printf*NWd@@> is NNWsN,,@@>`NT'<4N7N1A0S4N+X
^
Answer:
>@@> is T'<4
Explanation:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/B
Technical Aptitude Questions
Fhen two strings are placed together *or separated by white9space+ they
are concatenated *this is called as NstringizationN operation+. So the string
is as if it is given as NWd@@> is WsN. The conditional operator* `7 +
evaluates to NT'<4N.
AA+ main*+
]
int yX
scanf*NWdN,Uy+X LL input given is 2CCC
if* *yWB@@C UU yW>CC S@ C+ VV yW>CC @@ C +
printf*NWd is a leap yearN+X
else
printf*NWd is not a leap yearN+X
^
Answer:
2CCC is a leap year
Explanation:
An ordinary program to chec if leap year or not.
AG+ Ydefine ma5 ?
Ydefine int arr>Oma5P
main*+
]
typedef char arr2Oma5PX
arr> list@]C,>,2,/,B^X
arr2 name@NnameNX
printf*NWd WsN,listOCP,name+X
^
Answer:
!ompiler error *in the line arr> list @ ]C,>,2,/,B^+
Explanation:
arr2 is declared of type array of size ? of characters. So it can be used to
declare the variable name of the type arr2. (ut it is not the case of arr>.
,ence an error.
Rule of Thumb:
Ydefines are used for te5tual replacement whereas typedefs are used for
declaring new types.
AE+ int i@>CX
main*+
]
e5tern int iX
]
int i@2CX
]
const volatile unsigned i@/CX
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/?
Technical Aptitude Questions
printf*NWdN,i+X
^
printf*NWdN,i+X
^
printf*NWdN,i+X
^
Answer:
/C,2C,>C
Explanation:
T]T introduces new bloc and thus new scope. &n the innermost bloc i is
declared as,
const volatile unsigned
which is a valid declaration. i is assumed of type int. So printf prints /C. &n
the ne5t bloc, i has value 2C and so printf prints 2C. &n the outermost
bloc, i is declared as e5tern, so no storage space is allocated for it. After
compilation is over the liner resolves it to global variable i *since it is the
only variable visible there+. So it prints iTs value as >C.
AK+ main*+
]
int :=X
]
int i@>CX
=@UiX
^
printf*NWdN,:=+X
^
Answer:
>C
Explanation7
The variable i is a bloc level variable and the visibility is inside that
bloc only. (ut the lifetime of i is lifetime of the function so it lives upto
the e5it of main function. Since the i is still allocated space, := prints the
value stored in i since = points i.
GC+ main*+
]
int i@9>X
9iX
printf*Ni @ Wd, 9i @ Wd ZnN,i,9i+X
^
Answer:
i @ 9>, 9i @ >
Explanation:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/A
Technical Aptitude Questions
9i is e5ecuted and this e5ecution doesnTt affect the value of i. &n printf first
you =ust print the value of i. After that the value of the e5pression 9i @ 9*9>+
is printed.
G>+ YincludeRstdio.hQ
main*+
]
const int i@BX
float =X
= @ ;;iX
printf*NWd WfN, i,;;=+X
^
Answer7
!ompiler error
Explanation7
i is a constant. you cannot change the value of constant
G2+ YincludeRstdio.hQ
main*+
]
int aO2PO2PO2P @ ] ]>C,2,/,B^, ]?,A,G,E^ ^X
int :p,:.X
p@UaO2PO2PO2PX
:.@:::aX
printf*NWd..WdN,:p,:.+X
^
Answer:
garbagevalue..>
Explanation:
p@UaO2PO2PO2P 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. :.@:::a starting address of a is assigned integer pointer. now . is
pointing to starting address of a.if you print :. meAnswer7it will print first
element of /D array.
G/+ YincludeRstdio.hQ
main*+
]
register i@?X
char =OP@ NhelloNX
printf*NWs WdN,=,i+X
^
Answer:
hello ?
Explanation7
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/G
Technical Aptitude Questions
if you declare i as register compiler will treat it as ordinary integer and it
will tae integer value. i value may be stored either in register or in
memory.
GB+ main*+
]
int i@?,=@A,zX
printf*NWdN,i;;;=+X
^
Answer:
>>
Explanation:
the e5pression i;;;= is treated as *i;; ; =+

GA+ struct aaa]
struct aaa :prevX
int iX
struct aaa :ne5tX
^X
main*+
]
struct aaa abc,def,ghi,=lX
int 5@>CCX
abc.i@CXabc.prev@U=lX
abc.ne5t@UdefX
def.i@>Xdef.prev@UabcXdef.ne5t@UghiX
ghi.i@2Xghi.prev@UdefX
ghi.ne5t@U=lX
=l.i@/X=l.prev@UghiX=l.ne5t@UabcX
5@abc.ne5t9Qne5t9Qprev9Qne5t9QiX
printf*NWdN,5+X
^
Answer:
2
Explanation:
above all statements form a double circular lined listX
abc.ne5t9Qne5t9Qprev9Qne5t9Qi
this one points to NghiN node the value of at particular node is 2.
GG+ struct point
]
int 5X
int yX
^X
struct point origin,:ppX
main*+
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/E
Technical Aptitude Questions
]
pp@UoriginX
printf*Norigin is*WdWd+ZnN,*:pp+.5,*:pp+.y+X
printf*Norigin is *WdWd+ZnN,pp9Q5,pp9Qy+X
^
Answer:
origin is*C,C+
origin is*C,C+
Explanation7
pp is a pointer to structure. we can access the elements of the structure
either with arrow mar or with indirection operator.
'ote:
Since structure point is globally declared 5 U y are initialized as zeroes
GE+ main*+
]
int i@MlMabc*>C+X
printf*NWdZnN,99i+X
^
int MlMabc*int i+
]
return*i;;+X
^
Answer:
K
Explanation:
return*i;;+ it will first return i and then increments. i.e. >C will be
returned.
GK+ main*+
]
char :pX
int :.X
long :rX
p@.@r@CX
p;;X
.;;X
r;;X
printf*NWp...Wp...WpN,p,.,r+X
^
Answer:
CCC>...CCC2...CCCB
Explanation:
;; operator when applied to pointers increments address according to
their corresponding data9types.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
/K
Technical Aptitude Questions
EC+ main*+
]
char c@T T,5,convert*z+X
getc*c+X
if**cQ@TaT+ UU *cR@TzT++
5@convert*c+X
printf*NWcN,5+X
^
convert*z+
]
return z9/2X
^
Answer:
!ompiler error
Explanation:
declaration of convert and format of getc*+ are wrong.
E>+ main*int argc, char ::argv+
]
printf*Nenter the characterN+X
getchar*+X
sum*argvO>P,argvO2P+X
^
sum*num>,num2+
int num>,num2X
]
return num>;num2X
^
Answer:
!ompiler error.
Explanation:
argvO>P U argvO2P are strings. They are passed to the function sum without
converting it to integer values.
E2+ Y include Rstdio.hQ
int oneMdOP@]>,2,/^X
main*+
]
int :ptrX
ptr@oneMdX
ptr;@/X
printf*NWdN,:ptr+X
^
Answer7
garbage value
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
BC
Technical Aptitude Questions
Explanation:
ptr pointer is pointing to out of the array range of oneMd.
E/+ Y includeRstdio.hQ
aaa*+ ]
printf*NhiN+X
^
bbb*+]
printf*NhelloN+X
^
ccc*+]
printf*NbyeN+X
^
main*+
]
int *:ptrO/P+*+X
ptrOCP@aaaX
ptrO>P@bbbX
ptrO2P@cccX
ptrO2P*+X
^
Answer7
bye
Explanation:
ptr is array of pointers to functions of return type int.ptrOCP is assigned to
address of the function aaa. Similarly ptrO>P and ptrO2P for bbb and ccc
respectively. ptrO2P*+ is in effect of writing ccc*+, since ptrO2P points to ccc.
E?+ YincludeRstdio.hQ
main*+
]
1&04 :ptrX
char iX
ptr@fopen*Nzzz.cN,NrN+X
while**i@fgetch*ptr++S@4"1+
printf*NWcN,i+X
^
Answer:
contents of zzz.c followed by an infinite loop
Explanation:
The condition is checed against 4"1, it should be checed against
$<00.
EA+ main*+
]
int i @CX=@CX
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
B>
Technical Aptitude Questions
if*i UU =;;+
printf*NWd..WdN,i;;,=+X
printf*NWd..Wd,i,=+X
^
Answer:
C..C
Explanation:
The value of i is C. Since this information is enough to determine the truth
value of the boolean e5pression. So the statement following the if
statement is not e5ecuted. The values of i and = remain unchanged and get
printed.

EG+ main*+
]
int iX
i @ abc*+X
printf*NWdN,i+X
^
abc*+
]
MAH @ >CCCX
^
Answer:
>CCC
Explanation:
$ormally the return value from the function is through the information
from the accumulator. ,ere MA, is the pseudo global variable denoting
the accumulator. ,ence, the value of the accumulator is set >CCC so the
function returns value >CCC.
EE+ int iX
main*+]
int tX
for * t@BXscanf*NWdN,Ui+9tXprintf*NWdZnN,i++
printf*NWd99N,t99+X
^
LL &f the inputs are C,>,2,/ find the oLp
Answer:
B99C
/99>
2992
Explanation:
0et us assume some 5@ scanf*NWdN,Ui+9t the values during e5ecution
will be,
t i 5
B C 9B
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
B2
Technical Aptitude Questions
/ > 92
2 2 C

EK+ main*+]
int a@ CXint b @ 2CXchar 5 @>Xchar y @>CX
if*a,b,5,y+
printf*NhelloN+X
^
Answer:
hello
Explanation:
The comma operator has associativity from left to right. "nly the
rightmost 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
zero value if becomes true so, NhelloN will be printed.
KC+ main*+]
unsigned int iX
for*i@>XiQ92Xi99+
printf*Nc aptitudeN+X
^
Explanation:
i is an unsigned integer. &t is compared with a signed value. Since the both
types doesnTt match, signed is promoted to unsigned value. The unsigned
e.uivalent of 92 is a huge value so condition becomes false and control
comes out of the loop.
K>+ &n the following pgm add a stmt in the function fun such that the address of
TaT gets stored in T=T.
main*+]
int : =X
void fun*int ::+X
fun*U=+X
^
void fun*int ::+ ]
int a @CX
L: add a stmt here:L
^
Answer:
: @ Ua
Explanation:
The argument of the function is a pointer to a pointer.

K2+ Fhat are the following notations of defining functions nown as`
i. int abc*int a,float b+
]
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
B/
Technical Aptitude Questions
L: some code :L
^
ii. int abc*a,b+
int aX float bX
]
L: some code:L
^
Answer:
i. A$S& ! notation
ii. _ernighan U 'itche notation
K/+ main*+
]
char :pX
p@NWdZnNX
p;;X
p;;X
printf*p92,/CC+X
^
Answer:
/CC
Explanation:
The pointer points to W since it is incremented twice and again
decremented by 2, it points to TWdZnT and /CC is printed.
KB+ main*+]
char aO>CCPX
aOCP@TaTXaO>PP@TbTXaO2P@TcTXaOBP@TdTX
abc*a+X
^
abc*char aOP+]
a;;X
printf*NWcN,:a+X
a;;X
printf*NWcN,:a+X
^
Explanation:
The base address is modified only in function and as a result a points to TbT
then after incrementing to TcT so bc will be printed.

K?+ func*a,b+
int a,bX
]
return* a@ *a@@b+ +X
^
main*+
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
BB
Technical Aptitude Questions
]
int process*+,func*+X
printf*NThe value of process is Wd SZn N,process*func,/,A++X
^
process*pf,val>,val2+
int *:pf+ *+X
int val>,val2X
]
return**:pf+ *val>,val2++X
^
Answer:
The value if process is C S
Explanation:
The function TprocessT has / parameters 9 >, a pointer to another function 2
and /, integers. Fhen this function is invoed from main, the following
substitutions for formal parameters tae place7 func for pf, / for val> and A
for val2. This function returns the result of the operation performed by the
function TfuncT. The function func has two integer parameters. The formal
parameters are substituted as / for a and A for b. since / is not e.ual to A,
a@@b returns C. therefore the function returns C which in turn is returned
by the function TprocessT.
KA+ void main*+
]
static int i@?X
if*99i+]
main*+X
printf*NWd N,i+X
^
^
Answer:
C C C C
Explanation:
The variable N&N is declared as static, hence memory for & will be allocated
for only once, as it encounters the statement. The function main*+ will be called
recursively unless & becomes e.ual to C, and since main*+ is recursively called, so
the value of static & ie., C will be printed every time the control is returned.
KG+ void main*+
]
int @ret*sizeof*float++X
printf*NZn here value is WdN,;;+X
^
int ret*int ret+
]
ret ;@ 2.?X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
B?
Technical Aptitude Questions
return*ret+X
^
Answer:
,ere value is G
Explanation:
The int ret*int ret+, ie., the function name and the argument name can be
the same.
1irstly, the function ret*+ is called in which the sizeof*float+ ie., B is
passed, after the first e5pression the value in ret will be A, as ret is integer hence
the value stored in ret will have implicit type conversion from float to int. The ret
is returned in main*+ it is printed after and preincrement.

KE+ void main*+
]
char aOP@N>2/B?ZCNX
int i@strlen*a+X
printf*Nhere in / WdZnN,;;i+X
^
Answer:
here in / A
Explanation:
The char array TaT will hold the initialized string, whose length will be
counted from C till the null character. ,ence the T&T will hold the value e.ual to ?,
after the pre9increment in the printf statement, the A will be printed.
KK+ void main*+
]
unsigned giveit@9>X
int gotitX
printf*NWu N,;;giveit+X
printf*NWu ZnN,gotit@99giveit+X
^
Answer:
C A??/?
Explanation:
>CC+ void main*+
]
int iX
char aOP@NZCNX
if*printf*NWsZnN,a++
printf*N" here ZnN+X
else
printf*N1orget itZnN+X
^
Answer:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
BA
Technical Aptitude Questions
" here
Explanation:
6rintf will return how many characters does it print. ,ence printing
a null character returns > which maes the if statement true, thus
N" hereN is printed.

>C>+ void main*+
]
void :vX
int integer@2X
int :i@UintegerX
v@iX
printf*NWdN,*int:+:v+X
^
Answer:
!ompiler 4rror. Fe cannot apply indirection on type void:.
Explanation:
-oid pointer is a generic pointer type. $o pointer arithmetic can be
done on it. -oid pointers are normally used for,
>. 6assing generic pointers to functions and returning such pointers.
2. As a intermediate pointer type.
/. <sed when the e5act pointer type will be nown at a later point of
time.
>C2+ void main*+
]
int i@i;;,=@=;;,@;;X
printf*[WdWdWd\,i,=,+X
^
Answer:
%arbage values.
Explanation:
6n identifier is availa.le to use in program code from the point of its
declaration.
So e5pressions such as i @ i;; are valid statements. The i, = and are
automatic variables and so they contain some garbage value. =ar.age in
is gar.age out 2=+=E4.
>C/+ void main*+
]
static int i@i;;, =@=;;, @;;X
printf*[i @ Wd = @ Wd @ Wd\, i, =, +X
^
Answer:
i @ > = @ > @ >
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
BG
Technical Aptitude Questions
Explanation:
Since static variables are initialized to zero by default.
>CB+ void main*+
]
while*>+]
if*printf*NWdN,printf*NWdN+++
breaX
else
continueX
^
^
Answer:
%arbage values
Explanation:
The inner printf e5ecutes first to print some garbage value. The printf
returns no of characters printed and this value also cannot be predicted.
Still the outer printf prints something and so returns a non9zero value. So
it encounters the brea statement and comes out of the while statement.
>CB+ main*+
]
unsigned int i@>CX
while*i99Q@C+
printf*NWu N,i+X
^
Answer:
>C K E G A ? B / 2 > C A??/? A??/BJ..
Explanation:
Since i is an unsigned integer it can never become negative. So the
e5pression i99 Q@C will always be true, leading to an infinite loop.
>C?+ YincludeRconio.hQ
main*+
]
int 5,y@2,z,aX
if*5@yW2+ z@2X
a@2X
printf*NWd Wd N,z,5+X
^
Answer:
%arbage9value C
Explanation:
The value of yW2 is C. This value is assigned to 5. The condition reduces
to if *5+ or in other words if*C+ and so z goes uninitialized.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
BE
Technical Aptitude Questions
Thu! "ule: ,hec all control paths to write bug free code.
>CA+ main*+
]
int aO>CPX
printf*NWdN,:a;>9:a;/+X
^
Answer:
B
Explanation:
:a and 9:a cancels out. The result is as simple as > ; / @ B S
>CG+ Ydefine prod*a,b+ a:b
main*+
]
int 5@/,y@BX
printf*NWdN,prod*5;2,y9>++X
^
Answer:
>C
Explanation:
The macro e5pands and evaluates to as7
5;2:y9> @Q 5;*2:y+9> @Q >C
>CE+ main*+
]
unsigned int i@A?CCCX
while*i;;S@C+X
printf*NWdN,i+X
^
Answer:
>
Explanation:
$ote the semicolon after the while statement. Fhen the value of i becomes
C it comes out of while loop. Due to post9increment on i the value of i
while printing is >.

>CK+ main*+
]
int i@CX
while*;*;i99+S@C+
i9@i;;X
printf*NWdN,i+X
^
Answer:
9>
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
BK
Technical Aptitude Questions
Explanation:
Qnary 8 is the only dummy operator in ,. So it has no effect on the
e5pression and now the while loop is, while*i99S@C+ which is false
and so breas out of while loop. The value )> is printed due to the post9
decrement operator.

>>/+ main*+
]
float f@?,g@>CX
enum]i@>C,=@2C,@?C^X
printf*NWdZnN,;;+X
printf*NWfZnN,fRR2+X
printf*NWlfZnN,fWg+X
printf*NWlfZnN,fmod*f,g++X
^
Answer:
0ine no ?7 4rror7 0value re.uired
0ine no A7 !annot apply leftshift to float
0ine no G7 !annot apply mod to float
Explanation:
4numeration constants cannot be modified, so you cannot apply ;;.
(it9wise operators and W operators cannot be applied on float values.
fmod*+ is to find the modulus values for floats as W operator is for ints.
>>C+ main*+
]
int i@>CX
void pascal f*int,int,int+X
f*i;;,i;;,i;;+X
printf*N WdN,i+X
^
void pascal f*integer 7i,integer7=,integer 7+
]
write*i,=,+X
^
Answer:
!ompiler error7 unnown type integer
!ompiler error7 undeclared function write
Explanation:
6ascal eyword doesn3t mean that pascal code can be used. &t means that
the function follows 6ascal argument passing mechanism in calling the functions.
>>>+ void pascal f*int i,int =,int +
]
printf*[Wd Wd Wd\,i, =, +X
^
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?C
Technical Aptitude Questions
void cdecl f*int i,int =,int +
]
printf*[Wd Wd Wd\,i, =, +X
^
main*+
]
int i@>CX
f*i;;,i;;,i;;+X
printf*N WdZnN,i+X
i@>CX
f*i;;,i;;,i;;+X
printf*N WdN,i+X
^
Answer:
>C >> >2 >/
>2 >> >C >/
Explanation:
6ascal argument passing mechanism forces the arguments to be called
from left to right. cdecl is the normal ! argument passing mechanism where the
arguments are passed from right to left.

>>2+. Fhat is the output of the program given below
main*+
]
signed char i@CX
for*XiQ@CXi;;+ X
printf*NWdZnN,i+X
^
Answer
9>2E
Explanation
$otice the semicolon at the end of the for loop. T,e initial value of
the i is set to C. The inner loop e5ecutes to increment the value
from C to >2G *the positive range of char+ and then it rotates to the
negative value of 9>2E. The condition in the for loop fails and so
comes out of the for loop. &t prints the current value of i that is
9>2E.

>>/+ main*+
]
unsigned char i@CX
for*XiQ@CXi;;+ X
printf*NWdZnN,i+X
^
Answer
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?>
Technical Aptitude Questions
infinite loop
Explanation
The difference between the previous .uestion and this one is that the char
is declared to be unsigned. So the i;; can never yield negative value and iQ@C
never becomes false so that it can come out of the for loop.
>>B+ main*+
]
char i@CX
for*XiQ@CXi;;+ X
printf*NWdZnN,i+X

^
Answer:
(ehavior is implementation dependent.
Explanation:
The detail if the char is signedLunsigned by default is
implementation dependent. &f the implementation treats the char to be
signed by default the program will print )>2E and terminate. "n the other
hand if it considers char to be unsigned by default, it goes to infinite loop.
Rule:
Iou can write programs that have implementation dependent
behavior. (ut dont write programs that depend on such behavior.
>>?+ &s the following statement a declarationLdefinition. 1ind what does it mean`
int *:5+O>CPX
Answer
Definition.
5 is a pointer to array of*size >C+ integers.
Apply cloc9wise rule to find the meaning of this definition.
>>A+. Fhat is the output for the program given below
typedef enum errorType]warning, error, e5ception,^errorX
main*+
]
error g>X
g>@>X
printf*NWdN,g>+X
^
Answer
!ompiler error7 #ultiple declaration for error
Explanation
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?2
Technical Aptitude Questions
The name error is used in the two meanings. "ne means that it is a
enumerator constant with value >. The another use is that it is a type name
*due to typedef+ for enum errorType. %iven a situation the compiler cannot
distinguish the meaning of error to now in what sense the error is used7
error g>X
g>@errorX
LL which error it refers in each case`
Fhen the compiler can distinguish between usages then it will not
issue error *in pure technical terms, names can only be overloaded in
different namespaces+.
Note7 the e5tra comma in the declaration,
enum errorType]warning, error, e5ception,^
is not an error. An e5tra comma is valid and is provided =ust for
programmer3s convenience.


>>G+ typedef struct error]int warning, error, e5ceptionX^errorX
main*+
]
error g>X
g>.error @>X
printf*NWdN,g>.error+X
^
Answer
>
Explanation
The three usages of name errors can be distinguishable by the compiler at
any instance, so valid *they are in different namespaces+.
Typedef struct error]int warning, error, e5ceptionX^errorX
This error can be used only by preceding the error by struct ayword as in7
struct error some4rrorX
typedef struct error]int warning, error, e5ceptionX^errorX
This can be used only after . *dot+ or 9Q *arrow+ operator preceded by the variable
name as in 7
g>.error @>X
printf*NWdN,g>.error+X
typedef struct error]int warning, error, e5ceptionX^errorX
This can be used to define variables without using the preceding struct eyword
as in7
error g>X
Since the compiler can perfectly distinguish between these three usages, it is
perfectly legal and valid.
'ote
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?/
Technical Aptitude Questions
This code is given here to =ust e5plain the concept behind. &n real
programming don3t use such overloading of names. &t reduces the readability of
the code. 6ossible doesn3t mean that we should use itS

>>E+ Yifdef something
int some@CX
Yendif
main*+
]
int thing @ CX
printf*NWd WdZnN, some ,thing+X
^
Answer:
!ompiler error 7 undefined symbol some
Explanation:
This is a very simple e5ample for conditional compilation. The
name something is not already nown to the compiler maing the
declaration
int some @ CX
effectively removed from the source code.
>>K+ Yif something @@ C
int some@CX
Yendif
main*+
]
int thing @ CX
printf*NWd WdZnN, some ,thing+X
^
Answer
C C
Explanation
This code is to show that preprocessor e5pressions are not the
same as the ordinary e5pressions. &f a name is not nown the
preprocessor treats it to be e.ual to zero.
>2C+. Fhat is the output for the following program
main*+
]
int arr2DO/PO/PX
printf*NWdZnN, **arr2D@@: arr2D+UU*: arr2D @@ arr2DOCP++ +X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?B
Technical Aptitude Questions
^
Answer
>
Explanation
This is due to the close relation between the arrays and pointers. $
dimensional arrays are made up of *$9>+ dimensional arrays.
arr2D is made up of a / single arrays that contains / integers each .
The name arr2D refers to the beginning of all the / arrays. :arr2D
refers to the start of the first >D array *of / integers+ that is the
same address as arr2D. So the e5pression *arr2D @@ :arr2D+ is true
*>+.
Similarly, :arr2D is nothing but :*arr2D ; C+, adding a zero
doesn3t change the valueLmeaning. Again arr2DOCP is the another
way of telling :*arr2D ; C+. So the e5pression *:*arr2D ; C+ @@
arr2DOCP+ is true *>+.
Since both parts of the e5pression evaluates to true the result is
true*>+ and the same is printed.
>2>+ void main*+
]
if*aC @@ *unsigned int+9>+
printf*[Iou can answer this if you now how values are represented in
memory\+X
^
Answer
Iou can answer this if you now how values are represented in
memory
45planation
a *tilde operator or bit9wise negation operator+ operates on C to
produce all ones to fill the space for an integer. )> is represented in
unsigned value as all >3s and so both are e.ual.
>22+ int swap*int :a,int :b+
]
:a@:a;:bX:b@:a9:bX:a@:a9:bX
^
main*+
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
??
arr2D
arr2DO>P
arr2DO2P
arr2DO/P
Technical Aptitude Questions
]
int 5@>C,y@2CX
swap*U5,Uy+X
printf*N5@ Wd y @ WdZnN,5,y+X
^
Answer
5 @ 2C y @ >C
45planation
This is one way of swapping two values. Simple checing will help
understand this.
>2/+ main*+
]
char :p @ [ay.m\X
printf*[Wc\,;;:*p;;++X
^
Answer7
b
>2B+ main*+
]
int i@?X
printf*NWdN,;;i;;+X
^
Answer:
!ompiler error7 0value re.uired in function main
Explanation:
;;i yields an rvalue. 1or postfi5 ;; to operate an lvalue is
re.uired.
>2?+ main*+
]
char :p @ [ay.m\X
char cX
c @ ;;:p;;X
printf*[Wc\,c+X
^
Answer:
b
Explanation:
There is no difference between the e5pression ;;:*p;;+ and ;
;:p;;. 6arenthesis =ust wors as a visual clue for the reader to see
which e5pression is first evaluated.
>2A+
int aaa*+ ]printf*[,i\+X^
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?A
Technical Aptitude Questions
int bbb*+]printf*[hello\+X^
iny ccc*+]printf*[bye\+X^
main*+
]
int * : ptrO/P+ *+X
ptrOCP @ aaaX
ptrO>P @ bbbX
ptrO2P @cccX
ptrO2P*+X
^
Answer7
b%e
45planation7
int *: ptrO/P+*+ says that ptr is an array of pointers to functions that taes
no arguments and returns the type int. (y the assignment ptrOCP @ aaaX it
means that the first function pointer in the array is initialized with the
address of the function aaa. Similarly, the other two array elements also
get initialized with the addresses of the functions bbb and ccc. Since ptrO2P
contains the address of the function ccc, the call to the function ptrO2P*+ is
same as calling ccc*+. So it results in printing NbyeN.
>2G+
main*+
]
int i@?X
printf*[Wd\,i@;;i @@A+X
^
Answer:
1
Explanation:
The e5pression can be treated as i @ *;;i@@A+, because @@ is of higher
precedence than @ operator. &n the inner e5pression, ;;i is e.ual to A
yielding true*>+. ,ence the result.
>2E+ main*+
]
char pO P@NWdZnNX
pO>P @ TcTX
printf*p,A?+X
^
Answer:
A
Explanation:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?G
Technical Aptitude Questions
Due to the assignment pO>P @ 2c3 the string becomes, [WcZn\. Since this
string becomes the format string for printf and AS!&& value of A? is 2A3,
the same gets printed.

>2K+ void * : abc* int, void * :def+ *+ + + *+X
Answer77
abc is a ptr to a function which taes 2 parameters .*a+. an integer
variable.*b+. a ptrto a funtion which returns void. the return type of the
function is void.
Explanation:
Apply the cloc9wise rule to find the result.
>/C+ main*+
]
while *strcmp*[some\,\someZC\++
printf*[Strings are not e.ualZn\+X
^
Answer:
$o output
Explanation:
4nding the string constant with ZC e5plicitly maes no difference. So
[some\ and [someZC\ are e.uivalent. So, strcmp returns C *false+ hence
breaing out of the while loop.
>/>+ main*+
]
char str>OP @ ]2s3,3o3,3m3,3e3^X
char str2OP @ ]2s3,3o3,3m3,3e3,3ZC3^X
while *strcmp*str>,str2++
printf*[Strings are not e.ualZn\+X
^
Answer:
[Strings are not e.ual\
[Strings are not e.ual\
J.
Explanation:
&f a string constant is initialized e5plicitly with characters, 2ZC3 is not
appended automatically to the string. Since str> doesn3t have null
termination, it treats whatever the values that are in the following positions
as part of the string until it randomly reaches a 2ZC3. So str> and str2 are
not the same, hence the result.

>/2+ main*+
]
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?E
Technical Aptitude Questions
int i @ /X
for *Xi;;@CX+ printf*[Wd\,i+X
^
Answer:
!ompiler 4rror7 0value re.uired.
Explanation:
As we now that increment operators return rvalues and hence it
cannot appear on the left hand side of an assignment operation.

>//+ void main*+
]
int :mptr, :cptrX
mptr @ *int:+malloc*sizeof*int++X
printf*[Wd\,:mptr+X
int :cptr @ *int:+calloc*sizeof*int+,>+X
printf*[Wd\,:cptr+X
^
Answer:
garbage9value C
Explanation:
The memory space allocated by malloc is uninitialized, whereas calloc
returns the allocated memory space initialized to zeros.
>/B+ void main*+
]
static int iX
while*iR@>C+
*iQ2+`i;;7i99X
printf*[Wd\, i+X
^
Answer:
/2GAG
Explanation:
Since i is static it is initialized to C. &nside the while loop the conditional
operator evaluates to false, e5ecuting i99. This continues till the integer
value rotates to positive value */2GAG+. The while condition becomes false
and hence, comes out of the while loop, printing the i value.
>/?+ main*+
]
int i@>C,=@2CX
= @ i, =`*i,=+`i7=7=X
printf*NWd WdN,i,=+X
^
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
?K
Technical Aptitude Questions
Answer:
>C >C
Explanation:
The Ternary operator * ` 7 + is e.uivalent for if9then9else statement. So the
.uestion can be written as7
if*i,=+
]
if*i,=+
= @ iX
else
= @ =X
^
else
= @ =X
>/A+ >. const char :aX
2. char: const aX
/. char const :aX
9Differentiate the above declarations.
Answer:
>. TconstT applies to char : rather than TaT * pointer to a constant char +
:a@T1T 7 illegal
a@N,iN 7 legal
2. TconstT applies to TaT rather than to the value of a *constant pointer to
char +
:a@T1T 7 legal
a@N,iN 7 illegal
/. Same as >.
>/G+ main*+
]
int i@?,=@>CX
i@iU@=UU>CX
printf*NWd WdN,i,=+X
^
Answer:
> >C
Explanation:
The e5pression can be written as i@*iU@*=UU>C++X The inner e5pression
*=UU>C+ evaluates to > because =@@>C. i is ?. i @ ?U> is >. ,ence the
result.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
AC
Technical Aptitude Questions
>/E+ main*+
]
int i@B,=@GX
= @ = VV i;; UU printf*NI"< !A$N+X
printf*NWd WdN, i, =+X
^
Answer:
B >
Explanation:
Dhe .oolean expression needs to .e evaluated only till the truth value of
the expression is not 'nown. = is not e.ual to zero itself means that the
e5pression3s truth value is >. (ecause it is followed by VV and true SS
2anything4 IV true where 2anything4 will not .e evaluated. So the
remaining e5pression is not evaluated and so the value of i remains the
same.
Similarly when UU operator is involved in an e5pression, when any of the
operands become false, the whole e5pression3s truth value becomes false
and hence the remaining e5pression will not be evaluated.
false (( 2anything4 IV false where 2anything4 will not .e evaluated.
>/K+ main*+
]
register int a@2X
printf*NAddress of a @ WdN,Ua+X
printf*N-alue of a @ WdN,a+X
^
Answer:
!ompier 4rror7 TUT on register variable
"ule to "ee!er:
& #a$$ress o% & operator 'annot !e applie$ on re(ister )aria!les*
>BC+ main*+
]
float i@>.?X
switch*i+
]
case >7 printf*N>N+X
case 27 printf*N2N+X
default 7 printf*NCN+X
^
^
Answer:
!ompiler 4rror7 switch e5pression not integral
Explanation:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
A>
Technical Aptitude Questions
$witch statements can .e applied only to integral types.
>B>+ main*+
]
e5tern iX
printf*NWdZnN,i+X
]
int i@2CX
printf*NWdZnN,i+X
^
^
Answer:
0iner 4rror 7 <nresolved e5ternal symbol i
Explanation:
The identifier i is available in the inner bloc and so using e5tern has no
use in resolving it.
>B2+ main*+
]
int a@2,:f>,:f2X
f>@f2@UaX
:f2;@:f2;@a;@2.?X
printf*NZnWd Wd WdN,a,:f>,:f2+X
^
Answer:
>A >A >A
Explanation:
f> and f2 both refer to the same memory location a. So changes through f>
and f2 ultimately affects only the value of a.
>B/+ main*+
]
char :p@N%""DNX
char aO P@N%""DNX
printf*NZn sizeof*p+ @ Wd, sizeof*:p+ @ Wd, strlen*p+ @ WdN, sizeof*p+,
sizeof*:p+, strlen*p++X
printf*NZn sizeof*a+ @ Wd, strlen*a+ @ WdN, sizeof*a+, strlen*a++X
^
Answer:
sizeof*p+ @ 2, sizeof*:p+ @ >, strlen*p+ @ B
sizeof*a+ @ ?, strlen*a+ @ B
Explanation:
sizeof*p+ @Q sizeof*char:+ @Q 2
sizeof*:p+ @Q sizeof*char+ @Q >
Similarly,
sizeof*a+ @Q size of the character array @Q ?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
A2
Technical Aptitude Questions
When siCeof operator is applied to an array it returns the siCeof the array
and it is not the same as the sizeof the pointer variable. ,ere the sizeof*a+
where a is the character array and the size of the array is ? because the
space necessary for the terminating $<00 character should also be taen
into account.
>BB+ Ydefine D&#* array, type+ sizeof*array+Lsizeof*type+
main*+
]
int arrO>CPX
printf*[The dimension of the array is Wd\, D&#*arr, int++X
^
Answer:
>C
Explanation:
The size of integer array of >C elements is >C : sizeof*int+. The macro
e5pands to sizeof*arr+Lsizeof*int+ @Q >C : sizeof*int+ L sizeof*int+ @Q >C.
>B?+ int D&#*int arrayOP+
]
return sizeof*array+Lsizeof*int +X
^
main*+
]
int arrO>CPX
printf*[The dimension of the array is Wd\, D&#*arr++X
^
Answer:
>
Explanation:
6rrays cannot .e passed to functions as arguments and only the pointers
can .e passed. So the argument is e.uivalent to int : array *this is one of
the very few places where OP and : usage are e.uivalent+. The return
statement becomes, sizeof*int :+L sizeof*int+ that happens to be e.ual in
this case.
>BA+ main*+
]
static int aO/PO/P@]>,2,/,B,?,A,G,E,K^X
int i,=X
static :pOP@]a,a;>,a;2^X
for*i@CXiR/Xi;;+
]
for*=@CX=R/X=;;+
printf*NWdZtWdZtWdZtWdZnN,:*:*p;i+;=+,
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
A/
Technical Aptitude Questions
:*:*=;p+;i+,:*:*i;p+;=+,:*:*p;=+;i++X
^
^
Answer:
> > > >
2 B 2 B
/ G / G
B 2 B 2
? ? ? ?
A E A E
G / G /
E A E A
K K K K
Explanation:
:*:*p;i+;=+ is e.uivalent to pOiPO=P.
>BG+ main*+
]
void swap*+X
int 5@>C,y@EX
swap*U5,Uy+X
printf*N5@Wd y@WdN,5,y+X
^
void swap*int :a, int :b+
]
:a 8@ :b, :b 8@ :a, :a 8@ :bX
^
Answer:
5@>C y@E
Explanation:
<sing 8 lie this is a way to swap two variables without using a temporary
variable and that too in a single statement.
&nside main*+, void swap*+X means that swap is a function that may tae
any number of arguments *not no arguments+ and returns nothing. So this
doesn3t issue a compiler error by the call swap*U5,Uy+X that has two
arguments.
This convention is historically due to pre9A$S& style *referred to as
_ernighan and 'itchie style+ style of function declaration. &n that style, the
swap function will be defined as follows,
void swap*+
int :a, int :b
]
:a 8@ :b, :b 8@ :a, :a 8@ :bX
^
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
AB
Technical Aptitude Questions
where the arguments follow the *+. So naturally the declaration for swap
will loo lie, void swap*+ which means the swap can tae any number of
arguments.
>BE+ main*+
]
int i @ 2?GX
int :i6tr @ UiX
printf*NWd WdN, :**char:+i6tr+, :**char:+i6tr;>+ +X
^
Answer:
> >
Explanation:
The integer value 2?G is stored in the memory as, CCCCCCC> CCCCCCC>, so
the individual bytes are taen by casting it to char : and get printed.
>BK+ main*+
]
int i @ 2?EX
int :i6tr @ UiX
printf*NWd WdN, :**char:+i6tr+, :**char:+i6tr;>+ +X
^
Answer:
2 >
Explanation:
The integer value 2?G can be represented in binary as, CCCCCCC>
CCCCCCC>. 'emember that the &$T40 machines are 2small9endian3
machines. $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?E is stored in memory as7 CCCCCCC>
CCCCCC>C.
>?C+ main*+
]
int i@/CCX
char :ptr @ UiX
:;;ptr@2X
printf*NWdN,i+X
^
Answer:
??A
Explanation:
The integer value /CC in binary notation is7 CCCCCCC> CC>C>>CC. &t is
stored in memory *small9endian+ as7 CC>C>>CC CCCCCCC>. 'esult of the
e5pression :;;ptr @ 2 maes the memory representation as7 CC>C>>CC
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
A?
Technical Aptitude Questions
CCCCCC>C. So the integer corresponding to it is CCCCCC>C CC>C>>CC @Q
??A.
>?>+ Yinclude Rstdio.hQ
main*+
]
char : str @ NhelloNX
char : ptr @ strX
char least @ >2GX
while *:ptr;;+
least @ *:ptrRleast + `:ptr 7leastX
printf*NWdN,least+X
^
Answer:
C
Explanation:
After 2ptr3 reaches the end of the string the value pointed by 2str3 is 2ZC3.
So the value of 2str3 is less than that of 2least3. So the value of 2least3
finally is C.
>?2+ Declare an array of $ pointers to functions returning pointers to functions
returning pointers to characters`
Answer:
*char:*:+* ++ *:ptrO$P+* +X
>?/+ main*+
]
struct student
]
char nameO/CPX
struct date dobX
^studX
struct date
]
int day,month,yearX
^X
scanf*NWsWdWdWdN, stud.rollno, Ustudent.dob.day,
Ustudent.dob.month, Ustudent.dob.year+X
^
Answer:
!ompiler 4rror7 <ndefined structure date
Explanation:
&nside the struct definition of 2student3 the member of type struct date is
given. The compiler doesn3t have the definition of date structure *forward
reference is not allowed in ! in this case+ so it issues an error.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
AA
Technical Aptitude Questions
>?B+ main*+
]
struct dateX
struct student
]
char nameO/CPX
struct date dobX
^studX
struct date
]
int day,month,yearX
^X
scanf*NWsWdWdWdN, stud.rollno, Ustudent.dob.day, Ustudent.dob.month,
Ustudent.dob.year+X
^
Answer:
!ompiler 4rror7 <ndefined structure date
Explanation:
"nly declaration of struct date is available inside the structure definition
of 2student3 but to have a variable of type struct date the definition of the
structure is re.uired.
>??+ There were >C records stored in [somefile.dat\ but the following program printed
>> names. Fhat went wrong`
void main*+
]
struct student
]
char nameO/CP, rollnoOAPX
^studX
1&04 :fp @ fopen*[somefile.dat\,\r\+X
while*Sfeof*fp++
]
fread*Ustud, sizeof*stud+, > , fp+X
puts*stud.name+X
^
^
Explanation:
fread reads >C records and prints the names successfully. &t will
return 4"1 only when fread tries to read another record and fails
reading 4"1 *and returning 4"1+. So it prints the last record
again. After this only the condition feof*fp+ becomes false, hence
comes out of the while loop.
>?A+ &s there any difference between the two declarations,
>. int foo*int :arrOP+ and
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
AG
Technical Aptitude Questions
2. int foo*int :arrO2P+
Answer:
$o
Explanation:
1unctions can only pass pointers and not arrays. The numbers that are
allowed inside the OP is =ust for more readability. So there is no difference
between the two declarations.
>?G+ Fhat is the subtle error in the following code segment`
void fun*int n, int arrOP+
]
int :p@CX
int i@CX
while*i;;Rn+
p @ UarrOiPX
:p @ CX
^
Answer & Explanation:
&f the body of the loop never e5ecutes p is assigned no address. So
p remains $<00 where :p @C may result in problem *may rise to
runtime error [$<00 pointer assignment\ and terminate the
program+.
>?E+ Fhat is wrong with the following code`
int :foo*+
]
int :s @ malloc*sizeof*int+>CC+X
assert*s S@ $<00+X
return sX
^
Answer & Explanation:
assert macro should be used for debugging and finding out bugs. The
chec s S@ $<00 is for errorLe5ception handling and for that assert
shouldn3t be used. A plain if and the corresponding remedy statement has
to be given.
>?K+ Fhat is the hidden bug with the following statement`
assert*val;; S@ C+X
Answer & Explanation:
Assert macro is used for debugging and removed in release version. &n
assert, the e5perssion involves side9effects. So the behavior of the code
becomes different in case of debug version and the release version thus
leading to a subtle bug.
"ule to "ee!er:
!onFt use expressions that have side3effects in assert statements.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
AE
Technical Aptitude Questions
>AC+ void main*+
]
int :i @ C5BCCX LL i points to the address BCC
:i @ CX LL set the value of memory location pointed by iX
^
Answer:
<ndefined behavior
Explanation:
The second statement results in undefined behavior because it points to
some location whose value may not be available for modification. Dhis
type of pointer in which the non3availa.ility of the implementation of the
referenced location is 'nown as Wincomplete typeW.
>A>+ Ydefine assert*cond+ if*S*cond++ Z
*fprintf*stderr, Nassertion failed7 Ws, file Ws, line Wd ZnN,Ycond,Z
MM1&04MM,MM0&$4MM+, abort*++
void main*+
]
int i @ >CX
if*i@@C+
assert*i R >CC+X
else
printf*NThis statement becomes else for if in assert macroN+X
^
Answer7
$o output
Explanation:
The else part in which the printf is there becomes the else for if in the assert
macro. ,ence nothing is printed.
The solution is to use conditional operator instead of if statement,
Ydefine assert*cond+ **cond+`*C+7 *fprintf *stderr, Nassertion failed7 Z Ws, file Ws,
line Wd ZnN,Ycond, MM1&04MM,MM0&$4MM+, abort*+++
$ote7
,owever this problem of [matching with nearest else\ cannot be solved
by the usual method of placing the if statement inside a bloc lie this,
Ydefine assert*cond+ ] Z
if*S*cond++ Z
*fprintf*stderr, Nassertion failed7 Ws, file Ws, line Wd ZnN,Ycond,Z
MM1&04MM,MM0&$4MM+, abort*++ Z
^
>A2+ &s the following code legal`
struct a
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
AK
Technical Aptitude Questions
]
int 5X
struct a bX
^
Answer7
$o
Explanation:
&s it not legal for a structure to contain a member that is of the same
type as in this case. (ecause this will cause the structure declaration to be
recursive without end.
>A/+ &s the following code legal`
struct a
]
int 5X
struct a :bX
^
Answer:
Ies.
Explanation:
:b is a pointer to type struct a and so is legal. The compiler nows, the
size of the pointer to a structure even before the size of the structure
is determined*as you now the pointer to any type is of same size+. This
type of structures is nown as 2self9referencing3 structure.
>AB+ &s the following code legal`
typedef struct a
]
int 5X
aType :bX
^aType
Answer:
$o
Explanation:
The typename aType is not nown at the point of declaring the structure
*forward references are not made for typedefs+.
>A?+ &s the following code legal`
typedef struct a aTypeX
struct a
]
int 5X
aType :bX
^X
Answer:
Ies
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
GC
Technical Aptitude Questions
Explanation:
The typename aType is nown at the point of declaring the structure,
because it is already typedefined.
>AA+ &s the following code legal`
void main*+
]
typedef struct a aTypeX
aType some-ariableX
struct a
]
int 5X
aType :bX
^X
^
Answer:
$o
Explanation:
Fhen the declaration,
typedef struct a aTypeX
is encountered body of struct a is not nown. This is nown as 2incomplete
types3.

>AG+ void main*+
]
printf*[sizeof *void :+ @ Wd Zn[, sizeof* void :++X
printf*[sizeof *int :+ @ Wd Zn\, sizeof*int :++X
printf*[sizeof *double :+ @ Wd Zn\, sizeof*double :++X
printf*[sizeof*struct unnown :+ @ Wd Zn\, sizeof*struct unnown :++X
^
Answer :
sizeof *void :+ @ 2
sizeof *int :+ @ 2
sizeof *double :+ @ 2
sizeof*struct unnown :+ @ 2
Explanation:
The pointer to any type is of same size.
>AE+ char inputStringO>CCP @ ]C^X
To get string input from the eyboard which one of the following is better`
>+ gets*inputString+
2+ fgets*inputString, sizeof*inputString+, fp+
Answer & Explanation:
The second one is better because gets*inputString+ doesnTt now the size
of the string passed and so, if a very big input *here, more than >CC chars+
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
G>
Technical Aptitude Questions
the charactes will be written past the input string. Fhen fgets is used with
stdin performs the same operation as gets but is safe.
>AK+ Fhich version do you prefer of the following two,
>+ printf*[Ws\,str+X LL or the more curt one
2+ printf*str+X
Answer & Explanation:
6refer the first one. &f the str contains any format characters lie Wd then
it will result in a subtle bug.
>GC+ void main*+
]
int i@>C, =@2X
int :ip@ Ui, :=p @ U=X
int @ :ipL:=pX
printf*[Wd\,+X
^
Answer:
!ompiler 4rror7 [<ne5pected end of file in comment started in line ?\.
Explanation:
The programmer intended to divide two integers, but by the
[ma5imum munch\ rule, the compiler treats the operator
se.uence L and : as L: which happens to be the starting of
comment. To force what is intended by the programmer,
int @ :ipL :=pX
LL give space e5plicity separating L and :
LLor
int @ :ipL*:=p+X
LL put braces to force the intention
will solve the problem.
>G>+ void main*+
]
char chX
for*ch@CXchR@>2GXch;;+
printf*[Wc Wd Zn[, ch, ch+X
^
Answer:
&mplementaion dependent
Explanation:
The char type may be signed or unsigned by default. &f it is signed then
ch;; is e5ecuted after ch reaches >2G and rotates bac to 9>2E. Thus ch is
always smaller than >2G.
>G2+ &s this code legal`
int :ptrX
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
G2
Technical Aptitude Questions
ptr @ *int :+ C5BCCX
Answer:
Ies
Explanation:
The pointer ptr will point at the integer in the memory location C5BCC.
>G/+ main*+
]
char aOBP@N,400"NX
printf*NWsN,a+X
^
Answer:
!ompiler error7 Too many initializers
Explanation:
The array a is of size B but the string constant re.uires A bytes to get
stored.
>GB+ main*+
]
char aOBP@N,400NX
printf*NWsN,a+X
^
Answer:
,400WbSabSb```baaS
Explanation:
The character array has the memory =ust enough to hold the string
[,400\ and doesnt have enough space to store the terminating null
character. So it prints the ,400 correctly and continues to print garbage
values till it accidentally comes across a $<00 character.
>G?+ main*+
]
int a@>C,:=X
void :X
=@@UaX
=;;X
;;X
printf*NZn Wu Wu N,=,+X
^
Answer:
!ompiler error7 !annot increment a void pointer
Explanation:
-oid pointers are generic pointers and they can be used only when the type
is not nown and as an intermediate address storage type. $o pointer
arithmetic can be done on it and you cannot apply indirection operator *:+
on void pointers.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
G/
Technical Aptitude Questions
>GA+ main*+
]
e5tern int iX
] int i@2CX
]
const volatile unsigned i@/CX printf*NWdN,i+X
^
printf*NWdN,i+X
^
printf*NWdN,i+X
^
int iX
>GG+ 6rintf can be implemented by using MMMMMMMMMM list.
Answer:
-ariable length argument lists
>GE+ char :some1un*+
]
char :temp @ [string constantNX
return tempX
^
int main*+
]
puts*some1un*++X
^
Answer7
string constant
Explanation7
The program suffers no problem and gives the output correctly because the
character constants are stored in codeLdata area and not allocated in stac, so this doesn3t
lead to dangling pointers.
>GK+ char :some1un>*+
]
char tempO P @ [stringNX
return tempX
^
char :some1un2*+
]
char tempO P @ ]2s3, 2t3,3r3,3i3,3n3,3g3^X
return tempX
^
int main*+
]
puts*some1un>*++X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
GB
Technical Aptitude Questions
puts*some1un2*++X
^
Answer7
%arbage values.
Explanation7
(oth the functions suffer from the problem of dangling pointers. &n some1un>*+
temp is a character array and so the space for it is allocated in heap and is initialized with
character string [string\. This is created dynamically as the function is called, so is also
deleted dynamically on e5iting the function so the string data is not available in the
calling function main*+ leading to print some garbage values. The function some1un2*+
also suffers from the same problem but the problem can be easily identified in this case.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
G?
Technical Aptitude Questions
!;; Aptitude and ""6S
$ote 7 All the programs are tested under Turbo !;; /.C, B.? and #icrosoft -!;; A.C
compilers.
&t is assumed that,
6rograms run under Findows environment,
The underlying machine is an 5EA based system,
6rogram is compiled using Turbo !L!;; compiler.
The program output may depend on the information based on this assumptions
*for e5ample sizeof*int+ @@ 2 may be assumed+.
>+ class Sample
]
public7
int :ptrX
Sample*int i+
]
ptr @ new int*i+X
^
aSample*+
]
delete ptrX
^
void 6rint-al*+
]
cout RR NThe value is N RR :ptrX
^
^X
void Some1unc*Sample 5+
]
cout RR NSay i am in some1unc N RR endlX
^
int main*+
]
Sample s>@ >CX
Some1unc*s>+X
s>.6rint-al*+X
^
Answer:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
GA
C++ Aptitude
and OOPS

Technical Aptitude Questions
Say i am in some1unc
$ull pointer assignment*'un9time error+
Explanation7
As the ob=ect is passed by value to Some1unc the destructor of the ob=ect is
called when the control returns from the function. So when 6rint-al is called it meets up
with ptr that has been freed.The solution is to pass the Sample ob=ect by reference to
Some1unc7
void Some1unc*Sample U5+
]
cout RR NSay i am in some1unc N RR endlX
^
because when we pass ob=ects by refernece that ob=ect is not destroyed. while returning
from the function.
2+ Fhich is the parameter that is added to every non9static member function when it is
called`
Answer:
2this3 pointer
/+ class base
]
public7
int bvalX
base*+] bval@CX^
^X
class deri7public base
]
public7
int dvalX
deri*+] dval@>X^
^X
void Some1unc*base :arr,int size+
]
for*int i@CX iRsizeX i;;,arr;;+
coutRRarr9QbvalX
coutRRendlX
^
int main*+
]
base (aseArrO?PX
Some1unc*(aseArr,?+X
deri DeriArrO?PX
Some1unc*DeriArr,?+X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
GG
Technical Aptitude Questions
^
Answer:
CCCCC
C>C>C
Explanation:
The function Some1unc e5pects two arguments.The first one is a pointer to an
array of base class ob=ects and the second one is the sizeof the array.The first call of
some1unc calls it with an array of bae ob=ects, so it wors correctly and prints the bval of
all the ob=ects. Fhen Somefunc is called the second time the argument 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 e5pects to be sent. So the derived class pointer is promoted to
base class pointer and the address is sent to the function. Some1unc*+ nows nothing
about this and =ust treats the pointer as an array of base class ob=ects. So when arr;; is
met, the size of base class ob=ect is taen into consideration and is incremented by
sizeof*int+ bytes for bval *the deri class ob=ects have bval and dval as members and so is
of size Q@ sizeof*int+;sizeof*int+ +.
B+ class base
]
public7
void base1un*+] coutRRNfrom baseNRRendlX^
^X
class deri7public base
]
public7
void base1un*+] coutRR Nfrom derivedNRRendlX^
^X
void Some1unc*base :base"b=+
]
base"b=9Qbase1un*+X
^
int main*+
]
base base"b=ectX
Some1unc*Ubase"b=ect+X
deri deri"b=ectX
Some1unc*Uderi"b=ect+X
^
Answer:
from base
from base
Explanation:
As we have seen in the previous case, Some1unc e5pects a pointer to a base class.
Since a pointer to a derived class ob=ect is passed, it treats the argument only as a base
class pointer and the corresponding base function is called.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
GE
Technical Aptitude Questions
?+ class base
]
public7
virtual void base1un*+] coutRRNfrom baseNRRendlX^
^X
class deri7public base
]
public7
void base1un*+] coutRR Nfrom derivedNRRendlX^
^X
void Some1unc*base :base"b=+
]
base"b=9Qbase1un*+X
^
int main*+
]
base base"b=ectX
Some1unc*Ubase"b=ect+X
deri deri"b=ectX
Some1unc*Uderi"b=ect+X
^
Answer:
from base
from derived
Explanation:
'emember that base1unc is a virtual function. That means that it supports run9
time polymorphism. So the function corresponding to the derived class ob=ect is called.
void main*+
]
int a, :pa, UraX
pa @ UaX
ra @ aX
cout RRNa@NRRa RRN:pa@NRR:pa RRNraNRRra X
^
L:
Answer 7
!ompiler 4rror7 TraT,reference must be initialized
45planation 7
6ointers are different from references. "ne of the main
differences is that the pointers can be both initialized and assigned,
whereas references can only be initialized. So this code issues an error.
:L
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
GK
Technical Aptitude Questions
const int size @ ?X
void print*int :ptr+
]
coutRRptrOCPX
^
void print*int ptrOsizeP+
]
coutRRptrOCPX
^
void main*+
]
int aOsizeP @ ]>,2,/,B,?^X
int :b @ new int*size+X
print*a+X
print*b+X
^
L:
Answer7
!ompiler 4rror 7 function Tvoid print*int :+T already has a body
45planation7
Arrays cannot be passed to functions, only pointers *for arrays, base addresses+
can be passed. So the arguments int :ptr and int prtOsizeP have no difference
as function arguments. &n other words, both the functoins have the same signature and
so cannot be overloaded.
:L
class some]
public7
asome*+
]
coutRRNsomeTs destructorNRRendlX
^
^X
void main*+
]
some sX
s.asome*+X
^
L:
Answer7
someTs destructor
someTs destructor
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
EC
Technical Aptitude Questions
45planation7
Destructors can be called e5plicitly. ,ere Ts.asome*+T e5plicitly calls the
destructor of TsT. Fhen main*+ returns, destructor of s is called again,
hence the result.
:L
Yinclude Riostream.hQ
class fig2d
]
int dim>X
int dim2X
public7
fig2d*+ ] dim>@?X dim2@AX^
virtual void operatorRR*ostream U rhs+X
^X
void fig2d77operatorRR*ostream Urhs+
]
rhs RRthis9Qdim>RRN NRRthis9Qdim2RRN NX
^
L:class fig/d 7 public fig2d
]
int dim/X
public7
fig/d*+ ] dim/@GX^
virtual void operatorRR*ostream Urhs+X
^X
void fig/d77operatorRR*ostream Urhs+
]
fig2d77operator RR*rhs+X
rhsRRthis9Qdim/X
^
:L
void main*+
]
fig2d ob=>X
LL fig/d ob=2X
ob=> RR coutX
LL ob=2 RR coutX
^
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
E>
Technical Aptitude Questions
L:
Answer 7
? A
45planation7
&n this program, the RR operator is overloaded with ostream as argument.
This enables the TcoutT to be present at the right9hand9side. $ormally, TcoutT
is implemented as global function, but it doesnTt mean that TcoutT is not possible
to be overloaded as member function.
"verloading RR as virtual member function becomes handy when the class in which
it is overloaded is inherited, and this becomes available to be overrided. This is as
opposed
to global friend functions, where friendTs are not inherited.
:L
class op"verload]
public7
bool operator@@*op"verload temp+X
^X
bool op"verload77operator@@*op"verload temp+]
if*:this @@ temp +]
coutRRNThe both are same ob=ectsZnNX
return trueX
^
else]
coutRRNThe both are differentZnNX
return falseX
^
^
void main*+]
op"verload a>, a2X
a>@ @a2X
^
Answer 7
'untime 4rror7 Stac "verflow
45planation 7
Dust lie normal functions, operator functions can be called recursively. This
program =ust illustrates that point, by calling the operator @@ function recursively, leading
to an infinite loop.
class comple5]
double reX
double imX
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
E2
Technical Aptitude Questions
public7
comple5*+ 7 re*>+,im*C.?+ ]^
bool operator@@*comple5 Urhs+X
operator int*+]^
^X
bool comple577operator @@ *comple5 Urhs+]
if**this9Qre @@ rhs.re+ UU *this9Qim @@ rhs.im++
return trueX
else
return falseX
^
int main*+]
comple5 c>X
coutRR c>X
^
Answer 7 %arbage value
45planation7
The programmer wishes to print the comple5 ob=ect using output
re9direction operator,which he has not defined for his lass.(ut the compiler instead of
giving an error sees the conversion function
and converts the user defined ob=ect to standard ob=ect and prints
some garbage value.
class comple5]
double reX
double imX
public7
comple5*+ 7 re*C+,im*C+ ]^
comple5*double n+ ] re@n,im@nX^X
comple5*int m,int n+ ] re@m,im@nX^
void print*+ ] coutRRreX coutRRimX^
^X
void main*+]
comple5 c/X
double i@?X
c/ @ iX
c/.print*+X
^
Answer7
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
E/
Technical Aptitude Questions
?,?
45planation7
Though no operator@ function taing comple5, double is defined, the double on
the rhs is converted into a temporary ob=ect using the single argument constructor taing
double and assigned to the lvalue.
void main*+
]
int a, :pa, UraX
pa @ UaX
ra @ aX
cout RRNa@NRRa RRN:pa@NRR:pa RRNraNRRra X
^
Answer 7
!ompiler 4rror7 TraT,reference must be initialized
45planation 7
6ointers are different from references. "ne of the main
differences is that the pointers can be both initialized and assigned,
whereas references can only be initialized. So this code issues an error.
Tr+ it ,oursel%
>+ Determine the output of the T!;;T !odelet.
class base
]
public 7
out*+
]
coutRRNbase NX
^
^X
class deri]
public 7 out*+
]
coutRRNderi NX
^
^X
void main*+
] deri dpO/PX
base :bp @ *base:+dpX
for *int i@CX iR/Xi;;+
*bp;;+9Qout*+X
^
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
EB
Technical Aptitude Questions
2+ Dustify the use of virtual constructors and destructors in !;;.
/+ 4ach !;; ob=ect possesses the B member fns,*which can be declared by the
programmer e5plicitly or by the implementation if they are not available+. Fhat are
those B functions`
B+ Fhat is wrong with this class declaration`
class something
]
char :strX
public7
something*+]
st @ new charO>CPX ^
asomething*+
]
delete strX
^
^X
?+ &nheritance is also nown as 99999999 relationship. !ontainership as MMMMMMMM
relationship.
A+ Fhen is it necessary to use member9wise initialization list *also nown as header
initialization list+ in !;;`
G+ Fhich is the only operator in !;; which can be overloaded but $"T inherited.
E+ &s there anything wrong with this !;; class declaration`
class temp
]
int value>X
mutable int value2X
public 7
void fun*int val+
const]
**temp:+ this+9Qvalue> @ >CX
value2 @ >CX
^
^X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
E?
Technical Aptitude Questions
1. What is a modifier?
Answer:
A modifier, also called a modifying function is a member function that changes the
value of at least one data member. &n other words, an operation that modifies the state of
an ob=ect. #odifiers are also nown as 2mutators3.
2. What is an accessor?
Answer:
An accessor is a class operation that does not modify 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.
Answer:
Teplate 'lass:
A generic definition or a parameterized class not instantiated until the client
provides the needed information. &t3s =argon for plain templates.
-lass teplate:
A class template specifies how individual classes can be constructed much lie the
way a class specifies how individual ob=ects can be constructed. &t3s =argon for plain
classes.
*. When does a name clash occur?
Answer:
A name clash occurs when a name is defined in more than one place. 1or
e5ample., two different class libraries could give two different classes the same name. &f
you try to use many class libraries at the same time, there is a fair chance that you will be
unable to compile or lin the program because of name clashes.
-. !efine namespace.
Answer:
&t is a feature in c;; to minimize name collisions in the global name space. This
namespace eyword assigns a distinct name to a library that allows other libraries to use
the same identifier names without creating any name collisions. 1urthermore, the
compiler uses the namespace signature for differentiating the definitions.
0. What is the use of XusingF declaration.
Answer:
A using declaration maes it possible to use a name from a namespace without the
scope operator.
5. What is an +terator class?
Answer:
A class that is used to traverse through the ob=ects maintained by a container
class. There are five categories of iterators7
input iterators,
output iterators,
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
EA
Technical Aptitude Questions
forward iterators,
bidirectional iterators,
random 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 one9at9
a9time basis in order. The order can be storage order *as in lists and .ueues+ or some
arbitrary order *as in array indices+ or according to some ordering relation *as in an
ordered binary tree+. The iterator is a construct, which provides an interface that, when
called, yields either the ne5t element in the container, or some value denoting the fact that
there are no more elements to e5amine. &terators hide the details of access to and update
of the elements of a container class.
The simplest and safest iterators are those that permit read9only access to the
contents of a container class. The following code fragment shows how an iterator might
appear in code7
contMiter7@new contMiterator*+X
57@contMiter.ne5t*+X
while 5L@none do
...
s*5+X
...
57@contMiter.ne5t*+X
endX
&n this e5ample, contMiter is the name of the iterator. &t is created on the first line by
instantiation of contMiterator class, an iterator class defined to iterate over some container
class, cont. Succesive elements from the container are carried to 5. The loop terminates
when 5 is bound to some empty value. *,ere, none+&n the middle of the loop, there is s*5+
an operation on 5, the current element from the container. The ne5t element of the
container is obtained at the bottom of the loop.
?. List out some of the EE!"#$ availa.le.
Answer:
%4#ST"$4L"6A0 of %emstone systems.
"$T"S of "ntos.
"b=ectivity of "b=ectivity inc.
-ersant of -ersant ob=ect technology.
"b=ect store of "b=ect Design.
A'D4$T of A'D4$T software.
6"4T of 6"4T software.
1@. List out some of the o.ject3oriented methodologies.
Answer:
"b=ect "riented Development *""D+ *(ooch >KK>,>KKB+.
"b=ect "riented Analysis and Design *""ALD+ *!oad and Iourdon >KK>+.
"b=ect #odelling Techni.ues *"#T+ *'umbaugh >KK>+.
"b=ect "riented Software 4ngineering *"b=ectory+ *Dacobson >KK2+.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
EG
Technical Aptitude Questions
"b=ect "riented Analysis *""A+ *Shlaer and #ellor >KK2+.
The 1usion #ethod *!oleman >KK>+.
11. What is an incomplete type?
Answer:
&ncomplete types refers to pointers in which there is non availability of the
implementation of the referenced location or it points to some location whose value is not
available for modification.
Exaple:
int :i@C5BCC LL i points to address BCC
:i@CX LLset the value of memory location pointed by i.
&ncomplete types are otherwise called uninitialized pointers.
12. What is a dangling pointer?
Answer:
A dangling pointer arises when you use the address of an ob=ect after its lifetime
is over.
This may occur in situations lie returning addresses of the automatic variables from a
function or using the address of the memory bloc after it is freed.
13. !ifferentiate .etween the message and method.
Answer:
.essa(e .etho$
"b=ects communicate by sending messages 6rovides response to a message.
to each other.
A message is sent to invoe a method. &t is an implementation of an operation.
1*. What is an adaptor class or Wrapper class?
Answer:
A class that has no functionality of its own. &ts member functions hide the use of a
third party software component or an ob=ect with the non9compatible interface or a non9
ob=ect9 oriented implementation.
1-. What is a &ull o.ject?
Answer:
&t is an ob=ect of some class whose purpose is to indicate that a real ob=ect of that
class does not e5ist. "ne common use for a null ob=ect is a return value from a member
function that is supposed to return an ob=ect with some specified properties but cannot
find such an ob=ect.
10. What is class invariant?
Answer:
A class invariant is a condition that defines all valid states for an ob=ect. &t is a
logical condition to ensure the correct woring of a class. !lass invariants must hold
when an ob=ect is created, and they must be preserved under all operations of the class. &n
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
EE
Technical Aptitude Questions
particular all class invariants are both preconditions and post9conditions for all operations
or member functions of the class.
15. What do you mean .y $tac' unwinding?
Answer:
&t is a process during e5ception handling when the destructor is called for all local
ob=ects between the place where the e5ception was thrown and where it is caught.

17. !efine precondition and post3condition to a mem.er function.
Answer:
/re'on$ition:
A precondition is a condition that must be true on entry to a member 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.
1or e5ample, the interface invariants of stac' class say nothing about pushing yet
another element on a stac that is already full. Fe say that isful24 is a precondition of the
push operation.
/ost-'on$ition:
A post9condition is a condition that must be true on e5it from a member function
if the precondition was valid on entry to that function. A class is implemented correctly if
post9conditions are never false.
1or e5ample, after pushing an element on the stac, we now that isempty24 must
necessarily hold. This is a post9condition of the push operation.
1?. What are the conditions that have to .e met for a condition to .e an invariant of the
class?
Answer:
The condition should hold at the end of every constructor.
The condition should hold at the end of every mutator*non9const+ operation.

2@. What are proxy o.jects?
Answer:
"b=ects that stand for other ob=ects are called pro5y ob=ects or surrogates.
Exaple:
templateRclass TQ
class Array2D
]
public7
class Array>D
]
public7
TU operatorOP *int inde5+X
const TU operatorOP *int inde5+ constX
...
^X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
EK
Technical Aptitude Questions
Array>D operatorOP *int inde5+X
const Array>D operatorOP *int inde5+ constX
...
^X

The following then becomes legal7
Array2DRfloatQdata*>C,2C+X
........
coutRRdataO/POAPX LL fine
,ere dataO/P yields an Array>D ob=ect and the operator OP invocation on that
ob=ect yields the float in position*/,A+ of the original two dimensional array. !lients of the
Array2D class need not be aware of the presence of the Array>D class. "b=ects of this
latter class stand for one9dimensional array ob=ects that, conceptually, do not e5ist for
clients of Array2D. Such clients program as if they were using real, live, two9dimensional
arrays. 4ach Array>D ob=ect stands for a one9dimensional array that is absent from a
conceptual model used by the clients of Array2D. &n the above e5ample, Array>D is a
pro5y class. &ts instances stand for one9dimensional arrays that, conceptually, do not
e5ist.

21. &ame some pure o.ject oriented languages.
Answer:
Smalltal,
Dava,
4iffel,
Sather.
22. &ame the operators that cannot .e overloaded.
Answer:
sizeof . .: .9Q 77 `7
23. What is a node class?
Answer:
A node class is a class that,
relies on the base class for services and implementation,
provides a wider interface to te users than its base class,
relies primarily on virtual functions in its public interface
depends on all its direct and indirect base class
can be understood only in the conte5t 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 from its base class.
2*. What is an orthogonal .ase class?
Answer:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
KC
Technical Aptitude Questions
&f two base classes have no overlapping methods or data they are said to be
independent of, or orthogonal to each other. "rthogonal in the sense means that two
classes operate in different dimensions and do not interfere with each other in any way.
The same derived class may inherit such classes with no difficulty.
2-. What is a container class? What are the types of container classes?
Answer:
A container class is a class that is used to hold ob=ects in memory or e5ternal
storage. A container class acts as a generic holder. A container class has a predefined
behavior and a well9nown interface. A container class is a supporting class whose
purpose is to hide the topology used for maintaining the list of ob=ects in memory. Fhen
a container class contains a group of mi5ed ob=ects, the container is called a
heterogeneous containerX when the container is holding a group of ob=ects that are all the
same, the container is called a homogeneous container.
20. What is a protocol class?
Answer:
An abstract class is a protocol class if7
it neither contains nor inherits from classes that contain member data, non9virtual
functions, or private *or protected+ members of any ind.
it has a non9inline virtual destructor defined with an empty implementation,
all member functions other than the destructor including inherited functions, are
declared pure virtual functions and left undefined.
25. What is a mixin class?
Answer:
A class that provides some but not all of the implementation for a virtual base
class is often called mi5in. Derivation done =ust for the purpose of redefining the virtual
functions in the base classes is often called mi5in inheritance. #i5in classes typically
donTt share common bases.
27. What is a concrete class?
Answer:
A concrete class is used to define a useful ob=ect that can be instantiated as an
automatic variable on the program stac. The implementation of a concrete class is
defined. The concrete class is not intended to be a base class and no attempt to minimize
dependency on other classes in the implementation or behavior of the class.
2?.What is the handle class?
Answer:
A handle is a class that maintains a pointer to an ob=ect that is programmatically
accessible through the public interface of the handle class.
Explanation:
&n case of abstract classes, unless one manipulates the ob=ects of these classes
through pointers and references, the benefits of the virtual functions are lost. <ser code
may become dependent on details of implementation classes because an abstract type
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
K>
Technical Aptitude Questions
cannot be allocated statistically or on the stac without its size being nown. <sing
pointers or references implies that the burden of memory management falls on the user.
Another limitation of abstract class ob=ect is of fi5ed size. !lasses however are used to
represent concepts that re.uire varying amounts of storage to implement them.
A popular techni.ue for dealing with these issues is to separate what is used as a single
ob=ect in two parts7 a handle providing the user interface and a representation holding all
or most 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 more data than the simple
representation pointer, but not much more. ,ence the layout of the handle is typically
stable, even when the representation changes and also that handles are small enough to
move around relatively freely so that the user needn3t use the pointers and the references.

3@. What is an action class?
Answer:
The simplest and most obvious way to specify an action in !;; is to write a
function. ,owever, if the action has to be delayed, has to be transmitted TelsewhereT
before being performed, re.uires its own data, has to be combined with other actions, etc
then it often becomes attractive to provide the action in the form of a class that can
e5ecute the desired action and provide other services as well. #anipulators used with
iostreams is an obvious e5ample.
Explanation:
A common form of action class is a simple class containing =ust one virtual
function.
class Action
]
public7
virtual int doMit* int +@CX
virtual aAction* +X
^
%iven this, we can write code say a member that can store actions for later
e5ecution without using pointers to functions, without nowing anything about the
ob=ects involved, and without even nowing the name of the operation it invoes. 1or
e5ample7
class writeMfile 7 public Action
]
1ileU fX
public7
int doMit*int+
]
return fwrite* +.suceed* +X
^
^X
class errorMmessage7 public Action
]
responseMbo5 db*message.cstr* +,N!ontinueN,N!ancelN,N'etryN+X
switch *db.getresponse* ++
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
K2
Technical Aptitude Questions
]
case C7 return CX
case >7 abort*+X
case 27 currentMoperation.redo* +Xreturn >X
^
^X
A user of the Action class will be completely isolated from any nowledge of
derived classes such as writeMfile and errorMmessage.
31. When can you tell that a memory lea' will occur?
Answer:
A memory lea occurs when a program loses the ability to free a bloc of
dynamically allocated memory.
32.What is a parameteriCed type?
Answer:
A template is a parameterized construct or type containing generic code that can
use or manipulate any type. &t is called parameterized because an actual type is a
parameter of the code body. 6olymorphism may be achieved through parameterized
types. This type of polymorphism is called parameteric polymorphism. 6arameteric
polymorphism is the mechanism by which the same code is used on different types
passed as parameters.
33. !ifferentiate .etween a deep copy and a shallow copy?
Answer:
Deep copy involves using the contents of one ob=ect to create another instance of
the same class. &n a deep copy, the two ob=ects may contain ht same information but the
target ob=ect will have its own buffers and resources. the destruction of either ob=ect will
not affect the remaining ob=ect. The overloaded assignment operator would create a deep
copy of ob=ects.
Shallow copy involves copying the contents of one ob=ect into another instance of
the same class thus creating a mirror image. "wing to straight copying of references and
pointers, the two ob=ects will share the same e5ternally contained contents of the other
ob=ect to be unpredictable.
Explanation:
<sing a copy constructor we simply copy the data values member by member.
This method of copying is called shallow copy. &f the ob=ect is a simple class, comprised
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 members 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. Fhen 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) - ll !ight" !e"erved
K/
Technical Aptitude Questions
&f the ob=ect has any pointers a deep copy needs to be e5ecuted. Fith the deep
copy of an ob=ect, memory is allocated for the ob=ect in free store and the elements
pointed to are copied. A deep copy is used for ob=ects that are returned from a function.
3*. What is an opa/ue pointer?
Answer:
A pointer is said to be opa.ue 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 merging an
implementation file with all its headers and header files.
3-. What is a smart pointer?
Answer:
A smart pointer is an ob=ect that acts, loos and feels lie a normal pointer but
offers more functionality. &n !;;, smart pointers are implemented as template classes
that encapsulate a pointer and override standard pointer operators. They have a number of
advantages over regular pointers. They are guaranteed to be initialized as either null
pointers or pointers to a heap ob=ect. &ndirection through a null pointer is checed. $o
delete is ever necessary. "b=ects are automatically freed when the last pointer to them has
gone away. "ne significant problem with these smart pointers is that unlie regular
pointers, they donTt respect inheritance. Smart pointers are unattractive for polymorphic
code. %iven below is an e5ample for the implementation of smart pointers.
Exaple:
template Rclass HQ
class smartMpointer
]
public7
smartMpointer*+X LL maes a null pointer
smartMpointer*const HU 5+ LL maes pointer to copy of 5
HU operator :* +X
const HU operator:* + constX
H: operator9Q*+ constX
smartMpointer*const smartMpointer RHQ U+X
const smartMpointer RHQ U operator @*const smartMpointerRHQU+X
asmartMpointer*+X
private7
LL...
^X
This class implement a smart pointer to an ob=ect of type H. The ob=ect itself is
located on the heap. ,ere is how to use it7
smartMpointer RemployeeQ p@ employee*N,arrisN,>///+X
0ie other overloaded operators, p will behave lie a regular pointer,
coutRR:pX
p9QraiseMsalary*C.?+X
30. What is reflexive association?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
KB
Technical Aptitude Questions
Answer:
The Tis9aT is called a refle5ive association because the refle5ive association permits
classes to bear the is9a association not only with their super9classes but also with
themselves. &t differs from a Tspecializes9fromT as Tspecializes9fromT is usually used to
describe the association between a super9class and a sub9class. 1or e5ample7
6rinter is9a printer.
35. What is slicing?
Answer:
Slicing means that the data added by a subclass are discarded when an ob=ect of
the subclass is passed or returned by value or from a function e5pecting a base class
ob=ect.
Explanation:
!onsider the following class declaration7
class base
]
...
baseU operator @*const baseU+X
base *const baseU+X
^
void fun* +
]
base e@mX
e@mX
^
As base copy functions donTt now anything about the derived only the base part
of the derived is copied. This is commonly referred to as slicing. "ne reason to pass
ob=ects of classes in a hierarchy is to avoid slicing. "ther reasons are to preserve
polymorphic behavior and to gain efficiency.
37. What is name mangling?
Answer:
$ame mangling is the process through which your c;; compilers give each
function in your program a uni.ue name. &n !;;, all programs have at9least a few
functions with the same name. $ame mangling is a concession to the fact that liner
always insists on all function names being uni.ue.
Exaple:
&n general, member names are made uni.ue by concatenating the name of the
member with that of the class e.g. given the declaration7
class (ar
]
public7
int ivalX
...
^X
ival becomes something lie7
LL a possible member name mangling
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
K?
Technical Aptitude Questions
ivalMM/(ar
!onsider this derivation7
class 1oo 7 public (ar
]
public7
int ivalX
...
^
The internal representation of a 1oo ob=ect is the concatenation of its base and
derived class members.
LL 6seudo !;; code
LL &nternal representation of 1oo
class 1oo
]
public7
int ivalMM/(arX
int ivalMM/1ooX
...
^X
<nambiguous access of either ival members is achieved through name mangling.
#ember functions, because they can be overloaded, re.uire an e5tensive mangling to
provide each with a uni.ue name. ,ere the compiler generates the same name for the two
overloaded instances*Their argument lists mae their instances uni.ue+.

3?. What are proxy o.jects?
Answer:
"b=ects that points to other ob=ects are called pro5y ob=ects or surrogates. &ts an
ob=ect that provides the same interface as its server ob=ect but does not have any
functionality. During a method 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.
Answer:
A declaration introduces a name into the programX a definition provides a uni.ue
description of an entity *e.g. type, instance, and function+. Declarations can be repeated in
a given scope, it introduces a name in a given scope. There must be e5actly one definition
of every ob=ect, function or class used in a !;; program.
A declaration is a definition unless7
it declares a function without specifying its body,
it contains an e5tern specifier and no initializer or function body,
it is the declaration of a static class data member without a class definition,
it is a class name definition,
it is a typedef declaration.
A definition is a declaration unless7
it defines a static class data member,
it defines a non9inline member function.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
KA
Technical Aptitude Questions
*1. What is cloning?
Answer:
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.
Answer:
The main characteristics of static functions include,
&t is without the a this pointer,
&t canTt directly access the non9static members of its class
&t canTt be declared const, volatile or virtual.
&t doesnTt need to be invoed through an ob=ect of its class, although for
convenience, it may.
*3. Will the inline function .e compiled as the inline function always? Yustify.
Answer:
An inline function is a re.uest and not a command. ,ence it wonTt be compiled as
an inline function always.
Explanation:
&nline9e5pansion could fail if the inline function contains loops, the address of an
inline function is used, or an inline function is called in a comple5 e5pression. The rules
for inlining are compiler dependent.
**. !efine a way other than using the 'eyword inline to ma'e a function inline.
Answer:
The function must be defined inside the class.
*-. )ow can a W::W operator .e used as unary operator?
Answer:
The scope operator can be used to refer to members of the global namespace.
(ecause the global namespace doesn3t have a name, the notation 77 member9name refers
to a member of the global namespace. This can be useful for referring to members of
global namespace whose names have been hidden by names declared in nested local
scope. <nless we specify to the compiler in which namespace to search for a declaration,
the compiler simple searches the current scope, and any scopes in which the current
scope is nested, to find the declaration for the name.
*0. What is placement new?
Answer:
Fhen you want to call a constructor directly, you use the placement new.
Sometimes you have some raw memory thatTs already been allocated, and you need to
construct an ob=ect in the memory you have. "perator newTs special version placement
new allows you to do it.
class Fidget
]
public 7
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
KG
Technical Aptitude Questions
Fidget*int widgetsize+X
...
Fidget: !onstructMwidgetMintMbuffer*void :buffer,int widgetsize+
]
return new*buffer+ Fidget*widgetsize+X
^
^X
This function returns a pointer to a Fidget ob=ect thatTs constructed within the
buffer passed to the function. Such a function might be useful for applications using
shared memory or memory9mapped &L", because ob=ects in such applications must be
placed at specific addresses or in memory allocated by special routines.
--./
1. What do you mean .y analysis and design?
6nalysis:
(asically, it is the process of determining what needs to be done before
how it should be done. &n order to accomplish this, the developer refers the e5isting
systems and documents. So, simply it is an art of discovery.
!esign:
&t is the process of adoptingLchoosing the one among the many, which best
accomplishes the users needs. So, simply, it is compromising mechanism.
2. What are the steps involved in designing?
(efore getting into the design the designer should go through the S'S prepared
by the System Analyst.
The main tass of design are Architectural Design and Detailed Design.
&n Architectural Design we find what are the main modules in the problem
domain.
&n Detailed Design we find what should be done within each module.
3. What are the main underlying concepts of o.ject orientation?
"b=ects, messages, class, inheritance and polymorphism are the main concepts of
ob=ect orientation.
*. What do u meant .y K$"+K of an o.ject?
S(& stands for State, (ehavior and &dentity. Since every ob=ect has the above
three.
$tate:
&t is =ust a value to the attribute of an ob=ect at a particular time.
"ehaviour7
&t describes the actions and their reactions of that ob=ect.
+dentity7
An ob=ect has an identity that characterizes its own e5istence. The identity
maes it possible to distinguish any ob=ect in an unambiguous way, and independently
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
KE
Technical Aptitude Questions
from its state.
-. !ifferentiate persistent ( non3persistent o.jects?
6ersistent refers to an ob=ectTs ability to transcend time or space. A persistent
ob=ect storesLsaves its state in a permanent storage system with out losing the information
represented by the ob=ect.
A non9persistent ob=ect is said to be transient or ephemeral. (y default ob=ects are
considered as non9persistent.
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. &n simple words it can be
referred as client.
6assive ob=ects are one, which passively waits for the message to be processed. &t
waits for another ob=ect that re.uires its services. &n simple words it can be referred as
server.
Diagram7
client server
*Active+ *6assive+
5. What is meant .y software development method`
Software development method describes how to model and build software
systems in a reliable and reproducible way. To put it simple, methods that are used to
represent onesT thining using graphical notations.
7. What are models and meta models?
#odel:
+t is a complete description of something *i.e. system+.
#eta model:
&t describes the model elements, synta5 and semantics of the notation that
allows their manipulation.
?. What do you meant .y static and dynamic modeling?
Static modeling is used to specify structure of the ob=ects that e5ist in the problem
domain. These are e5pressed using class, o.ject and Q$1,6$1 diagrams.
(ut Dynamic modeling refers representing the ob=ect interactions during runtime.
&t 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 e5ist
in the problem domain. e.g. for modeling element is class notation, ob=ect notation etc.
'elationships are used to represent the interaction between the modeling
elements.
The following are the 'elationships.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
KK
Technical Aptitude Questions
6ssociation: &tsT =ust a semantic connection two classes.
e.g.7
6ggregation: &tsT the relationship between two classes which are related in the fashion
that master and slave. The master taes full rights than the slave. Since the slave
wors under the master. &t is represented as line with diamond in the master area.
e57
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.
&t is represented as dared diamond at the whole part.
e5ample7
class A]
LLsome code
^X
class (
]
A aaX LL an ob=ect of class AX
LL some code for class (X
^X
&n the above e5ample 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
diagram lie this.
=eneraliCation: This relationship used when we want represents a class, which
captures the common states of ob=ects of different classes. &t is represented as arrow
line pointed at the class, which has captured the common states.



!ependency: &t is the relationship between dependent and independent classes. Any
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>CC
car wheels
class A class (
uses
class A class (
class A
class ( class !
Technical Aptitude Questions
change in the independent class will affect the states of the dependent class.
D&A%'A#7
class A class (
11. Why generaliCation is very strong?
4ven though %eneralization satisfies Structural, &nterface, (ehaviour properties.
&t is mathematically very strong, as it is Antisymmetric and Transitive.
6ntisymmetric: employee is a person, but not all persons are employees.
#athematically all As3 are (, but all (s3 not A.
Dransitive: A@Q(, (@Qc then A@Qc.
A. Salesman.
(. 4mployee.
!. 6erson.
'ote: All the other relationships satisfy all the properties lie Structural
properties, &nterface properties, (ehaviour properties.
12. !ifferentiate 6ggregation and containment?
Aggregation is the relationship between the whole and a part. Fe can addLsubtract
some properties in the part *slave+ side. &t wonTt affect the whole part.
(est e5ample is !ar, which contains the wheels and some e5tra parts. 4ven
though the parts are not there we can call it as car.
(ut, in the case of containment the whole part is affected when the part within
that got affected. The human body is an apt e5ample for this relationship. Fhen the
whole body dies the parts *heart etc+ are died.
13. ,an lin' and 6ssociation applied interchangea.ly?
$o, Iou 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 77 student7Abhilash course7#!A
Association77 student course
1*. what is meant .y Kmethod3warsK?
(efore >KKB there were different methodologies lie 'umbaugh, (ooch,
Dacobson, #eyer etc who followed their own notations to model the systems. The
developers were in a dilemma to choose the method which best accomplishes their needs.
This particular span was called as Nmethod9warsN
1-. Whether unified method and unified modeling language are same or different?
<nified method is convergence of the 'umbaugh and (ooch.
<nified modeling lang. is the fusion of 'umbaugh, (ooch and Dacobson as well
as (etrand #eyer *whose contribution is Nse.uence diagramN+. &tsT the superset of all the
methodologies.
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) - ll !ight" !e"erved
>C>
Technical Aptitude Questions
The Three amigos namely,
Yames um.augh 2E#D4: A veteran in analysis who came up with an idea about the
ob=ects and their 'elationships *in particular Associations+.
=rady "ooch: A veteran in design who came up with an idea about partitioning of
systems into subsystems.

+var Yaco.son 2E.jectory4: The father of <S4!AS4S, who described about the user
and system interaction.
15. !ifferentiate the class representation of "ooch% um.augh and Q#L?
&f you loo at the class representaiton of 'umbaugh and <#0, &t is some what
similar and both are very easy to draw.
Represent$tion: -0T 102.
/i$3r$m:

(ooch7 &n this method classes are represented as N!loudsN 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 !ase is a description of a set of se.uence of actions that a system performs
that yields an observable result of value to a particular action.
&n SSAD process R@Q &n ""AD <S4!AS4. &t is represented elliptically.
Represent$tion:
1?. Who is an 6ctor?
An Actor is someone or something that must interact with the system.&n addition
to that an Actor initiates the process*that is <S4!AS4+.
&t is represented as a sticman lie this.
/i$3r$m:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>C2
Technical Aptitude Questions
2@. What is guard condition?
%uard condition is one, which acts as a firewall. The access from a particular
ob=ect can be made only when the particular condition is met.
1or 45ample,
customer chec customer number AT#.
,ere the ob=ect on the customer accesses the AT# facility only when the guard condition
is met.
21. !ifferentiate the following notations?
+: :o.j1 :o.j2

++: :o.j1 :o.j2
&n the above representation &, ob=> sends message to ob=2. (ut in the case of && the
data is transferred from 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 accomplished by specifying the relationship called Nrefinement\
which tals about the two different abstraction of the same thing.
"r e5ample,
calculate pay calculate
class> class2 class/
23. $uppose a class acts an 6ctor in the pro.lem domain% how to represent it in the static
model?
&n this scenario you can use [stereotype\. Since stereotype is =ust a string that
gives e5tra semantic to the particular entityLmodel element. &t is given with in the RR QQ.
class A
RR ActorQQ
attributes
methods.
2*. Why does the function arguments are called as KsignaturesK?
The arguments distinguish functions with the same name *functional
polymorphism+. The name alone does not necessarily identify a uni.ue function.
,owever, the name and its arguments *signatures+ will uni.uely identify a function.
&n real life we see suppose, in class there are two guys with same name, but they
can be easily identified by their signatures. The same concept is applied here.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>C/
Technical Aptitude Questions
e57
class person
]
public7
char getse5*+X
void setse5*char+X
void setse5*int+X
^X
&n the above e5ample we see that there is a function setse5*+ with same name but
with different signature.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>CB
Technical Aptitude Questions
Quantitative Aptitude
Exer'ise 1
0ol)e the %ollowin( an$ 'he'1 with the answers (i)en at the en$*
>. &t was calculated that G? men could complete a piece of wor in 2C days. Fhen
wor was scheduled to commence, it was found necessary to send 2? men to
another pro=ect. ,ow much longer will it tae to complete the wor`
2. A student divided a number by 2L/ when he re.uired to multiply by /L2. !alculate
the percentage of error in his result.
/. A dishonest shopeeper professes to sell pulses at the cost price, but he uses a
false weight of K?Cgm. for a g. ,is gain is JW.
B. A software engineer has the capability of thining >CC lines of code in five
minutes and can type >CC lines of code in >C minutes. ,e taes a brea for five
minutes after every ten minutes. ,ow many lines of codes will he complete typing
after an hour`
?. A man was engaged on a =ob for /C days on the condition that he would get a
wage of 's. >C for the day he wors, but he have to pay a fine of 's. 2 for each
day of his absence. &f he gets 's. 2>A at the end, he was absent for wor for ...
days.
A. A contractor agreeing to finish a wor in >?C days, employed G? men each
woring E hours daily. After KC days, only 2LG of the wor was completed.
&ncreasing the number of men by MMMMMMMM each woring now for >C hours daily,
the wor can be completed in time.
G. what is a percent of b divided by b percent of a`
*a+ a *b+ b *c+ > *d+ >C *d+ >CC
E. A man bought a horse and a cart. &f he sold the horse at >C W loss and the cart at
2C 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. >C in the bargain. The amount paid by him was
's.MMMMMMM for the horse and 's.MMMMMMMM for the cart.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>C?
Quantitative
Aptitude
Technical Aptitude Questions
K. A tennis marer is trying to put together a team of four players for a tennis
tournament out of seven available. males 9 a, b and cX females ) m, n, o and p. All
players are of e.ual ability and there must be at least two males in the team. 1or a
team of four, all players must be able to play with each other under the following
restrictions7
b should not play with m,
c should not play with p, and
a should not play with o.
Fhich of the following statements must be false`
>. b and p cannot be selected together
2. c and o cannot be selected together
/. c and n cannot be selected together.
>C9>2. The following figure depicts three views of a cube. (ased on this, answer
.uestions >C9>2.
A ? B
> 22 / A
>C. The number on the face opposite to the face carrying > is MMMMMMM .
>>. The number on the faces ad=acent to the face mared ? are MMMMMMM .
>2. Fhich of the following pairs does not correctly give the numbers on the opposite
faces.
*>+ A,? *2+ B,> */+ >,/ *B+ B,2
>/. 1ive farmers have G, K, >>, >/ U >B apple trees, respectively in their orchards.
0ast year, each of them discovered that every tree in their own orchard bore
e5actly the same number of apples. 1urther, if the third farmer gives one apple to
the first, and the fifth gives three to each of the second and the fourth, they would
all have e5actly the same number of apples. Fhat were the yields per tree in the
orchards of the third and fourth farmers`
>B. 1ive boys were climbing a hill. D was following ,. ' was =ust ahead of %. _ was
between % U ,. They were climbing up in a column. Fho was the second`
>?9>E Dohn is undecided which of the four novels to buy. ,e is considering a spy
thriller, a #urder mystery, a %othic romance and a science fiction novel. The
boos are written by 'otho, %ory, (urchfield and ,opper, not necessary in that
order, and published by ,eron, 6iegon, (lue=a and sparrow, not necessary in that
order.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>CA
2 / 2
Technical Aptitude Questions
1 *>+ The boo by 'otho is published by Sparrow.
4 *2+ The Spy thriller is published by ,eron.
*/+ The science fiction novel is by (urchfield and is not published by (lue=a.
5 *B+The %othic romance is by ,opper.
+
>?. 6igeon publishes MMMMMMMMMMMM.
>A. The novel by %ory MMMMMMMMMMMMMMMM.
>G. Dohn purchases boos by the authors whose names come first and third in
alphabetical order. ,e does not buy the boos MMMMMM.
>E. "n the basis of the first paragraph and statement *2+, */+ and *B+ only, it is
possible to deduce that
>. 'otho wrote the murder mystery or the spy thriller
2. Sparrow published the murder mystery or the spy thriller
/. The boo by (urchfield is published by Sparrow.
>K. &f a light flashes every A seconds, how many times will it flash in c of an hour`
2C. &f point 6 is on line segment A(, then which of the following is always true`
*>+ A6 @ 6( *2+ A6 Q 6( */+ 6( Q A6 *B+ A( Q A6 *?+ A( Q A6 ; 6(
2>. All men are vertebrates. Some mammals are vertebrates. Fhich of the following
conclusions drawn from the above statement is correct.
All men are mammals
All mammals are men
Some vertebrates are mammals.
$one
22. Fhich of the following statements drawn from the given statements are correct`
%iven7
All watches sold in that shop are of high standard. Some of the ,#T watches are
sold in that shop.
a+ All watches of high standard were manufactured by ,#T.
b+ Some of the ,#T watches are of high standard.
c+ $one of the ,#T watches is of high standard.
d+ Some of the ,#T watches of high standard are sold in that shop.
2/92G.
>. Ashland is north of 4ast 0iverpool and west of !oshocton.
2. (owling green is north of Ashland and west of 1rederictown.
/. Dover is south and east of Ashland.
B. 4ast 0iverpool is north of 1rederictown and east of Dover.
?. 1rederictown is north of Dover and west of Ashland.
A. !oshocton is south of 1rederictown and west of Dover.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>CG
Technical Aptitude Questions
2/. Fhich of the towns mentioned is furthest of the north ) west
*a+ Ashland *b+ (owling green *c+ !oshocton
*d+ 4ast 0iverpool *e+ 1rederictown
2B. Fhich of the following must be both north and east of 1rederictown`
*a+ Ashland *b+ !oshocton *c+ 4ast 0iverpool
& a only && b only &&& c only &- a U b - a U c
2?. Fhich of the following towns must be situated both south and west of at least one
other town`
A. Ashland only
(. Ashland and 1rederictown
!. Dover and 1rederictown
D. Dover, !oshocton and 1rederictown
4. !oshocton, Dover and 4ast 0iverpool.
2A. Fhich of the following statements, if true, would mae the information in the
numbered statements more specific`
*a+ !oshocton is north of Dover.
*b+ 4ast 0iverpool is north of Dover
*c+ Ashland is east of (owling green.
*d+ !oshocton is east of 1rederictown
*e+ (owling green is north of 1rederictown
2G. Fhich of the numbered statements gives information that can be deduced from
one or more of the other statements`
*A+ > *(+ 2 *!+ / *D+ B *4+ A
2E. 4ight friends ,arsha, 1ais, (ala=i, 4swar, Dhinesh, !handra, %eetha, and Ahmed
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 Ahmed.
!handra is sitting between Ahmed and %eetha and (ala=i and 4shwar are not
sitting opposite to each other. Fho is third to the left of Dhinesh`
2K. &f every alternative letter starting from ( of the 4nglish alphabet is written in
small letter, rest all are written in capital letters, how the month [ September\ be
written.
*>+ Sept4#b4r *2+ S4pTe#(4r */+ Septembe'
*B+ Septe#ber *?+ $one of the above.
/C. The length of the side of a s.uare is represented by 5;2. The length of the side of
an e.uilateral triangle is 25. &f the s.uare and the e.uilateral triangle have e.ual
perimeter, then the value of 5 is MMMMMMM.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>CE
Technical Aptitude Questions
/>. &t taes #r. _arthi y hours to complete typing a manuscript. After 2 hours, he
was called away. Fhat fractional part of the assignment was left incomplete`
/2. Fhich of the following is larger than /L?`
*>+ d *2+ /KL?C */+ GL2? *B+ /L>C *?+ ?KL>CC
//. The number that does not have a reciprocal is MMMMMMMMMMMM.
/B. There are / persons Sudhir, Arvind, and %auri. Sudhir lent cars to Arvind and
%auri as many as they had already. After some time Arvind gave as many cars to
Sudhir and %auri as many as they have. After sometime %auri did the same thing.
At the end of this transaction each one of them had 2B. 1ind the cars each
originally had.
/?. A man bought a horse and a cart. &f he sold the horse at >C W loss and the cart at
2C 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. >C in the bargain. The amount paid by him was
's.MMMMMMM for the horse and 's.MMMMMMMM for the cart.
.ns6ers:
>. Answer:
/C days.
Explanation:
"efore:
"ne day wor @ > L 2C
"ne man3s one day wor @ > L * 2C : G?+
&ow:
$o. "f worers @ ?C
"ne day wor @ ?C : > L * 2C : G?+
The total no. of days re.uired to complete the wor @ *G? : 2C+ L ?C @ /C
2. Answer:
C W
Explanation:
Since /5 L 2 @ 5 L *2 L /+
/. Answer:
?./ W
Explanation:
,e sells K?C grams of pulses and gains ?C grams.
&f he sells >CC grams of pulses then he will gain *?C L K?C+ :>CC @ ?.2A
B. Answer:
2?C lines of codes
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>CK
Technical Aptitude Questions
?. Answer:
G days
Explanation:
The e.uation portraying the given problem is7
>C : 5 ) 2 : */C ) 5+ @ 2>A where 5 is the number of woring days.
Solving this we get 5 @ 2/
$umber of days he was absent was G */C92/+ days.
A. Answer:
>?C men.
Explanation:
"ne day3s wor @ 2 L *G : KC+
"ne hour3s wor @ 2 L *G : KC : E+
"ne man3s wor @ 2 L *G : KC : E : G?+
The remaining wor *?LG+ has to be completed within AC days, because the
total number of days allotted for the pro=ect is >?C days.
So we get the e.uation
*2 : >C : 5 : AC+ L *G : KC : E : G?+ @ ?LG where 5 is the number of men
woring after the KC
th
day.
Fe get 5 @ 22?
Since we have G? men already, it is enough to add only >?C men.
G. Answer:
*c+ >
Explanation:
a percent of b 7 *aL>CC+ : b
b percent of a 7 *bL>CC+ : a
a percent of b divided by b percent of a 7 **a L >CC +:b+ L *bL>CC+ : a ++ @ >
E. Answer:
!ost price of horse @ 's. BCC U the cost price of cart @ 2CC.
Explanation:-
0et 5 be the cost price of the horse and y be the cost price of the cart.
&n the first sale there is no loss or profit. *i.e.+ The loss obtained is e.ual to the
gain.
Therefore *>CL>CC+ : 5 @ *2CL>CC+ : y
H @ 2 : y 99999999999999999*>+
&n the second sale, he lost 's. >C. *i.e.+ The loss is greater than the profit by 's.
>C.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>C
Technical Aptitude Questions
Therefore *? L >CC+ : 5 @ *? L >CC+ : y ; >C 9999999*2+
Substituting *>+ in *2+ we get
*>C L >CC+ : y @ *? L >CC+ : y ; >C
*? L >CC+ : y @ >C
% 7 400
1rom *>+ 2 : 2CC @ x 7 +00
K. Answer:
/.
Explanation:
Since inclusion of any male player will re=ect a female from the team.
Since there should be four member in the team and only three males are available,
the girl, n should included in the team always irrespective of others selection.
>C. Answer:
?
>>. Answer:
>,2,/ U B
>2. Answer:
(
>/. Answer:
>> U K apples per tree.
Explanation:
0et a, b, c, d U e be the total number of apples bored per year in A, (, !,
D U 4 2s orchard. %iven that a ; > @ b ; / @ c ) > @ d ; / @ e ) A
(ut the .uestion is to find the number of apples bored per tree in ! and D 2s
orchard. &f is enough to consider c ) > @ d ; /.
Since the number of trees in !3s orchard is >> and that of D3s orchard is
>/. 0et 5 and y be the number of apples bored per tree in ! U d 2s orchard
respectively.
Therefore >> 5 ) > @ >/ y ; /
(y trial and error method, we get the value for 5 and y as >> and K
>B. Answer:
%.
Explanation:
The order in which they are climbing is ' ) % ) _ ) , ) D
>? ) >E
Answer:
$ovel $ame Author 6ublisher
Spy thriller 'atho ,eron
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>>
Technical Aptitude Questions
#urder mystery %ory 6iegon
%othic romance (urchfield (lue=a
Science fiction ,opper Sparrow
Explanation:
%iven
$ovel $ame Author 6ublisher
Spy thriller 'atho ,eron
#urder mystery %ory 6iegon
%othic romance (urchfield (lue=a
Science fiction ,opper Sparrow
Since (lue=a doesn3t publish the novel by (urchfield and ,eron publishes
the novel spy thriller, 6iegon publishes the novel by (urchfield.
Since ,opper writes %othic romance 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 %ory, %ory writes Spy thriller and 'atho writes #urder mystery.
>K. Answer:
B?> times.
Explanation:
There are AC minutes in an hour.
&n c of an hour there are *AC : c+ minutes @ B? minutes.
&n c of an hour there are *AC : B?+ seconds @ 2GCC seconds.
0ight flashed for every A seconds.
&n 2GCC seconds 2GCCLA @ B?C times.
The count start after the first flash, the light will flashes B?> times in c of
an hour.
2C. Answer:
*B+
Explanation:
6
A (
Since p is a point on the line segment A(, A( Q A6
2>. Answer: *c+
22. Answer: *b+ U *d+.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>2
Technical Aptitude Questions
Ahmed
2/ 9 2G.Answer:
1ais !handra
2E. Answer: 1ais
Explanation: )arsha =eetha
4swar (ala=i
Dhinesh
2K. Answer:
*?+.
Explanation:
Since every alternative letter starting from ( of the 4nglish alphabet is
written in small letter, the letters written in small letter are b, d, f...
&n the first two answers the letter 4 is written in both small U capital
letters, so they are not the correct answers. (ut in third and fourth answers the
letter is written in small letter instead capital letter, so they are not the answers8

/C. Answer:
5 @ B
Explanation:
Since the side of the s.uare is 5 ; 2, its perimeter @ B *5 ; 2+ @ B5 ; E
Since the side of the e.uilateral triangle is 25, its perimeter @ / : 25 @ A5
Also, the perimeters of both are e.ual.
*i.e.+ B5 ; E @ A5
*i.e.+ 25 @ E 5 @ B.
/>. Answer:
5 *y ) 2+ L y.
Explanation:
To type a manuscript arthi too y hours.
Therefore his speed in typing @ >Ly.
,e was called away after 2 hours of typing.
Therefore the wor completed @ >Ly : 2.
Therefore the remaining wor to be completed @ > ) 2Ly.
*i.e.+ wor to be completed @ *y92+Ly
/2. Answer:
*2+
//. Answer:
>
Explanation:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>/
Technical Aptitude Questions
"ne is the only number e5ists without reciprocal because the reciprocal of
one is one itself.
/B. Answer:
Sudhir had /K cars, Arvind had 2> cars and %auri had >2 cars.
Explanation:
Sudhir Arvind %auri
1inally 2B 2B 2B
(efore %auri3s transaction >2 >2 BE
(efore Arvind3s transaction A B2 2B
(efore Sudhir3 s transaction /K 2> >2
/?. Answer:
!ost price of horse7 's. BCC U
!ost price of cart7 's. 2CC
Explanation:
0et 5 be the cost of horse U y be the cost of the cart.
>C W of loss in selling horse @ 2C W of gain in selling the cart
Therefore *>C L >CC+ : 5 @ *2C : >CC+ : y
5 @ 2y 99999999999*>+
? W of loss in selling the horse is >C more than the ? W gain in selling the
cart.
Therefore *? L >CC+ : 5 9 >C @ *? L >CC+ : y
?5 9 >CCC @ ?y
Substituting *>+
>Cy 9 >CCC @ ?y
?y @ >CCC
y @ 2CC
5 @ BCC from *>+
Exer'ise 2*1
9or the follo6in3& fin# the next term in the series
>. A, 2B, AC,>2C, 2>C
a+ //A b+ /AA c+ //C d+ AAC
Answer 7 a+ //A
Explanation 7 The series is >.2./, 2./.B, /.B.?, B.?.A, ?.A.G, ..... * T.T means product+
2. >, ?, >/, 2?
Answer 7 B>
Explanation 7 The series is of the form C82;>82, >82;282,...
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>B
Technical Aptitude Questions
/. C, ?, E, >G
Answer 7 2B
Explanation 7 >829>, 282;>, /829>, B82;>, ?829>
B. >, E, K, AB, 2? *,int 7 4very successive terms are related+
Answer 7 2>A
Explanation 7 >82, 28/, /82, B8/, ?82, A8/
?. E,2B,>2,/A,>E,?B

Answer 7 2G
A. G>,GA,AK,GB,AG,G2
Answer 7 AG
G. ?,K,>A,2K,?B
Answer 7 >C/
Explanation 7 ?:29>@KX K:292@>AX >A:29/@2KX 2K:29B@?BX ?B:29?@>C/
E. >,2,B,>C,>A,BC,AB *Successive terms are related+
Answer 7 2CC
Explanation 7 The series is powers of 2 *28C,28>,..+.
All digits are less than E. 4very second number is in octal number system.
>2E should follow AB. >2E base >C @ 2CC base E.
Exer'ise 2*2
9in# the o## m$n out8
>. /,?,G,>2,>/,>G,>K
Answer 7 >2
Explanation 7 All but >2 are odd numbers
2. 2,?,>C,>G,2A,/G,?C,AB
Answer 7 AB
Explanation 7 2;/@?X ?;?@>CX >C;G@>GX >G;K@2AX 2A;>>@/GX /G;>/@?CX ?C;>?@A?X
/. >C?,E?,AC,/C,C,9B?,9KC
Answer 7 C
Explanation 7 >C?92C@E?X E?92?@ACX AC9/C@/CX /C9/?@9?X 9?9BC@9B?X 9B?9B?@9KCX
Exer'ise 2
:ol;e the follo6in38
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>?
Technical Aptitude Questions
>. Fhat is the number of zeros at the end of the product of the numbers from > to >CC`
Answer 7 >2G
2. A fast typist can type some matter in 2 hours and a slow typist can type the same in /
hours. &f both type combinely, in how much time will they finish`
Answer 7 > hr >2 min
Explanation : The fast typistTs wor done in > hr @ >L2
The slow typistTs wor done in > hr @ >L/
&f they wor combinely, wor done in > hr @ >L2;>L/ @ ?LA
So, the wor will be completed in AL? hours. i.e., >;>L? hours @ >hr >2 min
/. %avasarTs average in his first ?C innings was ?C. After the ?>st innings, his average
was ?>. ,ow many runs did he score in his ?>st innings. *supposing that he lost his
wicet in his ?>st innings+
Answer 7 >C>
Explanation 7 Total score after ?C innings @ ?C:?C @ 2?CC
Total score after ?> innings @ ?>:?> @ 2AC>
So, runs made in the ?>st innings @ 2AC>92?CC @ >C>
&f he had not lost his wicet in his ?>st innings, he would have scored an
unbeaten ?C in his ?>st innings.
B. "ut of EC coins, one is counterfeit. Fhat is the minimum number of weighings needed
to find out the counterfeit coin`
Answer 7 B
?. Fhat can you conclude from the statement 7 All green are blue, all blue are red. `
*i+ some blue are green
*ii+ some red are green
*iii+ some 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
Answer 7 *b+
A. A rectangular plate with length E inches, breadth >> inches and thicness 2 inches is
available. Fhat is the length of the circular rod with diameter E inches and e.ual to the
volume of the rectangular plate`
Answer 7 /.? inches
Explanation 7 -olume of the circular rod *cylinder+ @ -olume of the rectangular
plate
*22LG+:B:B:h @ E:>>:2
h @ GL2 @ /.?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>A
Technical Aptitude Questions
G. Fhat is the sum of all numbers between >CC and >CCC which are divisible by >B `
Answer 7 /?/K2
Explanation 7 The number closest to >CC which is greater than >CC and divisible
by >B is >>2, which is the first term of the series which has to be summed.
The number closest to >CCC which is less than >CCC and divisible by >B is
KKB, which is the last term of the series.
>>2 ; >2A ; .... ; KKB @ >B*E;K; ... ; G>+ @ /?/K2
E. &f s*a+ denotes s.uare root of a, find the value of s*>2;s*>2;s*>2; ...... upto infinity.
Answer 7 B
Explanation 7 0et 5 @ s*>2;s*>2;s*>2;.....
Fe can write 5 @ s*>2;5+. i.e., 582 @ >2 ; 5. Solving this .uadratic e.uation, we
get 5 @ 9/ or 5@B. Sum cannot be 9ve and hence sum @ B.
K. A cylindrical container has a radius of eight inches with a height of three inches.
!ompute how many inches should be added to either the radius or height to give the same
increase in volume`
Answer 7 >AL/ inches
Explanation 7 0et 5 be the amount of increase. The volume will increase by the
same amount if the radius increased or the height is increased.
So, the effect on increasing height is e.ual to the effect on increasing the radius.
i.e., *22LG+:E:E:*/;5+ @ *22LG+:*E;5+:*E;5+:/
Solving the .uadratic e.uation we get the 5 @ C or >AL/. The possible increase
would be by >AL/ inches.
>C. Fith =ust si5 weights and a balance scale, you can weigh any unit number of gs from
> to /AB. Fhat could be the si5 weights`
Answer 7 >, /, K, 2G, E>, 2B/ *All powers of /+
>>. Diophantus passed one si5th of his life in childhood, one twelfth in youth, and one
seventh more as a bachelorX five years after his marriage a son was born who died four
years before his father at half his final age. ,ow old is Diophantus`
Answer 7 EB years
Explanation 7 5LA ; 5L>2 ; 5LG ; ? ; 5L2 ; B @ 5
>2 . &f time at this moment is K 6.#., what will be the time 2/KKKKKKKK2 hours later`
Answer 7 > 6.#.
Explanation 7 2B billion hours later, it would be K 6.#. and E hours before that it
would be > 6.#.
>/. ,ow big will an angle of one and a half degree loo through a glass that magnifies
things three times`
Answer 7 > >L2 degrees
Explanation 7 The magnifying glass cannot increase the magnitude of an angle.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>G
Technical Aptitude Questions
>B. Divide B? into four parts such that when 2 is added to the first part, 2 is subtracted
from the second part, 2 is multiplied by the third part and the fourth part is divided by
two, all result in the same number.
Answer7 E, >2, ?, 2C
Explanation7 a ; b ; c ; d @B?X a;2 @ b92 @ 2c @ dL2X a@b9BX c @ *b92+L2X d @
2*b92+X b9B ; b ; *b92+L2 ; 2*b92+ @ B?X
>?. & drove AC m at /C mph and then an additional AC m at ?C mph. !ompute my
average speed over my >2C m.
Answer 7 /G >L2
Explanation 7 Time re.d for the first AC m @ >2C min.X Time re.d for the second
AC m @ G2 min.X Total time re.d @ >K2 min
Avg speed @ *AC:>2C+L>K2 @ /G >L2
Auestions 10 and 15 are .ased on the following :
1ive e5ecutives of 4uropean !orporation hold a !onference in 'ome
#r. A converses in Spanish U &talian
#r. (, a spaniard, nows 4nglish also
#r. ! nows 4nglish and belongs to &taly
#r. D converses in 1rench and Spanish
#r. 4 , a native of &taly nows 1rench
>A. Fhich of the following can act as interpreter if #r. ! U #r. D wish to converse
a+ only #r. A b+ "nly #r. ( c+ #r. A U #r. ( d+ Any of the other three
Answer 7 d+ Any of the other three.
Explanation 7 1rom the data given, we can infer the following.
A nows Spanish, &talian
( nows Spanish, 4nglish
! nows &talian, 4nglish
D nows Spanish, 1rench
4 nows &talian, 1rench
To act as an interpreter between ! and D, a person has to now one of the
combinations &talianUSpanish, &talianU1rench, 4nglishUSpanish, 4nglishU1rench
A, (, and 4 now atleast one of the combinations.

>G. &f a Ath e5ecutive is brought in, to be understood by ma5imum number of original
five he should be fluent in
a+ 4nglish U 1rench b+ &talian U Spanish c+ 4nglish U 1rench d+ 1rench U
&talian
Answer 7 b+ &talian U Spanish
Explanation 7 $o of e5ecutives who now
i+ 4nglish is 2
ii+ Spanish is /
iii+ &talian is /
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>E
Technical Aptitude Questions
iv+ 1rench is 2
&talian U Spanish are spoen by the ma5imum no of e5ecutives. So, if the Ath
e5ecutive is fluent in &talian U Spanish, he can communicate with all the original five
because everybody nows either Spanish or &talian.
>E. Fhat is the sum of the first 2? natural odd numbers`
Answer 7 A2?
Explanation 7 The sum of the first n natural odd nos is s.uare*n+.
>;/ @ B @ s.uare*2+ >;/;? @ K @ s.uare*/+
>K. The sum of any seven consecutive numbers is divisible by
a+ 2 b+ G c+ / d+ >>
Exer'ise 2
Tr% the follo6in38
>. There are seventy clers woring in a company, of which /C are females. Also, /C
clers are marriedX 2B clers are above 2? years of ageX >K married clers are
above 2? years, of which G are malesX >2 males are above 2? years of ageX and >?
males are married. ,ow many bachelor girls are there and how many of these are
above 2?`
2. A man sailed off from the $orth 6ole. After covering 2,CCC miles in one direction
he turned Fest, sailed 2,CCC miles, turned $orth and sailed ahead another 2,CCC
miles till he met his friend. ,ow far was he from the $orth 6ole and in what
direction`
/. ,ere is a series of comments on the ages of three persons D, ', S by themselves.
S 7 The difference between 'Ts age and mine is three years.
D 7 ' is the youngest.
' 7 4ither & am 2B years old or D 2? or S 2A.
D 7 All are above 2B years of age.
S 7 & am the eldest if and only if ' is not the youngest.
' 7 S is elder to me.
D 7 & am the eldest.
' 7 S is not 2G years old.
S 7 The sum of my age and DTs is two more than twice 'Ts age.
"ne of the three had been telling a lie throughout whereas others had spoen the
truth. Determine the ages of S,D,'.
B. &n a group of five people, what is the probability of finding two persons with the
same month of birth`
?. A father and his son go out for a Twal9and9runT every morning around a trac
formed by an e.uilateral triangle. The fatherTs waling speed is 2 mph and his
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>>K
Technical Aptitude Questions
running speed is ? mph. The sonTs waling and running speeds are twice that of
his father. (oth start together from one ape5 of the triangle, the son going
clocwise and the father anti9clocwise. &nitially the father runs and the son wals
for a certain period of time. Thereafter, as soon as the father starts waling, the
son starts running. (oth complete the course in B? minutes. 1or how long does the
father run` Fhere do the two cross each other`
A. The Director of #edical Services was on his annual visit to the 4$T ,ospital.
Fhile going through the out patientsT records he came across the following data
for a particular day 7 N 4ar consultations B?X $ose ?CX Throat GCX 4ar and $ose
/CX $ose and Throat 2CX 4ar and Throat /CX 4ar, $ose and Throat >CX Total
patients >CC.N Then he came to the conclusion that the records were bogus. Fas
he right`
G. Amongst 'am, Sham and %obind are a doctor, a lawyer and a police officer. They
are married to 'adha, %ita and Sita *not in order+. 4ach of the wives have a
profession. %obindTs wife is an artist. 'am is not married to %ita. The lawyerTs
wife is a teacher. 'adha is married to the police officer. Sita is an e5pert coo.
FhoTs who`
E. Fhat should come ne5t`
>, 2, B, >C, >A, BC, AB,
Auestions ?312 are .ased on the following :
Three adults ) 'oberto, Sarah and -icy ) will be traveling in a van with five
children ) 1reddy, ,illary, Donathan, 0upe, and #arta. The van has a driver3s seat
and one passenger seat in the front, and two benches behind the front seats, one
beach behind the other. 4ach bench has room for e5actly three people. 4veryone
must sit in a seat or on a bench, and seating is sub=ect to the following restrictions7
An adult must sit on each bench.
4ither 'oberto or Sarah must sit in the driver3s seat.
Donathan must sit immediately beside #arta.
K. "f the following, who can sit in the front passenger seat `
*a+ Donathan *b+ 0upe *c+ 'oberto *d+ Sarah *e+ -icy
>C. Fhich of the following groups of three can sit together on a bench`
*a+ 1reddy, Donathan and #arta *b+ 1reddy, Donathan and -icy
*c+ 1reddy, Sarah and -icy *d+ ,illary, 0upe and Sarah
*e+ 0upe, #arta and 'oberto
>>. &f 1reddy sits immediately beside -icy, which of the following cannot be true `
a. Donathan sits immediately beside Sarah
b. 0upe sits immediately beside -icy
c. ,illary sits in the front passenger seat
d. 1reddy sits on the same bench as ,illary
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2C
Technical Aptitude Questions
e. ,illary sits on the same bench as 'oberto
>2. &f Sarah sits on a bench that is behind where Donathan is sitting, which of the
following must be true `
a. ,illary sits in a seat or on a bench that is in front of where #arta is sitting
b. 0upe sits in a seat or on a bench that is in front of where 1reddy is sitting
c. 1reddy sits on the same bench as ,illary
d. 0upe sits on the same bench as Sarah
e. #arta sits on the same bench as -icy
>/. #ae si5 s.uares of the same size using twelve match9stics. *,int 7 Iou will
need an adhesive to arrange the re.uired figure+
>B. A farmer has two rectangular fields. The larger field has twice the length and B
times the width of the smaller field. &f the smaller field has area _, then the are of
the larger field is greater than the area of the smaller field by what amount`
*a+ A_ *b+ E_ *c+ >2_ *d+ G_
>?. $ine e.ual circles are enclosed in a s.uare whose area is /As. units. 1ind the area
of each circle.
>A. There are K cards. Arrange them in a /:/ matri5. !ards are of B colors. They are
red, yellow, blue, green. !onditions for arrangement7 one red card must be in first
row or second row. 2 green cards should be in /
rd
column. Iellow cards must be in
the / corners only. Two blue cards must be in the 2nd row. At least one green card
in each row.
>G. &s z less than w` z and w are real numbers.
*&+ z
2
@ 2?
*&&+ w @ K
To answer the .uestion,
a+ 4ither & or && is sufficient
b+ (oth & and && are sufficient but neither of them is alone sufficient
c+ & U && are sufficient
d+ (oth are not sufficient
>E. A speas truth GCW of the timeX ( speas truth ECW of the time. Fhat is the
probability that both are contradicting each other`
>K. &n a family G children donTt eat spinach, A donTt eat carrot, ? donTt eat beans, B
donTt eat spinach U carrots, / donTt eat carrot U beans, 2 donTt eat beans U
spinach. "ne doesnTt eat all /. 1ind the no. of children.
2C. Anna, (ena, !atherina and Diana are at their monthly business meeting. Their
occupations are author, biologist, chemist and doctor, but not necessarily in that
order. Diana =ust told the neighbour, who is a biologist that !atherina was on her
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2>
Technical Aptitude Questions
way with doughnuts. Anna is sitting across from the doctor and ne5t to the
chemist. The doctor was thining that (ena was a good name for parentTs to
choose, but didnTt say anything. Fhat is each personTs occupation`
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>22
Technical Aptitude Questions
<$&H !oncepts
S4!T&"$ 9 &
1&04 #A$A%4#4$T &$ <$&H
1. )ow are devices represented in Q&+Z?
All devices are represented by files called special files that are located
inLdev directory. Thus, device files and other files are named and accessed in the same
way. A Tregular fileT is =ust an ordinary data file in the dis. A Tbloc special fileT represents
a device with characteristics similar to a dis *data transfer in terms of blocs+. A
Tcharacter special fileT represents a device with characteristics similar to a eyboard *data
transfer is by stream of bits in se.uential order+.
2. What is WinodeW?
All <$&H files have its description stored in a structure called TinodeT. The inode
contains info about the file9size, its location, time of last access, time of last modification,
permission and so on. Directories are also represented as files and have an associated
inode. &n addition to descriptions about the file, the inode contains pointers to the data
blocs of the file. &f the file is large, inode has indirect pointer to a bloc of pointers to
additional data blocs *this further aggregates for larger files+. A bloc is typically E.
&node consists of the following fields7
1ile owner identifier
1ile type
1ile access permissions
1ile access times
$umber of lins
1ile size
0ocation of the file data
3. "rief a.out the directory representation in Q&+Z
A <ni5 directory is a file containing a correspondence between filenames and
inodes. A directory is a special file that the ernel maintains. "nly ernel modifies
directories, but processes can read directories. The contents of a directory are a list of
filename and inode number pairs. Fhen new directories are created, ernel maes two
entries named T.T *refers to the directory itself+ and T..T *refers to parent directory+.
System call for creating directory is mdir *pathname, mode+.
*. What are the Qnix system calls for +GE?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2/
UNIX Concepts

Technical Aptitude Questions
open*pathname,flag,mode+ 9 open file
creat*pathname,mode+ 9 create file
close*filedes+ 9 close an open file
read*filedes,buffer,bytes+ 9 read data from an open file
write*filedes,buffer,bytes+ 9 write data to an open file
lsee*filedes,offset,from+ 9 position an open file
dup*filedes+ 9 duplicate an e5isting file descriptor
dup2*oldfd,newfd+ 9 duplicate to a desired file descriptor
fcntl*filedes,cmd,arg+ 9 change properties of an open file
ioctl*filedes,re.uest,arg+ 9 change the behaviour of an open file
The difference between fcntl anf ioctl is that the former is intended for any open file,
while the latter is for device9specific operations.
-. )ow do you change <ile 6ccess >ermissions?
4very file has following attributes7
ownerTs user &D * >A bit integer +
ownerTs group &D * >A bit integer +
1ile access mode word
Tr w 5 9r w 59 r w 5T
*user permission9group permission9others permission+
r9read, w9write, 59e5ecute
To change the access mode, we use chmod*filename,mode+.
45ample >7
To change mode of myfile to Trw9rw9r99T *ie. read, write permission for user 9
read,write permission for group 9 only read permission for others+ we give the args as7
chmod*myfile,CAAB+ .
4ach operation is represented by discrete values
TrT is B
TwT is 2
T5T is >
Therefore, for TrwT the value is A*B;2+.
45ample 27
To change mode of myfile to Trw5r99r99T we give the args as7
chmod*myfile,CGBB+.
0. What are lin's and sym.olic lin's in Q&+Z file system?
A lin is a second name *not a file+ for a file. 0ins can be used to assign more
than one name to a file, but cannot be used to assign a directory more than one name or
lin filenames on different computers.
Symbolic lin TisT a file that only contains the name of another file."peration on
the symbolic lin is directed to the file pointed by the it.(oth the limitations of lins are
eliminated in symbolic lins.
!ommands for lining files are7
0in ln filename> filename2
Symbolic lin ln 9s filename> filename2
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2B
Technical Aptitude Questions
5. What is a <+<E?
1&1" are otherwise called as Tnamed pipesT. 1&1" *first9in9first9out+ is a special
file which is said to be data transient. "nce data is read from named pipe, it cannot be
read again. Also, data can be read only in the order written. &t is used in interprocess
communication where a process writes to one end of the pipe *producer+ and the other
reads from the other end *consumer+.
7. )ow do you create special files li'e named pipes and device files?
The system call mnod creates special files in the following se.uence.
>. ernel assigns new inode,
2. sets the file type to indicate that the file is a pipe, directory or special file,
/. &f it is a device file, it maes the other entries lie ma=or, minor device numbers.
1or e5ample7
&f the device is a dis, ma=or device number refers to the dis controller and minor
device number is the dis.

?. !iscuss the mount and unmount system calls
The privileged mount system call is used to attach a file system to a directory of
another file systemX the unmount system call detaches a file system. Fhen you mount
another file system on to your directory, you are essentially splicing one directory tree
onto a branch in another directory tree. The first argument to mount call is the mount
point, that is , a directory in the current file naming system. The second argument is the
file system to mount to that point. Fhen you insert a cdrom to your uni5 systemTs drive,
the file system in the cdrom automatically mounts to LdevLcdrom in your system.
1@. )ow does the inode map to data .loc' of a file?
&node has >/ bloc addresses. The first >C are direct bloc addresses of the first
>C data blocs in the file. The >>th address points to a one9level inde5 bloc. The >2th
address points to a two9level *double in9direction+ inde5 bloc. The >/th address points to
a three9level*triple in9direction+inde5 bloc. This provides a very large ma5imum file size
with efficient access to large files, but also small files are accessed directly in one dis
read.
11. What is a shell?
A shell is an interactive user interface to an operating system services that allows an user
to enter commands as character strings or through a graphical user interface. The shell
converts them to system calls to the "S or fors off a process to e5ecute the command.
System call results and other information from the "S are presented to the user through
an interactive interface. !ommonly used shells are sh,csh,s etc.
S4!T&"$ 9 &&
6'"!4SS #"D40 and &6!
1. "rief a.out the initial process se/uence while the system .oots up.
Fhile booting, special process called the TswapperT or TschedulerT is created with
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2?
Technical Aptitude Questions
6rocess9&D C. The swapper manages memory allocation for processes and influences
!6< allocation. The swapper inturn creates / children7
the process dispatcher,
vhand and
dbflush
with &Ds >,2 and / respectively.
This is done by e5ecuting the file LetcLinit. 6rocess dispatcher gives birth to the
shell. <ni5 eeps trac of all the processes in an internal data structure called the 6rocess
Table *listing command is ps 9el+.
2. What are various +!s associated with a process?
<ni5 identifies each process with a uni.ue integer called 6rocess&D. The process
that e5ecutes the re.uest for creation of a process is called the Tparent processT whose 6&D
is T6arent 6rocess &DT. 4very process is associated with a particular user called the TownerT
who has privileges over the process. The identification for the user is T<ser&DT. "wner is
the user who e5ecutes the process. 6rocess also has T4ffective <ser &DT which determines
the access privileges for accessing resources lie files.
getpid*+ 9process id
getppid*+ 9parent process id
getuid*+ 9user id
geteuid*+ 9effective user id
3. 1xplain for'24 system call.
The efor*+T used to create a new process from an e5isting process. The new
process is called the child process, and the e5isting process is called the parent. Fe can
tell which is which by checing the return value from efor*+T. The parent gets the childTs
pid returned to him, but the child gets C returned to him.
*. >redict the output of the following program code
main*+
]
for*+X
printf*N,ello ForldSN+X
^
Answer:
,ello ForldS,ello ForldS
Explanation7
The for creates a child that is a duplicate of the parent process. The child begins
from the for*+.All the statements after the call to for*+ will be e5ecuted twice.*once by
the parent process and other by child+. The statement before for*+ is e5ecuted only by
the parent process.
-. >redict the output of the following program code
main*+
]
for*+X for*+X for*+X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2A
Technical Aptitude Questions
printf*N,ello ForldSN+X
^
Answer:
N,ello ForldN will be printed E times.
Explanation7
28n times where n is the number of calls to for*+
0. List the system calls used for process management:
:%stem ($lls /es(ription
for*+ To create a new process
e5ec*+ To e5ecute a new program in a process
wait*+ To wait until a created process completes its e5ecution
e5it*+ To e5it from a process e5ecution
getpid*+ To get a process identifier of the current process
getppid*+ To get parent process identifier
nice*+ To bias the e5isting priority of a process
br*+ To increaseLdecrease the data segment size of a process
5. )ow can you getGset an environment varia.le from a program?
%etting the value of an environment variable is done by using egetenv*+T.
Setting the value of an environment variable is done by using eputenv*+T.
7. )ow can a parent and child process communicate?
A parent and child can communicate through any of the normal inter9process
communication schemes *pipes, socets, message .ueues, shared memory+, but also have
some special ways to communicate that tae advantage of their relationship as a parent
and child. "ne of the most obvious is that the parent can get the e5it status of the child.
?. What is a Com.ie?
Fhen a program fors and the child finishes before the parent, the ernel still
eeps some of its information about the child in case the parent might need it 9 for
e5ample, the parent may need to chec the childTs e5it status. To be able to get this
information, the parent calls ewait*+TX &n the interval between the child terminating and the
parent calling ewait*+T, the child is said to be a ezombieT *&f 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 e5ecutes it changes state according to its circumstances. <ni5
processes have the following states7
'unning 7 The process is either running or it is ready to run .
Faiting 7 The process is waiting for an event or for a resource.
Stopped 7 The process has been stopped, usually by receiving a signal.
fombie 7 The process is dead but have not been removed from the process table.
11. What )appens when you execute a program?
Fhen you e5ecute a program on your <$&H system, the system creates a special
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2G
Technical Aptitude Questions
environment for that program. This environment contains everything needed for the
system to run the program as if no other program were running on the system. 4ach
process has process conte5t, which is everything that is uni.ue about the state of the
program you are currently running. 4very time you e5ecute a program the <$&H system
does a for, which performs a series of operations to create a process conte5t and then
e5ecute your program in that conte5t. The steps include the following7
Allocate a slot in the process table, a list of currently running programs ept by
<$&H.
Assign a uni.ue process identifier *6&D+ to the process.
i!opy the conte5t of the parent, the process that re.uested the spawning of the new
process.
'eturn the new 6&D to the parent process. This enables the parent process to e5amine
or control the process directly.
After the for is complete, <$&H runs your program.
12. What )appens when you execute a command?
Fhen you enter TlsT command to loo at the contents of your current woring
directory, <$&H does a series of things to create an environment for ls and the run it7 The
shell has <$&H perform a for. This creates a new process that the shell will use to run
the ls program. The shell has <$&H perform an e5ec of the ls program. This replaces the
shell program and data with the program and data for ls and then starts running that new
program. The ls program is loaded into the new process conte5t, replacing the te5t and
data of the shell. The ls program performs its tas, listing the contents of the current
directory.
13. What is a !aemon?
A daemon is a process that detaches itself from the terminal and runs,
disconnected, in the bacground, waiting for re.uests and responding to them. &t can also
be defined as the bacground process that does not belong to a terminal session. #any
system functions are commonly performed by daemons, including the sendmail daemon,
which handles mail, and the $$T6 daemon, which handles <S4$4T news. #any other
daemons may e5ist. Some of the most common daemons are7
init7 Taes over the basic running of the system when the ernel has finished the boot
process.
inetd7 'esponsible for starting networ services that do not have their own stand9
alone daemons. 1or e5ample, inetd usually taes care of incoming rlogin, telnet, and
ftp connections.
cron7 'esponsible for running repetitive tass on a regular schedule.
1*. What is WpsW command for?
The ps command prints the process status for some or all of the running
processes. The information given are the process identification number *6&D+,the amount
of time that the process has taen to e5ecute so far etc.
1-. )ow would you 'ill a process?
The ill command taes the 6&D as one argumentX this identifies which process to
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2E
Technical Aptitude Questions
terminate. The 6&D of a process can be got using TpsT command.
10. What is an advantage of executing a process in .ac'ground?
The most common reason to put a process in the bacground is to allow you to do
something else interactively without waiting for the process to complete. At the end of
the command you add the special bacground symbol, U. This symbol tells your shell to
e5ecute the given command in the bacground.
45ample7 cp :.: ..LbacupU *cp is for copy+
15. )ow do you execute one program from within another?
The system calls used for low9level process creation are e5eclp*+ and e5ecvp*+.
The e5eclp call overlays the e5isting program with the new one , runs that and e5its. The
original program gets bac control only when an error occurs.
e5eclp*path,fileMname,arguments..+X LLlast argument must be $<00
A variant of e5eclp called e5ecvp is used when the number of arguments is not nown in
advance.
e5ecvp*path,argumentMarray+X LLargument array should be terminated by $<00
17. What is +>,? What are the various schemes availa.le?
The term &6! *&nter96rocess !ommunication+ describes various ways by which
different process running on some operating system communicate between each other.
-arious schemes available are as follows7
>ipes:
"ne9way communication scheme through which different process can
communicate. The problem is that the two processes should have a common
ancestor *parent9child relationship+. ,owever this problem was fi5ed with the
introduction of named9pipes *1&1"+.
#essage Aueues :
#essage .ueues can be used between related and unrelated processes
running on a machine.
$hared #emory:
This is the fastest of all &6! schemes. The memory to be shared is mapped
into the address space of the processes *that are sharing+. The speed achieved is
attributed to the fact that there is no ernel involvement. (ut this scheme needs
synchronization.
-arious forms of synchronisation are mute5es, condition9variables, read9write
locs, record9locs, and semaphores.
S4!T&"$ 9 &&&
#4#"'I #A$A%4#4$T
1. What is the difference .etween $wapping and >aging?
$wapping:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>2K
Technical Aptitude Questions
Fhole process is moved from the swap device to the main memory for
e5ecution. 6rocess size must be less than or e.ual to the available main memory. &t is
easier to implementation and overhead to the system. Swapping systems does not handle
the memory more fle5ibly as compared to the paging systems.
>aging:
"nly the re.uired memory pages are moved to main memory from the
swap device for e5ecution. 6rocess size does not matter. %ives the concept of the virtual
memory.
&t provides greater fle5ibility in mapping the virtual address space into the
physical memory of the machine. Allows more number of processes to fit in the main
memory simultaneously. Allows the greater process size than the available physical
memory. Demand paging systems handle the memory more fle5ibly.
2. What is major difference .etween the )istoric Qnix and the new "$! release of Qnix
$ystem B in terms of #emory #anagement?
,istoric <ni5 uses Swapping ) entire process is transferred to the main memory
from the swap device, whereas the <ni5 System - uses Demand 6aging ) only the part of
the process is moved to the main memory. ,istoric <ni5 uses one Swap Device and <ni5
System - allow multiple Swap Devices.
3. What is the main goal of the #emory #anagement?
&t decides which process should reside in the main memory,
#anages the parts of the virtual address space of a process which is non9core
resident,
#onitors the available main memory and periodically write the processes into the
swap device to provide more processes fit in the main memory simultaneously.
*. 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 number of the resource units available there.
This allows 1irst91it allocation of contiguous blocs of a resource. &nitially the
#ap contains one entry ) address *bloc offset from the starting of the swap area+ and the
total number of resources.
_ernel treats each unit of #ap as a group of dis blocs. "n the allocation and
freeing of the resources _ernel updates the #ap for accurate information.
-. What scheme does the [ernel in Qnix $ystem B follow while choosing a swap device
among the multiple swap devices?
_ernel follows 'ound 'obin scheme choosing a swap device among the multiple
swap devices in <ni5 System -.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>/C
> >C,CCC
Address <nits
Technical Aptitude Questions
0. What is a egion?
A 'egion is a continuous area of a process3s address space *such as te5t, data and
stac+. The ernel in a 2'egion Table3 that is local to the process maintains region.
'egions are sharable among the process.
5. What are the events done .y the [ernel after a process is .eing swapped out from the
main memory?
Fhen _ernel swaps the process out of the primary memory, it performs the
following7
_ernel decrements the 'eference !ount of each region of the process. &f the
reference count becomes zero, swaps the region out of the main memory,
_ernel allocates the space for the swapping process in the swap device,
_ernel locs 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.
6rocess before swapping is residing in the primary memory in its original form.
The regions *te5t, data and stac+ may not be occupied fully by the process, there may be
few empty slots in any of the regions and while swapping _ernel do not bother about the
empty slots while swapping the process out.
After swapping the process resides in the swap *secondary memory+ device. The
regions swapped out will be present but only the occupied region slots but not the empty
slots that were present before assigning.
Fhile swapping the process once again into the main memory, the _ernel
referring to the 6rocess #emory #ap, it assigns the main memory accordingly taing
care of the empty slots in the regions.
?. What do you mean .y u3area 2user area4 or u3.loc'?
This contains the private data that is manipulated only by the _ernel. This is local
to the 6rocess, i.e. each process is allocated a u9area.
1@. What are the entities that are swapped out of the main memory while swapping the
process out of the main memory?
All memory space occupied by the process, process3s u9area, and _ernel stac are
swapped out, theoretically.
6ractically, if the process3s u9area contains the Address Translation Tables for the
process then _ernel implementations do not swap the u9area.
11. What is <or' swap?
for*+ is a system call to create a child process. Fhen the parent process calls
for*+ system call, the child process is created and if there is short of memory then the
child process is sent to the read9to9run state in the swap device, and return to the user
state without swapping the parent process. Fhen the memory will be available the child
process will be swapped into the main memory.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>/>
Technical Aptitude Questions
12. What is 1xpansion swap?
At the time when any process re.uires more memory than it is currently allocated,
the _ernel performs 45pansion swap. To do this _ernel reserves enough space in the
swap device. Then the address translation mapping is ad=usted for the new virtual address
space but the physical memory is not allocated. At last _ernel swaps the process into the
assigned space in the swap device. 0ater when the _ernel swaps the process into the
main memory this assigns memory according to the new address translation mapping.
13. )ow the $wapper wor's?
The swapper is the only process that swaps the processes. The Swapper operates
only in the _ernel mode and it does not uses System calls instead it uses internal _ernel
functions for swapping. &t is the archetype of all ernel process.
1*. What are the processes that are not .othered .y the swapper? =ive eason.
fombie process7 They do not tae any up physical memory.
6rocesses loced in memories that are updating the region of the process.
_ernel swaps only the sleeping processes rather than the 2ready9to9run3
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 wors on the highest scheduling priority. 1irstly it will loo for any
sleeping process, if not found then it will loo for the ready9to9run process for swapping.
(ut the ma=or re.uirement for the swapper to wor the ready9to9run process must be
core9resident for at least 2 seconds before swapping out. And for swapping in the process
must have been resided in the swap device for at least 2 seconds. &f the re.uirement is not
satisfied then the swapper will go into the wait state on that event and it is awaen 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 time of the processes in the swap device, the priority of the processes
and the amount of time 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 process3s memory resident time,
6riority of the process and
The nice value.
17. What do you mean .y nice value?
$ice value is the value that controls ]increments or decrements^ the priority of
the process. This value that is returned by the nice *+ system call. The e.uation for using
nice value is7
>riority I 2\recent ,>Q usage]Gconstant4 8 2.ase3 priority4 8 2nice value4
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>/2
Technical Aptitude Questions
"nly the administrator can supply the nice value. The nice *+ system call wors
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 main memory are asleep.
All 2ready9to9run3 processes are swapped out.
There is no space in the swap device for the new incoming process that are
swapped out of the main memory.
There is no space in the main memory for the new incoming process.
2@. What are conditions for a machine to support !emand >aging?
#emory architecture must based on 6ages,
The machine must support the 2restartable3 instructions.
21. What is Xthe principle of localityF?
&t3s the nature of the processes that they refer only to the small subset of the total
data space of the process. i.e. the process fre.uently calls the same subroutines or
e5ecutes 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 2n3, references, where
2n3 is called the window of the woring set of the process.
23. What is the window of the wor'ing set of a process?
The window of the woring set of a process is the total number in which the
process had referred the set of pages in the woring set of the process.
2*. What is called a page fault?
6age fault is referred to the situation when the process addresses a page in the
woring set of the process but the process fails to locate the page in the woring set. And
on a page fault the ernel updates the woring set by reading the page from the secondary
device.
2-. What are data structures that are used for !emand >aging?
_ernel contains B data structures for Demand paging. They are,
6age table entries,
Dis bloc descriptors,
6age frame data table *pfdata+,
Swap9use table.

20. What are the .its that support the demand paging?
-alid, 'eference, #odify, !opy 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) - ll !ight" !e"erved
>//
Technical Aptitude Questions
6age address
Age !opy on write #odify 'eference -alid 6rotection
25. )ow the [ernel handles the for'24 system call in traditional Qnix and in the $ystem B
Qnix% while swapping?
_ernel in traditional <ni5, maes the duplicate copy of the parent3s address space
and attaches it to the child3s process, while swapping. _ernel in System - <ni5,
manipulates the region tables, page table, and pfdata table entries, by incrementing the
reference count of the region table of shared regions.
27. !ifference .etween the for'24 and vfor'24 system call?
During the for*+ system call the _ernel maes a copy of the parent process3s
address space and attaches it to the child process.
(ut the vfor*+ system call do not maes any copy of the parent3s address space,
so it is faster than the for*+ system call. The child process as a result of the vfor*+
system call e5ecutes e5ec*+ system call. The child process from vfor*+ system call
e5ecutes in the parent3s address space *this can overwrite the parent3s data and stac +
which suspends the parent process until the child process e5its.
2?. What is "$$2"loc' $tarted .y $ym.ol4?
A data representation at the machine level, that has initial values when a program
starts and tells about how much space the ernel allocates for the un9initialized data.
_ernel initializes it to zero at run9time.
3@. What is >age3$tealer process?
This is the _ernel process that maes rooms for the incoming pages, by swapping
the memory pages that are not the part of the woring set of a process. 6age9Stealer is
created by the _ernel at the system initialization and invoes it throughout the lifetime of
the system. _ernel locs 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 are7
The page is aging and is not yet eligible for swapping,
The page is eligible for swapping but not yet eligible for reassignment to other virtual
address space.
32. What are the phases of swapping a page from the memory?
6age stealer finds the page eligible for swapping and places the page number
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, decrements the pfdata reference count, and places
the pfdata table entry at the end of the free list if its reference count is C.
33. What is page fault? +ts types?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>/B
Technical Aptitude Questions
6age fault refers to the situation of not having a page in the main memory when
any process references it.
There are two types of page fault 7
-alidity fault,
6rotection fault.
3*. +n what way the <ault )andlers and the +nterrupt handlers are different?
1ault handlers are also an interrupt handler with an e5ception that the interrupt
handlers cannot sleep. 1ault handlers sleep in the conte5t of the process that caused the
memory fault. The fault refers to the running process and no arbitrary processes are put to
sleep.
3-. What is validity fault?
&f a process referring a page in the main memory whose valid bit is not set, it
results in validity fault.
The valid bit is not set for those pages7
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.
/A. What does the swapping system do if it identifies the illegal page for swapping?
&f the dis bloc descriptor does not contain any record of the faulted page, then
this causes the attempted memory reference is invalid and the ernel sends a
\$egmentation violation] signal to the offending process. This happens when the
swapping system identifies any invalid memory reference.
35. What are states that the page can .e in% after causing a page fault?
"n a swap device and not in memory,
"n the free page list in the main memory,
&n an e5ecutable file,
#ared [demand zero\,
#ared [demand fill\.
37. +n what way the validity fault handler concludes?
&t sets the valid bit of the page by clearing the modify bit.
&t recalculates the process priority.
3?. 6t what mode the fault handler executes?
At the _ernel #ode.
*@. What do you mean .y the protection fault?
6rotection fault refers to the process accessing the pages, which do not have the
access permission. A process also incur the protection fault when it attempts to write a
page whose copy on write bit was set during the for*+ system 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) - ll !ight" !e"erved
>/?
Technical Aptitude Questions
&n situations lie, where the copy on write bit of a page is set and that page is
shared by more 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 number. Then _ernel
decrements the reference count of the old pfdata table entry.
&n cases lie, 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 from its dis copy *if one e5ists+,
because other process may share the dis copy. Then it removes the pfdata table entry
from the page9.ueue as the new copy of the virtual page is not on the swap device. &t
decrements the swap9use count for the page and if count drops to C, frees the swap space.
*2. <or which 'ind of fault the page is chec'ed first?
The page is first checed for the validity fault, as soon as it is found that the page
is invalid *valid bit is clear+, the validity fault handler returns immediately, 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 e5ecution of the fault handler, it sets the modify and protection
bits and clears the copy on write bit. &t recalculates the process9priority and checs 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
memory. &f the sum of the woring sets of all processes is greater that the physical
memory then the fault handler will usually sleep because it cannot allocate pages for a
process. This results in the reduction of the system throughput because _ernel spends too
much time in overhead, rearranging the memory in the frantic pace.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>/A
Technical Aptitude Questions
'D(#S !oncepts
1. What is data.ase?
A database is a logically coherent collection of data with some inherent meaning,
representing some aspect of real world and which is designed, built and populated with
data for a specific purpose.
2. What is !"#$?
&t is a collection of programs that enables user to create and maintain a database.
&n other words it is general9purpose 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 system.
*. 6dvantages of !"#$?
'edundancy is controlled.
<nauthorised access is restricted.
6roviding multiple user interfaces.
4nforcing integrity constraints.
6roviding bacup and recovery.
-. !isadvantage in <ile >rocessing $ystem?
Data redundancy U inconsistency.
Difficult in accessing data.
Data isolation.
Data integrity.
!oncurrent access is not possible.
Security 6roblems.
0. !escri.e the three levels of data a.straction?
The are three levels of abstraction7
>hysical level: The lowest level of abstraction describes how data are stored.
Logical level: The ne5t higher level of abstraction, describes what data are stored in
database and what relationship among 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) - ll !ight" !e"erved
>/G
RDBMS Concepts

Technical Aptitude Questions
There are two &ntegrity rules.
1ntity +ntegrity: States that [6rimary ey cannot have $<00 value\
eferential +ntegrity: States that [1oreign _ey can be either a $<00 value
or should be 6rimary _ey value of other relation.
7. What is extension and intension?
1xtension 9
&t is the number of tuples present in a table at any instance. This is time
dependent.
+ntension 9
&t is a constant value that gives the name, structure of table and the
constraints laid on it.
?. What is $ystem ? What are its two major su.systems?
System ' was designed and developed over a period of >KGB9GK at &(# San Dose
'esearch !enter. &t is a prototype and its purpose was to demonstrate that it is possible to
build a 'elational System that can be used in a real life environment to solve real life
problems, with performance at least comparable to that of e5isting system.
&ts two subsystems are
'esearch Storage
System 'elational Data System.
1@. )ow is the data structure of $ystem different from the relational structure?
<nlie 'elational systems in System '
Domains are not supported
4nforcement of candidate ey uni.ueness is optional
4nforcement of entity integrity is optional
'eferential integrity is not enforced
11. What is !ata +ndependence?
Data independence means that [the application is independent of the storage
structure and access strategy of data\. &n other words, The ability to modify the schema
definition in one level should not affect the schema definition in the ne5t higher level.
Two types of Data &ndependence7
6hysical Data &ndependence7 #odification in physical level should not
affect the logical level.
0ogical Data &ndependence7 #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 may be thought of as a virtual table, that is, a table that does not really
e5ist in its own right but is instead derived from one or more underlying base table. &n
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) - ll !ight" !e"erved
>/E
Technical Aptitude Questions
%rowth and restructuring of base tables is not reflected in views. Thus the view
can insulate users from 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
semantics and constraints.
1*. What is 13 model?
This data model is based on real world that consists of basic ob=ects called entities
and of relationship among these ob=ects. 4ntities are described in a database by a set of
attributes.
1-. What is E.ject Eriented model?
This model 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 methods. "b=ects that contain same types
of values and the same methods are grouped together into classes.
10. What is an 1ntity?
&t is a TthingT in the real world with an independent e5istence.
15. What is an 1ntity type?
&t is a collection *set+ of entities that have same attributes.
17. What is an 1ntity set?
&t 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 may not have sufficient attributes to form a primary ey, and its
primary ey compromises of its partial ey and primary ey of its parent entity, then it is
said to be Fea 4ntity set.
21. What is an attri.ute?
&t is a particular property, which describes the entity.
22. What is a elation $chema and a elation?
A relation Schema denoted by '*A>, A2, J, An+ is made up of the relation name
' and the list of attributes Ai that it contains. A relation is defined as a set of tuples. 0et r
be the relation which contains set tuples *t>, t2, t/, ..., tn+. 4ach tuple is an ordered list of
n9values t@*v>,v2, ..., vn+.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>/K
Technical Aptitude Questions
23. What is degree of a elation?
&t is the number of attribute of its relation schema.
2*. What is elationship?
&t is an association among two or more entities.
2-. What is elationship set?
The collection *or set+ of similar relationships.
20. What is elationship type?
'elationship type defines a set of associations or a relationship set among a given
set of entity types.

25. What is degree of elationship type?
&t is the number of entity type participating.
2-. What is !!L 2!ata !efinition Language4?
A data base schema is specifies by a set of definitions e5pressed by a special
language called DD0.
20. What is B!L 2Biew !efinition Language4?
&t specifies user views and their mappings to the conceptual schema.
25. What is $!L 2$torage !efinition Language4?
This language is to specify the internal schema. This language may specify the
mapping between two schemas.
27. What is !ata $torage 3 !efinition Language?
The storage structures and access methods used by database system are specified
by a set of definition in a special type of DD0 called data storage9definition language.
2?. What is !#L 2!ata #anipulation Language4?
This language that enable user to access or manipulate data as organised by
appropriate data model.
>rocedural !#L or Low level: D#0 re.uires a user to specify what data are needed
and how to get those data.
&on3>rocedural !#L or )igh level: D#0 re.uires a user to specify what data are
needed without specifying how to get those data.
31. What is !#L ,ompiler?
&t translates D#0 statements in a .uery language into low9level instruction that
the .uery evaluation engine can understand.
32. What is Auery evaluation engine?
&t e5ecutes low9level instruction generated by compiler.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>BC
Technical Aptitude Questions
33. What is !!L +nterpreter?
&t interprets DD0 statements and record them in tables containing metadata.
3*. What is ecord3at3a3time?
The 0ow level or 6rocedural D#0 can specify and retrieve each record from a set
of records. This retrieve of a record is said to be 'ecord9at9a9time.
3-. What is $et3at3a3time or $et3oriented?
The ,igh level or $on9procedural D#0 can specify and retrieve many records in
a single D#0 statement. This retrieve of a record is said to be Set9at9a9time or Set9
oriented.
30. What is elational 6lge.ra?
&t is procedural .uery language. &t consists of a set of operations that tae one or
two relations as input and produce a new relation.
35. What is elational ,alculus?
&t is an applied predicate calculus specifically tailored for relational databases
proposed by 4.1. !odd. 4.g. of languages based on it are DS0 A06,A, Q<40.
38. )ow does Duple3oriented relational calculus differ from domain3oriented
relational calculus
The tuple9oriented calculus uses a tuple variables i.e., variable whose only
permitted values are tuples of that relation. 4.g. Q<40
The domain9oriented calculus has domain variables i.e., variables that range over the
underlying domains instead of over relation. 4.g. &00, D4D<!4.
3?. What is normaliCation?
&t is a process of analysing the given relation schemas based on their 1unctional
Dependencies *1Ds+ and primary ey to achieve the properties
#inimizing redundancy
#inimizing insertion, deletion and update anomalies.
*@. What is <unctional !ependency?
A 1unctional dependency is denoted by H I between two sets of attributes H
and I that are subsets of ' specifies a constraint on the possible tuple that can form a
relation state r of '. The constraint is for any two tuples t> and t2 in r if t>OHP @ t2OHP
then they have t>OIP @ t2OIP. This means the value of H component of a tuple uni.uely
determines the value of component I.
*1. When is a functional dependency < said to .e minimal?
4very dependency in 1 has a single attribute for its right hand side.
Fe cannot replace any dependency H A in 1 with a dependency I A where I is a
proper subset of H and still have a set of dependency that is e.uivalent to 1.
Fe cannot remove any dependency from 1 and still have set of dependency that is
e.uivalent to 1.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>B>
Technical Aptitude Questions
*2. What is #ultivalued dependency?
#ultivalued dependency denoted by H I specified on relation schema ',
where H and I are both subsets of ', specifies the following constraint on any relation r
of '7 if two tuples t> and t2 e5ist in r such that t>OHP @ t2OHP then t/ and tB should also
e5ist in r with the following properties
t/O5P @ tBOHP @ t>OHP @ t2OHP
t/OIP @ t>OIP and tBOIP @ t2OIP
t/OfP @ t2OfP and tBOfP @ t>OfP
where Of @ *'9*H < I++ P

*3. What is Lossless join property?
&t guarantees that the spurious tuple generation does not occur with respect to
relation schemas after decomposition.
**. What is 1 &< 2&ormal <orm4?
The domain of attribute must include only atomic *simple, indivisible+ values.
*-. What is <ully <unctional dependency?
&t is based on concept of full functional dependency. A functional dependency
H I is full functional dependency if removal of any attribute A from H means that the
dependency does not hold any more.
*0. What is 2&<?
A relation schema ' is in 2$1 if it is in >$1 and every non9prime attribute A in '
is fully functionally dependent on primary ey.
*5. What is 3&<?
A relation schema ' is in /$1 if it is in 2$1 and for every 1D H A either of the
following is true
H is a Super9ey of '.
A is a prime attribute of '.
&n other words, if every non prime attribute is non9transitively dependent on
primary ey.
*7. What is ",&< 2"oyce3,odd &ormal <orm4?
A relation schema ' is in (!$1 if it is in /$1 and satisfies an additional
constraint that for every 1D H A, H must be a candidate ey.

*?. What is *&<?
A relation schema ' is said to be in B$1 if for every #ultivalued dependency
H I that holds over ', one of following is true
H is subset or e.ual to *or+ HI @ '.
H is a super ey.
-@. What is -&<?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>B2
Technical Aptitude Questions
A 'elation schema ' is said to be ?$1 if for every =oin dependency ]'>, '2, ...,
'n^ that holds ', one the following is true
'i @ ' for some i.
The =oin dependency is implied by the set of 1D, over ' in which the left side is ey
of '.
-1. What is !omain3[ey &ormal <orm?
A relation is said to be in D_$1 if all constraints and dependencies that should
hold on the the constraint can be enforced by simply enforcing the domain
constraint and ey constraint on the relation.

-2. What are partial% alternate%% artificial% compound and natural 'ey?
>artial [ey:
&t is a set of attributes that can uni.uely identify wea entities and that are
related to same owner entity. &t is sometime called as Discriminator.
6lternate [ey:
All !andidate _eys e5cluding the 6rimary _ey are nown as Alternate
_eys.
6rtificial [ey7
&f no obvious ey, either stand alone or compound is available, then the
last resort is to simply create a ey, by assigning a uni.ue number to each record or
occurrence. Then this is nown as developing an artificial ey.
,ompound [ey:
&f no single data element uni.uely identifies occurrences within a
construct, then combining multiple elements to create a uni.ue identifier for the construct
is nown as creating a compound ey.
&atural [ey:
Fhen one of the data elements stored within a construct is utilized as the
primary ey, then it is called the natural ey.
-3. What is indexing and what are the different 'inds of indexing?
&nde5ing is a techni.ue for determining how .uicly specific data can be found.
Types7
(inary search style inde5ing
(9Tree inde5ing
&nverted list inde5ing
#emory resident table
Table inde5ing
-*. What is system catalog or catalog relation? )ow is .etter 'nown as?
A 'D(#S maintains a description of all the data that it contains, information
about every relation and inde5 that it contains. This information is stored in a collection
of relations maintained by the system called metadata. &t is also called data dictionary.
--. What is meant .y /uery optimiCation?
The phase that identifies an efficient e5ecution plan for evaluating a .uery that
has the least estimated cost is referred to as .uery optimization.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>B/
Technical Aptitude Questions
-0. What is join dependency and inclusion dependency?
Yoin !ependency:
A Doin dependency is generalization of #ultivalued dependency.A
DD ]'>, '2, ..., 'n^ is said to hold over a relation ' if '>, '2, '/, ..., 'n is a lossless9
=oin decomposition of ' . There is no set of sound and complete inference rules for DD.
+nclusion !ependency:
An &nclusion Dependency is a statement of the form that some columns of
a relation are contained in other columns. A foreign ey constraint is an e5ample of
inclusion dependency.
-5. What is dura.ility in !"#$?
"nce the D(#S informs the user that a transaction has successfully completed,
its effects should persist even if the system crashes before all its changes are reflected on
dis. This property is called durability.
-7. What do you mean .y atomicity and aggregation?
6tomicity:
4ither all actions are carried out or none are. <sers should not have to
worry about the effect of incomplete transactions. D(#S ensures this by undoing the
actions of incomplete transactions.
6ggregation:
A concept which is used to model a relationship between a collection of
entities and relationships. &t is used when we need to e5press a relationship among
relationships.
-?. What is a >hantom !eadloc'?
&n distributed deadloc detection, the delay in propagating local information
might cause the deadloc detection algorithms to identify deadlocs that do not really
e5ist. Such situations are called phantom deadlocs and they lead to unnecessary aborts.
0@. What is a chec'point and When does it occur?
A !hecpoint is lie a snapshot of the D(#S state. (y taing checpoints, the
D(#S can reduce the amount of wor to be done during restart in the event of
subse.uent crashes.
01. What are the different phases of transaction?
Different phases are
Analysis phase
'edo 6hase
<ndo phase
02. What do you mean .y flat file data.ase?
&t is a database in which there are no programs or user access languages. &t has no
cross9file capabilities but is user9friendly and provides user9interface management.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>BB
Technical Aptitude Questions
03. What is Ktransparent !"#$K?
&t is one, which eeps its 6hysical Structure hidden from user.
0*. "rief theory of &etwor'% )ierarchical schemas and their properties
$etwor schema uses a graph data structure to organize records e5ample for such
a database management system is !T!% while a hierarchical schema uses a tree data
structure e5ample for such a system is &#S.
0-. What is a /uery?
A .uery with respect to D(#S relates to user commands that are used to interact
with a data base. The .uery language can be classified into data definition language and
data manipulation language.
00. What do you mean .y ,orrelated su./uery?
Sub.ueries, or nested .ueries, are used to bring bac a set of rows to be used by
the parent .uery. Depending on how the sub.uery is written, it can be e5ecuted once for
the parent .uery or it can be e5ecuted once for each row returned by the parent .uery. &f
the sub.uery is e5ecuted for each row of the parent, this is called a correlated su./uery.
A correlated sub.uery can be easily identified if it contains any references to the
parent sub.uery columns in its F,4'4 clause. !olumns from the sub.uery cannot be
referenced anywhere else in the parent .uery. The following e5ample demonstrates a non9
correlated sub.uery.
4.g. Select : 1rom !<ST Fhere T>CLC/L>KKCT &$ *Select "DAT4 1rom "'D4'
Fhere !<ST.!$<# @ "'D4'.!$<#+
05. What are the primitive operations common to all record management systems?
Addition, deletion and modification.
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?
6'"D4!T&"$ and S404!T&"$.
5@. 6re the resulting relations of >E!Q,D and YE+& operation the same?
$o.
>E!Q,D7 !oncatenation of every row in one relation with every row in
another.
YE+&7 !oncatenation of rows from one relation and related rows from another.
51. What is !"#$ [1&1L?
Two important pieces of 'D(#S architecture are the ernel, which is the
software, and the data dictionary, which consists of the system9level data structures used
by the ernel to manage the database
Iou might thin of an 'D(#S as an operating system *or set of subsystems+,
designed specifically for controlling data accessX its primary functions are storing,
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>B?
Technical Aptitude Questions
retrieving, and securing data. An 'D(#S maintains its own list of authorized users and
their associated privilegesX manages memory caches and pagingX controls locing for
concurrent resource usageX dispatches and schedules user re.uestsX and manages space
usage within its table9space structures
.
52. &ame the su.3systems of a !"#$
&L", Security, 0anguage 6rocessing, 6rocess !ontrol, Storage #anagement,
0ogging and 'ecovery, Distribution !ontrol, Transaction !ontrol, #emory #anagement,
0oc #anagement
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 maintained e5clusively by the ernel.
5*. What is the jo. of the information stored in data3dictionary?
The information in the data dictionary validates the e5istence of the ob=ects,
provides access to them, and maps the actual physical storage location.
5-. &ot only !"#$ ta'es care of locating data it also
determines an optimal access path to store or retrieve the data
50. )ow do you communicate with an !"#$?
Iou communicate with an 'D(#S using Structured Query 0anguage *SQ0+
55. !efine $AL and state the differences .etween $AL and other conventional
programming Languages
SQ0 is a nonprocedural language that is designed specifically for data access
operations on normalized relational database structures. The primary difference between
SQ0 and other conventional programming languages is that SQ0 statements specify what
data operations should be performed rather than how to perform them.
57. &ame the three major set of files on dis' that compose a data.ase in Eracle
There are three ma=or sets of files on dis that compose a database. All the files
are binary. These are
Database files
!ontrol files
'edo logs
The most important 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 must be present, open, and available to "racle for any data
on the database to be useable. Fithout these files, you cannot access the database, and the
database administrator might have to recover some or all of the database using a bacup, if
there is one.
5?. What is an Eracle +nstance?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>BA
Technical Aptitude Questions
The "racle system processes, also nown as "racle bacground processes,
provide functions for the user processesgfunctions that would otherwise be done by the
user processes themselves
"racle database9wide system memory 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 bacground processes and user processes can use them.
The combination of the S%A and the "racle bacground 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 system processes that must always be up and running for the
database to be useable include !"W *Database Friter+, L=W *0og Friter+, $#E&
*System #onitor+, and >#E& *6rocess #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 size.
Depending on their sizes, 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 mae the database
structure very fle5ible for controlling access to storage for different users, putting the
database on different dis drives, or bacing up and restoring =ust part of the database.
Iou must have at least one database file but usually, more than one files
are used. &n terms of accessing and using the data in the tables and other ob=ects, the
number *or location+ of the files is immaterial.
The database files are fi5ed in size and never grow bigger than the size at
which they were created
,ontrol <iles
The control files and redo logs support the rest of the architecture. Any
database must have at least one control file, although you typically have more than one to
guard against loss. The control file records the name of the database, the date and time it
was created, the location of the database and redo logs, and the synchronization
information to ensure that all three sets of files are always in step. 4very time you add a
new database or redo log file to the database, the information is recorded in the control
files.
edo Logs
Any database must 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 system ob=ects. &f 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 committed transactions. &n the case of
non9data loss failure, "racle can apply the information in the redo logs automatically
without intervention from the D(A.
The redo log files are fi5ed in size and never grow dynamically from the
size at which they were created.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>BG
Technical Aptitude Questions
72. What is EW+!?
The '"F&D is a uni.ue database9wide 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 '"F&D consists of the following three components, the combination of
which uni.uely identifies the physical storage location of the row.
"racle database file number, which contains the bloc with the rows
"racle bloc address, which contains the row
The row within the bloc *because each bloc can hold many rows+
The '"F&D is used internally in inde5es as a .uic means of retrieving rows
with a particular ey value. Application developers also use it in SQ0 statements as a
.uic way to access a row once they now the '"F&D
73. What is Eracle "loc'? ,an two Eracle "loc's have the same address?
"racle NformatsN the database files into a number of "racle blocs when they are
first createdgmaing it easier for the 'D(#S software to manage the files and easier to
read data into the memory areas.
The bloc size should be a multiple of the operating system bloc size. 'egardless
of the bloc size, the entire bloc is not available for holding dataX "racle taes up some
space to manage the contents of the bloc. This bloc header has a minimum size, but it
can grow.
These "racle blocs are the smallest unit of storage. &ncreasing the "racle bloc
size can improve performance, but it should be done only when the database is first
created.
4ach "racle bloc is numbered se.uentially for each database file starting at >.
Two blocs can have the same bloc address if they are in different database files.
7*. What is data.ase Drigger?
A database trigger is a 60LSQ0 bloc that can defined to automatically e5ecute for
insert, update, and delete statements against a table. The trigger can e defined to e5ecute
once for the entire statement or once for every row that is inserted, updated, or deleted.
1or 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 60LSQ0.
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 dumps the definitions and data for the specified part of the
database to an operating system binary file. The +mport utility reads the file produced by
an e5port, recreates the definitions of ob=ects, and inserts the data
&f 45port and &mport are used as a means of bacing up and recovering the
database, all the changes made to the database cannot be recovered since the e5port was
performed. The best you can do is recover the database to the time when the e5port was
last performed.
70. What are stored3procedures? 6nd what are the advantages of using them.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>BE
Technical Aptitude Questions
Stored procedures are database ob=ects that perform a user defined operation. A
stored procedure can have a set of compound SQ0 statements. A stored procedure
e5ecutes the SQ0 commands 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
60LSQ0 e5ception handling is a mechanism for dealing with run9time errors
encountered during procedure e5ecution. <se of this mechanism enables e5ecution to
continue if the error is not severe enough to cause procedure termination.
The e5ception handler must be defined within a subprogram specification. 4rrors
cause the program to raise an e5ception with a transfer of control to the e5ception9handler
bloc. After the e5ception handler e5ecutes, control returns to the bloc in which the
handler was defined. &f there are no more e5ecutable statements in the bloc, control
returns to the caller.
Qser3!efined 1xceptions
60LSQ0 enables the user to define e5ception handlers in the declarations
area of subprogram specifications. <ser accomplishes this by naming an e5ception as in
the following e5ample7
otMfailure 4H!46T&"$X
&n this case, the e5ception name is otMfailure. !ode associated with this handler is written
in the 4H!46T&"$ specification area as follows7
4H!46T&"$
when "TM1A&0<'4 then
outMstatusMcode 7@ gMoutMstatusMcodeX
outMmsg 7@ gMoutMmsgX
The following is an e5ample of a subprogram e5ception7
4H!46T&"$
when $"MDATAM1"<$D then
gMoutMstatusMcode 7@ T1A&0TX
'A&S4 otMfailureX
Fithin this e5ception is the 'A&S4 statement that transfers control bac to the otMfailure
e5ception handler. This techni.ue of raising the e5ception is used to invoe all user9
defined e5ceptions.
$ystem3!efined 1xceptions
45ceptions internal to 60LSQ0 are raised automatically upon error.
$"MDATAM1"<$D is a system9defined e5ception. Table below gives a complete list of
internal e5ceptions.
>LG$AL internal exceptions.
Ex'eption Nae 3ra'le Error
!<'S"'MA0'4ADIM"64$ "'A9CA?>>
D<6M-A0M"$M&$D4H "'A9CCCC>
&$-A0&DM!<'S"' "'A9C>CC>
&$-A0&DM$<#(4' "'A9C>G22
0"%&$MD4$&4D "'A9C>C>G
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>BK
Technical Aptitude Questions
$"MDATAM1"<$D "'A9C>BC/
$"TM0"%%4DM"$ "'A9C>C>2
6'"%'A#M4''"' "'A9CA?C>
ST"'A%4M4''"' "'A9CA?CC
T&#4"<TM"$M'4S"<'!4 "'A9CCC?>
T""M#A$IM'"FS "'A9C>B22
T'A$SA!T&"$M(A!_4DM"<T "'A9CCCA>
-A0<4M4''"' "'A9CA?C2
f4'"MD&-&D4 "'A9C>BGA
&n addition to this list of e5ceptions, there is a catch9all e5ception named
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 60LSQ0 relates to the idea that you can define
procedures and functions with the same name. 60LSQ0 does not loo only at the
referenced name, however, to resolve a procedure or function call. The count and data
types of formal parameters are also considered.
60LSQ0 also attempts to resolve any procedure or function calls in locally defined
pacages before looing at globally defined pacages or internal functions. To further
ensure calling the proper procedure, you can use the dot notation. 6refacing a procedure
or function name with the pacage name fully .ualifies any procedure or function
reference.
7?. Da.les derived from the 1!
a+ Are totally unnormalised
b+ Are always in >$1
c+ !an be further denormalised
d+ #ay have multi9valued attributes
*b+ Are always in >$1
?@. $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 made on eys that are not primary eys.
?1. 6 " , is a set of attri.utes. Dhe functional dependency is as follows
6" 3V "
6, 3V ,
, 3V "
a+ is in >$1
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?C
Technical Aptitude Questions
b+ is in 2$1
c+ is in /$1
d+ is in (!$1
*a+ is in >$1 since *A!+
;
@ ] A, (, !^ hence A! is the primary ey. Since !
( is a 1D given, where neither ! is a _ey nor ( is a prime attribute, this it is not in /$1.
1urther ( is not functionally dependent on ey A! thus it is not in 2$1. Thus the given
1Ds is in >$1.
?2. +n mapping of 1! to !<!
a+ entities in 4'D should correspond to an e5isting entityLstore in D1D
b+ entity in D1D is converted to attributes of an entity in 4'D
c+ relations in 4'D has > to > correspondence to processes in D1D
d+ relationships in 4'D has > to > correspondence to flows in D1D
*a+ entities in 4'D should correspond to an e5isting entityLstore in D1D
?3. 6 dominant entity is the entity
a+ on the $ side in a > 7 $ relationship
b+ on the > side in a > 7 $ relationship
c+ on either side in a > 7 > relationship
d+ nothing to do with > 7 > or > 7 $ relationship
*b+ on the > side in a > 7 $ 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+ 4rror 9 the string in single .uotes T$"'T,T and TS"<T,T
c+ 4rror 9 the string should be in double .uotes
d+ 4rror 9 "'D4' (I clause
*d+ 4rror 9 the "'D4' (I clause. Since "'D4' (I clause cannot be used in
<$&"$S
?-. What is $torage #anager?
&t is a program module that provides the interface between the low9level data
stored in database, application programs and .ueries submitted to the system.

?0. What is "uffer #anager?
&t is a program module, which is responsible for fetching data from dis storage
into main memory and deciding what data to be cache in memory.
?5. What is Dransaction #anager?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?>
Technical Aptitude Questions
&t is a program module, which ensures that database, remains in a consistent state
despite system failures and concurrent transaction e5ecution proceeds without
conflicting.
?7. What is <ile #anager?
&t is a program module, which manages the allocation of space on dis storage
and data structure used to represent information stored on a dis.
??. What is 6uthoriCation and +ntegrity manager?
&t is the program module, which tests for the satisfaction of integrity constraint
and checs the authority of user to access data.

1@@. What are stand3alone procedures?
6rocedures that are not part of a pacage are nown as stand9alone because they
independently defined. A good e5ample of a stand9alone procedure is one written in a
SQ0:1orms application. These types of procedures are not available for reference from
other "racle tools. Another limitation of stand9alone procedures is that they are compiled
at run time, which slows e5ecution.
1@1. What are cursors give different types of cursors.
60LSQ0 uses cursors for all database information accesses statements. 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:
&t 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 from the
dis directly to tape. Iou must shut down the instance to guarantee a consistent copy.
&f a cold bacup is performed, the only option available in the event of
data file loss is restoring all the files from the latest bacup. All wor performed on the
database since the last bacup is lost.
)ot "ac'up:
Some sites *such as worldwide airline reservations systems+ cannot
shut down the database while maing a bacup copy of the files. The cold bacup is not
an available option.
So different means of bacing up database must be used g the hot
bacup. &ssue a SQ0 command to indicate to "racle, on a tablespace9by9tablespace basis,
that the files of the tablespace are to baced up. The users can continue to mae full use
of the files, including maing changes to the data. "nce the user has indicated that heLshe
wants to bac up the tablespace files, heLshe can use the operating system to copy those
files to the desired bacup destination.
The database must be running in A'!,&-40"% mode for the hot
bacup option.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?2
Technical Aptitude Questions
&f a data loss failure does occur, the lost database files can be restored
using the hot bacup and the online and offline redo logs created since the bacup was
done. The database is restored to the most consistent state without any loss of committed
transactions.
1@3. What are 6rmstrong rules? )ow do we say that they are complete andGor sound
The well9nown inference rules for 1Ds
'efle5ive rule 7
&f I is subset or e.ual to H then H I.
Augmentation rule7
&f H I then Hf If.
Transitive rule7
&f ]H I, I f^ then H f.
Decomposition rule 7
&f H If then H I.
<nion or Additive rule7
&f ]H I, H f^ then H If.
6seudo Transitive rule 7
&f ]H I, FI f^ then FH f.
"f these the first three are nown as Amstrong 'ules. They are sound because it is
enough if a set of 1Ds satisfy these three. They are called complete because using these
three rules we can generate the rest all inference rules.
1@*. )ow can you find the minimal 'ey of relational schema?
#inimal ey is one which can identify each tuple of the given relation schema
uni.uely. 1or finding the minimal ey it is re.uired 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 > Determining H
;
, closure for H, given set of 1Ds 1
>. Set H
;
@ H
2. Set "ld H
; @
H
;
/. 1or each 1D I f in 1 and if I belongs to H
;
then add f
to H
;
B. 'epeat steps 2 and / until "ld H
;
@ H
;
.l3o8>> Determining minimal _ for relation schema ', given set of 1Ds 1
>. Set _ to ' that is mae _ a set of all attributes in '
2. 1or each attribute A in _
a. !ompute *_ ) A+
;
with respect to 1
b. &f *_ ) A+
;
@ ' then set _ @ *_ ) A+
;
1@-. What do you understand .y dependency preservation?
%iven a relation ' and a set of 1Ds 1, dependency preservation states that
the closure of the union of the pro=ection of 1 on each decomposed relation 'i is e.ual to
the closure of 1. i.e.,
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?/
Technical Aptitude Questions
**'>*1++ < J < *'n*1+++
;
@ 1
;

if decomposition is not dependency preserving, then some dependency is lost in the
decomposition.

1@0. What is meant .y >roactive% etroactive and $imultaneous Qpdate.
>roactive Qpdate:
The updates that are applied to database before it becomes
effective in real world .
etroactive Qpdate:
The updates that are applied to database after it becomes effective
in real world .
$imulatneous Qpdate:
The updates that are applied to database at the same time when it
becomes effective in real world .
1@5. What are the different types of YE+& operations?
1/ui Yoin: This is the most common type of =oin which involves only
e.uality comparisions. The disadvantage in this type of =oin is that there
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?B
Technical Aptitude Questions
SQ0
1. Which is the su.set of $AL commands used to manipulate Eracle !ata.ase
structures% including ta.les?
Data Definition 0anguage *DD0+
2. What operator performs pattern matching?
0&_4 operator
3. What operator tests column for the a.sence of data?
&S $<00 operator
*. Which command executes the contents of a specified file?
STA'T RfilenameQ or bRfilenameQ
-. 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?
M for single character substitution and W for multi9character 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?
&nsert, update, delete, select, references, inde5, e5ecute, alter, all
11. What command is used to get .ac' the privileges offered .y the =6&D command?
'4-"_4
12. Which system ta.les contain information on privileges granted and privileges
o.tained?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>??
SQL
Technical Aptitude Questions
<S4'MTA(M6'&-SM#AD4, <S4'MTA(M6'&-SM'4!D
13. Which system ta.le contains information on constraints on all the ta.les created?
<S4'M!"$ST'A&$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 4#6.
1-. What is the difference .etween DQ&,6D1 and !1L1D1 commands?
T'<$!AT4 is a DD0 command whereas D404T4 is a D#0 command. ,ence
D404T4 operation can be rolled bac, but T'<$!AT4 operation cannot be rolled bac.
F,4'4 clause can be used with D404T4 and not with T'<$!AT4.
10. What command is used to create a ta.le .y copying the structure of another ta.le?
Answer :
!'4AT4 TA(04 .. AS S404!T command
Explanation :
To copy only the structure, the F,4'4 clause of the S404!T command should
contain a 1A0S4 statement as in the following.
!'4AT4 TA(04 $4FTA(04 AS S404!T : 1'"# 4H&ST&$%TA(04
F,4'4 >@2X
&f the F,4'4 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'"<(04T,4T'"<(04
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
Answer :
$"
Explanation :
The .uery checs whether a given string is a numerical 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 employees. The null values in the commission
column will be replaced by C and added to salary.
2@. Which date function is used to find the difference .etween two dates?
#"$T,SM(4TF44$
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?A
Technical Aptitude Questions
21. Why does the following command give a compilation error?
!E> D6"L1 (D6"L1^&6#1J
-ariable names should start with an alphabet. ,ere the table name starts with an
TUT symbol.
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 heLshe has obtained from
the owner to any other user.
23. What is the use of the !E> option in the 6LD1 D6"L1 command?
&t 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 @ >>CCC, comm @ >CCC
2-. What is the use of !1$, in $AL?
Answer :
D4S! has two purposes. &t is used to describe a schema as well as to retrieve
rows from table in descending order.
Explanation :
The .uery S404!T : 1'"# 4#6 "'D4' (I 4$A#4 D4S! will display the
output sorted on 4$A#4 in descending order.
20. What is the use of ,6$,6!1 ,E&$D6+&D$?
Fhen this clause is used with the D'"6 command, a parent table can be dropped
even when a child table e5ists.
25. Which function is used to find the largest integer less than or e/ual to a specific
value?
10""'
27. What is the output of the following /uery?
$1L1,D DQ&,2123*.-057%324 <E# !Q6LJ
>2CC
:?2 @ ?1=R>=:
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?G
Technical Aptitude Questions
4* 0-5E.A0
Da.le 1 : 0T674E0
6$A#4 *-A'!,A'+, S60A!4 *-A'!,A'+, !"<'S4 *-A'!,A'+, !!"ST
*$<#(4'+
Da.le 2 : 038T9A"E
6$A#4 *-A'!,A'+, T&T04 *-A'!,A'+, D4-&$ *-A'!,A'+, S!"ST
*$<#(4'+, D!"ST *$<#(4'+, S"0D *$<#(4'+
Da.le 3 : /"3:"A..E"
6$A#4 *-A'!,A'+, D"( *DAT4+, D"D *DAT4+, S4H *!,A'+, 6'"1>
*-A'!,A'+, 6'"12 *-A'!,A'+, SA0 *$<#(4'+
2=A='/ :
6$A#4 ) 6rogrammer $ame, S60A!4 ) Study 6lace, !!"ST ) !ourse !ost, D4-&$
) Developed in, S!"ST ) Software !ost, D!"ST ) Development !ost, 6'"1> )
6roficiency >
;6E"4E0 :
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) - ll !ight" !e"erved
>?E
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
B=C::
>. S404!T A-%*S!"ST+ 1'"# S"1TFA'4 F,4'4 D4-&$ @ T"'A!04TX
2. S404!T 6$A#4,T'<$!*#"$T,SM(4TF44$*SISDAT4,D"(+L>2+
NA%4N, T'<$!*#"$T,SM(4TF44$*SISDAT4,D"D+L>2+ N4H64'&4$!4N
1'"# 6'"%'A##4'X
/. S404!T 6$A#4 1'"# ST<D&4S F,4'4 !"<'S4 @ T6%D!ATX
B. S404!T #AH*S"0D+ 1'"# S"1TFA'4X
?. S404!T 6$A#4, D"( 1'"# 6'"%'A##4' F,4'4 D"( 0&_4 TWA6'
WTX
A. S404!T #&$*!!"ST+ 1'"# ST<D&4SX
G. S404!T !"<$T*:+ 1'"# ST<D&4S F,4'4 !"<'S4 @ TD!ATX
E. S404!T S<#*S!"ST:S"0D9D!"ST+ 1'"# S"1TFA'4 %'"<6 (I
D4-&$ ,A-&$% D4-&$ @ T!TX
K. S404!T : 1'"# S"1TFA'4 F,4'4 6$A#4 @ T'A_4S,TX
>C. S404!T : 1'"# ST<D&4S F,4'4 S60A!4 @ T64$TA1"<'TX
>>. S404!T : 1'"# S"1TFA'4 F,4'4 S!"ST:S"0D9D!"ST Q ?CCCX
>2. S404!T !4&0*D!"STLS!"ST+ 1'"# S"1TFA'4X
>/. S404!T : 1'"# S"1TFA'4 F,4'4 S!"ST:S"0D Q@ D!"STX
>B. S404!T #AH*S!"ST+ 1'"# S"1TFA'4 %'"<6 (I D4-&$ ,A-&$%
D4-&$ @ T-(TX
>?. S404!T !"<$T*:+ 1'"# S"1TFA'4 F,4'4 D4-&$ @ T"'A!04TX
>A. S404!T !"<$T*:+ 1'"# ST<D&4S F,4'4 S60A!4 @ T6'A%AT,&TX
>G. S404!T !"<$T*:+ 1'"# ST<D&4S F,4'4 !!"ST (4TF44$ >CCCC
A$D >?CCCX
>E. S404!T A-%*!!"ST+ 1'"# ST<D&4SX
>K. S404!T : 1'"# 6'"%'A##4' F,4'4 6'"1> @ T!T "' 6'"12 @ T!TX
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>?K
Technical Aptitude Questions
2C. S404!T : 1'"# 6'"%'A##4' F,4'4 6'"1> &$ *T!T,T6AS!A0T+ "'
6'"12 &$ *T!T,T6AS!A0T+X
2>. S404!T : 1'"# 6'"%'A##4' F,4'4 6'"1> $"T &$ *T!T,T!;;T+ A$D
6'"12 $"T &$ *T!T,T!;;T+X
22. S404!T T'<$!*#AH*#"$T,SM(4TF44$*SISDAT4,D"(+L>2++ 1'"#
6'"%'A##4' F,4'4 S4H @ T#TX
2/. S404!T T'<$!*A-%*#"$T,SM(4TF44$*SISDAT4,D"(+L>2++ 1'"#
6'"%'A##4' F,4'4 S4H @ T1TX
2B. S404!T 6$A#4, T'<$!*#"$T,SM(4TF44$*SISDAT4,D"D+L>2+ 1'"#
6'"%'A##4' "'D4' (I 6$A#4 D4S!X
2?. S404!T 6$A#4 1'"# 6'"%'A##4' F,4'4 T"M!,A'*D"(,T#"$T+ @
T"M!,A'*SISDAT4,T#"$T+X
2A. S404!T !"<$T*:+ 1'"# 6'"%'A##4' F,4'4 S4H @ T1TX
2G. S404!T D&ST&$!T*6'"1>+ 1'"# 6'"%'A##4' F,4'4 S4H @ T#TX
2E. S404!T A-%*SA0+ 1'"# 6'"%'A##4'X
2K. S404!T !"<$T*:+ 1'"# 6'"%'A##4' F,4'4 SA0 (4TF44$ ?CCC
A$D G?CCX
/C. S404!T : 1'"# 6'"%'A##4' F,4'4 6'"1> $"T &$ *T!T,T!;
;T,T6AS!A0T+ A$D 6'"12 $"T &$ *T!T,T!;;T,T6AS!A0T+X
/>. S404!T 6$A#4,T&T04,S!"ST 1'"# S"1TFA'4 F,4'4 S!"ST &$
*S404!T #AH*S!"ST+ 1'"# S"1TFA'4 %'"<6 (I 6$A#4+X
/2.S404!T T#r.T VV 6$A#4 VV T 9 has T VV
T'<$!*#"$T,SM(4TF44$*SISDAT4,D"D+L>2+ VV T years of e5perienceT
[6rogrammer\ 1'"# 6'"%'A##4' F,4'4 S4H @ T#T <$&"$ S404!T
T#s.T VV 6$A#4 VV T 9 has T VV T'<$! *#"$T,SM(4TF44$
*SISDAT4,D"D+L>2+ VV T years of e5perienceT [6rogrammer\ 1'"#
6'"%'A##4' F,4'4 S4H @ T1TX
44 * 0-5E.A :
Da.le 1 : /=DT
D46T$" *$"T $<00 , $<#(4'*2++, D$A#4 *-A'!,A'2*>B++,
0"! *-A'!,A'2*>/+
Da.le 2 : =0D
4#6$" *$"T $<00 , $<#(4'*B++, 4$A#4 *-A'!,A'2*>C++,
D"( *-A'!,A'2*K++, #%' *$<#(4'*B++, ,&'4DAT4 *DAT4+,
SA0 *$<#(4'*G,2++, !"## *$<#(4'*G,2++, D46T$" *$<#(4'*2++
#%' is the empno of the employee whom the employee reports to. D46T$" is a foreign
ey.
;6E"4E0
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>AC
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.
B=C::
>. S404!T D&ST&$!T*A.4$A#4+ 1'"# 4#6 A, 4#6 ( F,4'4 A.4#6$" @
(.#%'X or S404!T 4$A#4 1'"# 4#6 F,4'4 4#6$" &$ *S404!T #%'
1'"# 4#6+X
2. S404!T : 1'"# 4#6 F,4'4 D46T$" &$ *S404!T D46T$" 1'"# 4#6
%'"<6 (I D46T$" ,A-&$% !"<$T*4#6$"+Q>C A$D D46T$"@>C+X
/. S404!T A.4$A#4 N4#60"I44N, (.4$A#4 N'46"'TS T"N 1'"# 4#6 A,
4#6 ( F,4'4 A.#%'@(.4#6$"X
B. S404!T : 1'"# 4#6 F,4'4 4#6$" &$ * S404!T 4#6$" 1'"# 4#6
#&$<S S404!T #%' 1'"# 4#6+X
?. S404!T : 1'"# 4#6 F,4'4 SA0 Q * S404!T #&$*SA0+ 1'"# 4#6
%'"<6 (I D46T$" ,A-&$% D46T$"@2C+X
A. S404!T : 1'"# 4#6 F,4'4 SA0 Q * S404!T #AH*SA0+ 1'"# 4#6
%'"<6 (I D"( ,A-&$% D"( @ T#A$A%4'T +X
G. S404!T D"(, #AH*SA0+ 1'"# 4#6 %'"<6 (I D"(X
E. S404!T : 1'"# 4#6 F,4'4 *D46T$", ,&'4DAT4+ &$ *S404!T D46T$",
#AH*,&'4DAT4+ 1'"# 4#6 %'"<6 (I D46T$"+X
K. S404!T T"M!,A'*,&'4DAT4,TIIIIT+ NI4A'N, !"<$T*4#6$"+ N$". "1
4#60"I44SN 1'"# 4#6 %'"<6 (I T"M!,A'*,&'4DAT4,TIIIIT+ ,A-&$%
!"<$T*4#6$"+ @ *S404!T #AH*!"<$T*4#6$"++ 1'"# 4#6 %'"<6 (I
T"M!,A'*,&'4DAT4,TIIIIT++X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>A>
Technical Aptitude Questions
>C. S404!T D46T$", 06AD*S<#*>2:*SA0;$-0*!"##,C+++,>?+
N!"#64$SAT&"$N 1'"# 4#6 %'"<6 (I D46T$" ,A-&$%
S<#* >2:*SA0;$-0*!"##,C+++ @ *S404!T
#AH*S<#*>2:*SA0;$-0*!"##,C++++ 1'"# 4#6 %'"<6 (I D46T$"+X
>>. S404!T 4$A#4, ,&'4DAT4, 06AD*T:T,E+ N'4!4$T0I ,&'4DN 1'"# 4#6
F,4'4 ,&'4DAT4 @ *S404!T #AH*,&'4DAT4+ 1'"# 4#6+ <$&"$ S404!T
4$A#4 $A#4, ,&'4DAT4, 06AD*T T,>?+ N'4!4$T0I ,&'4DN 1'"# 4#6
F,4'4 ,&'4DAT4 S@ *S404!T #AH*,&'4DAT4+ 1'"# 4#6+X
>2. S404!T 4$A#4,SA0 1'"# 4#6 4 F,4'4 SA0 Q *S404!T A-%*SA0+
1'"# 4#6 1 F,4'4 4.D46T$" @ 1.D46T$"+X
>/. S404!T 4$A#4, SA0 1'"# 4#6 A F,4'4 U$ @ *S404!T !"<$T
*D&ST&$!T*SA0++ 1'"# 4#6 ( F,4'4 A.SA0R@(.SA0+X
>B. S404!T : 1'"# 4#6 A F,4'4 A.4#6$" &$ *S404!T 4#6$" 1'"# 4#6
%'"<6 (I 4#6$" ,A-&$% !"<$T*4#6$"+Q>+ A$D A.'"F&DS@#&$
*'"F&D++X
>?. S404!T 4$A#4
N4#60"I44N,T"M!,A'*T'<$!*#"$T,SM(4TF44$*SISDAT4,,&'4DAT4+L>
2++VVT I4A'S TVV T"M!,A'*T'<$!*#"D*#"$T,SM(4TF44$ *SISDAT4,
,&'4DAT4+,>2+++VVT #"$T,S T N04$%T, "1 S4'-&!4N 1'"# 4#6X
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>A2
Technical Aptitude Questions
!omputer $etwors
1. What are the two types of transmission technology availa.le?
*i+ (roadcast and *ii+ point9to9point
2. What is su.net?
A generic term for section of a large networs usually separated by a bridge or
router.
3. !ifference .etween the communication and transmission.
Transmission is a physical movement of information and concern issues lie bit
polarity, synchronisation, cloc etc.
!ommunication means the meaning full e5change of information between two
communication media.
*. What are the possi.le ways of data exchange?
*i+ Simple5 *ii+ ,alf9duple5 *iii+ 1ull9duple5.
-. What is $6>?
Series of interface points that allow other computers to communicate with the
other layers of networ protocol stac.
0. What do you meant .y Ktriple ZK in &etwor's?
The function of 6AD *6acet Assembler Disassembler+ is described in a document
nown as H./. The standard protocol has been defined between the terminal and the 6AD,
called H.2EX another standard protocol e5ists between hte 6AD and the networ, called
H.2K. Together, these three recommendations are often called Ntriple HN
5. What is frame relay% in which layer it comes?
1rame relay is a pacet switching technology. &t will operate in the data lin layer.
7. What is terminal emulation% in which layer it comes?
Telnet is also called as terminal emulation. &t belongs to application layer.
?. What is "eaconing?
The process that allows a networ to self9repair networs problems. The stations
on the networ notify the other stations on the ring when they are not receiving the
transmissions. (eaconing is used in Toen ring and 1DD& networs.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>A/
Computer
Netor!s

Technical Aptitude Questions
1@. What is redirector?
'edirector is software that intercepts file or prints &L" re.uests and translates them
into networ re.uests. This comes under presentation layer.
11. What is &1D"+E$ and &1D"1Q+?
$4T(&"S is a programming interface that allows &L" re.uests to be sent to and
received from a remote computer and it hides the networing hardware from applications.
$4T(4<& is $et(&"S e5tended user interface. A transport protocol designed by
microsoft and &(# for the use on small subnets.
12. What is 6+!?
A method for providing fault tolerance by using multiple hard dis drives.
13. What is passive topology?
Fhen the computers on the networ simply listen and receive the signal, they are
referred to as passive because they don3t amplify the signal in any way. 45ample for
passive topology 9 linear bus.
1*. What is "router?
,ybrid devices that combine the features of both bridges and routers.
1-. What is cladding?
A layer of a glass surrounding the center fiber of glass inside a fiber9optic cable.
10. What is point3to3point protocol
A communications protocol used to connect computers to remote networing
services including &nternet service providers.
15. )ow =ateway is different from outers?
A gateway operates at the upper levels of the "S& model and translates
information between two completely different networ architectures or data formats
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 !ontrol *#A!+
layer in the networ architecture. #A! address is usually stored in '"# on the networ
adapter card and is uni.ue.
2@. !ifference .etween .it rate and .aud rate.
(it rate is the number of bits transmitted during one second whereas baud rate
refers to the number of signal units per second that are re.uired to represent those bits.
.aud rate I .it rate G &
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>AB
Technical Aptitude Questions
where $ is no9of9bits represented by each signal shift.
21. What is "andwidth?
4very line has an upper limit and a lower limit on the fre.uency of signals it can
carry. This limited range is called the bandwidth.
22. What are the types of Dransmission media?
Signals are usually transmitted over some transmission media that are broadly
classified in to two categories.
a4 =uided #edia:
These are those that provide a conduit from one device to another that
include twisted9pair, coa5ial cable and fiber9optic cable. A signal traveling along any of
these media is directed and is contained by the physical limits of the medium. Twisted9
pair and coa5ial cable use metallic that accept and transport signals in the form of
electrical current. "ptical fiber is a glass or plastic cable that accepts and transports
signals in the form of light.
.4 Qnguided #edia:
This is the wireless media that transport electromagnetic waves without
using a physical conductor. Signals are broadcast either through air. This is done through
radio communication, satellite communication and cellular telephony.
23. What is >roject 7@2?
&t is a pro=ect started by &444 to set standards to enable intercommunication
between e.uipment from a variety of manufacturers. &t is a way for specifying functions
of the physical layer, the data lin layer and to some e5tent the networ layer to allow for
interconnectivity of ma=or 0A$
protocols.
&t consists of the following7
EC2.> is an internetworing standard for compatibility of different 0A$s and #A$s
across protocols.
EC2.2 0ogical lin control *00!+ is the upper sublayer of the data lin layer which is
non9architecture9specific, that is remains the same for all &4449defined 0A$s.
#edia access control *#A!+ is the lower sublayer of the data lin layer that contains
some distinct modules each carrying proprietary information specific to the 0A$
product being used. The modules are 4thernet 0A$ *EC2./+, Toen ring 0A$ *EC2.B+,
Toen bus 0A$ *EC2.?+.
EC2.A is distributed .ueue dual bus *DQD(+ designed to be used in #A$s.
2*. What is >rotocol !ata Qnit?
The data unit in the 00! level is called the protocol data unit *6D<+. The 6D<
contains of four fields a destination service access point *DSA6+, a source service access
point *SSA6+, a control field and an information field. DSA6, SSA6 are addresses used
by the 00! to identify the protocol stacs on the receiving and sending machines that are
generating and using the data. The control field specifies whether the 6D< frame is a
information frame *& 9 frame+ or a supervisory frame *S 9 frame+ or a unnumbered frame
*< 9 frame+.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>A?
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. &t receives the signal in the networ before it becomes 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 0A$s of same
type. They divide a larger networ in to smaller segments. They contain logic that allow
them to eep the traffic for each segment separate and thus are repeaters that relay a
frame only the side of the segment containing the intended recipent and control
congestion.
outers:
They relay pacets among multiple interconnected networs *i.e. 0A$s of
different type+. They operate in the physical, data lin and networ layers. They contain
software that enable them to determine which of the several possible paths is the best for
a particular transmission.
=ateways:
They relay pacets among networs that have different protocols *e.g.
between a 0A$ and a FA$+. They accept a pacet formatted for one protocol and
convert it to a pacet formatted for another protocol before forwarding it. They operate in
all seven layers of the "S& model.

20. What is +,#>?
&!#6 is &nternet !ontrol #essage 6rotocol, a networ layer protocol of the
T!6L&6 suite used by hosts and gateways to send notification of datagram problems bac
to the sender. &t uses the echo test L reply to test whether a destination is reachable and
responding. &t also handles both control and error messages.
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 message, at the transport
layer the data unit created is called either a segment or an user datagram, at the networ
layer the data unit created is called the datagram, at the data lin layer the datagram is
encapsulated in to a frame and finally transmitted as signals along the transmission
media.
27. What is difference .etween 6> and 6>?
The address resolution protocol *A'6+ is used to associate the /2 bit &6 address
with the BE 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'6 .uery pacet that includes the &6 address of
the receiver.
The reverse address resolution protocol *'A'6+ allows a host to discover its
&nternet 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) - ll !ight" !e"erved
>AA
Technical Aptitude Questions
The header should have a minimum length of 2C bytes and can have a ma5imum
length of AC bytes.

3@. What is the range of addresses in the classes of internet addresses?
!lass A C.C.C.C 9 >2G.2??.2??.2??
!lass ( >2E.C.C.C 9 >K>.2??.2??.2??
!lass ! >K2.C.C.C 9 22/.2??.2??.2??
!lass D 22B.C.C.C 9 2/K.2??.2??.2??
!lass 4 2BC.C.C.C 9 2BG.2??.2??.2??
31. What is the difference .etween D<D> and <D> application layer protocols?
The Trivial 1ile Transfer 6rotocol *T1T6+ allows a local host to obtain files from
a remote host but does not provide reliability or security. &t uses the fundamental pacet
delivery services offered by <D6.
The 1ile Transfer 6rotocol *1T6+ is the standard mechanism provided by T!6 L &6
for copying a file from one host to another. &t uses the services offer by T!6 and so is
reliable and secure. &t establishes two connections *virtual circuits+ between the hosts, one
for data transfer and another for control information.
32. What are major types of networ's and explain?
Server9based networ
6eer9to9peer networ
6eer9to9peer networ, computers can act as both servers sharing resources and as
clients using the resources.
Server9based networs provide centralized control of networ resources and rely
on server computers to provide security and networ administration
33. What are the important topologies for networ's?
"Q$ topology:
&n this each computer is directly connected to primary networ cable in a
single line.
6dvantages:
&ne5pensive, easy to install, simple to understand, easy to e5tend.
$D6 topology:
&n this all computers are connected using a central hub.
6dvantages:
!an be ine5pensive, easy to install and reconfigure and easy to trouble
shoot physical problems.
+&= topology:
&n this all computers are connected in loop.
6dvantages:
All computers have e.ual access to networ media, installation can be
simple, and signal does not degrade as much as in other topologies because each
computer regenerates it.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>AG
Technical Aptitude Questions
3*. What is mesh networ'?
A networ in which there are multiple networ lins between computers to
provide multiple paths for data to travel.
3-. What is difference .etween .ase.and and .road.and transmission?
&n a baseband transmission, the entire bandwidth of the cable is consumed by a
single signal. &n broadband transmission, signals are sent on multiple fre.uencies,
allowing multiple signals to be sent simultaneously.
30. 1xplain -3*33 rule?
&n a 4thernet networ, between any two points on the networ ,there can be no
more than five networ segments or four repeaters, and of those five segments only three
of segments can be populated.
35. What #6Q?
&n toen '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
networs. $on9'outable protocols are designed to wor on small, local networs and
cannot be used with a router
3?. Why should you care a.out the E$+ eference #odel?
&t provides a framewor for discussing networ operations and design.
*@. What is logical lin' control?
"ne of two sublayers of the data lin layer of "S& reference model, as defined by
the &444 EC2 standard. This sublayer is responsible for maintaining the lin between
computers when they are sending data across the physical networ connection.
*1. What is virtual channel?
-irtual channel is normally a connection from one source to one destination,
although multicast connections are also permitted. The other name for virtual channel is
virtual circuit.
*2. What is virtual path?
Along any transmission path from 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?
6acet filter is a standard router e.uipped with some e5tra functionality. The e5tra
functionality allows every incoming or outgoing pacet to be inspected. 6acets meeting
some criterion are forwarded normally. Those that fail the test are dropped.
**. What is traffic shaping?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>AE
Technical Aptitude Questions
"ne of the main causes of congestion is that traffic is often busy. &f hosts could be
made to transmit at a uniform rate, congestion would be less common. Another open loop
method to help manage congestion is forcing the pacet to be transmitted at a more
predictable rate. This is called traffic shaping.
*-. What is multicast routing?
Sending a message to a group is called multicasting, and its routing algorithm is
called multicast routing.
*0. What is region?
Fhen 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 pacets to
destinations within its own region, but nowing nothing about the internal structure of
other regions.
*5. What is silly window syndrome?
&t is a problem that can ruin T!6 performance. This problem occurs when data are
passed to the sending T!6 entity in large blocs, but an interactive application on the
receiving side reads > byte at a time.
*7. What are !igrams and Drigrams?
The most common two letter combinations are called as digrams. e.g. th, in, er, re
and an. The most common three letter combinations are called as trigrams. e.g. the, ing,
and, and ion.
*?. 1xpand +!16.
&D4A stands for &nternational Data 4ncryption Algorithm.
-@. What is wide3mouth frog?
Fide9mouth frog is the simplest nown ey distribution center *_D!+
authentication protocol.
-1. What is #ail =ateway?
&t is a system that performs a protocol translation between different electronic
mail delivery protocols.
-2. What is +=> 2+nterior =ateway >rotocol4?
&t is any routing protocol used within an autonomous system.
-3. What is 1=> 21xterior =ateway >rotocol4?
&t is the protocol the routers in neighboring autonomous systems use to identify
the set of networs that can be reached within or via each autonomous system.
-*. What is autonomous system?
&t is a collection of routers under the control of a single administrative authority
and that uses a common &nterior %ateway 6rotocol.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>AK
Technical Aptitude Questions
--. What is "=> 2"order =ateway >rotocol4?
&t is a protocol used to advertise the set of networs that can be reached with in an
autonomous system. (%6 enables this information to be shared with the autonomous
system. This is newer than 4%6 *45terior %ateway 6rotocol+.
-0. What is =ateway3to3=ateway protocol?
&t is a protocol formerly used to e5change routing information between &nternet
core routers.
-5. What is &BD 2&etwor' Birtual Derminal4?
&t is a set of rules defining a very simple virtual terminal interaction. The $-T is
used in the start of a Telnet session.
-7. What is a #ulti3homed )ost?
&t is a host that has a multiple networ interfaces and that re.uires multiple &6
addresses is called as a #ulti9homed ,ost.
-?. What is [er.eros?
&t is an authentication service developed at the #assachusetts &nstitute of
Technology. _erberos uses encryption to prevent intruders from discovering passwords
and gaining unauthorized access to files.
0@. What is E$><?
&t is an &nternet routing protocol that scales well, can route traffic along multiple
paths, and uses nowledge of an &nternetTs topology to mae accurate routing decisions.
01. What is >roxy 6>?
&t is using a router to answer A'6 re.uests. 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?
&t is a very simple protocol used for transmission of &6 datagrams across a serial
line.
03. What is +> 2outing +nformation >rotocol4?
&t is a simple protocol used to e5change information between the routers.
0*. What is source route?
&t is a se.uence of &6 addresses identifying the route a datagram must follow. A
source route may optionally be included in an &6 datagram header.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>GC
Technical Aptitude Questions
"perating Systems
1ollowing are a few basic .uestions that cover the essentials of "S7
1. 1xplain the concept of eentrancy.
&t is a useful, memory9saving techni.ue for multiprogrammed timesharing
systems. A eentrant >rocedure is one in which multiple users can share a single copy of
a program during the same period. 'eentrancy has 2 ey aspects7 The program code
cannot modify itself, and the local data for each user process must be stored separately.
Thus, the permanent part is the code, and the temporary part is the pointer bac to the
calling program and local variables used by that program. 4ach e5ecution instance is
called activation. &t e5ecutes the code in the permanent part, but has its own copy of local
variablesLparameters. The temporary part associated with each activation is the activation
record. %enerally, the activation record is ept on the stac.
'ote7 A reentrant procedure can be interrupted and called by an interrupting
program, and still e5ecute correctly on returning to the procedure.
2. 1xplain "eladyWs 6nomaly.
Also called 1&1" anomaly. <sually, on increasing the number of frames allocated
to a processT virtual memory, the process e5ecution is faster, because fewer page faults
occur. Sometimes, the reverse happens, i.e., the e5ecution time increases even when more
frames are allocated to the process. This is (eladyTs Anomaly. This is true for certain page
reference patterns.
3. What is a .inary semaphore? What is its use?
A binary semaphore is one, which taes only C and > as values. They are used to
implement mutual e5clusion and synchronize concurrent processes.
*. What is thrashing?
&t is a phenomenon in virtual memory schemes when the processor spends most of
its time swapping pages, rather than e5ecuting instructions. This is due to an inordinate
number of page faults.
-. List the ,offmanWs conditions that lead to a deadloc'.
#utual 45clusion7 "nly one process may use a critical resource at a time.
,old U Fait7 A process may be allocated some resources while waiting for others.
$o 6re9emption7 $o resource can be forcible removed from a process holding it.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>G>
Operatin" S#stems

Technical Aptitude Questions
!ircular Fait7 A closed chain of processes e5ist such that each process holds at least
one resource needed by another process in the chain.
0. What are short3% long3 and medium3term scheduling?
0ong term scheduler determines which programs are admitted to the system for
processing. &t controls the degree of multiprogramming. "nce admitted, a =ob becomes a
process.
#edium term scheduling is part of the swapping function. This relates to
processes that are in a bloced or suspended state. They are swapped out of real9memory
until they are ready to e5ecute. The swapping9in decision is based on memory9
management criteria.
Short term scheduler, also now as a dispatcher e5ecutes most fre.uently, and
maes the finest9grained decision of which process should e5ecute ne5t. This scheduler is
invoed whenever an event occurs. &t may lead to interruption of one process by
preemption.
5. What are turnaround time and response time?
Turnaround time is the interval between the submission of a =ob and its
completion. 'esponse time is the interval between submission of a re.uest, and the first
response to that re.uest.
7. What are the typical elements of a process image?
<ser data7 #odifiable part of user space. #ay include program data, user stac area,
and programs that may be modified.
<ser program7 The instructions to be e5ecuted.
System Stac7 4ach process has one or more 0&1" stacs associated with it. <sed to
store parameters and calling addresses for procedure and system calls.
6rocess control (loc *6!(+7 &nfo needed by the "S to control processes.
?. What is the Dranslation Loo'aside "uffer 2DL"4?
&n a cached system, the base addresses of the last few referenced pages is
maintained in registers called the T0( that aids in faster looup. T0( contains those
page9table entries that have been most recently used. $ormally, each virtual memory
reference causes 2 physical memory accesses99 one to fetch appropriate page9table entry,
and one to fetch the desired data. <sing T0( in9between, this is reduced to =ust one
physical memory access in cases of T0(9hit.
1@. What is the resident set and wor'ing set of a process?
'esident set is that portion of the process image that is actually in real9memory at
a particular instant. Foring set is that subset of resident set that is actually needed for
e5ecution. *'elate this to the variable9window size method for swapping techni.ues.+
11. When is a system in safe state?
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>G2
Technical Aptitude Questions
The set of dispatchable processes is in a safe state if there e5ists at least one
temporal order in which all processes can be run to completion without resulting in a
deadloc.
12. What is cycle stealing?
Fe encounter cycle stealing in the conte5t of Direct #emory Access *D#A+.
4ither the D#A controller can use the data bus when the !6< does not need it, or it may
force the !6< to temporarily suspend operation. The latter techni.ue 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?
&f one or a few processes have a high access rate to data on one trac of a storage
dis, then they may monopolize the device by repeated re.uests to that trac. This
generally happens with most common device scheduling algorithms *0&1", SST1, !9
S!A$, etc+. ,igh9density multisurface diss are more liely to be affected by this than
low density ones.
1*. What are the stipulations of ,2 level security?
!2 level security provides for7
Discretionary Access !ontrol
&dentification and Authentication
Auditing
'esource reuse
1-. What is .usy waiting?
The repeated e5ecution of a loop of code while waiting for an event to occur is
called busy9waiting. The !6< is not engaged in any real productive activity during this
period, and the process does not progress toward completion.
10. 1xplain the popular multiprocessor thread3scheduling strategies.
Load $haring: 6rocesses are not assigned to a particular processor. A global .ueue of
threads is maintained. 4ach processor, when idle, selects a thread from this .ueue.
$ote that load .alancing refers to a scheme where wor is allocated to processors on
a more permanent basis.
=ang $cheduling: A set of related threads is scheduled to run on a set of processors at
the same time, on a >9to9> basis. !losely related threads L processes may be scheduled
this way to reduce synchronization blocing, and minimize process switching. %roup
scheduling predated this strategy.
!edicated processor assignment: 6rovides implicit scheduling defined by assignment
of threads to processors. 1or the duration of program e5ecution, each program is
allocated a set of processors e.ual in number to the number of threads in the program.
6rocessors are chosen from the available pool.
!ynamic scheduling: The number of thread in a program can be altered during the
course of e5ecution.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>G/
Technical Aptitude Questions
15. When does the condition WrendeCvousW arise?
&n message passing, it is the condition in which, both, the sender and receiver are
bloced until the message is delivered.
17. What is a trap and trapdoor?
Trapdoor is a secret undocumented entry point into a program used to grant access
without normal methods 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?
0ocal replacement means that an incoming page is brought in only to the relevant
processT address space. %lobal replacement policy allows any page frame from any
process to be replaced. The latter is applicable to variable partitions model only.
2@. !efine latency% transfer and see' time with respect to dis' +GE.
See time is the time re.uired to move the dis arm to the re.uired trac.
'otational delay or latency is the time it taes for the beginning of the re.uired sector to
reach the head. Sum of see time *if any+ and latency is the access time. Time taen to
actually transfer a span of data is transfer time.
21. !escri.e the "uddy system of memory allocation.
1ree memory is maintained in lined lists, each of e.ual sized blocs. Any such
bloc is of size 28. Fhen some memory is re.uired by a process, the bloc size of ne5t
higher order is chosen, and broen into two. $ote that the two such pieces differ in
address only in their th bit. Such pieces are called buddies. Fhen any used bloc is
freed, the "S checs to see if its buddy is also free. &f so, it is re=oined, and put into the
original free9bloc lined9list.
22. What is time3stamping?
&t is a techni.ue proposed by 0amport, used to order events in a distributed
system without the use of clocs. This scheme is intended to order events consisting of
the transmission of messages. 4ach system TiT in the networ maintains a counter !i.
4very time a system transmits a message, it increments its counter by > and attaches the
time9stamp Ti to the message. Fhen a message is received, the receiving system T=T sets
its counter != to > more than the ma5imum of its current value and the incoming time9
stamp Ti. At each site, the ordering of messages is determined by the following rules7 1or
messages 5 from site i and y from site =, 5 precedes y if one of the following conditions
holds....*a+ if TiRT= or *b+ if Ti@T= and iR=.
23. )ow are the waitGsignal operations for monitor different from those for semaphores?
&f a process in a monitor signal and no tas is waiting on the condition variable,
the signal is lost. So this allows easier program design. Fhereas in semaphores, every
operation affects the value of the semaphore, so the wait and signal operations should be
perfectly balanced in the program.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>GB
Technical Aptitude Questions
2*. +n the context of memory management% what are placement and replacement
algorithms?
6lacement algorithms determine where in available real9memory to load a
program. !ommon methods are first9fit, ne5t9fit, best9fit. 'eplacement algorithms are
used when memory is full, and one process *or part of a process+ needs to be swapped out
to accommodate a new program. The replacement algorithm determines 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?
1or load9time dynamic lining7 0oad module to be loaded is read into memory.
Any reference to a target e5ternal module causes that module to be loaded and the
references are updated to a relative address from the start base address of the application
module.
Fith run9time dynamic loading7 Some of the lining is postponed until actual
reference during e5ecution. Then the correct module is loaded and lined.
20. What are demand3 and pre3paging?
Fith demand paging, a page is brought into memory only when a location on that
page is actually referenced during e5ecution. Fith pre9paging, pages other than the one
demanded by a page fault are brought in. The selection of such pages is done based on
common access patterns, especially for secondary memory devices.
25. >aging a memory management function% while multiprogramming a processor
management function% are the two interdependent?
Ies.
27. What is page canni.aliCing?
6age swapping or page replacements are called page cannibalizing.
2?. What has triggered the need for multitas'ing in >,s?
&ncreased speed and memory capacity of microprocessors together with the support
fir virtual memory and
%rowth of client server computing
3@. What are the four layers that Windows &D have in order to achieve independence?
,ardware abstraction layer
_ernel
Subsystems
System Services.
31. What is $#>?
To achieve ma5imum efficiency and reliability a mode of operation nown as
symmetric multiprocessing is used. &n essence, with S#6 any process or threads can be
assigned to any processor.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>G?
Technical Aptitude Questions
32. What are the 'ey o.ject oriented concepts used .y Windows &D?
4ncapsulation
"b=ect class and instance
33. +s Windows &D a full .lown o.ject oriented operating system? =ive reasons.
$o Findows $T is not so, because its not implemented in ob=ect oriented
language and the data structures reside within one e5ecutive component and are not
represented as ob=ects and it does not support ob=ect oriented capabilities .
3*. What is a draw.ac' of #BD?
&t does not have the features lie
ability to support multiple processors
virtual storage
source level debugging
3-. What is process spawning?
Fhen the "S at the e5plicit re.uest 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.
$ormal completion
Time limit e5ceeded
#emory unavailable
(ounds violation
6rotection error
Arithmetic error
Time overrun
&L" failure
&nvalid instruction
6rivileged instruction
Data misuse
"perator or "S intervention
6arent termination.
37. What are the reasons for process suspension?
swapping
interactive user re.uest
timing
parent process re.uest
3?. What is process migration?
&t is the transfer of sufficient amount of the state of process from one machine to
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>GA
Technical Aptitude Questions
the target machine
*@. What is mutant?
&n Findows $T a mutant provides ernel mode or user mode mutual e5clusion
with the notion of ownership.
*1. What is an idle thread?
The special thread a dispatcher will e5ecute when no ready thread is found.
*2. What is <t!is'?
&t is a fault tolerance dis driver for Findows $T.
*3. Fhat are the possible threads a thread can have`
'eady
Standby
'unning
Faiting
Transition
Terminated.
**. What are rings in Windows &D?
Findows $T uses protection mechanism called rings provides by the process to
implement separation between the user mode and ernel mode.
*-. What is 1xecutive in Windows &D?
&n Findows $T, e5ecutive refers to the operating system code that runs in ernel
mode.
*0. What are the su.3components of +GE manager in Windows &D?
$etwor redirectorL Server
!ache manager.
1ile systems
$etwor driver
Device driver
*5. What are !!'s? &ame an operating system that includes this feature.
DDs are device driver its, which are e.uivalent to SD_s for writing device
drivers. Findows $T includes DDs.
*7. What level of security does Windows &D meets?
!2 level security.
Copyright: Vyom Network (http://www.vyomworld.com) - ll !ight" !e"erved
>GG

You might also like