You are on page 1of 177

Face Interviews Confidently!

Technical Aptitude Questions

Table of Contents

Data Structures Aptitude....................................................................................................3 C Aptitude ........................................................................................................................12 C++ Aptitude and OOPS..................................................................................................76 Quantitative Aptitude......................................................................................................105 UN ! C"ncepts...............................................................................................................123 #D$%S C"ncepts...........................................................................................................137 SQ&..................................................................................................................................155 C"'puter Net("r)s........................................................................................................163 Operatin* S+ste's..........................................................................................................171

2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

Data Structures Aptitude 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 pac age, $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 lin ed 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. 0. What is the data structures used to perform recursion?
/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 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 ma es 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 ta e a tree with ? nodes *n@?+

$ull (ranches

&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 ? Straight merging,
B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions $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.

ii

iii

iv

&n general7 +f there are n nodes% there exist 2n,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+ 0in ed list 10. What is the type of the algorithm used in solving the 7 Aueens pro.lem? (ac trac ing 15. +n an 6BL tree% at what condition the .alancing is to .e done? &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) - All Rights Reserved

Technical Aptitude Questions "ne. &f there is only one entry possible in the buc et, 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. %iven tree7
A

&

&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 2n,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 >?. N"te: 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? >

2
A

Copyright: Vyom Network B(http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

At location A > 'oot 2 0!> / '!> 9 0!2 9 '!2 B 0!/ 9 '!/ 9 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 ta es place from the pivot value, which is the first value of the given elements, this is mar ed bold. The values at the left pointer and right pointer are indicated using 0 and ' respectively. 65 GC0 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 65 65 65 B? B? B? B? G? 0 ?C ?C ?C EC EC 0 ?? ?? E? E? E? 0 AC ' AC AC AC ' E? 0 ?? ?? ' EC EC ?C ' G? G? G? GC GC GC 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
G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

B?

?C

?? '

65

85 0

EC

G?

GC '

Technical Aptitude Questions

55 0 50 0

B? B? '

?C ' 55

60 60

65 65

70 ' 70

EC 0 EC 0

G? G? '

-5 -5

&n the ne5t pass we get the sorted form of the array. .5 50 55 60 65 70 75 -0 -5

23. <or the given graph% draw the !<$ and "<$?

A H %
"<$: !<$:

The given graph7

, 4 6

I # D

AH%,64#ID AH,64I#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 0in ed list, E
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ma es searching easier. This corresponds to the records that shall be stored in leaf nodes. 25. !raw the "3tree of order 3 created .y inserting the following data arriving in se/uence : ?2 2* 0 5 11 7 22 * - 10 1? 2@ 57
>>

>K

2B

>A

2C

22

GE

K2

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 chec ing ta es place. So complete binary tree is the better one since the property of complete binary tree is maintained even after operations li e additions and deletions are done on it. 2?. What is a spanning Dree? A spanning tree is a tree associated with a networ . All the nodes of the graph appear on the tree once. A 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.
K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

31. ,onvert the given graph with weighted edges to minimal spanning tree.

>
B>C

ACC

A>2
2KE?

/
/>C

2CC

?
BCC

>B2>

the e.uivalent minimal spanning tree is7 >

/ A>2 />C B 2CC ?

B>C 2

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 0in ed list is a linear one. According to Storage 0in ed 0ist is a $on9linear one. 3*. !raw a .inary Dree for the expression : 6 9 " 3 2, 8 !4 9 2> G A4 9

>C

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. C> ST<D4$TM'4!

C2
$A#4

C2
I4A'M"1MST<DI

C/
1&'STM$A#4

C/
0ASTM$A#4

C/
1&'STMS4#

C/
S4!"$DMS4#

>> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

! Aptitude

C Aptitude
N"te / 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 Ans(er/ !ompiler error7 !annot modify a constant value. 01p2anati"n7 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 Ans(er/ mmmm aaaa nnnn 01p2anati"n7 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
>2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 Ans(er/ & hate < 01p2anati"n7 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 ta es B bytes and long double ta es >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 Ans(er/ ?B/2> 01p2anati"n/ 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 li e any other ordinary function, which can be called recursively. -. main24 H int cN OIH2.7%3.*%*%0.5%-MJ int j%9pIc%9/IcJ for2jI@JjR-Jj884 H printf2K Ld K%9c4J 88/J M for2jI@JjR-Jj884H printf2K Ld K%9p4J 88pJ M >/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions M Ans(er/ 222222/BA? 01p2anati"n/ &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 Ans(er/ Lin'er 1rror 7 <ndefined symbol TMiT 01p2anati"n/ 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 lin ing. (ut lin er finds that no other variable of name i is available in any other program with memory space allocated for it. ,ence a lin er error has occurred . 5. main24 H int iI31%jI31%'I@%lI2%mJ mIi88((j88(('88SSl88J printf2KLd Ld Ld Ld LdK%i%j%'%l%m4J M Ans(er/ CC>/> 01p2anati"n / 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
>B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions M Ans(er/ >2 01p2anati"n/ The sizeof*+ operator gives the number of bytes ta en 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 Ans(er / three 01p2anati"n / 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 Ans(er/ fffC 01p2anati"n / 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) - All Rights Reserved

Technical Aptitude Questions void display2char 9string4 H printf2KLsK%string4J M Ans(er/ ,ompiler 1rror : Type mismatch in redeclaration of function display 01p2anati"n / &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 Ans(er/ c@2X 01p2anati"n/ ,ere unary minus *or negation+ operator is used twice. Same maths rules applies, ie. minus : minus@ plus. 'ote: ,owever you cannot give li e 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 Ans(er/ sizeof*i+@> 01p2anati"n/ Since the Ydefine replaces the string int by the macro (h$r 1*. main24 H int iI1@J iIUiV1*J printf2KiILdK%i4J M Ans(er/ i@C
>A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

01p2anati"n/ &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 Ans(er/ GG 01p2anati"n/ 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 Ans(er/ Some%arbage-alue999> 01p2anati"n/ 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
>G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions H struct xx H int xI3J char nameNOIKhelloKJ MJ struct xx 9sJ printf2KLdK%s3Vx4J printf2KLsK%s3Vname4J M Ans(er/ !ompiler 4rror 01p2anati"n/ 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 Ans(er/ !ompiler 4rror 01p2anati"n/ 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 Ans(er/ hai
>E Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 01p2anati"n/ Zn 9 newline Zb 9 bac space Zr 9 linefeed 2@. main24 H int iI-J printf2KLdLdLdLdLdLdK%i88%i33%88i%33i%i4J M Ans(er/ B??B? 01p2anati"n/ 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 Ans(er/ AB 01p2anati"n/ 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 Ans(er/ ib=Sgs=foet 01p2anati"n/ ;;:p;; will be parse in the given order :p that is value at the location currently pointed by p will be ta en ;;:p the retrieved value will be incremented when X is encountered the location will be incremented that is p;; will be e5ecuted
>K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 Ans(er/ ?C 01p2anati"n/ The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value will be ta en. 2*. Tdefine clrscr24 1@@ main24 H clrscr24J printf2KLdPnK%clrscr244J M Ans(er/ >CC 01p2anati"n/ 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 loo s li e 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 Ans(er/ Some address will be printed. 01p2anati"n/
2C Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 1unction names are =ust addresses *=ust li e 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 Ans(er/ $o outputLerror 01p2anati"n/ 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 ^ Ans(er/ C..>..2 01p2anati"n/ 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 ^ Ans(er/ B..2 01p2anati"n/ the second pointer is of char type and not a far pointer /C+ main*+ ] int i@BCC,=@/CCX printf*NWd..WdN+X

2> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions ^ Ans(er/ BCC../CC 01p2anati"n/ printf ta es the values of the first two assignments of the program. Any number of printfTs may be given. All of them ta e only the first two values. &f more number of assignments given in the program,then printf will ta e garbage values. />+ main*+ ] char :pX p@N,elloNX printf*NWcZnN,:U:p+X ^ Ans(er/ , 01p2anati"n/ : 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 ,. main*+ ] int i@>X while *iR@?+ ] printf*NWdN,i+X if *iQ2+ goto hereX i;;X ^ ^ fun*+ ] here7 printf*N66N+X ^ Ans(er/ !ompiler error7 <ndefined label ThereT in function main 01p2anati"n/ 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.

/2+

22 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ !ompiler error7 0value re.uired in function main 01p2anati"n/ Array names are pointer constants. So it cannot be modified. void main*+ ] int i@?X printf*NWdN,i;; ; ;;i+X ^ Ans(er/ "utput !annot be predicted e5actly. 01p2anati"n/ Side effects are involved in the evaluation of i void main*+ ] int i@?X printf*NWdN,i;;;;;i+X ^ Ans(er/ !ompiler 4rror 01p2anati"n/ The e5pression i;;;;;i is parsed as i ;; ;; ; i which is an illegal combination of operators. YincludeRstdio.hQ main*+ ] int i@>,=@2X switch*i+ ] case >7 printf*N%""DN+X brea X

/B+

/?+

/A+

2/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions case =7 printf*N(ADN+X brea X ^ ^ Ans(er/ !ompiler 4rror7 !onstant e5pression re.uired in function main. 01p2anati"n/ 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 ^ Ans(er/ > 01p2anati"n/ 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 >. Ydefine f*g,g2+ gYYg2 main*+ ] int var>2@>CCX printf*NWdN,f*var,>2++X ^ Ans(er/ >CC main*+ ] int i@CX for*Xi;;Xprintf*NWdN,i++ X printf*NWdN,i+X ^ Ans(er/ > 01p2anati"n/ before entering into the for loop the chec ing 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+.
2B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

/E+

/K+

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 ^ Ans(er/ # 01p2anati"n/ 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 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 ^ Ans(er/ !ompiler 4rror 01p2anati"n/ &nitialization should not be done for structure members inside the structure declaration YincludeRstdio.hQ main*+ ] struct 55 ] int 5X

B>+

B2+

2? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions struct yy ] char sX struct 55 :pX ^X struct yy :.X ^X ^ Ans(er/ !ompiler 4rror 01p2anati"n/ 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 ^ Ans(er/ 0in er error7 undefined symbol TMiT. 01p2anati"n/ e5tern declaration specifies that the variable i is defined somewhere else. The compiler passes the e5ternal variable to be resolved by the lin er. So compiler doesnTt find an error. During lin ing the lin er searches for the definition of i. Since it is not found the lin er flags an error. main*+ ] printf*NWdN, out+X ^ int out@>CCX Ans(er/ !ompiler error7 undefined symbol out in function main. 01p2anati"n/ 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. main*+ ] e5tern outX printf*NWdN, out+X ^ int out@>CCX Ans(er/

BB+

B?+

2A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions >CC 01p2anati"n/ This is the correct way of writing the previous program. BA+ main*+ ] show*+X ^ void show*+ ] printf*N&Tm the greatestN+X ^ Ans(er/ !ompier error7 Type mismatch in redeclaration of show. 01p2anati"n/ 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*+. 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 ^ Ans(er/ >CC, >CC, >CC, 2 >>B, >CB, >C2, / 01p2anati"n/ 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
2G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

BG+

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 ^ ^ Ans(er/ !ompiler error7 lvalue re.uired. 01p2anati"n/ 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 ^ Ans(er/ 111 222 333 3** 01p2anati"n/

2E Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ 01p2anati"n/ ,ere we have only one pointer to type char and since we ta e 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>.

2K

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ g2Cfy 01p2anati"n/ 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. 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 ^ Ans(er/ c 01p2anati"n/ &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

?2+

/C Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 2c 3. ?/+ 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 ^ ^ Ans(er/ *blan space+ irl rl l 01p2anati"n/ ,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. int i,=X for*i@CXiR@>CXi;;+ ] =;@?X assert*iR?+X ^ Ans(er/ 'untime error7 Abnormal program termination. assert failed *iR?+, Rfile nameQ,Rline numberQ 01p2anati"n/ asserts are used during debugging to ma e sure that certain conditions are satisfied. &f assertion fails, the program will terminate reporting the same. After debugging use, Yundef $D4(<%

?B+

/> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions and this will disable all the assertions from the source code. Assertion is a good debugging tool to ma e use of. ??+ main*+ ] int i@9>X ;iX printf*Ni @ Wd, ;i @ Wd ZnN,i,;i+X ^ Ans(er/ i @ 9>, ;i @ 9> 01p2anati"n/ <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+. Fhat are the files which are automatically opened when a ! file is e5ecuted` Ans(er/ stdin, stdout, stderr *standard input,standard output,standard error+.

?A+

?G+ what will be the position of the file mar er` a7 fsee *ptr,C,S44_MS4T+X b7 fsee *ptr,C,S44_M!<'+X Ans(er / a7 The S44_MS4T sets the file position mar er to the starting of the file. b7 The S44_M!<' sets the file position mar er to the current position of the file. ?E+ main*+ ] char nameO>CP,sO>2PX scanf*N ZNWO8ZNPZNN,s+X ^ ,ow scanf will e5ecute` Ans(er/ 1irst it chec s 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 . Fhat is the problem with the following code segment` while **fgets*receiving array,?C,fileMptr++ S@ 4"1+ X Ans(er 3 01p2anati"n/ fgets returns a pointer. So the correct end of file chec is chec ing for S@ $<00.

?K+

/2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

AC+

main*+ ] main*+X ^ Ans(er/ 'untime error 7 Stac overflow. 01p2anati"n/ 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. main*+ ] char :cptr,cX void :vptr,vX c@>CX v@CX cptr@UcX vptr@UvX printf*NWcWvN,c,v+X ^ Ans(er/ !ompiler error *at line number B+7 size of v is <n nown. 01p2anati"n/ 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. main*+ ] char :str>@NabcdNX char str2OP@NabcdNX printf*NWd Wd WdN,sizeof*str>+,sizeof*str2+,sizeof*NabcdN++X ^ Ans(er/ 2?? 01p2anati"n/ &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. main*+ ] char notX not@S2X

A>+

A2+

A/+

// Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions printf*NWdN,not+X ^ Ans(er/ C 01p2anati"n/ 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 ^ Ans(er/ T'<4 01p2anati"n7 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. main*+ ] int @>X printf*NWd@@> is NNWsN, , @@>`NT'<4N7N1A0S4N+X ^ Ans(er/ >@@> is T'<4 01p2anati"n/

A?+

/B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ 2CCC is a leap year 01p2anati"n/ An ordinary program to chec if leap year or not. 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 ^ Ans(er/ !ompiler error *in the line arr> list @ ]C,>,2,/,B^+ 01p2anati"n/ 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. int i@>CX main*+ ] e5tern int iX ] int i@2CX ] const volatile unsigned i@/CX

AG+

AE+

/? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions printf*NWdN,i+X ^ printf*NWdN,i+X ^ printf*NWdN,i+X ^ Ans(er/ /C,2C,>C 01p2anati"n/ 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 lin er 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 ^ Ans(er/ >C 01p2anati"n7 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. main*+ ] int i@9>X 9iX printf*Ni @ Wd, 9i @ Wd ZnN,i,9i+X ^ Ans(er/ i @ 9>, 9i @ > 01p2anati"n/

GC+

/A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er7 !ompiler error 01p2anati"n7 i is a constant. you cannot change the value of constant YincludeRstdio.hQ main*+ ] int aO2PO2PO2P @ ] ]>C,2,/,B^, ]?,A,G,E^ ^X int :p,:.X p@UaO2PO2PO2PX :.@:::aX printf*NWd..WdN,:p,:.+X ^ Ans(er/ garbagevalue..> 01p2anati"n/ 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. YincludeRstdio.hQ main*+ ] register i@?X char =OP@ NhelloNX printf*NWs WdN,=,i+X ^ Ans(er/ hello ? 01p2anati"n7

G2+

G/+

/G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions if you declare i as register compiler will treat it as ordinary integer and it will ta e integer value. i value may be stored either in register or in memory. GB+ main*+ ] int i@?,=@A,zX printf*NWdN,i;;;=+X ^ Ans(er/ >> 01p2anati"n/ the e5pression i;;;= is treated as *i;; ; =+ 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 ^ Ans(er/ 2 01p2anati"n/ above all statements form a double circular lin ed listX abc.ne5t9Qne5t9Qprev9Qne5t9Qi this one points to NghiN node the value of at particular node is 2. struct point ] int 5X int yX ^X struct point origin,:ppX main*+

GA+

GG+

/E Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions ] pp@UoriginX printf*Norigin is*WdWd+ZnN,*:pp+.5,*:pp+.y+X printf*Norigin is *WdWd+ZnN,pp9Q5,pp9Qy+X ^ Ans(er/ origin is*C,C+ origin is*C,C+ 01p2anati"n7 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 ^ Ans(er/ K 01p2anati"n/ return*i;;+ it will first return i and then increments. i.e. >C will be returned. main*+ ] char :pX int :.X long :rX p@.@r@CX p;;X .;;X r;;X printf*NWp...Wp...WpN,p,.,r+X ^ Ans(er/ CCC>...CCC2...CCCB 01p2anati"n/ ;; operator when applied to pointers increments address according to their corresponding data9types.

GK+

/K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ !ompiler error 01p2anati"n/ declaration of convert and format of getc*+ are wrong. 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 ^ Ans(er/ !ompiler error. 01p2anati"n/ argvO>P U argvO2P are strings. They are passed to the function sum without converting it to integer values. Y include Rstdio.hQ int oneMdOP@]>,2,/^X main*+ ] int :ptrX ptr@oneMdX ptr;@/X printf*NWdN,:ptr+X ^ Ans(er7 garbage value

E>+

E2+

BC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 01p2anati"n/ 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 ^ Ans(er7 bye 01p2anati"n/ 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. 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 ^ Ans(er/ contents of zzz.c followed by an infinite loop 01p2anati"n/ The condition is chec ed against 4"1, it should be chec ed against $<00. main*+ ] int i @CX=@CX

E?+

EA+
B>

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions if*i UU =;;+ printf*NWd..WdN,i;;,=+X printf*NWd..Wd,i,=+X ^ Ans(er/ C..C 01p2anati"n/ 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 ^ Ans(er/ >CCC 01p2anati"n/ $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. 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 Ans(er/ B99C /99> 2992 01p2anati"n/ 0et us assume some 5@ scanf*NWdN,Ui+9t the values during e5ecution will be, t i 5 B C 9B

EE+

B2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions / 2 EK+ > 2 92 C

main*+] int a@ CXint b @ 2CXchar 5 @>Xchar y @>CX if*a,b,5,y+ printf*NhelloN+X ^ Ans(er/ hello 01p2anati"n/ 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. main*+] unsigned int iX for*i@>XiQ92Xi99+ printf*Nc aptitudeN+X ^ 01p2anati"n/ 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. &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 ^ Ans(er/ : @ Ua 01p2anati"n/ The argument of the function is a pointer to a pointer. Fhat are the following notations of defining functions nown as` i. int abc*int a,float b+ ]

KC+

K>+

K2+
B/

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions L: some code :L ^ ii. int abc*a,b+ int aX float bX ] L: some code:L ^ Ans(er/ i. A$S& ! notation ii. _ernighan U 'itche notation K/+ main*+ ] char :pX p@NWdZnNX p;;X p;;X printf*p92,/CC+X ^ Ans(er/ /CC 01p2anati"n/ The pointer points to W since it is incremented twice and again decremented by 2, it points to TWdZnT and /CC is printed. 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 ^ 01p2anati"n/ 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. func*a,b+ int a,bX ] return* a@ *a@@b+ +X ^ main*+

KB+

K?+

BB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ The value if process is C S 01p2anati"n/ The function TprocessT has / parameters 9 >, a pointer to another function 2 and /, integers. Fhen this function is invo ed from main, the following substitutions for formal parameters ta e 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 ^ ^ Ans(er/ CCCC 01p2anati"n/ 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. void main*+ ] int @ret*sizeof*float++X printf*NZn here value is WdN,;; +X ^ int ret*int ret+ ] ret ;@ 2.?X

KG+

B? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions return*ret+X ^ Ans(er/ ,ere value is G 01p2anati"n/ 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 ^ Ans(er/ here in / A 01p2anati"n/ 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. void main*+ ] unsigned giveit@9>X int gotitX printf*NWu N,;;giveit+X printf*NWu ZnN,gotit@99giveit+X ^ Ans(er/ C A??/? 01p2anati"n/ void main*+ ] int iX char aOP@NZCNX if*printf*NWsZnN,a++ printf*N" here ZnN+X else printf*N1orget itZnN+X ^ Ans(er/

KK+

>CC+

BA Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions " here 01p2anati"n/ 6rintf will return how many characters does it print. ,ence printing a null character returns > which ma es 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 ^ Ans(er/ !ompiler 4rror. Fe cannot apply indirection on type void:. 01p2anati"n/ -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. void main*+ ] int i@i;;,=@=;;, @ ;;X printf*[WdWdWd\,i,=, +X ^ Ans(er/ %arbage values. 01p2anati"n/ 6n identifier is availa.le to use in program code from the point of its declaration. So 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. void main*+ ] static int i@i;;, =@=;;, @ ;;X printf*[i @ Wd = @ Wd @ Wd\, i, =, +X ^ Ans(er/ i@>=@> @>

>C2+

>C/+

BG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 01p2anati"n/ Since static variables are initialized to zero by default. >CB+ void main*+ ] while*>+] if*printf*NWdN,printf*NWdN+++ brea X else continueX ^ ^ Ans(er/ %arbage values 01p2anati"n/ 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. main*+ ] unsigned int i@>CX while*i99Q@C+ printf*NWu N,i+X ^ Ans(er/ >C K E G A ? B / 2 > C A??/? A??/BJ.. 01p2anati"n/ 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 ^ Ans(er/ %arbage9value C 01p2anati"n/ 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.

>CB+

BE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 45u'6 #u2e/ ,hec all control paths to write bug free code. >CA+ main*+ ] int aO>CPX printf*NWdN,:a;>9:a;/+X ^ Ans(er/ B 01p2anati"n/ :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 ^ Ans(er/ >C 01p2anati"n/ The macro e5pands and evaluates to as7 5;2:y9> @Q 5;*2:y+9> @Q >C main*+ ] unsigned int i@A?CCCX while*i;;S@C+X printf*NWdN,i+X ^ Ans(er/ > 01p2anati"n/ $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 ^ Ans(er/ 9>
BK Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

>CE+

Technical Aptitude Questions 01p2anati"n/ 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 brea s 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 ^ Ans(er/ 0ine no ?7 4rror7 0value re.uired 0ine no A7 !annot apply leftshift to float 0ine no G7 !annot apply mod to float 01p2anati"n/ 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 ^ Ans(er/ !ompiler error7 un nown type integer !ompiler error7 undeclared function write 01p2anati"n/ 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 ^

?C Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ >C >> >2 >/ >2 >> >C >/ 01p2anati"n/ 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 ^ Ans(er 9>2E 01p2anati"n $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 ^ Ans(er
?> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions infinite loop 01p2anati"n 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 ^ Ans(er/ (ehavior is implementation dependent. 01p2anati"n/ 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 Ans(er Definition. 5 is a pointer to array of*size >C+ integers. Apply cloc 9wise 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 ^ Ans(er !ompiler error7 #ultiple declaration for error 01p2anati"n
?2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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+. N"te7 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 ^

Ans(er > 01p2anati"n 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) - All Rights Reserved

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 ^ Ans(er/ !ompiler error 7 undefined symbol some 01p2anati"n/ This is a very simple e5ample for conditional compilation. The name something is not already nown to the compiler ma ing 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 ^ Ans(er CC 01p2anati"n 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
?B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions ^ Ans(er > 01p2anati"n 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 . arr2D arr2DO>P arr2DO2P arr2DO/P

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) - All Rights Reserved

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 chec ing will help understand this. >2/+ main*+ ] char :p @ [ay.m\X printf*[Wc\,;;:*p;;++X ^ Answer7 b main*+ ] int i@?X printf*NWdN,;;i;;+X ^ Ans(er/ !ompiler error7 0value re.uired in function main 01p2anati"n/ ;;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 ^ Ans(er/ b 01p2anati"n/ There is no difference between the e5pression ;;:*p;;+ and ; ;:p;;. 6arenthesis =ust wor s as a visual clue for the reader to see which e5pression is first evaluated. >2A+ int aaa*+ ]printf*[,i\+X^
?A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

>2B+

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 ta es 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 ^ Ans(er/ 1 01p2anati"n/ 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 ^ Ans(er/ A 01p2anati"n/
?G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ta es 2 parameters .*a+. an integer variable.*b+. a ptrto a funtion which returns void. the return type of the function is void. 01p2anati"n/ Apply the cloc 9wise rule to find the result. >/C+ main*+ ] while *strcmp*[some\,\someZC\++ printf*[Strings are not e.ualZn\+X ^ Ans(er/ $o output 01p2anati"n/ 4nding the string constant with ZC e5plicitly ma es no difference. So [some\ and [someZC\ are e.uivalent. So, strcmp returns C *false+ hence brea ing 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 ^ Ans(er/ [Strings are not e.ual\ [Strings are not e.ual\ J. 01p2anati"n/ &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+
?E Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

>/>+

main*+ ]

Technical Aptitude Questions int i @ /X for *Xi;;@CX+ printf*[Wd\,i+X ^ Ans(er/ !ompiler 4rror7 0value re.uired. 01p2anati"n/ 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 ^ Ans(er/ garbage9value C 01p2anati"n/ The memory space allocated by malloc is uninitialized, whereas calloc returns the allocated memory space initialized to zeros. void main*+ ] static int iX while*iR@>C+ *iQ2+`i;;7i99X printf*[Wd\, i+X ^ Ans(er/ /2GAG 01p2anati"n/ 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 ^
?K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

>/B+

>/?+

Technical Aptitude Questions Ans(er/ >C >C 01p2anati"n/ 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. Ans(er/ >. 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 a@N,iN /. Same as >. >/G+ main*+ ] int i@?,=@>CX i@iU@=UU>CX printf*NWd WdN,i,=+X ^ Ans(er/ > >C 01p2anati"n/ 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.
AC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

7 legal 7 illegal

Technical Aptitude Questions

>/E+

main*+ ] int i@B,=@GX = @ = VV i;; UU printf*NI"< !A$N+X printf*NWd WdN, i, =+X ^ Ans(er/ B> 01p2anati"n/ 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 ^ Ans(er/ !ompier 4rror7 TUT on register variable #u2e t" #e'e'6er/ 3 7address "8 9 "perat"r cann"t 6e app2ied "n re*ister varia62es.

>BC+

main*+ ] float i@>.?X switch*i+ ] case >7 printf*N>N+X case 27 printf*N2N+X default 7 printf*NCN+X ^ ^ Ans(er/ !ompiler 4rror7 switch e5pression not integral 01p2anati"n/

A> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ ^ Ans(er/ 0in er 4rror 7 <nresolved e5ternal symbol i 01p2anati"n/ 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 ^ Ans(er/ >A >A >A 01p2anati"n/ 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 ^ Ans(er/ sizeof*p+ @ 2, sizeof*:p+ @ >, strlen*p+ @ B sizeof*a+ @ ?, strlen*a+ @ B 01p2anati"n/ sizeof*p+ @Q sizeof*char:+ @Q 2 sizeof*:p+ @Q sizeof*char+ @Q > Similarly, sizeof*a+ @Q size of the character array @Q ?
A2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ta en 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 ^ Ans(er/ >C 01p2anati"n/ 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. 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 ^ Ans(er/ > 01p2anati"n/ 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. 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+;=+,
A/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

>B?+

>BA+

Technical Aptitude Questions :*:*=;p+;i+,:*:*i;p+;=+,:*:*p;=+;i++X ^ ^ Ans(er/ > 2 / B ? A G E K > B G 2 ? E / A K > 2 / B ? A G E K > B G 2 ? E / A K

01p2anati"n/ :*:*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 ^ Ans(er/ 5@>C y@E 01p2anati"n/ <sing 8 li e 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 ta e 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 ^
AB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions where the arguments follow the *+. So naturally the declaration for swap will loo li e, void swap*+ which means the swap can ta e any number of arguments. >BE+ main*+ ] int i @ 2?GX int :i6tr @ UiX printf*NWd WdN, :**char:+i6tr+, :**char:+i6tr;>+ +X ^ Ans(er/ >> 01p2anati"n/ The integer value 2?G is stored in the memory as, CCCCCCC> CCCCCCC>, so the individual bytes are ta en 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 ^ Ans(er/ 2> 01p2anati"n/ 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 ^ Ans(er/ ??A 01p2anati"n/ 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 ma es the memory representation as7 CC>C>>CC
A? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ C 01p2anati"n/ 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. Declare an array of $ pointers to functions returning pointers to functions returning pointers to characters` Ans(er/ *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.month, Ustudent.dob.year+X

>?2+

>?/+

Ustudent.dob.day,

^ Ans(er/ !ompiler 4rror7 <ndefined structure date 01p2anati"n/ &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.
AA Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ !ompiler 4rror7 <ndefined structure date 01p2anati"n/ "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 ^ ^ 01p2anati"n/ 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. &s there any difference between the two declarations, >. int foo*int :arrOP+ and

>?A+
AG

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 2. int foo*int :arrO2P+ Ans(er/ $o 01p2anati"n/ 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 ^ Ans(er 3 01p2anati"n/ &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+. Fhat is wrong with the following code` int :foo*+ ] int :s @ malloc*sizeof*int+>CC+X assert*s S@ $<00+X return sX ^ Ans(er 3 01p2anati"n/ 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. Fhat is the hidden bug with the following statement` assert*val;; S@ C+X Ans(er 3 01p2anati"n/ 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. #u2e t" #e'e'6er/ !onFt use expressions that have side3effects in assert statements.

>?E+

>?K+

AE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ <ndefined behavior 01p2anati"n/ 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. 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 01p2anati"n/ 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 li e 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 ^

>A>+

>A2+
AK

&s the following code legal` struct a

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions ] int 5X struct a bX ^ Answer7 $o 01p2anati"n/ &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 ^ Ans(er/ Ies. 01p2anati"n/ :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. &s the following code legal` typedef struct a ] int 5X aType :bX ^aType Ans(er/ $o 01p2anati"n/ The typename aType is not nown at the point of declaring the structure *forward references are not made for typedefs+. &s the following code legal` typedef struct a aTypeX struct a ] int 5X aType :bX ^X Ans(er/ Ies

>AB+

>A?+

GC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 01p2anati"n/ 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 ^ Ans(er/ $o 01p2anati"n/ Fhen the declaration, typedef struct a aTypeX is encountered body of struct a is not nown. This is nown as 2incomplete types3. 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 un nown :+ @ Wd Zn\, sizeof*struct un nown :++X ^ Ans(er / sizeof *void :+ @ 2 sizeof *int :+ @ 2 sizeof *double :+ @ 2 sizeof*struct un nown :+ @ 2 01p2anati"n/ The pointer to any type is of same size. 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+ Ans(er 3 01p2anati"n/ 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+

>AG+

>AE+

G> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 Ans(er 3 01p2anati"n/ 6refer the first one. &f the str contains any format characters li e Wd then it will result in a subtle bug. void main*+ ] int i@>C, =@2X int :ip@ Ui, :=p @ U=X int @ :ipL:=pX printf*[Wd\, +X ^ Ans(er/ !ompiler 4rror7 [<ne5pected end of file in comment started in line ?\. 01p2anati"n/ 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. void main*+ ] char chX for*ch@CXchR@>2GXch;;+ printf*[Wc Wd Zn[, ch, ch+X ^ Ans(er/ &mplementaion dependent 01p2anati"n/ 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. &s this code legal` int :ptrX

>GC+

>G>+

>G2+
G2

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions ptr @ *int :+ C5BCCX Ans(er/ Ies 01p2anati"n/ The pointer ptr will point at the integer in the memory location C5BCC. >G/+ main*+ ] char aOBP@N,400"NX printf*NWsN,a+X ^ Ans(er/ !ompiler error7 Too many initializers 01p2anati"n/ 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 ^ Ans(er/ ,400WbSabSb```baaS 01p2anati"n/ 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 ^ Ans(er/ !ompiler error7 !annot increment a void pointer 01p2anati"n/ -oid pointers are generic pointers and they can be used only when the type is not nown and as an intermediate address storage type. $o pointer arithmetic can be done on it and you cannot apply indirection operator *:+ on void pointers.
G/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

>GA+

main*+ ] ] ] ^ printf*NWdN,i+X ^ printf*NWdN,i+X ^ int iX e5tern int iX int i@2CX const volatile unsigned i@/CX printf*NWdN,i+X

>GG+

6rintf can be implemented by using MMMMMMMMMM list. Ans(er/ -ariable length argument lists >GE+ char :some1un*+ ] char :temp @ [string constantNX return tempX ^ int main*+ ] puts*some1un*++X ^ Answer7 string constant 01p2anati"n7 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

GB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions puts*some1un2*++X ^ Answer7 %arbage values. 01p2anati"n7 (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.

G? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

C++ Aptitude and OOPS


!;; 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 ^ Ans(er / GA
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions Say i am in some1unc $ull pointer assignment*'un9time error+ 01p2anati"n7 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` Ans(er/ 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
GG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions ^ Ans(er/ CCCCC C>C>C 01p2anati"n/ 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 wor s 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 ta en 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 ^ Ans(er/ from base from base 01p2anati"n/ 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.
GE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ^ Ans(er/ from base from derived 01p2anati"n/ '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
GK Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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
EC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 LL ^
E> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

ob=> RR coutX ob=2 RR coutX

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 li e 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
E2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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
E/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions ?,? 45planation7 Though no operator@ function ta ing comple5, double is defined, the double on the rhs is converted into a temporary ob=ect using the single argument constructor ta ing 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. 4r+ it :"urse28 >+ 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 ^
EB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 relationship. nown as 99999999 relationship. !ontainership as MMMMMMMM

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

E? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 1. What is a modifier? Ans(er/ 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? Ans(er/ 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. Ans(er/
4e'p2ate c2ass/

A generic definition or a parameterized class not instantiated until the client provides the needed information. &t3s =argon for plain templates.
C2ass te'p2ate/

A class template specifies how individual classes can be constructed much li e the way a class specifies how individual ob=ects can be constructed. &t3s =argon for plain classes. *. When does a name clash occur? Ans(er/ 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. Ans(er/ &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. Ans(er/ A using declaration ma es it possible to use a name from a namespace without the scope operator. 5. What is an +terator class? Ans(er/ 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,
EA Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. Ans(er/ %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. Ans(er/ "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+.
EG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions "b=ect "riented Analysis *""A+ *Shlaer and #ellor >KK2+. The 1usion #ethod *!oleman >KK>+.

11. What is an incomplete type? Ans(er/ &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. 01a'p2e/ 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? Ans(er/ A dangling pointer arises when you use the address of an ob=ect after its lifetime is over. This may occur in situations li e 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. Ans(er/ %essa*e %et5"d "b=ects communicate by sending messages 6rovides response to a message. to each other. A message is sent to invo e a method. &t is an implementation of an operation. 1*. What is an adaptor class or Wrapper class? Ans(er/ 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? Ans(er/ &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? Ans(er/ A class invariant is a condition that defines all valid states for an ob=ect. &t is a logical condition to ensure the correct wor ing 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
EE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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? Ans(er/ &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. Ans(er/ Prec"nditi"n/ 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. P"st,c"nditi"n/ 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? Ans(er/ 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? Ans(er/ "b=ects that stand for other ob=ects are called pro5y ob=ects or surrogates. 01a'p2e/ templateRclass TQ class Array2D ] public7 class Array>D ] public7 TU operatorOP *int inde5+X const TU operatorOP *int inde5+ constX ... ^X
EK Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. Ans(er/ Smalltal , Dava, 4iffel, Sather. 22. &ame the operators that cannot .e overloaded. Ans(er/ sizeof . .: .9Q 77 `7 23. What is a node class? Ans(er/ 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? Ans(er/ KC
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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? Ans(er/ 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 well9 nown 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? Ans(er/ 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? Ans(er/ 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? Ans(er/ 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? Ans(er/ 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. 01p2anati"n/ &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
K> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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? Ans(er/ 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. 01p2anati"n/ 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 invo es. 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* ++
K2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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? Ans(er/ A memory lea occurs when a program loses the ability to free a bloc dynamically allocated memory.

of

32.What is a parameteriCed type? Ans(er/ 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? Ans(er/ 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. 01p2anati"n/ <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 .
K/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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? Ans(er/ 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? Ans(er/ A smart pointer is an ob=ect that acts, loo s and feels li e 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 chec ed. $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 unli e regular pointers, they donTt respect inheritance. Smart pointers are unattractive for polymorphic code. %iven below is an e5ample for the implementation of smart pointers.
01a'p2e/

template Rclass HQ class smartMpointer ] public7 smartMpointer*+X smartMpointer*const HU 5+ HU operator :* +X const HU operator:* + constX H: operator9Q*+ constX

LL ma es a null pointer LL ma es pointer to copy of 5

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 0i e other overloaded operators, p will behave li e a regular pointer, coutRR:pX p9QraiseMsalary*C.?+X 30. KB What is reflexive association?
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions Ans(er/ 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? Ans(er/ 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. 01p2anati"n/ !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? Ans(er/ $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 lin er always insists on all function names being uni.ue.
01a'p2e/

&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 li e7 K? LL a possible member name mangling
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ma e their instances uni.ue+. 3?. What are proxy o.jects? Ans(er/ "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. Ans(er/ 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.
KA Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions *1. What is cloning? Ans(er/ An ob=ect can carry out copying in two ways i.e. it can set itself to be a copy of another ob=ect, or it can return a copy of itself. The latter process is called cloning. *2. !escri.e the main characteristics of static functions. Ans(er/ The 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 invo ed 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. Ans(er/ An inline function is a re.uest and not a command. ,ence it wonTt be compiled as an inline function always. 01p2anati"n/ &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. Ans(er/ The function must be defined inside the class. *-. )ow can a W::W operator .e used as unary operator? Ans(er/ The scope operator can be used to refer to 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? Ans(er/ 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
KG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 tas s 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 ma es it possible to distinguish any ob=ect in an unambiguous way, and independently
KE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 thin ing 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.
KK Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions 6ssociation: &tsT =ust a semantic connection two classes. e.g.7 uses class A class ( 6ggregation: &tsT the relationship between two classes which are related in the fashion that master and slave. The master ta es full rights than the slave. Since the slave wor s under the master. &t is represented as line with diamond in the master area. e57 car contains wheels, etc. car car wheels

,ontainment: This relationship is applied when the part contained with in the whole part, dies when the whole part dies. &t is represented as dar ed 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 li e this. class A class (

=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. class A

class (

class !

!ependency: &t is the relationship between dependent and independent classes. Any
>CC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 li e 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 li e '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?
>C> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 stic man li e this. /i$3r$m:

>C2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 tal s 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.
>C/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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.

>CB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

Quantitative Aptitude
Quantitative Aptitude
01ercise 1 S"2ve t5e 8"22"(in* and c5ec) (it5 t5e ans(ers *iven at t5e end. >. &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 ta e to complete the wor ` 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 shop eeper professes to sell pulses at the cost price, but he uses a false weight of K?Cgm. for a g. ,is gain is JW. A software engineer has the capability of thin ing >CC lines of code in five minutes and can type >CC lines of code in >C minutes. ,e ta es 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 wor s, 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 contractor agreeing to finish a wor in >?C days, employed G? men each wor ing E hours daily. After KC days, only 2LG of the wor was completed. &ncreasing the number of men by MMMMMMMM each wor ing now for >C hours daily, the wor can be completed in time. what is a percent of b divided by b percent of a` *a+ a *b+ b *c+ > *d+ >C *d+ >CC

2. /. B.

?.

A.

G. 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.

>C? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions K. A tennis mar er 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 > 2 2 ? 22 / / B A

>C. >>. >2.

The number on the face opposite to the face carrying > is MMMMMMM . The number on the faces ad=acent to the face mar ed ? are MMMMMMM . 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` 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`

>/.

>B.

>?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 boo s are written by 'oth o, %or y, (urchfield and ,opper, not necessary in that order, and published by ,eron, 6iegon, (lue=a and sparrow, not necessary in that order.
>CA Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions > 2 / B >?. >A. >G. >E. *>+ The boo by 'oth o is published by Sparrow. *2+ The Spy thriller is published by ,eron. */+ The science fiction novel is by (urchfield and is not published by (lue=a. *B+The %othic romance is by ,opper. 6igeon publishes MMMMMMMMMMMM. The novel by %or y MMMMMMMMMMMMMMMM. Dohn purchases boo s by the authors whose names come first and third in alphabetical order. ,e does not buy the boo s MMMMMM. "n the basis of the first paragraph and statement *2+, */+ and *B+ only, it is possible to deduce that >. 'oth o 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. &f a light flashes every A seconds, how many times will it flash in c of an hour` &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( 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 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. /. B. ?. A.
>CG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

>K. 2C. 2>.

22.

2/92G. Ashland is north of 4ast 0iverpool and west of !oshocton. (owling green is north of Ashland and west of 1rederic town. Dover is south and east of Ashland. 4ast 0iverpool is north of 1rederic town and east of Dover. 1rederic town is north of Dover and west of Ashland. !oshocton is south of 1rederic town and west of Dover.

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+ 1rederic town Fhich of the following must be both north and east of 1rederic town` *a+ Ashland *b+ !oshocton *c+ 4ast 0iverpool & a only && b only &&& c only &- a U b -aUc Fhich of the following towns must be situated both south and west of at least one other town` A. Ashland only (. Ashland and 1rederic town !. Dover and 1rederic town D. Dover, !oshocton and 1rederic town 4. !oshocton, Dover and 4ast 0iverpool. Fhich of the following statements, if true, would ma e 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 1rederic town *e+ (owling green is north of 1rederic town 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 4ight friends ,arsha, 1a is, (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` &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. 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.

2B.

2?.

2A.

2G.

2E.

2K.

/C.

>CE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions />. /2. //. /B. &t ta es #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` 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. 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.

/?.

.ns4ers: >. Ans(er/ /C days. 01p2anati"n/ "efore: "ne day wor "ne man3s one day wor &ow: $o. "f wor ers "ne day wor

@ @ @ @

> L 2C > L * 2C : G?+ ?C ?C : > L * 2C : G?+

The total no. of days re.uired to complete the wor @ *G? : 2C+ L ?C @ /C 2. Ans(er/ CW 01p2anati"n/ Since /5 L 2 @ 5 L *2 L /+ Ans(er/ ?./ W 01p2anati"n/ ,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 Ans(er/ 2?C lines of codes

/.

B.
>CK

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

?.

Ans(er/ G days 01p2anati"n/ The e.uation portraying the given problem is7 >C : 5 ) 2 : */C ) 5+ @ 2>A where 5 is the number of wor ing days. Solving this we get 5 @ 2/ $umber of days he was absent was G */C92/+ days. Ans(er/ >?C men. 01p2anati"n/ "ne day3s wor "ne hour3s wor "ne man3s wor

A.

@ @ @

2 L *G : KC+ 2 L *G : KC : E+ 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 wor ing after the KCth day. Fe get 5 @ 22? Since we have G? men already, it is enough to add only >?C men. G. Ans(er/ *c+ > 01p2anati"n/ 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 ++ @ > Ans(er/ !ost price of horse @ 's. BCC U the cost price of cart @ 2CC. 01p2anati"n/, 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

E.

H @ 2 : y 99999999999999999*>+ &n the second sale, he lost 's. >C. *i.e.+ The loss is greater than the profit by 's. >C.
>>C Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 % 5 600 1rom *>+ 2 : 2CC @ x 5 +00 K. Ans(er/ /. 01p2anati"n/ 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. Ans(er/ ? Ans(er/ >,2,/ U B Ans(er/ ( Ans(er/ >> U K apples per tree. 01p2anati"n/ 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 Ans(er/ %. 01p2anati"n/ The order in which they are climbing is ' ) % ) _ ) , ) D Ans(er/ $ovel $ame Spy thriller
>>> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

>C. >>. >2. >/.

>B.

>? ) >E Author 'ath o 6ublisher ,eron

Technical Aptitude Questions #urder mystery %othic romance Science fiction 01p2anati"n/ %iven $ovel $ame Spy thriller #urder mystery %othic romance Science fiction %or y (urchfield ,opper 6iegon (lue=a Sparrow

Author 'ath o %or y (urchfield ,opper

6ublisher ,eron 6iegon (lue=a 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 %or y, %or y writes Spy thriller and 'ath o writes #urder mystery. >K. Ans(er/ B?> times. 01p2anati"n/ 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. Ans(er/ *B+ 01p2anati"n/ 6 A ( Since p is a point on the line segment A(, A( Q A6 2>. 22. Ans(er/ *c+ Ans(er/ *b+ U *d+.

2C.

>>2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions Ahmed 2/ 9 2G.Ans(er/ 1a is 2E. Ans(er/ 1a is 01p2anati"n/ )arsha 4swar Dhinesh 678 Ans(er/ *?+. 01p2anati"n/ 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 Ans(er/ 5@B 01p2anati"n/ 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. Ans(er/ ? *y ) 2+ L y. 01p2anati"n/ 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 Ans(er/ *2+ Ans(er/ > 01p2anati"n/ (ala=i !handra =eetha

908

/>.

/2. //.

>>/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions "ne is the only number e5ists without reciprocal because the reciprocal of one is one itself. /B. Ans(er/ Sudhir had /K cars, Arvind had 2> cars and %auri had >2 cars. 01p2anati"n/ Sudhir Arvind 1inally 2B (efore %auri3s transaction >2 (efore Arvind3s transaction A (efore Sudhir3 s transaction /K /?. 2B >2 B2 2>

%auri 2B BE 2B >2

Ans(er/ !ost price of horse7 's. BCC U !ost price of cart7 's. 2CC 01p2anati"n/ 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 *>+

01ercise 2.1 :or the follo4in3& fin# the next term in the series >. A, 2B, AC,>2C, 2>C a+ //A b+ /AA c+ //C d+ AAC * T.T means product+

Ans(er 7 a+ //A 01p2anati"n 7 The series is >.2./, 2./.B, /.B.?, B.?.A, ?.A.G, ..... 2. >, ?, >/, 2? Ans(er 7 B> 01p2anati"n 7 The series is of the form C82;>82, >82;282,...
>>B

Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions /. C, ?, E, >G Ans(er 7 2B 01p2anati"n 7 >829>, 282;>, /829>, B82;>, ?829> B. >, E, K, AB, 2? *,int 7 4very successive terms are related+

Ans(er 7 2>A 01p2anati"n 7 >82, 28/, /82, B8/, ?82, A8/ ?. E,2B,>2,/A,>E,?B Ans(er 7 2G A. G>,GA,AK,GB,AG,G2 Ans(er 7 AG G. ?,K,>A,2K,?B Ans(er 7 >C/ 01p2anati"n 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+ Ans(er 7 2CC 01p2anati"n 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. 01ercise 2.2 :in# the o## m$n out8 >. /,?,G,>2,>/,>G,>K Ans(er 7 >2 01p2anati"n 7 All but >2 are odd numbers 2. 2,?,>C,>G,2A,/G,?C,AB Ans(er 7 AB 01p2anati"n 7 2;/@?X ?;?@>CX >C;G@>GX >G;K@2AX 2A;>>@/GX /G;>/@?CX ?C;>?@A?X /. >C?,E?,AC,/C,C,9B?,9KC Ans(er 7 C 01p2anati"n 7 >C?92C@E?X E?92?@ACX AC9/C@/CX /C9/?@9?X 9?9BC@9B?X 9B?9B?@9KCX 01ercise 3 ;ol<e the follo4in38
>>? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

>. Fhat is the number of zeros at the end of the product of the numbers from > to >CC` Ans(er 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` Ans(er 7 > hr >2 min 01p2anati"n / 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 /. %avas arTs 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 wic et in his ?>st innings+ Ans(er 7 >C> 01p2anati"n 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 wic et 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` Ans(er 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 Ans(er 7 *b+ A. A rectangular plate with length E inches, breadth >> inches and thic ness 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` Ans(er 7 /.? inches 01p2anati"n 7 -olume of the circular rod *cylinder+ @ -olume of the rectangular plate *22LG+:B:B:h @ E:>>:2 h @ GL2 @ /.?
>>A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions G. Fhat is the sum of all numbers between >CC and >CCC which are divisible by >B ` Ans(er 7 /?/K2 01p2anati"n 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. Ans(er 7 B 01p2anati"n 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` Ans(er 7 >AL/ inches 01p2anati"n 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` Ans(er 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` Ans(er 7 EB years 01p2anati"n 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` Ans(er 7 > 6.#. 01p2anati"n 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` Ans(er 7 > >L2 degrees 01p2anati"n 7 The magnifying glass cannot increase the magnitude of an angle.
>>G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. Ans(er7 E, >2, ?, 2C 01p2anati"n7 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. Ans(er 7 /G >L2 01p2anati"n 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 Ans(er 7 d+ Any of the other three. 01p2anati"n 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 Ans(er 7 b+ &talian U Spanish 01p2anati"n 7 $o of e5ecutives who now i+ 4nglish is 2 ii+ Spanish is / iii+ &talian is /
>>E Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions iv+ 1rench is 2 &talian U Spanish are spo en 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` Ans(er 7 A2? 01p2anati"n 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+ >> 01ercise 3 Tr% the follo4in38 >. There are seventy cler s wor ing in a company, of which /C are females. Also, /C cler s are marriedX 2B cler s are above 2? years of ageX >K married cler s 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 spo en 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 Twal 9and9runT every morning around a trac formed by an e.uilateral triangle. The fatherTs wal ing speed is 2 mph and his
>>K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions running speed is ? mph. The sonTs wal ing and running speeds are twice that of his father. (oth start together from one ape5 of the triangle, the son going cloc wise and the father anti9cloc wise. &nitially the father runs and the son wal s for a certain period of time. Thereafter, as soon as the father starts wal ing, 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 -ic y ) 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+ -ic y >C. Fhich of the following groups of three can sit together on a bench` *a+ 1reddy, Donathan and #arta *b+ 1reddy, Donathan and -ic y *c+ 1reddy, Sarah and -ic y *d+ ,illary, 0upe and Sarah *e+ 0upe, #arta and 'oberto >>. &f 1reddy sits immediately beside -ic y, which of the following cannot be true ` a. Donathan sits immediately beside Sarah b. 0upe sits immediately beside -ic y c. ,illary sits in the front passenger seat d. 1reddy sits on the same bench as ,illary
>2C Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 -ic y >/. #a e si5 s.uares of the same size using twelve match9stic s. *,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. *&+ z2 @ 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 spea s truth GCW of the timeX ( spea s 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
>2> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions way with doughnuts. Anna is sitting across from the doctor and ne5t to the chemist. The doctor was thin ing that (ena was a good name for parentTs to choose, but didnTt say anything. Fhat is each personTs occupation`

>22 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

UNIX Concepts
<$&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 bloc s+. 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 bloc s of the file. &f the file is large, inode has indirect pointer to a bloc of pointers to additional data bloc s *this further aggregates for larger files+. A bloc is typically E . &node consists of the following fields7 1ile owner identifier 1ile type 1ile access permissions 1ile access times $umber of lin s 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 ma es two entries named T.T *refers to the directory itself+ and T..T *refers to parent directory+. System call for creating directory is m dir *pathname, mode+. *. What are the Qnix system calls for +GE?
>2/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. 0in s 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 lin s are eliminated in symbolic lin s. !ommands for lin ing files are7 0in ln filename> filename2 Symbolic lin ln 9s filename> filename2
>2B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 m nod 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 ma es the other entries li e 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 bloc s 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 for s 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
>2? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 li e 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 chec ing 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 ^ Ans(er/ ,ello ForldS,ello ForldS 01p2anati"n7 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
>2A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions printf*N,ello ForldSN+X ^ Ans(er/ N,ello ForldN will be printed E times. 01p2anati"n7 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, soc ets, message .ueues, shared memory+, but also have some special ways to communicate that ta e 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 for s 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
>2G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 wor ing 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 bac ground, waiting for re.uests and responding to them. &t can also be defined as the bac ground 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 Ta es 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 ta es care of incoming rlogin, telnet, and ftp connections. cron7 'esponsible for running repetitive tas s 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 ta en to e5ecute so far etc. 1-. )ow would you 'ill a process? The ill command ta es the 6&D as one argumentX this identifies which process to >2E
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 bac ground 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 bac ground symbol, U. This symbol tells your shell to e5ecute the given command in the bac ground. 45ample7 cp :.: ..Lbac upU *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 loc s, record9loc s, and semaphores. S4!T&"$ 9 &&& #4#"'I #A$A%4#4$T 1. What is the difference .etween $wapping and >aging? $wapping:
>2K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. Address > <nits >C,CCC

This allows 1irst91it allocation of contiguous bloc s 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 bloc s. "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 -.
>/C Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 loc s the other swapping process while the current swapping operation is going on, The _ernel saves the swap address of the region in the region table. 7. +s the >rocess .efore and after the swap are the same? =ive reason. 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 ta ing 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) - All Rights Reserved

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 ta e any up physical memory. 6rocesses loc ed 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 wor s 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 awa en once in a second by the _ernel. 10. What are the criteria for choosing a process for swapping into memory from the swap device? The resident 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
>/2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions "nly the administrator can supply the nice value. The nice *+ system call wor s for the running process only. $ice value of one process cannot affect the nice value of the other process. 1?. What are conditions on which deadloc' can occur while swapping the processes? All processes in the 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 wor ing set of the process. 23. What is the window of the wor'ing set of a process? The window of the wor ing set of a process is the total number in which the process had referred the set of pages in the wor ing set of the process. 2*. What is called a page fault? 6age fault is referred to the situation when the process addresses a page in the wor ing set of the process but the process fails to locate the page in the wor ing set. And on a page fault the ernel updates the wor ing set by reading the page 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) - All Rights Reserved

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, ma es 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 ma es a copy of the parent process3s address space and attaches it to the child process. (ut the vfor *+ system call do not ma es 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 ma es rooms for the incoming pages, by swapping the memory pages that are not the part of the wor ing set of a process. 6age9Stealer is created by the _ernel at the system initialization and invo es it throughout the lifetime of the system. _ernel loc s a region when a process faults on a page in the region, so that page stealer cannot steal the page, which is being faulted in. 31. &ame two paging states for a page in memory? The two paging states 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?
>/B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. 30. 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, #ar ed [demand zero\, #ar ed [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) - All Rights Reserved

Technical Aptitude Questions &n situations li e, 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 li e, where the copy on write bit is set and no processes are sharing the page, the _ernel allows the physical page to be reused by the processes. (y doing so, it clears the copy on write bit and disassociates the page 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 chec ed for the validity fault, as soon as it is found that the page is invalid *valid bit is clear+, the validity fault handler returns 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 chec s for signals. **. )ow the [ernel handles .oth the page stealer and the fault handler? The page stealer and the fault handler thrash because of the shortage of the memory. &f the sum of the wor ing 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.

>/A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

RDBMS Concepts
'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 bac up 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. >/G!efine the Kintegrity rulesK
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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? <nli e '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.
>/E Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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+.
>/K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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.
>BC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 ta e 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. 37. )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.
>B> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 Super9 ey 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 -&<? >B2
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 .uic ly 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. >B/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 deadloc s that do not really e5ist. Such situations are called phantom deadloc s and they lead to unnecessary aborts. 0@. What is a chec'point and When does it occur? A !hec point is li e a snapshot of the D(#S state. (y ta ing chec points, 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.
>BB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 non9correlated 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,
>B? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 loc ing 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 bac up, if there is one. 5?. What is an Eracle +nstance?
>BA Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions The "racle system processes, also nown as "racle bac ground 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 bac ground processes and user processes can use them. The combination of the S%A and the "racle bac ground processes is nown as an Eracle instance 7@. What are the four Eracle system processes that must always .e up and running for the data.ase to .e usea.le The four "racle 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 ma e the database structure very fle5ible for controlling access to storage for different users, putting the database on different dis drives, or bac ing up and restoring =ust part of the database. 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.
>BG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 bloc s when they are first createdgma ing 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 ta es up some space to manage the contents of the bloc . This bloc header has a minimum size, but it can grow. These "racle bloc s 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 bloc s 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 bac ing 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.
>BE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 invo e 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. 01cepti"n Na'e !<'S"'MA0'4ADIM"64$ D<6M-A0M"$M&$D4H &$-A0&DM!<'S"' &$-A0&DM$<#(4' 0"%&$MD4$&4D
>BK Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Orac2e 0rr"r "'A9CA?>> "'A9CCCC> "'A9C>CC> "'A9C>G22 "'A9C>C>G

Technical Aptitude Questions $"MDATAM1"<$D $"TM0"%%4DM"$ 6'"%'A#M4''"' ST"'A%4M4''"' T&#4"<TM"$M'4S"<'!4 T""M#A$IM'"FS T'A$SA!T&"$M(A!_4DM"<T -A0<4M4''"' f4'"MD&-&D4 "'A9C>BC/ "'A9C>C>2 "'A9CA?C> "'A9CA?CC "'A9CCC?> "'A9C>B22 "'A9CCCA> "'A9CA?C2 "'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 pac ages before loo ing at globally defined pac ages or internal functions. To further ensure calling the proper procedure, you can use the dot notation. 6refacing a procedure or function name with the pac age 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
>?C Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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&E D)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) - All Rights Reserved

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 chec s the authority of user to access data. 1@@. What are stand3alone procedures? 6rocedures that are not part of a pac age 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 bac up is performed, the only option available in the event of data file loss is restoring all the files from the latest bac up. All wor performed on the database since the last bac up is lost. )ot "ac'up: Some sites *such as worldwide airline reservations systems+ cannot shut down the database while ma ing a bac up copy of the files. The cold bac up is not an available option. So different means of bac ing up database must be used g the hot bac up. &ssue a SQ0 command to indicate to "racle, on a tablespace9by9tablespace basis, that the files of the tablespace are to bac ed up. The users can continue to ma e full use of the files, including ma ing 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 bac up destination. The database must be running in A'!,&-40"% mode for the hot bac up option.
>?2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions &f a data loss failure does occur, the lost database files can be restored using the hot bac up and the online and offline redo logs created since the bac up was done. The database is restored to the 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 well9 nown 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 ma e _ 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) - All Rights Reserved

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

>?B Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

SQL
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 +&$1 D +&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) - All Rights Reserved

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*. D Q&,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 D Q&,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? Ans(er / !'4AT4 TA(04 .. AS S404!T command 01p2anati"n / 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,12D 6&$L6D12LD +#2 D +#2WUU 6D)1& UUW%WUW4% WUW4% W6&W% W99W4%W9W%WD EQ"L1W4 < E# !Q6LJ
T'"<(04T,4T'"<(04 17. What will .e the output of the following /uery? $1L1,D !1,E!12D 6&$L6D12W6W%W123*-057?@W%W1111111111W4% W1W%W_1$W% W&EW 4J Ans(er / $" 01p2anati"n / The .uery chec s 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$
>?A Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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? Ans(er / D4S! has two purposes. &t is used to describe a schema as well as to retrieve rows from table in descending order. 01p2anati"n / 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&$D 6+&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 D Q&,2123*.-057%324 < E# !Q6LJ >2CC

;@2 A @1>R?>;
>?G Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions . SC;0%AS Da.le 1 : S4UD 0S 6$A#4 *-A'!,A'+, S60A!4 *-A'!,A'+, !"<'S4 *-A'!,A'+, !!"ST *$<#(4'+ Da.le 2 : SO<4=A#0 6$A#4 *-A'!,A'+, T&T04 *-A'!,A'+, D4-&$ *$<#(4'+, D!"ST *$<#(4'+, S"0D *$<#(4'+ Da.le 3 : P#O>#A%%0# 6$A#4 *-A'!,A'+, D"( *DAT4+, D"D *DAT4+, S4H *!,A'+, 6'"1> *-A'!,A'+, 6'"12 *-A'!,A'+, SA0 *$<#(4'+ 2>B>'/ : 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 > QU0# 0S / 1. <ind out the selling cost average for pac'ages developed in Eracle. 2. !isplay the names% ages and experience of all programmers. 3. !isplay the names of those who have done the >=!,6 course. *. What is the highest num.er of copies sold .y a pac'age? -. !isplay the names and date of .irth of all programmers .orn in 6pril. 0. !isplay the lowest course fee. 5. )ow many programmers have done the !,6 course. 7. )ow much revenue has .een earned through the sale of pac'ages developed in ,. ?. !isplay the details of software developed .y a'esh. 1@. )ow many programmers studied at >entafour. 11. !isplay the details of pac'ages whose sales crossed the -@@@ mar'. 12. <ind out the num.er of copies which should .e sold in order to recover the development cost of each pac'age. 13. !isplay the details of pac'ages for which the development cost has .een recovered. 1*. What is the price of costliest software developed in B"? 1-. )ow many pac'ages were developed in Eracle ? 10. )ow many programmers studied at > 6=6D)+? 15. )ow many programmers paid 1@@@@ to 1-@@@ for the course? 17. What is the average course fee? 1?. !isplay the details of programmers 'nowing ,.
>?E Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

*-A'!,A'+,

S!"ST

Technical Aptitude Questions 2@. )ow many programmers 'now either , or >ascal? 21. )ow many programmers donFt 'now , and ,88? 22. )ow old is the oldest male programmer? 23. What is the average age of female programmers? 2*. ,alculate the experience in years for each programmer and display along with their names in descending order. 2-. Who are the programmers who cele.rate their .irthdays during the current month? 20. )ow many female programmers are there? 25. What are the languages 'nown .y the male programmers? 27. What is the average salary? 2?. )ow many people draw -@@@ to 5-@@? 3@. !isplay the details of those who donFt 'now ,% ,88 or >ascal. 31. !isplay the costliest pac'age developed .y each programmer. 32. >roduce the following output for all the male programmers >rogrammer #r. 6rvind : has 1- years of experience C>D;: >. 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
>?K Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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

. SC;0%A /
Da.le 1 : />ET D46T$" *$"T $<00 , $<#(4'*2++, D$A#4 *-A'!,A'2*>B++, 0"! *-A'!,A'2*>/+ Da.le 2 : >0E 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. QU0# 0S
>AC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 2 ecords% which are inserted% that already exist4 in the 1#> ta.le. 1-. Write a /uery to list the length of service of the employees 2of the form n years and m months4. C>D;: >. 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
>A> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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

>A2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

Computer Net or!s !omputer $etwor s


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 networ s usually separated by a bridge or router. 3. !ifference .etween the communication and transmission. Transmission is a physical movement of information and concern issues li e 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 *6ac et 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 pac et 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 networ s problems. The stations on the networ notify the other stations on the ring when they are not receiving the transmissions. (eaconing is used in To en ring and 1DD& networ s. >A/
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 networ ing 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 networ ing 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 attenuation. cable is called

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 &
>AB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 internetwor ing 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./+, To en ring 0A$ *EC2.B+, To en 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 stac s 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+.
>A? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 pac ets among multiple interconnected networ s *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 pac ets among networ s that have different protocols *e.g. between a 0A$ and a FA$+. They accept a pac et formatted for one protocol and convert it to a pac et 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 pac et 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?
>AA Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 pac et 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 networ s 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.
>AG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

3*. What is mesh networ'? A networ in which there are multiple networ provide multiple paths for data to travel.

lin s between computers to

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 to en 'ing , hub is called #ultistation Access <nit*#A<+. 37. What is the difference .etween routa.le and non3 routa.le protocols? 'outable protocols can wor with a router and can be used to build large networ s. $on9'outable protocols are designed to wor on small, local networ s 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? 6ac et filter is a standard router e.uipped with some e5tra functionality. The e5tra functionality allows every incoming or outgoing pac et to be inspected. 6ac ets meeting some criterion are forwarded normally. Those that fail the test are dropped. **. What is traffic shaping?
>AE Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 pac et 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 pac ets 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 bloc s, 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 authentication protocol. nown ey distribution center *_D!+

-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 networ s 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.
>AK Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

--. What is "=> 2"order =ateway >rotocol4? &t is a protocol used to advertise the set of networ s 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 ma e 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 +> 2 outing +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.

>GC Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

Technical Aptitude Questions

Operatin" S#stems
"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 ta es 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.

>G> Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 bloc ed 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 ma es the finest9grained decision of which process should e5ecute ne5t. This scheduler is invo ed 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 Stac 7 4ach process has one or more 0&1" stac s 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 loo up. 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. For ing 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?
>G2 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 dis s are more li ely 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 bloc ing, 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.
>G/ Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 bloc ed 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 ta es 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 ta en to actually transfer a span of data is transfer time. 21. !escri.e the "uddy system of memory allocation. 1ree memory is maintained in lin ed lists, each of e.ual sized bloc s. 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 bro en 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 chec s to see if its buddy is also free. &f so, it is re=oined, and put into the original free9bloc lin ed9list. 22. What is time3stamping? &t is a techni.ue proposed by 0amport, used to order events in a distributed system without the use of cloc s. 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.
>GB Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 lin ing7 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 lin ing is postponed until actual reference during e5ecution. Then the correct module is loaded and lin ed. 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.
>G? Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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 li e 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 >GA
Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

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. DD s are device driver its, which are e.uivalent to SD_s for writing device drivers. Findows $T includes DD s. *7. What level of security does Windows &D meets? !2 level security.

>GG Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved

You might also like