technical aptitude questions

253
Face Interviews Confidently!

Upload: rajat-pani

Post on 16-Aug-2015

261 views

Category:

Documents


7 download

DESCRIPTION

TA

TRANSCRIPT

Face Interviews Confdently!Technical Aptitude QuestionsTable of ContentsData Structures Aptitude.............................................................................3C Aptitude..................................................................................................12C++ Aptitude and OOPS.............................................................................75Quantitative Aptitude...............................................................................104UNIX Concepts.........................................................................................121RDBMS Concepts.....................................................................................135SQL..........................................................................................................153Computer Networks.................................................................................161Operating Systems...................................................................................169Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved2Technical Aptitude QuestionsData Structures Aptitude1. What is data structure?A datastructureisawayoforganizingdatathat considersnotonlytheitemsstored, but also their relationship to each other. Advance nowledge about therelationship between data items allows designing of efficient algorithms for themanipulation of data.2. List out the areas in which data structures are applied extensively? !ompiler Design, "perating System, Database #anagement System, Statistical analysis pacage, $umerical Analysis, %raphics, Artificial &ntelligence, Simulation3. 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 pointertype will you use?The heterogeneous lined list contains different data types in its nodes and weneed a lin, pointer to connect them. &t is not possible to use ordinary pointers for this. Sowe go for void pointer. -oid pointer is capable of storing pointer to any type as it is ageneric pointer type. -. #inimum num.er of /ueues needed to implement the priority /ueue?Two. "ne .ueue is usedfor actual storingof data andanother for storingpriorities.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved/Data Structures Aptitude Technical Aptitude Questions0. What is the data structures used to perform recursion?Stac. (ecause of its 0&1" *0ast &n 1irst "ut+ property it remembers its 2caller3 sonows whom to return when the function has to return. 'ecursion maes use of systemstac for storing the return addresses of the function calls. 1very recursivefunctionhas 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 andpostfix 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 $otation78 9 : ;A(! 9 D4 ; 1%6ostfi5 $otation7A( ; ! : D4 9 9 1% ; 8?. $orting is not possi.le .y using which of the following methods?2a4 +nsertion 2.4 $election 2c4 1xchange2d4 !eletion*d+ Deletion.

0et us tae a tree with ? nodes *n@?+ &t will have only A *ie,?;>+ null branches. &n general, 6 .inary tree with n nodes has exactly n+1 null nodes. 11. What are the methods availa.le in storing se/uential files ?Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedB$ull (ranchesTechnical Aptitude Questions Straight merging, $atural merging, 6olyphase sort, Distribution of &nitial runs.12. )ow many different trees are possi.le with 1@ nodes ?>C>B1or e5ample, consider a tree with/nodes*n@/+, it will have the ma5imumcombination of ? different *ie, 2/ 9 / @?+ trees.i ii iiiivv&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 list2c4 $tac' 2d4 Aueue 2e4 none*b+ 0ined list10. What is the type of the algorithm used in solving the 7 Aueens pro.lem?(actracing15. +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 bucet, when the collision occurs,there is no way to accommodate the colliding value. This results in the overlapping ofvalues.1?. Draverse the given tree using +norder% >reorder and >ostorder traversals. &norder 7 D , ( 4 A 1 ! & % D 6reorder7 A ( D , 4 ! 1 % & D 6ostorder7 , D 4 ( 1 & D % ! A2@. Dhere are 7% 1-% 13% 1* nodes were there in * different trees. Which of them couldhave formed a full .inary tree?>?. &n general7Dhere are 2n-1 nodes in a full .inary tree."y the method of elimination:1ullbinarytreescontainoddnumberofnodes.Sotherecannotbefullbinary trees with E or >B nodes, so re=ected.Fith >/ nodes you can form acompletebinary tree but not a full binary tree. So the correct answer is >?.Note:1ull and !omplete binary trees are different.6ll full .inary trees are complete.inary trees .ut not vice versa. 21. +n the given .inary tree% using array you can store the node * at which location?Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedAA( !D4 1 %, &D%iven tree7>2 /B?Technical Aptitude QuestionsAt locationA> 2 / 9 9 B 9 9 ?'oot 0!> '!> 0!2 '!2 0!/ '!/ 0!B '!Bwhere 0!n means 0eft !hild of node n and '!n means 'ight !hildof node n22. $ort the given values using Auic' $ort?A? GC G? EC E? AC ?? ?C B?Sortingtaesplacefromthepivot value, whichisthefirstvalueofthegivenelements, this is mared bold. The values at the left pointer and right pointer are indicatedusing 0 and ' respectively.65 GC0G? EC E? AC ?? ?C B?'Sincepivot isnot yet changedthesameprocessiscontinuedafterinterchangingthevalues at 0 and ' positions65 B? G? 0EC E? AC ?? ?C 'GC65 B? ?C EC 0E? AC ?? 'G? GC65 B? ?C ?? E? 0AC 'EC G? GC65 B? ?C ?? AC 'E? 0EC G? GCFhen the 0 and ' pointers cross each other the pivot value is interchanged with the valueat right pointer. &f the pivot is changed it means that the pivot has occupied its originalposition in the sorted order *shown in bold italics+ and hence two different arrays areformed,one from start of the original array to the pivot position9> and the other frompivot position;> to end.60 0B? ?C ?? '65 85 0EC G? GC 'Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedGTechnical Aptitude Questions55 0B? ?C '60 65 70 'EC 0G? 8550 0B? '55 60 65 70 EC 0G? '85&n the ne5t pass we get the sorted form of the array.45 50 55 60 65 70 75 80 8523. is internally represented as all >Ts. Fhen left shifted four times the leastsignificant BbitsarefilledwithCTs.TheW5format specifierspecifiesthat theintegervalue be printed as a he5adecimal value.11. main24Hchar stringNOIK)ello WorldKJdisplay2string4JMCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>?Technical Aptitude Questionsvoid display2char 9string4Hprintf2KLsK%string4JM Answer:,ompiler 1rror : Type mismatch in redeclaration of function display Explanation :&nthirdline, whenthefunction#ispl$%is encountered, the compilerdoesnTt now anything about the function display. &t assumes the arguments and returntypes 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 compiletime error occurs.12. main24Hint cI3 32Jprintf2KcILdK%c4JMAnswer:c@2X Explanation:,ere unary minus *or negation+ operator is used twice. Same mathsrulesapplies, ie. minus : minus@ plus.'ote: ,owever youcannot givelie992. (ecause99 operator canonlybeapplied to variables as a #e(rement operator *eg., i99+. 2 is a constant and not a variable.13. Tdefine int charmain24Hint iI0-Jprintf2KsiCeof2i4ILdK%siCeof2i44JMAnswer: sizeof*i+@>Explanation:Since the Ydefine replaces the stringint by the macro (h$r 1*. main24Hint iI1@JiIUiV1*Jprintf2KiILdK%i4JMAnswer:i@CCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>ATechnical Aptitude QuestionsExplanation:&n the e5pression )i*1+ , $"T *S+ operator has more precedence than 2 Q3symbol. )is a unary logical operator. Si *S>C+ is C *not of true is false+. CQ>B is false*zero+. 1-. TincludeRstdio.hVmain24Hchar sNOIHWaW%W.W%WcW%WPnW%WcW%WP@WMJchar 9p%9str%9str1JpI(sN3OJstrIpJstr1IsJprintf2KLdK%889p 8 889str13324JMAnswer:GGExplanation:p is pointing to character TZnT. str> is pointing to character TaT ;;:p. Np is pointingtoTZnT andthat isincrementedbyone.Nthe AS!&& valueofTZnT is>C, whichisthenincrementedto>>. Thevalueof ;;:pis >>. ;;:str>, str>is pointingtoTaT that isincremented 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.hVmain24Hint aN2ON2ON2O I H H1@%2%3%*M% H-%0%5%7MMJint 9p%9/JpI(aN2ON2ON2OJ9/I999aJprintf2KLd3333LdK%9p%9/4JMAnswer:Some%arbage-alue999>Explanation:p@UaO2PO2PO2Pyoudeclareonlytwo2Darrays, but youaretryingtoaccess the third 2D*which you are not declared+ it will print garbage values. :.@:::astarting 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.hVmain24Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>GTechnical Aptitude QuestionsHstruct xxHint xI3Jchar nameNOIKhelloKJ MJstruct xx 9sJprintf2KLdK%s3Vx4Jprintf2KLsK%s3Vname4JMAnswer:!ompiler 4rrorExplanation:Iou should not initialize variables in declaration17. TincludeRstdio.hVmain24Hstruct xxHint xJstruct yyHchar sJstruct xx 9pJMJstruct yy 9/JMJMAnswer:!ompiler 4rrorExplanation:The structure yy is nested within structure 55. ,ence, the elements are ofyy are to be accessed through the instance of structure 55, which needs an instance of yyto be nown. &f the instance is created after defining the structure the compiler will notnow about the instance relative to 55. ,ence for nested structure yy you have to declaremember.1?. main24Hprintf2KPna.K4Jprintf2KP.siK4Jprintf2KPrhaK4JMAnswer:haiCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>ETechnical Aptitude QuestionsExplanation:Zn9 newlineZb9 bacspaceZr9 linefeed2@. main24Hint iI-Jprintf2KLdLdLdLdLdLdK%i88%i33%88i%33i%i4JMAnswer:B??B?Explanation:Theargumentsinafunctioncall arepushedintothestacfromlefttoright. The evaluation is by popping out from the stac. and theevaluation is from right toleft, hence the result.21. Tdefine s/uare2x4 x9xmain24Hint iJi I 0*Gs/uare2*4Jprintf2KLdK%i4JMAnswer:ABExplanation:the macro call s.uare*B+ will substituted by B:B so the e5pression becomesi @ ABLB:B . Since L and : has e.ual priority the e5pression will be evaluated as *ABLB+:Bi.e. >A:B @ AB

22. main24Hchar 9pIKhai friendsK%9p1Jp1IpJwhile29pUIWP@W4 889p88Jprintf2KLs LsK%p%p14JMAnswer:ib=Sgs=foetExplanation:;;:p;; will be parse in the given order :p that is value at the location currently pointed by p will be taen ;;:p the retrieved value will be incremented when X is encountered the location will be incremented that is p;; will be e5ecutedCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>KTechnical Aptitude Questions,ence, inthewhileloopinitial valuepointedbypis2h3,whichischangedto2i3 bye5ecuting ;;:p and pointer moves to point, 2a3 which is similarly changed to 2b3 and soon. Similarly blan space is converted to 2S3. Thus, we obtain value in p becomes [ib=Sgs=foet\ and since p reaches 2ZC3 and p> points to p thus p>doesnot print anything. 23. Tinclude Rstdio.hVTdefine a 1@main24HTdefine a -@printf2KLdK%a4JMAnswer:?CExplanation:The preprocessor directives can be redefined anywhere in the program. Sothe most recently assigned value will be taen.2*. Tdefine clrscr24 1@@main24Hclrscr24Jprintf2KLdPnK%clrscr244JMAnswer:>CCExplanation:6reprocessor e5ecutes as a seperate pass before the e5ecutionof thecompiler. So te5tual replacement of clrscr*+ to >CC occurs.The inputprogram to compilerloos lie this 7main*+] >CCX printf*NWdZnN,>CC+X^'ote:>CCX is an e5ecutable statement but with no action. So it doesnTt give anyproblem2-. main24Hprintf2KLpK%main4JMAnswer:Some address will be printed.Explanation:Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved2CTechnical Aptitude Questions1unction names are =ust addresses *=ust lie array names are addresses+.main*+ is also a function. So the address of function main will be printed. Wp in printfspecifies that the argument is an address. They are printed as he5adecimal numbers.2G+ main*+]clrscr*+X^clrscr*+XAnswer:$o outputLerrorExplanation:The first clrscr*+ occurs inside a function. So it becomes a function call. &nthe second clrscr*+X is a function declaration *because it is not inside anyfunction+.2E+ enum colors ](0A!_,(0+X^Answer:C..>..2Explanation:enum assigns numbers starting from C, if not e5plicitly defined.2K+ void main*+] char far :farther,:farthestX

printf*NWd..WdN,sizeof*farther+,sizeof*farthest++X ^Answer:B..2Explanation:the second pointer is of char type and not a far pointer/C+ main*+] int i@BCC,=@/CCX printf*NWd..WdN+XCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved2>Technical Aptitude Questions^Answer:BCC../CCExplanation:printf taes the values of the first two assignments of the program. Anynumber of printfTs may be given. All of them tae only the first two values.&f more number of assignments given in the program,then printf will taegarbage values./>+main*+] char :pX p@N,elloNX printf*NWcZnN,:U:p+X^Answer:, Explanation::is a dereference operator Uis a reference operator. Theycanbeapplied any number of times provided it is meaningful. ,ere p points tothe first character in the string N,elloN. :p dereferences it and so its valueis ,. AgainU references it to an address and : dereferences it to the value,./2+main*+]int i@>Xwhile *iR@?+] printf*NWdN,i+X if *iQ2+goto hereX i;;X^^fun*+] here7 printf*N66N+X^Answer:!ompiler error7 is T'is WsN. Theconditional operator* `7 +evaluates to NT'CC S@ C+ VV yW>CC @@ C + printf*NWd is a leap yearN+Xelse printf*NWd is not a leap yearN+X^Answer:2CCC is a leap yearExplanation:An ordinary program to chec if leap year or not.AG+ Ydefine ma5 ?Ydefine int arr>Oma5Pmain*+]typedef char arr2Oma5PXarr> list@]C,>,2,/,B^Xarr2 name@NnameNXprintf*NWd WsN,listOCP,name+X^Answer:!ompiler error *in the line arr> list @ ]C,>,2,/,B^+Explanation:arr2 is declared of type array of size ? of characters. So it can be used todeclare 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 fordeclaring new types.AE+ int i@>CXmain*+] e5tern int iX ] int i@2CX] const volatile unsigned i@/CXCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved/?Technical Aptitude Questions printf*NWdN,i+X^printf*NWdN,i+X ^printf*NWdN,i+X^Answer:/C,2C,>CExplanation:T]T introduces new bloc and thus new scope. &n the innermost bloc i isdeclared as, const volatile unsignedwhich is a valid declaration. i is assumed of type int. So printf prints /C. &nthe ne5t bloc, i hasvalue 2Cand soprintfprints2C. &ntheoutermostbloc, i is declared as e5tern, so no storage space is allocated for it. Aftercompilation is over the liner resolves it to global variable i *since it is theonly variable visible there+. So it prints iTs value as >C.AK+ main*+]int :=X] int i@>CX =@UiX ^ printf*NWdN,:=+X^Answer:>CExplanation7Thevariablei isabloclevel variableandthevisibilityisinsidethatbloc only. (ut the lifetime of i is lifetime of the function so it lives uptothe e5it of main function. Since the i is still allocated space, := prints thevalue stored in i since = points i.GC+ main*+]int i@9>X9iXprintf*Ni @ Wd, 9i @ Wd ZnN,i,9i+X^Answer:i @ 9>, 9i @ >Explanation:Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved/ATechnical Aptitude Questions9i is e5ecuted and this e5ecution doesnTt affect the value of i. &n printf firstyou =ust print the value of i. After that the value of the e5pression 9i @ 9*9>+is printed.G>+ YincludeRstdio.hQmain*+ ] const int i@BX float =X = @ ;;iX printf*NWdWfN, i,;;=+X ^Answer7!ompiler error Explanation7i is a constant. you cannot change the value of constant G2+ YincludeRstdio.hQmain*+]int aO2PO2PO2P @ ] ]>C,2,/,B^, ]?,A,G,E^^Xint :p,:.Xp@UaO2PO2PO2PX:.@:::aXprintf*NWd..WdN,:p,:.+X^Answer:garbagevalue..>Explanation:p@UaO2PO2PO2Pyoudeclareonlytwo2Darrays. but youaretryingtoaccess thethird2D*whichyouarenot declared+ it will print garbagevalues. :.@:::a starting address of a is assigned integer pointer. now . ispointing to starting address of a.if you print :. meAnswer7it will print firstelement of /D array.G/+ YincludeRstdio.hQmain*+]register i@?Xchar =OP@ NhelloNX printf*NWsWdN,=,i+X^Answer:hello ?Explanation7Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved/GTechnical Aptitude Questionsif you declare i as registercompiler will treat it as ordinary integer and itwill tae integer value.i value may be stored either in register or inmemory.GB+ main*+]int i@?,=@A,zXprintf*NWdN,i;;;=+X ^Answer:>>Explanation:the e5pression i;;;= is treated as *i;; ; =+

