RecruitmentQuizPaperAPrepareBy2GoTradeLtd.Version:1.06Jan2006Pleasecompletethefollowing8questionswithin2hours.Question1TheVBFunction,()function,GetCurrencyCodedemonstratesthetranslationbetweenthecurrencycodeandcurrencynumber.However,theperformanceofthisFunctionis()functionisnotgoodenough;thehigherorderofinputnumbertakesmuchmoretimestocalculate.Pleasesuggestawaytoimprovetheprogramperformance:FunctionGetCurrencyCode()FunctionGetCurrencyCode(ByValinputAsString)AsStringIfinput="01"Thenreturn="AFA"ElseIfinput="02"Thenreturn="ALL"ElseIfinput="03"Thenreturn="DZD"ElseIfinput="04"Thenreturn="USD"ElseIfinput="05"Thenreturn="HKD"ElseIfinput="75"Thenreturn="EUR"ElseIfinput="76"Thenreturn="XCD"ElseIfinput="77"Thenreturn="AMD"EndIfEndFunctionAnswer:FunctionGetCurrencyCode()FunctionGetCurrencyCode(ByValinputAsString)AsStringSelectCaseinputCase"01":return="AFA"Case"02":return="ALL"Case"03":return="DZD"Case"04":return="USD"Case"05":return="HKD"Case"75":return="EUR"Case"76":return="XCD"Case"77":return="AMD"CaseElse:return="unknown"EndSelectEndFunctionQuestion2WriteaFunctionthat()functionthatreversestheorderofthewordsinastring.Forinstance,yourFunctionshould()functionshouldtransformthestring“Doordonot,thereisnotry.”To“try.Noistherenot,doorDo”.Assumethatallwordsarespacedelimitedandtreatpunctuationthesameasletters.Useyourmosthands-onprogramminglanguage.Answer:JavaScriptVersion:FunctionReversesOrder()functionReversesOrder(){varOldStr="Doordonot,thereisnotry."varNewStr="";varArrayStr=OldStr.split("");for(vari=ArrayStr.length-1;i>=0;i--){NewStr+=ArrayStr[i]+"";}returnNewStr;}Question3StudythefollowingVBprogram:ImportsSystemImportsSystem.IOModuleModule1ModuleModule1PublicArtListAsArrayListEndModulePublicClassForm1ClassForm1InheritsSystem.Windows.Forms.FormWindowsFormDesignergeneratedcode#Region"WindowsFormDesignergeneratedcode"…#EndRegion<[Serializable]()>PublicClassArtClassArtPublicTitleAsStringPublicDesAsStringPublicValueAsIntegerPublicPriceAsDoublePublicPictureAsStringEndClassPrivateSubButton1_Click_1()SubButton1_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimmyArtAsNewObjectDimhashtableAsNewCollections.HashtableDimkeyAsStringTrymyArt=NewArtWithmyArt.Title="Title".Des="Desc".Value=123.Price=321.05EndWithkey=myArt.Title&myArt.Des&CStr(myArt.Value)&CStr(myArt.Price)hashtable.Add(key,myArt)ArtList.Add(myArt)CatchexAsException'Thisistheline94’MsgBox(ex.Message&vbCrLf&ex.StackTrace)EndTryEndSubEndClassAformiscreatedonwhichabuttoncontrolisplaced.WhentheButton1_Clickisfired,amessageboxispopup:Whatistheproblemandhowtofixit?Answer:Question4InthefollowingVBprogram,pleasestatesanypotentialproblem(s)andhowtocorrect.PrivateSubbtnCalc_Click()SubbtnCalc_Click()DimresultAsIntegerTryMe.Cursor=Windows.Forms.Cursors.WaitCursorresult=Convert.ToInt32(txtInput1.Text)/Convert.ToInt32(txtInput2.Text)txtResult.Text=resultMe.Cursor=Windows.Forms.Cursors.DefaultCatchexAsExceptionMsgBox(ex.StackTrace)CatchexAsArgumentNullExceptionMsgBox("InputTestboxcannotbenull.")CatchexAsOverflowExceptionMsgBox("InputTestbox2cannotbezero!")CatchexAsFormatExceptionMsgBox("InputTestboxshouldbenumericformat!")EndTryEndSubAnswer:Question5GetRecordset()isaVBFunctionthat()functionthatreturnsaADODB.Recordsetobject:Ref_IDQtyPriceRow000123100060.50Row100123200060.00Row200123350059.50Row300124300060.50Row400125200059.50Row500125100058.00(ThisrecordsetissortedbyRef_ID)ThefollowingprogramDimrstasADODB.RecordsetRst=GetRecordsetDoWhileNotrst.EOFConsole.writeline(rst.Fields("Ref_ID")&vbcrlf&rst.Fields("Qty")&vbcrlf&rst.Fields("Price"))rst.MoveNext()LoopCangeneratethefollowingoutput:Output:00123100060.5000123200060.0000123350059.5000124300060.5000125200059.5000125100058.00Pleasesuggesthowtomodifytheaboveprogramtogeneratethefollowingoutput:Output:00123100060.50200060.00350059.50---------650060.0000124300060.50---------300060.5000125200059.50100058.00------