GA+ struct aaa]struct aaa :prevXint iXstruct aaa :ne5tX^Xmain*+] struct aaa abc,def,ghi,=lX int 5@>CCX [email protected]@U=lX abc.ne5t@UdefX def.i@>[email protected]@UghiX [email protected]@UdefX ghi.ne5t@U=lX =l.i@/X=l.prev@UghiX=l.ne5t@UabcX [email protected] printf*NWdN,5+X^Answer:2Explanation:above all statements form a double circular lined listXabc.ne5t9Qne5t9Qprev9Qne5t9Qi this one points to NghiN node the value of at particular node is 2.GG+ struct point ] int 5X int yX ^Xstruct point origin,:ppXmain*+Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved/ETechnical Aptitude Questions]pp@UoriginXprintf*Norigin is*WdWd+ZnN,*:pp+.5,*:pp+.y+Xprintf*Norigin is *WdWd+ZnN,pp9Q5,pp9Qy+X^ Answer:origin is*C,C+origin is*C,C+ Explanation7pp is a pointer to structure. we can access the elements of the structureeither with arrow mar or with indirection operator. 'ote: Since structure pointis globally declared 5 U y are initialized as zeroes GE+ main*+] int i@MlMabc*>C+X printf*NWdZnN,99i+X^int MlMabc*int i+] return*i;;+X^Answer:KExplanation: return*i;;+ it will first return i andthen increments. i.e. >Cwill bereturned.GK+ main*+] char :pX int :.X long :rX p@.@r@CX p;;X .;;X r;;X printf*NWp...Wp...WpN,p,.,r+X^Answer:CCC>...CCC2...CCCBExplanation:;;operatorwhenappliedtopointersincrementsaddressaccordingtotheir corresponding data9types.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved/KTechnical Aptitude Questions EC+ main*+] char c@T T,5,convert*z+X getc*c+X if**cQ@TaT+ UU *cR@TzT++ 5@convert*c+X printf*NWcN,5+X^convert*z+]return z9/2X^Answer: !ompiler errorExplanation:declaration of convert and format of getc*+ are wrong. E>+ main*int argc, char ::argv+] printf*Nenter the characterN+X getchar*+X sum*argvO>P,argvO2P+X^sum*num>,num2+int num>,num2X] return num>;num2X^Answer:!ompiler error.Explanation:argvO>P U argvO2P are strings. They are passed to the function sum withoutconverting it to integer values.E2+ Y include Rstdio.hQint oneMdOP@]>,2,/^Xmain*+] int :ptrX ptr@oneMdX ptr;@/X printf*NWdN,:ptr+X^Answer7garbage valueCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedBCTechnical Aptitude QuestionsExplanation:ptr pointer is pointing to out of the array range of oneMd.E/+ Y includeRstdio.hQaaa*+ ]printf*NhiN+X ^bbb*+] printf*NhelloN+X ^ccc*+] printf*NbyeN+X ^main*+]int *:ptrO/P+*+XptrOCP@aaaXptrO>P@bbbXptrO2P@cccXptrO2P*+X^Answer7bye Explanation:ptr is array of pointers to functions of return type int.ptrOCP is assigned toaddressof the functionaaa.Similarly ptrO>Pand ptrO2P forbbb andcccrespectively. ptrO2P*+ is in effect of writing ccc*+, since ptrO2P points to ccc.E?+ YincludeRstdio.hQmain*+]1&04 :ptrXchar iXptr@fopen*Nzzz.cN,NrN+Xwhile**i@fgetch*ptr++S@4"1+printf*NWcN,i+X^Answer:contents of zzz.c followed by an infinite loopExplanation:The condition is checed against 4"1, it shouldbe checed against$Technical Aptitude Questions if*i UU =;;+printf*NWd..WdN,i;;,=+Xprintf*NWd..Wd,i,=+X^Answer:C..C Explanation:The value of i is C. Since this information is enough to determine the truthvalue of the boolean e5pression. So the statement following the ifstatement is not e5ecuted.The values of i and = remain unchanged and getprinted.

EG+ main*+] int iX i @ abc*+X printf*NWdN,i+X^abc*+] MAH @ >CCCX^Answer:>CCCExplanation:$ormallythereturnvaluefromthefunctionisthroughtheinformationfrom the accumulator. ,ere MA, is the pseudo global variable denotingthe accumulator. ,ence, the value of the accumulator is set >CCC so thefunction returns value >CCC. EE+ int iX main*+]int tXfor * t@BXscanf*NWdN,Ui+9tXprintf*NWdZnN,i++printf*NWd99N,t99+X ^LL &f the inputs are C,>,2,/ find the oLpAnswer:B99C/99>2992 Explanation:0et us assume some 5@ scanf*NWdN,Ui+9t the values during e5ecution will be,ti 5B C9BCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedB2Technical Aptitude Questions/ >922 2 C

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

K2+ Fhat are the following notations of defining functions nown as`i.int abc*int a,float b+ ]Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedB/Technical Aptitude Questions L: some code :L ^ii.int abc*a,b+int aX float bX ] L: some code:L ^Answer:i.A$S& ! notationii. _ernighan U 'itche notation K/+ main*+]char :pXp@NWdZnNXp;;Xp;;Xprintf*p92,/CC+X^Answer:/CCExplanation:The pointer points to Wsince it is incremented twice and againdecremented by 2, it points to TWdZnT and /CC is printed.KB+ main*+] char aO>CCPX aOCP@TaTXaO>PP@TbTXaO2P@TcTXaOBP@TdTX abc*a+X^abc*char aOP+] a;;X printf*NWcN,:a+X a;;X printf*NWcN,:a+X^Explanation:The base address is modified only in function and as a result a points to TbTthen after incrementing to TcT so bc will be printed.

K?+ func*a,b+int a,bX] return* a@ *a@@b+ +X^main*+Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedBBTechnical Aptitude Questions]int process*+,func*+Xprintf*NThe value of process is Wd SZn N,process*func,/,A++X^process*pf,val>,val2+int *:pf+ *+Xint val>,val2X]return**:pf+ *val>,val2++X ^Answer:The value if process is C SExplanation:The function TprocessT has / parameters 9 >, a pointer to another function2and /, integers. Fhen this function is invoed from main, the followingsubstitutions for formal parameters tae place7 func for pf, / for val> and Afor val2. This function returns the result of the operation performed by thefunction TfuncT. The function func has two integer parameters. The formalparameters 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 returnedby the function TprocessT.KA+ void main*+]static int i@?Xif*99i+]main*+Xprintf*NWd N,i+X^^Answer: C C C CExplanation:The variable N&N is declared as static, hence memory for & will be allocatedfor only once, as it encounters the statement. The function main*+ will be calledrecursively unless & becomes e.ual to C, and since main*+ is recursively called, sothe value of static & ie., C will be printed every time the control is returned.KG+ void main*+]int @ret*sizeof*float++Xprintf*NZn here value is WdN,;;+X^int ret*int ret+]ret ;@ 2.?XCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedB?Technical Aptitude Questionsreturn*ret+X^Answer: ,ere value is GExplanation:The int ret*int ret+, ie., the function name and the argument name can bethe same.1irstly, thefunctionret*+ is calledinwhichthesizeof*float+ ie., Bispassed,after the first e5pression the value in ret will be A, as ret is integer hencethe value stored in ret will have implicit type conversion from float to int. The retis returned in main*+ it is printed after and preincrement. KE+ void main*+]char aOP@N>2/B?ZCNXint i@strlen*a+Xprintf*Nhere in / WdZnN,;;i+X^Answer: here in / AExplanation:ThechararrayTaT will holdtheinitializedstring, whoselengthwill becounted from C till the null character. ,ence the T&T will hold the value e.ual to ?,after the pre9increment in the printf statement, the A will be printed.KK+ void main*+]unsigned giveit@9>Xint gotitXprintf*NWu N,;;giveit+Xprintf*NWu ZnN,gotit@99giveit+X^Answer: C A??/?Explanation:>CC+ void main*+]int iXchar aOP@NZCNXif*printf*NWsZnN,a++printf*N" here ZnN+Xelseprintf*N1orget itZnN+X^Answer:Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedBATechnical Aptitude Questions " here Explanation:6rintf will return how many characters does it print. ,ence printinga null character returns > which maes the if statement true, thusN" hereN is printed. >C>+ void main*+]void :vXint integer@2Xint :i@UintegerXv@iXprintf*NWdN,*int:+:v+X^Answer: !ompiler 4rror. Fe cannot apply indirection on type void:.Explanation:-oidpointerisageneric pointertype. $o pointer arithmeticcan bedone on it. -oid pointers are normally used for, >. 6assing generic pointers to functions and returning such pointers.2. As a intermediate pointer type./. C2+ void main*+]int i@i;;,=@=;;,@;;Xprintf*[WdWdWd\,i,=,+X^Answer: %arbage values.Explanation:6nidentifierisavaila.letouseinprogramcodefromthepoint of itsdeclaration. So e5pressions such as i @ i;; are valid statements. The i, = andareautomatic variables and so they contain some garbage value.=ar.age inis gar.age out 2=+=E4. >C/+ void main*+]static int i@i;;, =@=;;, @;;Xprintf*[i @ Wd = @ Wd@ Wd\, i, =, +X^Answer: i @ > = @ >@ >Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedBGTechnical Aptitude QuestionsExplanation:Since static variables are initialized to zero by default.>CB+ void main*+]while*>+]if*printf*NWdN,printf*NWdN+++breaXelsecontinueX^^Answer: %arbage valuesExplanation:Theinner printf e5ecutesfirst toprint somegarbagevalue. Theprintfreturns no of characters printed and this value also cannot be predicted.Still the outer printfprints something and so returns a non9zero value. Soit encounters the brea statement and comes out of the while statement.>CB+ main*+]unsigned int i@>CXwhile*i99Q@C+printf*NWu N,i+X^Answer:>C K E G A ? B / 2 > C A??/? A??/BJ..Explanation:Since i is anunsignedinteger it cannever become negative. Sothee5pression i99 Q@Cwill always be true, leading to an infinite loop.>C?+ YincludeRconio.hQmain*+]int 5,y@2,z,aXif*5@yW2+ z@2Xa@2Xprintf*NWd Wd N,z,5+X^ Answer: %arbage9value CExplanation:The value of yW2 is C. This value is assigned to 5. The condition reducesto if *5+ or in other words if*C+ and so z goes uninitialized.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedBETechnical Aptitude QuestionsThu! "ule: ,hec all control paths to write bug free code.>CA+ main*+]int aO>CPXprintf*NWdN,:a;>9:a;/+X^Answer:BExplanation::a and 9:a cancels out. The result is as simple as > ; / @ B S>CG+ Ydefine prod*a,b+ a:bmain*+ ]int 5@/,y@BXprintf*NWdN,prod*5;2,y9>++X^Answer:>CExplanation:The macro e5pands and evaluates to as75;2:y9> @Q 5;*2:y+9> @Q >C>CE+ main*+]unsigned int i@A?CCCXwhile*i;;S@C+Xprintf*NWdN,i+X^Answer: >Explanation:$ote the semicolon after the while statement. Fhen the value of i becomesC it comes out of while loop. Due to post9increment on i the value of iwhile printing is >.

>CK+ main*+]int i@CXwhile*;*;i99+S@C+i9@i;;Xprintf*NWdN,i+X^Answer:9>Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedBKTechnical Aptitude QuestionsExplanation:Qnary8istheonlydummyoperatorin,. Soit hasnoeffect onthee5pression and now the while loop is,while*i99S@C+ which is falseand so breas out of while loop. The value )> is printed due to the post9decrement operator. >>/+ main*+]float f@?,g@>CXenum]i@>C,=@2C,@?C^Xprintf*NWdZnN,;;+Xprintf*NWfZnN,fRR2+Xprintf*NWlfZnN,fWg+Xprintf*NWlfZnN,fmod*f,g++X ^Answer:0ine no ?7 4rror7 0value re.uired0ine no A7 !annot apply leftshift to float0ine no G7 !annot apply mod to floatExplanation: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@>CXvoid pascal f*int,int,int+Xf*i;;,i;;,i;;+Xprintf*N WdN,i+X^void pascal f*integer 7i,integer7=,integer 7+] write*i,=,+X ^Answer:!ompiler error7unnown type integer!ompiler error7undeclared function writeExplanation:6ascal eyword doesn3t mean that pascal code can be used. &t means thatthe function follows 6ascal argument passing mechanism in calling the functions. >>>+void pascal f*int i,int =,int +] printf*[Wd Wd Wd\,i, =, +X ^Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?CTechnical Aptitude Questionsvoid cdecl f*int i,int =,int +] printf*[Wd Wd Wd\,i, =, +X ^main*+]int i@>CXf*i;;,i;;,i;;+Xprintf*N WdZnN,i+Xi@>CXf*i;;,i;;,i;;+Xprintf*N WdN,i+X^Answer:>C >> >2 >/>2 >> >C >/Explanation:6ascal argument passingmechanismforcesthearguments tobecalledfrom left to right. cdecl is the normal ! argument passing mechanism where thearguments are passed from right to left. >>2+. Fhat is the output of the program given belowmain*+] signed char i@CX for*XiQ@CXi;;+ X printf*NWdZnN,i+X^Answer9>2EExplanation$otice the semicolon at the end of the for loop. T,e initial value ofthe i is set to C. The inner loop e5ecutes to increment the valuefrom C to >2G *the positive range of char+ and then it rotates to thenegative value of 9>2E. The condition in the for loop fails and socomes out of the for loop. &t prints the current value of i that is9>2E. >>/+ main*+] unsigned char i@CX for*XiQ@CXi;;+ X printf*NWdZnN,i+X^AnswerCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?>Technical Aptitude Questionsinfinite loopExplanationThe difference between the previous .uestion and this one is that the charis declared to be unsigned. So the i;; can never yield negative value and iQ@Cnever becomes false so that it can come out of the for loop.>>B+ main*+ ] char i@CX for*XiQ@CXi;;+ X printf*NWdZnN,i+X

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

>>G+typedef struct error]int warning, error, e5ceptionX^errorX main*+]error g>Xg>.error @>X printf*NWdN,g>.error+X ^Answer>ExplanationThe three usages of name errors can be distinguishable by the compiler atany instance, so valid *they are in different namespaces+.Typedef struct error]int warning, error, e5ceptionX^errorXThis error can be used only by preceding the error by struct ayword as in7struct error some4rrorXtypedef struct error]int warning, error, e5ceptionX^errorXThis can be used only after . *dot+ or 9Q *arrow+ operator preceded by the variablename as in 7g>.error @>X printf*NWdN,g>.error+X typedef struct error]int warning, error, e5ceptionX^errorXThis can be used to define variables without using the preceding struct eywordas in7error g>XSincethecompiler canperfectlydistinguishbetweenthesethreeusages, it isperfectly legal and valid.'oteCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?/Technical Aptitude QuestionsThis code is given here to =ust e5plain the concept behind. &n realprogramming don3t use such overloading of names. &t reduces the readability ofthe code. 6ossible doesn3t mean that we should use itS

>>E+ Yifdef somethingint some@CXYendifmain*+]int thing @ CXprintf*NWd WdZnN, some ,thing+X^Answer:!ompiler error 7 undefined symbol someExplanation:Thisisaverysimplee5ampleforconditional compilation. Thename something is not already nown to the compiler maing thedeclaration int some @ CXeffectively removed from the source code.>>K+Yif something @@ Cint some@CXYendifmain*+]int thing @ CXprintf*NWd WdZnN, some ,thing+X^AnswerC C ExplanationThis codeis toshowthat preprocessor e5pressions arenot thesameas theordinarye5pressions. &f anameis not nownthepreprocessor 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++ +XCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?BTechnical Aptitude Questions ^Answer>ExplanationThis is due to the close relation between the arrays and pointers. $dimensional arrays aremade upof *$9>+ dimensional arrays.arr2D is made up of a / single arrays that contains / integers each .The name arr2D refers to the beginning of all the / arrays. :arr2Drefers to the start of the first >D array *of / integers+ that is thesame address as arr2D. So the e5pression *arr2D @@ :arr2D+ is true*>+. Similarly, :arr2Dis nothingbut :*arr2D;C+, addinga zerodoesn3t change the valueLmeaning. Again arr2DOCP is the anotherway of telling :*arr2D ; C+. So the e5pression *:*arr2D ; C+ @@arr2DOCP+ is true *>+. Sincebothpartsofthee5pressionevaluatestotruetheresultistrue*>+ and the same is printed.>2>+ void main*+ ]if*aC @@ *unsigned int+9>+printf*[Ioucan answer thisifyounowhow valuesare represented inmemory\+X ^ AnswerIoucan answer thisifyounowhow valuesare represented inmemory45planationa*tildeoperatororbit9wisenegationoperator+operatesonCtoproduce all ones to fill the space for an integer. )> is represented inunsigned 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??arr2Darr2DO>Parr2DO2Parr2DO/PTechnical Aptitude Questions]int 5@>C,y@2CXswap*U5,Uy+Xprintf*N5@ Wd y @ WdZnN,5,y+X^Answer5 @ 2C y @ >C45planationThis is onewayof swappingtwovalues. Simple checingwill helpunderstand this.>2/+main*+]char :p @ [ay.m\Xprintf*[Wc\,;;:*p;;++X^Answer7b>2B+ main*+] int i@?X printf*NWdN,;;i;;+X^ Answer:!ompiler error7 0value re.uired in function mainExplanation:;;i yields anrvalue. 1or postfi5;;tooperate anlvalue isre.uired.>2?+ main*+]char :p @ [ay.m\Xchar cXc @ ;;:p;;Xprintf*[Wc\,c+X^Answer:bExplanation:Thereisnodifferencebetweenthee5pression;;:*p;;+ and;;:p;;. 6arenthesis =ust wors as a visual clue for the reader to seewhich e5pression is first evaluated. >2A+int aaa*+ ]printf*[,i\+X^Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?ATechnical Aptitude Questionsint bbb*+]printf*[hello\+X^iny ccc*+]printf*[bye\+X^main*+]int * : ptrO/P+ *+XptrOCP @ aaaXptrO>P @ bbbXptrO2P @cccXptrO2P*+X^Answer7 b%e45planation7 int *: ptrO/P+*+ says that ptr is an array of pointers to functions that taesno arguments and returns the type int. (y the assignment ptrOCP @ aaaX itmeansthat thefirst functionpointerinthearrayisinitializedwiththeaddress of the function aaa. Similarly, the other two array elements alsoget initialized with the addresses of the functions bbb and ccc. Since ptrO2Pcontains the address of the function ccc, the call to the function ptrO2P*+ issame as calling ccc*+. So it results in printingNbyeN.>2G+main*+]int i@?Xprintf*[Wd\,i@;;i @@A+X^Answer:1Explanation:The e5pression can be treated as i @ *;;i@@A+, because @@ is of higherprecedencethan@operator. &ntheinner e5pression, ;;i ise.ual toAyielding true*>+. ,ence the result.>2E+ main*+]char pO P@NWdZnNXpO>P @ TcTXprintf*p,A?+X^Answer:AExplanation:Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?GTechnical Aptitude QuestionsDue to the assignment pO>P @ 2c3 the string becomes, [WcZn\. Since thisstring becomes the format string for printf and AS!&& value of A? is 2A3,the same gets printed. >2K+ void * : abc* int, void * :def+ *+ + + *+XAnswer77abcisaptrtoafunctionwhichtaes2parameters.*a+. anintegervariable.*b+.a ptrto a funtion which returns void. the return type of thefunction isvoid.Explanation:Apply the cloc9wise rule to find the result.>/C+ main*+]while *strcmp*[some\,\someZC\++ printf*[Strings are not e.ualZn\+X^Answer:$o outputExplanation:4ndingthestringconstant withZCe5plicitlymaes nodifference. So[some\ and [someZC\ are e.uivalent.So, strcmp returns C *false+ hencebreaing out of the while loop. >/>+ main*+]char str>OP @ ]2s3,3o3,3m3,3e3^Xchar str2OP @ ]2s3,3o3,3m3,3e3,3ZC3^Xwhile *strcmp*str>,str2++ printf*[Strings are not e.ualZn\+X^Answer:[Strings are not e.ual\[Strings are not e.ual\J.Explanation:&f astringconstant is initializede5plicitlywithcharacters, 2ZC3is notappended automatically to the string. Since str> doesn3t have nulltermination, it treats whatever the values that are in the following positionsas part of the string until it randomly reaches a 2ZC3. So str> and str2 arenot the same, hence the result. >/2+ main*+]Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?ETechnical Aptitude Questionsint i @ /Xfor *Xi;;@CX+ printf*[Wd\,i+X^Answer:!ompiler 4rror7 0value re.uired.Explanation:As we now that increment operators return rvalues and hence itcannot appear on the left hand side of an assignment operation. >//+ void main*+]int :mptr, :cptrXmptr @ *int:+malloc*sizeof*int++Xprintf*[Wd\,:mptr+Xint :cptr @ *int:+calloc*sizeof*int+,>+Xprintf*[Wd\,:cptr+X^Answer:garbage9value CExplanation:Thememoryspaceallocatedbymallocisuninitialized, whereascallocreturns the allocated memory space initialized to zeros.>/B+ void main*+]static int iXwhile*iR@>C+*iQ2+`i;;7i99Xprintf*[Wd\, i+X^Answer:/2GAGExplanation:Since i is static it is initialized to C. &nside the while loop the conditionaloperatorevaluatestofalse, e5ecutingi99.Thiscontinuestill theintegervalue rotates to positive value */2GAG+. The while condition becomes falseand hence, comes out of the while loop, printing the i value.>/?+ main*+]int i@>C,=@2CX= @ i, =`*i,=+`i7=7=Xprintf*NWd WdN,i,=+X^Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved?KTechnical Aptitude QuestionsAnswer:>C >CExplanation:The Ternary operator * ` 7 + is e.uivalent for if9then9else statement. So the.uestion can be written as7if*i,=+ ]if*i,=+ = @ iXelse= @ =X^ else= @ =X>/A+ >. const char :aX2. char: const aX /. char const :aX9Differentiate the above declarations.Answer:>. TconstT applies to char : rather than TaT * pointer to a constant char +:a@T1T 7 illegala@N,iN 7 legal2. TconstTapplies to TaTrather than to the value of a *constant pointer tochar +:a@T1T 7 legala@N,iN 7 illegal/. Same as >.>/G+ main*+]int i@?,=@>CXi@iU@=UU>CXprintf*NWd WdN,i,=+X^Answer:> >CExplanation:The e5pression can be written as i@*iU@*=UU>C++X The inner e5pression*=UU>C+evaluatesto > because=@@>C.iis?.i @?U> is >.,encetheresult. Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedACTechnical Aptitude Questions>/E+ main*+]int i@B,=@GX= @ = VV i;; UU printf*NI"< !A$N+Xprintf*NWd WdN, i, =+X^Answer:B > Explanation:Dhe .oolean expression needs to .e evaluated only till the truth value ofthe expression is not 'nown.= is not e.ual to zero itself means that thee5pression3struthvalueis >. (ecauseit is followedbyVV andtrueSS2anything4 IVtrue where 2anything4 will not .e evaluated.So theremaining e5pression is not evaluated and so the value of i remains thesame.Similarly when UU operator is involved in an e5pression, when any of theoperands become false, the whole e5pression3s truth value becomes falseand hence the remaining e5pression will not be evaluated. false (( 2anything4 IV false where 2anything4 will not .e evaluated.>/K+ main*+]register int a@2Xprintf*NAddress of a @ WdN,Ua+Xprintf*N-alue of a @ WdN,a+X^Answer:!ompier 4rror7 TUT on register variable"ule to "ee!er: & #a$$ress o% & operator 'annot !e applie$ on re(ister )aria!les*>BC+ main*+]float i@>.?Xswitch*i+]case >7 printf*N>N+Xcase 27 printf*N2N+Xdefault 7 printf*NCN+X^^Answer:!ompiler 4rror7 switch e5pression not integralExplanation:Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedA>Technical Aptitude Questions$witch statements can .e applied only to integral types.>B>+ main*+]e5tern iXprintf*NWdZnN,i+X]int i@2CXprintf*NWdZnN,i+X^^Answer:0iner 4rror 7 B2+ main*+]int a@2,:f>,:f2Xf>@f2@UaX:f2;@:f2;@a;@2.?Xprintf*NZnWd Wd WdN,a,:f>,:f2+X^Answer:>A >A >AExplanation: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%""DNXchar aO P@N%""DNXprintf*NZnsizeof*p+ @Wd, sizeof*:p+ @Wd, strlen*p+ @WdN, sizeof*p+,sizeof*:p+, strlen*p++Xprintf*NZn sizeof*a+ @ Wd, strlen*a+ @ WdN, sizeof*a+, strlen*a++X^Answer:sizeof*p+ @ 2, sizeof*:p+ @ >, strlen*p+ @ Bsizeof*a+ @ ?, strlen*a+ @ BExplanation:sizeof*p+ @Q sizeof*char:+ @Q 2sizeof*:p+ @Q sizeof*char+ @Q >Similarly,sizeof*a+ @Q size of the character array @Q ?Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedA2Technical Aptitude QuestionsWhen siCeof operator is applied to an array it returns the siCeof the arrayand 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 thespace necessary for the terminating $BB+ Ydefine D* array, type+ sizeof*array+Lsizeof*type+main*+]int arrO>CPXprintf*[The dimension of the array is Wd\, D*arr, int++X^Answer:>C Explanation:The size of integer array of >C elements is >C : sizeof*int+. The macroe5pands to sizeof*arr+Lsizeof*int+ @Q >C : sizeof*int+ L sizeof*int+ @Q >C.>B?+ int D*int arrayOP+ ]return sizeof*array+Lsizeof*int +X^main*+]int arrO>CPXprintf*[The dimension of the array is Wd\, D*arr++X^Answer:> Explanation:6rrays cannot .e passed to functions as arguments and only the pointerscan .e passed. So the argument is e.uivalent to int : array *this is one oftheveryfewplaces whereOP and:usagearee.uivalent+. Thereturnstatement becomes,sizeof*int :+L sizeof*int+ that happens to be e.ual inthis case. >BA+ main*+]static int aO/PO/P@]>,2,/,B,?,A,G,E,K^Xint i,=Xstatic :pOP@]a,a;>,a;2^Xfor*i@CXiR/Xi;;+]for*=@CX=R/X=;;+printf*NWdZtWdZtWdZtWdZnN,:*:*p;i+;=+,Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedA/Technical Aptitude Questions:*:*=;p+;i+,:*:*i;p+;=+,:*:*p;=+;i++X^^Answer:> > > >2 B 2 B/ G / GB 2 B 2? ? ? ?A E A EG / G /E A E AK K K KExplanation::*:*p;i+;=+ is e.uivalent to pOiPO=P.>BG+ main*+]void swap*+Xint 5@>C,y@EX swap*U5,Uy+Xprintf*N5@Wd y@WdN,5,y+X^void swap*int :a, int :b+] :a 8@ :b,:b 8@ :a, :a 8@ :bX ^Answer:5@>C y@EExplanation:

CCCCCC>C. >?C+ main*+]int i@/CCXchar :ptr @ UiX:;;ptr@2Xprintf*NWdN,i+X^Answer:??AExplanation:Theintegervalue/CCinbinarynotationis7CCCCCCC>CC>C>>CC.&tisstoredinmemory*small9endian+as7CC>C>>CC CCCCCCC>.'esultofthee5pression:;;ptr@2maesthememoryrepresentationas7 CC>C>>CCCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedA?Technical Aptitude QuestionsCCCCCC>C. So the integer corresponding to itisCCCCCC>C CC>C>>CC @Q??A.>?>+ Yinclude Rstdio.hQmain*+]char : str @ NhelloNXchar : ptr @ strXchar least @ >2GXwhile *:ptr;;+least @ *:ptrRleast + `:ptr 7leastXprintf*NWdN,least+X^Answer:CExplanation:After 2ptr3 reaches the end of the string the value pointed by 2str3 is 2ZC3.Sothevalueof2str3 islessthanthat of2least3. Sothevalueof2least3finally is C.>?2+ Declare an array of $pointers to functions returning pointers to functionsreturning pointers to characters`Answer:*char:*:+* ++ *:ptrO$P+* +X>?/+ main*+]struct student ]char nameO/CPXstruct date dobX^studXstruct date] int day,month,yearX ^Xscanf*NWsWdWdWdN, stud.rollno, Ustudent.dob.day,Ustudent.dob.month,Ustudent.dob.year+X^Answer:!ompiler 4rror7 ?B+ main*+]struct dateXstruct student]char nameO/CPXstruct date dobX^studXstruct date ] int day,month,yearX ^Xscanf*NWsWdWdWdN, stud.rollno, Ustudent.dob.day, Ustudent.dob.month,Ustudent.dob.year+X^Answer:!ompiler 4rror7 ?A+ &s there any difference between the two declarations, >. int foo*int :arrOP+ andCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedAGTechnical Aptitude Questions2. int foo*int :arrO2P+Answer:$o Explanation:1unctionscanonlypasspointersandnot arrays. Thenumbersthat areallowed inside the OP is =ust for more readability. So there is no differencebetween the two declarations.>?G+ Fhat is the subtle error in the following code segment`void fun*int n, int arrOP+]int :p@CXint i@CXwhile*i;;Rn+p @ UarrOiPX:p @ CX^Answer & Explanation:&f the body of the loop never e5ecutes p is assigned no address. Sop remains $CC+Xassert*s S@ $AC+ void main*+]int :i @ C5BCCXLL i points to the address BCC:i @ CX LL set the value of memory location pointed by iX^Answer:X^^Xvoid Some1unc*base :arr,int size+]for*int i@CX iRsizeX i;;,arr;;+coutRRarr9QbvalXcoutRRendlX^int main*+]base (aseArrO?PXSome1unc*(aseArr,?+Xderi DeriArrO?PXSome1unc*DeriArr,?+XCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedGGTechnical Aptitude Questions^Answer: CCCCC C>C>CExplanation:The function Some1unc e5pects two arguments.The first one is a pointer to anarray ofbase class ob=ectsand the second oneis the sizeof the array.The firstcallofsome1unc calls it with an array of bae ob=ects, so it wors correctly and prints the bval ofall theob=ects.FhenSomefunciscalledthesecondtimetheargument passedisthepointeer to an array of derived class ob=ects and not the array of base class ob=ects. (utthat is what the function e5pects to be sent. So the derived class pointer is promoted tobase classpointerandthe address is sent tothe function.Some1unc*+nowsnothingabout this and =ust treats the pointer as an array of base class ob=ects. So when arr;; ismet, thesizeof baseclass ob=ect istaenintoconsiderationandis incrementedbysizeof*int+ bytes for bval *the deri class ob=ects have bval and dval as members and so isof size Q@ sizeof*int+;sizeof*int+ +. B+ class base]public7 void base1un*+] coutRRNfrom baseNRRendlX^^X class deri7public base]public7 void base1un*+] coutRR Nfrom derivedNRRendlX^^Xvoid Some1unc*base :base"b=+]base"b=9Qbase1un*+X^int main*+]base base"b=ectXSome1unc*Ubase"b=ect+Xderi deri"b=ectXSome1unc*Uderi"b=ect+X^Answer:from basefrom baseExplanation: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 baseclass pointer and the corresponding base function is called. Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedGETechnical Aptitude Questions?+ class base]public7 virtual void base1un*+] coutRRNfrom baseNRRendlX^^X class deri7public base]public7 void base1un*+] coutRR Nfrom derivedNRRendlX^^Xvoid Some1unc*base :base"b=+]base"b=9Qbase1un*+X^int main*+]base base"b=ectXSome1unc*Ubase"b=ect+Xderi deri"b=ectXSome1unc*Uderi"b=ect+X^Answer:from basefrom derived Explanation:'emember that base1unc is a virtual function. That means that it supports run9time polymorphism. So the function corresponding to the derived class ob=ect is called. void main*+]int a, :pa, UraXpa @ UaXra @ aXcout RRNa@NRRa RRN:pa@NRR:pa RRNraNRRra X^L:Answer 7 !ompiler 4rror7 TraT,reference must be initialized45planation 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.:LCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedGKTechnical Aptitude Questionsconst int size @ ?Xvoid print*int :ptr+]coutRRptrOCPX^void print*int ptrOsizeP+]coutRRptrOCPX^void main*+]int aOsizeP @ ]>,2,/,B,?^Xint :b @ new int*size+Xprint*a+Xprint*b+X^L:Answer7!ompiler 4rror 7 function Tvoid print*int :+T already has a body45planation7Arrays cannot be passed to functions, only pointers *for arrays, base addresses+ can be passed. So the arguments int :ptr and int prtOsizeP have no differenceas function arguments. &n other words, both the functoins have the same signature andso cannot be overloaded. :Lclass some]public7asome*+]coutRRNsomeTs destructorNRRendlX^^Xvoid main*+]some sXs.asome*+X^L:Answer7someTs destructorsomeTs destructorCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedECTechnical Aptitude Questions45planation7Destructors 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.:LYinclude Riostream.hQclass fig2d]int dim>Xint dim2Xpublic7fig2d*+ ] dim>@?X dim2@AX^virtual void operatorRR*ostream U rhs+X^Xvoid fig2d77operatorRR*ostream Urhs+]rhs RRthis9Qdim>RRN NRRthis9Qdim2RRN NX^L:class fig/d 7 public fig2d]int dim/Xpublic7fig/d*+ ] dim/@GX^virtual void operatorRR*ostream Urhs+X^Xvoid fig/d77operatorRR*ostream Urhs+]fig2d77operator RR*rhs+XrhsRRthis9Qdim/X^:Lvoid main*+]fig2d ob=>XLL fig/d ob=2Xob=> RR coutXLL ob=2 RR coutX^Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedE>Technical Aptitude QuestionsL: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.:Lclass op"verload]public7bool operator@@*op"verload temp+X^Xbool op"verload77operator@@*op"verload temp+]if*:this@@ temp +]coutRRNThe both are same ob=ectsZnNXreturn trueX^else]coutRRNThe both are differentZnNXreturn falseX^^void main*+]op"verload a>, a2Xa>@ @a2X^Answer 7 'untime 4rror7 Stac "verflow45planation 7Dust lie normal functions, operator functions can be called recursively. This program =ust illustrates that point, by calling the operator @@ function recursively, leadingto an infinite loop. class comple5]double reXdouble imXCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedE2Technical Aptitude Questionspublic7comple5*+ 7 re*>+,im*C.?+ ]^bool operator@@*comple5 Urhs+Xoperator int*+]^^Xbool comple577operator @@ *comple5 Urhs+]if**this9Qre @@ rhs.re+ UU *this9Qim @@ rhs.im++return trueXelsereturn falseX^int main*+]comple5c>XcoutRRc>X^Answer 7 %arbage value45planation7The programmer wishes to print the comple5 ob=ect using outputre9direction operator,which he has not defined for his lass.(ut the compiler instead of giving an error sees the conversion functionand converts the user defined ob=ect to standard ob=ect and printssome garbage value.class comple5]double reXdouble imXpublic7comple5*+ 7 re*C+,im*C+ ]^comple5*double n+ ] re@n,im@nX^Xcomple5*int m,int n+ ] re@m,im@nX^void print*+ ] coutRRreX coutRRimX^^Xvoid main*+]comple5 c/Xdouble i@?Xc/ @ iXc/.print*+X^Answer7 Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedE/Technical Aptitude Questions?,? 45planation7Though no operator@ function taing comple5, double is defined, the double on the rhs is converted into a temporary ob=ect using the single argument constructor taing double and assigned to the lvalue.void main*+]int a, :pa, UraXpa @ UaXra @ aXcout RRNa@NRRa RRN:pa@NRR:pa RRNraNRRra X^Answer 7 !ompiler 4rror7 TraT,reference must be initialized45planation 7 6ointers are different from references. "ne of the main differences is that the pointers can be both initialized and assigned,whereas references can only be initialized. So this code issues an error.Tr+ it ,oursel% >+ Determine the output of the T!;;T !odelet.class base]public 7 out*+ ] coutRRNbase NX^^Xclass deri] public 7 out*+ ] coutRRNderi NX ^ ^Xvoid main*+]deri dpO/PXbase :bp @ *base:+dpXfor *int i@CX iR/Xi;;+*bp;;+9Qout*+X^Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedEBTechnical Aptitude Questions2+ Dustify the use of virtual constructors and destructors in !;;./+ 4ach !;; ob=ect possesses the B member fns,*which can be declared by theprogrammer e5plicitly or by the implementation if they are not available+. Fhat arethose B functions`B+Fhat is wrong with this class declaration`class something]char :strXpublic7 something*+] st @ new charO>CPX ^asomething*+]delete strX ^ ^X?+ &nheritance is also nownas 99999999 relationship. !ontainership as MMMMMMMMrelationship.A+ Fhen is it necessary to use member9wise initialization list *also nown as headerinitialization 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 value2Xpublic 7 void fun*int val+ const] **temp:+ this+9Qvalue> @ >CX value2 @ >CX ^ ^XCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedE?Technical Aptitude Questions1.What is a modifier?Answer:A modifier, also called a modifying function is a member function that changes thevalue of at least one data member. &n other words, an operation that modifies the state ofan ob=ect. #odifiers are also nown as 2mutators3.2.What is an accessor?Answer:An accessor is a class operation that does not modify the state of an ob=ect. Theaccessor functions need to be declared as const operations3. !ifferentiate .etween a template class and class template.Answer:Teplate 'lass:Agenericdefinitionor aparameterizedclass not instantiateduntil theclientprovides the needed information. &t3s =argon for plain templates.-lass teplate:A class template specifies how individual classes can be constructed much lie thewayaclassspecifieshowindividual ob=ectscanbeconstructed. &t3s=argonforplainclasses.*. When does a name clash occur?Answer: Aname clashoccurs whenaname is definedinmore thanoneplace. 1ore5ample., two different class libraries could give two different classes the same name. &fyou try to use many class libraries at the same time, there is a fair chance that you will beunable to compile or lin the program because of name clashes.-. !efine namespace.Answer: &t is a feature in c;; to minimize name collisions in the global name space. Thisnamespace eyword assigns a distinct name to a library that allows other libraries to usethe same identifier names without creating any name collisions. 1urthermore, thecompiler uses the namespace signature for differentiating the definitions.0. What is the use of XusingF declaration.Answer: A using declaration maes it possible to use a name from a namespace without thescope operator.5. What is an +terator class?Answer: A classthat isusedtotraversethroughtheob=ectsmaintainedbyacontainerclass. There are five categories of iterators7input iterators, output iterators,Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedEATechnical Aptitude Questions forward iterators, bidirectional iterators,random access.Aniteratorisanentitythat givesaccesstothecontentsofacontainer ob=ectwithout violating encapsulation constraints. Access to the contents is granted on a one9at9a9time basis in order. The order can be storage order *as in lists and .ueues+ or somearbitraryorder*asinarrayindices+oraccordingtosomeorderingrelation*asinanordered binary tree+. The iterator is a construct, which provides an interface that, whencalled, yields either the ne5t element in the container, or some value denoting the fact thatthere are no more elements to e5amine. &terators hide the details of access to and updateof the elements of a container class.Thesimplest andsafest iteratorsarethosethat permit read9onlyaccesstothecontents of a container class. The following code fragment shows how an iterator mightappear in code7 contMiter7@new contMiterator*+X [email protected]*+X while 5L@none do ... s*5+X ... [email protected]*+XendX &n this e5ample, contMiter is the name of the iterator. &t is created on the first line byinstantiation of contMiterator class, an iterator class defined to iterate over some containerclass, cont. Succesive elements from the container are carried to 5. The loop terminateswhen 5 is bound to some empty value. *,ere, none+&n the middle of the loop, there is s*5+anoperationon5, thecurrent element fromthecontainer. Thene5t element of thecontainer is obtained at the bottom of the loop.?. List out some of the EE!"#$ availa.le.Answer: %4#ST"$4L"6A0 of %emstone systems. "$T"S of "ntos. "b=ectivity of"b=ectivity inc. -ersant of -ersant ob=ect technology."b=ect store of "b=ect Design.A'D4$T of A'D4$T software.6"4T of 6"4T software.1@. List out some of the o.ject3oriented methodologies.Answer:"b=ect "riented Development*""D+ *(ooch >KK>,>KKB+."b=ect "riented Analysis and Design*""ALD+ *!oad and Iourdon >KK>+."b=ect #odelling Techni.ues*"#T+*'umbaugh >KK>+."b=ect "riented Software 4ngineering*"b=ectory+ *Dacobson >KK2+.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedEGTechnical Aptitude Questions"b=ect "riented Analysis*""A+ *Shlaer and #ellor >KK2+.The 1usion #ethod*!oleman >KK>+.11. What is an incomplete type?Answer: &ncomplete types refers topointers inwhichthere is nonavailabilityof theimplementation of the referenced location or it points to some location whose value is notavailable for modification.Exaple: int :i@C5BCCLL i points to address BCC:i@CXLLset the value of memory location pointed by i.&ncomplete types are otherwise called uninitialized pointers.12. What is a dangling pointer?Answer:A dangling pointer arises when you use the address of an ob=ect after its lifetimeis over.This may occur in situations lie returning addresses of the automatic variables from afunction or using the address of the memory bloc after it is freed.13. !ifferentiate .etween the message and method.Answer:.essa(e .etho$"b=ects communicate by sending messages 6rovides response to a message.to each other.A message is sent to invoe a method. &t is an implementation of an operation.1*. What is an adaptor class or Wrapper class?Answer:A class that has no functionality of its own. &ts member functions hide the use of athird party software component or an ob=ect with the non9compatible interface or a non9ob=ect9 oriented implementation.1-. What is a &ull o.ject?Answer:&t is an ob=ect of some class whose purpose is to indicate that a real ob=ect of thatclass does not e5ist. "ne common use for a null ob=ect is a return value from a memberfunction that is supposed to return an ob=ect with some specified properties but cannotfind such an ob=ect.10. What is class invariant?Answer:A class invariant is a condition that defines all valid states for an ob=ect. &t is alogical conditiontoensurethecorrect woringofaclass. !lassinvariantsmust holdwhen an ob=ect is created, and they must be preserved under all operations of the class. &nCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedEETechnical Aptitude Questionsparticular all class invariants are both preconditions and post9conditions for all operationsor member functions of the class.15. What do you mean .y $tac' unwinding?Answer:&t is a process during e5ception handling when the destructor is called for all localob=ects between the place where the e5ception was thrown and where it is caught. 17. !efine precondition and post3condition to a mem.er function.Answer:/re'on$ition:A precondition is a condition that must be true on entry to a member function. Aclass is used correctly if preconditions are never false. An operation is not responsible fordoing anything sensible if its precondition fails to hold. 1or e5ample, the interface invariants of stac' class say nothing about pushing yetanother element on a stac that is already full. Fe say that isful24 is a precondition of thepush operation./ost-'on$ition:A post9condition is a condition that must be true on e5it from a member functionif the precondition was valid on entry to that function. A class is implemented correctly ifpost9conditions are never false.1or e5ample, after pushing an element on the stac, we now that isempty24 mustnecessarily 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 theclass?Answer: The condition should hold at the end of every constructor. The condition should hold at the end of every mutator*non9const+ operation.

2@. What are proxy o.jects?Answer: "b=ects that stand for other ob=ects are called pro5y ob=ects or surrogates.Exaple:templateRclass TQclass Array2D ] public7class Array>D ]public7 TU operatorOP *int inde5+X const TU operatorOP *int inde5+ constX ... ^XCopyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedEKTechnical Aptitude QuestionsArray>D operatorOP *int inde5+Xconst Array>D operatorOP *int inde5+ constX... ^X The following then becomes legal7 Array2DRfloatQdata*>C,2C+X ........ coutRRdataO/POAPX LLfine,eredataO/P yields anArray>Dob=ect andtheoperator OP invocationonthatob=ect yields the float in position*/,A+ of the original two dimensional array. !lients of theArray2D class need not be aware of the presence of the Array>D class. "b=ects of thislatter class stand for one9dimensionalarray ob=ects that,conceptually, do not e5ist forclients of Array2D. Such clients program as if they were using real, live, two9dimensionalarrays. 4ach Array>Dob=ectstandsforaone9dimensional arraythat isabsentfromaconceptual model used by the clients of Array2D. &n the above e5ample, Array>D is apro5yclass. &tsinstancesstandforone9dimensional arrays that, conceptually, donote5ist. 21. &ame some pure o.ject oriented languages.Answer: Smalltal, Dava, 4iffel, Sather.22. &ame the operators that cannot .e overloaded.Answer:sizeof. .: .9Q 77 `723. What is a node class?Answer:A node class is a class that, relies on the base class for services and implementation, provides a wider interface to te users than its base class, relies primarily on virtual functions in its public interface depends on all its direct and indirect base class can be understood only in the conte5t of the base class can be used as base for further derivation can be used to create ob=ects.A node class is a class that has added new services or functionality beyond the servicesinherited from its base class.2*. What is an orthogonal .ase class?Answer:Copyright: Vyom Network (http://www.vyomworld.com) - All Rights ReservedKCTechnical Aptitude Questions&f twobaseclasseshavenooverlappingmethodsordatatheyaresaidtobeindependent of, ororthogonal toeachother."rthogonal inthesensemeansthat twoclasses operate in different dimensions and do not interfere with each other in any way.The same derived class may inherit such classes with no difficulty.2-. What is a container class? What are the types of container classes?Answer:A containerclass isaclass thatis usedto hold ob=ectsinmemoryor e5ternalstorage.A containerclassacts as a genericholder. A container class has apredefinedbehavior andawell9nowninterface. Acontainer class is asupportingclass whosepurpose is to hide the topology used for maintaining the list of ob=ects in memory. Fhena container class contains a group of mi5ed ob=ects, the container is called aheterogeneous containerX when the container is holding a group of ob=ects that are all thesame, the container is called a homogeneous container.20. What is a protocol class?Answer:An abstract class is a protocol class if7 it neither contains nor inherits from classes that contain member data, non9virtualfunctions, 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, aredeclared pure virtual functions and left undefined.25. What is a mixin class?Answer:A class that provides some but not all of the implementation for a virtual baseclass is often called mi5in. Derivation done =ust for the purpose of redefining the virtualfunctions in the baseclassesis often called mi5ininheritance.#i5inclasses typicallydonTt share common bases.27. What is a concrete class?Answer:A concrete class is used to define a useful ob=ect that can be instantiated as anautomaticvariableontheprogramstac. Theimplementationof aconcreteclass isdefined. The concrete class is not intended to be a base class and no attempt to minimizedependency on other classes in the implementation or behavior of the class.2?.What is the handle class?Answer:A handle is a class that maintains a pointer to an ob=ect that is programmaticallyaccessible through the public interface of the handle class.Explanation:&ncaseofabstract classes,unlessonemanipulatestheob=ectsoftheseclassesthrough pointers and references, the benefits of the virtual functions are lost. Technical Aptitude Questionscannot beallocatedstatisticallyoronthestacwithout itssizebeingnown. 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 ofsystems into subsystems.

+var Yaco.son 2E.jectory4: The father of class2class/23. $uppose a class acts an 6ctor in the pro.lem domain% how to represent it in the staticmodel?&nthisscenarioyou can use[stereotype\. Sincestereotypeis =ustastringthatgives e5tra semantic to the particular entityLmodel element. &t is given with in the RRQQ.class ARR ActorQQattributesmethods.2*. Why does the function arguments are called as KsignaturesK?The arguments distinguish functions with the same name *functionalpolymorphism+. 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 theycan beeasily identified by their signatures. The same concept is applied here.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>C/Technical Aptitude Questionse57class person]public7char getse5*+Xvoid setse5*char+Xvoid setse5*int+X^X&n the above e5ample we see that there is a function setse5*+ with same name butwith different signature.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>CBTechnical Aptitude QuestionsQuantitative AptitudeExer'ise 10ol)e the %ollowin( an$ 'he'1 with the answers (i)en at the en$*>. &t was calculated that G? men could complete a piece of wor in 2C days. Fhenwor was scheduled to commence,it was found necessary to send 2? men toanother pro=ect. ,ow much longer will it tae to complete the wor`2. A student divided a number by 2L/ when he re.uired to multiply by /L2. !alculatethe percentage of error in his result./. A dishonest shopeeper professes to sell pulses at the cost price, but he uses afalse weight of K?Cgm. for a g. ,is gain is JW.B. Asoftwareengineer has thecapabilityof thining>CClines of codeinfiveminutes and can type >CC lines of code in >C minutes. ,e taes a brea for fiveminutes after every ten minutes. ,ow many lines of codes will he complete typingafter an hour`?. A man was engaged on a =ob for /C days on the condition that he would get awage of 's. >C for the day he wors, but he have to pay a fine of 's. 2 for eachday of his absence. &f he gets 's. 2>A at the end, he was absent for wor for ...days.A. Acontractor agreeingtofinishaworin>?Cdays, employedG?meneachworingEhours daily. After KCdays, only2LGof theworwas completed.&ncreasing the number of men by MMMMMMMM each woring now for >C hours daily,the wor can be completed in time.G. what is a percent of b divided by b percent of a`*a+a *b+ b *c+ > *d+ >C *d+ >CCE. A man bought a horse and a cart. &f he sold the horse at >C W loss and the cart at2C W gain, he would not lose anythingX but if he sold the horse at ?W loss and thecart at ?W gain, he would lose 's. >C in the bargain. The amount paid by him was's.MMMMMMM for the horse and 's.MMMMMMMM for the cart.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>C?Quantitative Aptitude Technical Aptitude QuestionsK. Atennismarer istryingtoput together ateamoffour players foratennistournament out of seven available. males 9 a, b and cX females ) m, n, o and p. Allplayers are of e.ual ability and there must be at least two males in the team. 1or ateam of four, all players must be able to play with each other under the followingrestrictions7b should not play with m,c should not play with p, anda should not play with o.Fhich of the following statements must be false`>. b and p cannot be selected together2. c and o cannot be selected together/. c and n cannot be selected together.>C9>2. The following figure depicts three views of a cube. (ased on this, answer.uestions >C9>2.A?B > 22/ A>C. The number on the face opposite to the face carrying > is MMMMMMM .>>. The number on the faces ad=acent to the face mared ? are MMMMMMM .>2. Fhich of the following pairs does not correctly give the numbers on the oppositefaces.*>+ A,? *2+ B,> */+ >,/ *B+ B,2>/. 1ive farmers have G, K, >>, >/ U >B apple trees, respectively in their orchards.0ast year, eachof themdiscoveredthat everytreeintheir ownorchardboree5actly the same number of apples. 1urther, if the third farmer gives one apple tothe first, and the fifth gives three to each of the second and the fourth, they wouldall have e5actly the same number of apples. Fhat were the yields per tree in theorchards of the third and fourth farmers`>B. 1ive boys were climbing a hill. D was following ,. ' was =ust ahead of %. _ wasbetween % U ,. They were climbing up in a column. Fho was the second`>?9>E Dohn is undecided which of the four novels to buy. ,e is considering a spy thriller, a#urdermystery, a%othicromanceandasciencefictionnovel. Theboos are written by 'otho, %ory, (urchfield and ,opper, not necessary in thatorder, and published by ,eron, 6iegon, (lue=a and sparrow, not necessary in thatorder.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>CA 2/2Technical Aptitude Questions1 *>+ The boo by 'otho is published by Sparrow.4 *2+ The Spy thriller is published by ,eron.*/+ The science fiction novel is by (urchfield and is not published by (lue=a.5 *B+The %othic romance is by ,opper.+>?. 6igeon publishes MMMMMMMMMMMM.>A. The novel by %ory MMMMMMMMMMMMMMMM.>G. Dohnpurchases boos bythe authors whose names come first andthird inalphabetical order. ,e does not buy the boos MMMMMM.>E. "nthebasis of thefirst paragraphandstatement *2+, */+ and*B+ only, it ispossible to deduce that>. 'otho wrote the murder mystery or the spy thriller2. Sparrow published the murder mystery or the spy thriller/. The boo by (urchfield is published by Sparrow. >K.&f a light flashes every A seconds, how many times will it flash in c of an hour`2C. &f point 6 is on line segment A(, then which of the following is always true`*>+ A6 @ 6( *2+ A6 Q 6(*/+ 6( Q A6*B+ A( Q A6*?+ A( Q A6 ; 6(2>. All men are vertebrates. Some mammals are vertebrates. Fhich of the followingconclusions drawn from the above statement is correct.All men are mammalsAll mammals are menSome vertebrates are mammals.$one22. Fhich of the following statements drawn from the given statements are correct`%iven7All watches sold in that shop are of high standard. Some of the ,#T watches aresold in that shop.a+ All watches of high standard were manufactured by ,#T.b+ Some of the ,#T watches are of high standard.c+ $one of the ,#T watches is of high standard.d+ Some of the ,#T watches of high standard are sold in that shop.2/92G.>. Ashland is north of 4ast 0iverpool and west of !oshocton.2. (owling green is north of Ashland and west of 1rederictown./. Dover is south and east of Ashland.B. 4ast 0iverpool is north of 1rederictown and east of Dover.?. 1rederictown is north of Dover and west of Ashland.A. !oshocton is south of 1rederictown and west of Dover.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>CGTechnical Aptitude Questions2/. Fhich of the towns mentioned is furthest of the north ) west*a+ Ashland*b+ (owling green *c+ !oshocton*d+ 4ast 0iverpool *e+ 1rederictown2B. Fhich of the following must be both north and east of 1rederictown`*a+ Ashland *b+ !oshocton *c+ 4ast 0iverpool& a only && b only &&& c only &- a U b - a U c2?. Fhich of the following towns must be situated both south and west of at least oneother town`A. Ashland only(. Ashland and 1rederictown!. Dover and 1rederictownD. Dover, !oshocton and 1rederictown4. !oshocton, Dover and 4ast 0iverpool.2A. Fhich of thefollowing statements, if true, wouldmae the informationinthenumbered statements more specific`*a+ !oshocton is north of Dover.*b+ 4ast 0iverpool is north of Dover*c+ Ashland is east of (owling green.*d+ !oshocton is east of 1rederictown*e+ (owling green is north of 1rederictown2G. Fhich of the numbered statements gives information that can be deduced fromone or more of the other statements`*A+ > *(+ 2 *!+ / *D+ B *4+ A2E. 4ight friends ,arsha, 1ais, (ala=i, 4swar, Dhinesh, !handra, %eetha, and Ahmedaresittinginacirclefacingthecenter. (ala=i is sittingbetween%eethaandDhinesh. ,arsha is third to the left of (ala=i and second to the right of Ahmed.!handraissittingbetween Ahmedand%eethaand(ala=i and4shwararenotsitting opposite to each other. Fho is third to the left of Dhinesh`2K. &feveryalternativeletterstartingfrom(ofthe4nglishalphabet iswritteninsmall letter, rest all are written in capital letters, how the month[ September\ bewritten. *>+ Sept4#b4r *2+ S4pTe#(4r */+ Septembe'*B+ Septe#ber*?+ $one of the above./C. The length of the side of a s.uare is represented by 5;2. The length of the side ofan e.uilateral triangle is 25. &f the s.uare and the e.uilateral triangle have e.ualperimeter, then the value of 5 is MMMMMMM.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>CETechnical Aptitude Questions/>. &t taes #r. _arthi y hours to complete typing a manuscript. After 2 hours, hewas called away. Fhat fractional part of the assignment was left incomplete`/2. Fhich of the following is larger than /L?`*>+d *2+ /KL?C */+ GL2? *B+ /L>C *?+ ?KL>CC//. The number that does not have a reciprocal is MMMMMMMMMMMM./B. There are / persons Sudhir, Arvind,and %auri. Sudhir lent cars to Arvind and%auri as many as they had already. After some time Arvind gave as many cars toSudhir and %auri as many as they have. After sometime %auri did the same thing.At theendof this transactioneachoneof themhad2B. 1indthecars eachoriginally had./?. A man bought a horse and a cart. &f he sold the horse at >C W loss and the cart at2C W gain, he would not lose anythingX but if he sold the horse at ?W loss and thecart at ?W gain, he would lose 's. >C in the bargain. The amount paid by him was's.MMMMMMM for the horse and 's.MMMMMMMM for the cart..ns6ers:>. Answer: /C days.Explanation:"efore:"ne day wor @> L 2C"ne man3s one day wor @> L * 2C : G?+&ow:$o. "f worers @?C"ne day wor @?C : > L* 2C : G?+The total no. of days re.uired to complete the wor @ *G? : 2C+ L ?C@ /C2. Answer: C WExplanation:Since /5 L 2@ 5 L *2 L /+/. Answer: ?./ WExplanation:,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@?.2AB. Answer: 2?C lines of codesCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>CKTechnical Aptitude Questions?. Answer: G daysExplanation:The e.uation portraying the given problem is7 >C :5 ) 2 : */C ) 5+ @2>A where 5 is the number of woring days.Solving this we get 5 @ 2/$umber of days he was absent was G */C92/+ days.A. Answer: >?C men.Explanation:"ne day3s wor@ 2 L *G : KC+"ne hour3s wor @ 2 L *G : KC : E+"ne man3s wor @ 2 L *G : KC : E : G?+The remaining wor *?LG+ has to be completed within AC days, because thetotal 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?+ @?LGwhere 5 is the number of menworing after the KCth day.Fe get 5 @ 22?Since we have G? men already, it is enough to add only >?C men.G. Answer: *c+ >Explanation: a percent of b 7 *aL>CC+ : bb percent of a 7 *bL>CC+ : aa percent of b divided by b percent of a 7 **a L >CC +:b+ L*bL>CC+ : a ++ @ >E. Answer:!ost price of horse @'s. BCC U the cost price of cart @ 2CC.Explanation:-0et 5 be the cost price of the horse and y be the cost price of the cart.&n the first sale there is no loss or profit. *i.e.+ The loss obtained is e.ual to thegain.Therefore *>CL>CC+ : 5@*2CL>CC+ : yH @2 : y 99999999999999999*>+&n the second sale, he lost 's. >C. *i.e.+ The loss is greater than the profit by 's.>C.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>>CTechnical Aptitude QuestionsTherefore *? L >CC+ : 5@*? L >CC+ : y ; >C 9999999*2+Substituting *>+ in *2+ we get*>C L >CC+ : y@*? L >CC+ : y ; >C*? L >CC+ : y@>C% 7 4001rom *>+ 2 : 2CC @ x 7 +00K. Answer: /.Explanation:Sinceinclusionofanymaleplayer will re=ect afemalefromtheteam.Since there should be four member in the team and only three males are available,the girl, n should included in the team always irrespective of others selection. >C. Answer: ?>>. Answer: >,2,/ U B>2. Answer: (>/. Answer:>> U K apples per tree.Explanation:0et a, b, c, d U e be the total number of apples bored per year in A, (, !,D U 4 2s orchard. %iven thata ; > @ b ; / @ c ) > @ d ; / @ e ) A(ut the .uestion is to find the number of apples bored per tree in ! and D 2sorchard. &f is enough to consider c ) > @ d ; /.Since the number of trees in !3s orchard is >> and that of D3s orchard is>/. 0et 5andybethenumber ofapplesboredpertreein!Ud2sorchardrespectively.Therefore >> 5 ) > @ >/ y ; /(y trial and error method, we get the value for 5 and y as >> and K>B. Answer: %.Explanation: The order in which they are climbing is ' ) % ) _ ) , ) D >? ) >EAnswer:$ovel $ame Author 6ublisherSpy thriller 'atho ,eronCopyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>>>Technical Aptitude Questions#urder mystery %ory 6iegon%othic romance (urchfield (lue=aScience fiction ,opper SparrowExplanation: %iven$ovel $ame Author 6ublisherSpy thriller 'atho ,eron#urder mystery %ory 6iegon%othic romance (urchfield (lue=aScience fiction ,opper SparrowSince (lue=a doesn3t publish the novel by (urchfield and ,eron publishesthe novel spy thriller, 6iegon publishes the novel by (urchfield.Since ,opper writes %othic romance and ,eron publishes the novel spythriller, (lue=a publishes the novel by ,opper.Since ,eron publishes the novel spy thriller and ,eron publishes the novelby %ory, %ory writes Spy thriller and 'atho writes #urder mystery. >K. Answer:B?> times.Explanation:There are AC minutes in an hour.&n c of an hour there are *AC : c+ minutes@ B? minutes.&n c of an hour there are *AC : B?+ seconds @ 2GCC seconds.0ight flashed for every A seconds.&n 2GCC seconds 2GCCLA @ B?C times.The count start after the first flash, the light will flashes B?> times in c ofan hour.2C. Answer: *B+Explanation: 6A (Since p is a point on the line segment A(, A( Q A62>. Answer:*c+22. Answer:*b+ U *d+.Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>>2Technical Aptitude QuestionsAhmed2/ 9 2G.Answer: 1ais !handra2E. Answer: 1aisExplanation: )arsha =eetha4swar (ala=iDhinesh2K. Answer: *?+.Explanation: Sinceevery alternativeletter starting from ( of the 4nglishalphabetiswritten in small letter, the letters written in small letter are b, d, f...&nthefirst twoanswerstheletter 4iswritteninbothsmall Ucapitalletters, so they are not the correct answers. (ut in third and fourth answers theletter is written in small letter instead capital letter, so they are not the answers8 /C. Answer: 5 @ BExplanation: Since the side of the s.uare is 5 ; 2, its perimeter @ B *5 ; 2+ @ B5 ; ESince the side of the e.uilateral triangle is 25, its perimeter @ / : 25 @ A5Also, the perimeters of both are e.ual.*i.e.+ B5 ; E @ A5*i.e.+25 @ E 5 @ B./>.Answer:5 *y ) 2+ L y.Explanation:To type a manuscript arthi too y hours.Therefore his speed in typing@ >Ly.,e was called away after 2 hours of typing.Therefore the wor completed @ >Ly : 2.Therefore the remaining wor to be completed @ > ) 2Ly. *i.e.+ wor to be completed@ *y92+Ly/2. Answer:*2+//. Answer:>Explanation: Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>>/Technical Aptitude Questions"ne is the only number e5ists without reciprocal because the reciprocal ofone is one itself./B. Answer:Sudhir had /K cars, Arvind had 2> cars and %auri had >2 cars.Explanation: Sudhir Arvind %auri1inally 2B 2B 2B(efore %auri3s transaction >2 >2 BE(efore Arvind3s transactionA B2 2B(efore Sudhir3 s transaction/K 2> >2/?. Answer: !ost price of horse7 's. BCC U !ost price of cart7 's. 2CCExplanation: 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 cartTherefore *>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 thecart.Therefore*? L >CC+ : 5 9 >C @ *? L >CC+ : y ?5 9 >CCC @?ySubstituting *>+>Cy 9 >CCC @ ?y?y @ >CCCy @ 2CC5 @ BCCfrom *>+Exer'ise 2*19or the follo6in3& fin# the next term in the series >.A, 2B, AC,>2C, 2>C a+ //A b+ /AA c+ //C d+ AAC Answer 7 a+ //A Explanation 7 The series is >.2./, 2./.B, /.B.?, B.?.A, ?.A.G, .....* T.T means product+2.>, ?, >/, 2?Answer 7 B>Explanation 7 The series is of the form C82;>82, >82;282,...Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>>BTechnical Aptitude Questions/. C, ?, E, >G Answer 7 2B Explanation 7 >829>, 282;>, /829>, B82;>, ?829>B. >, E, K, AB, 2?*,int 7 4very successive terms are related+ Answer 7 2>A Explanation 7 >82, 28/, /82, B8/, ?82, A8/?. E,2B,>2,/A,>E,?B Answer 7 2GA. G>,GA,AK,GB,AG,G2 Answer 7 AGG. ?,K,>A,2K,?B Answer 7 >C/ Explanation 7 ?:29>@KX K:292@>AX >A:29/@2KX 2K:29B@?BX ?B:29?@>C/E. >,2,B,>C,>A,BC,AB *Successive terms are related+ Answer 7 2CC Explanation 7 The series is powers of 2 *28C,28>,..+.All digits are less than E.4very second number is in octal number system. >2E should follow AB. >2E base >C @ 2CC base E.Exer'ise 2*29in# the o## m$n out8>. /,?,G,>2,>/,>G,>KAnswer 7 >2 Explanation 7 All but >2 are odd numbers2. 2,?,>C,>G,2A,/G,?C,AB Answer 7 AB Explanation 7 2;/@?X ?;?@>CX >C;G@>GX >G;K@2AX 2A;>>@/GX /G;>/@?CX ?C;>?@A?X/. >C?,E?,AC,/C,C,9B?,9KCAnswer 7 CExplanation 7 >C?92C@E?X E?92?@ACX AC9/C@/CX /C9/?@9?X 9?9BC@9B?X 9B?9B?@9KCXExer'ise 2:ol;e the follo6in38Copyright: 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`Answer 7 >2G2. A fast typist can type some matter in 2 hours and a slow typist can type the same in /hours. &f both type combinely, in how much time will they finish`Answer 7 > hr >2 minExplanation :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/ @ ?LASo, the wor will be completed in AL? hours. i.e., >;>L? hours @ >hr >2 min/. %avasarTs average in his first ?C innings was ?C. After the ?>st innings, his averagewas?>. ,owmanyrunsdidhescoreinhis?>st innings. *supposingthathelosthiswicet in his ?>st innings+Answer 7 >C>Explanation 7 Total score after ?C innings @ ?C:?C @ 2?CCTotal score after ?> innings @ ?>:?> @ 2AC>So, runs made in the ?>st innings @ 2AC>92?CC @ >C>&f he had not lost his wicet in his ?>st innings, he would have scored anunbeaten ?C in his ?>st innings.B. "ut of EC coins, one is counterfeit. Fhat is the minimum number of weighings neededto find out the counterfeit coin`Answer 7 B?. Fhat can you conclude from the statement 7 All green are blue, all blue are red. `*i+ some blue are green*ii+ some red are green *iii+ some green are not red*iv+ all red are blue*a+ i or ii but not both *b+ i U ii only*c+ iii or iv but not both*d+ iii U ivAnswer 7 *b+A. A rectangular plate with length E inches, breadth >> inches and thicness 2 inches isavailable. Fhat is the length of the circular rod with diameter E inches and e.ual to thevolume of the rectangular plate`Answer 7 /.? inchesExplanation 7 -olume of the circular rod *cylinder+ @ -olume of the rectangularplate*22LG+:B:B:h @ E:>>:2h @ GL2 @ /.?Copyright: Vyom Network (http://www.vyomworld.com) - All Rights Reserved>>ATechnical Aptitude QuestionsG. Fhat is the sum of all numbers between >CC and >CCC which are divisible by >B `Answer 7 /?/K2Explanation 7 The number closest to >CC which is greater than >CC and divisibleby >Bis >>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 isKKB, which is the last term of the series.>>2 ; >2A ; .... ; KKB @ >B*E;K; ... ; G>+ @ /?/K2E. &f s*a+ denotes s.uare root