欢迎来到天天文库
浏览记录
ID:42036309
大小:80.00 KB
页数:5页
时间:2019-09-06
《叠拓C语言笔试题目》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Telecom&MediaRecruitmentTestTietoInformationTechnology(Beijing)Co.,Ltd.SoftwareDeveloper叠拓信息技术(北京)有限公司杭州分公司CompanyConfidentialName:TelephoneNo.:Date:InstructionsPleaseanswerfollowingquestionsinEnglish,youcanonlyuselessthan60minutesforthistest1.Preprocessor10points)a)PleasedefineaMacrobyusing
2、preprocessinstruction#definein16-bitmachine,theconstantisusedtoindicatehowmanysecondsinoneyear.(Toignoretheleapyear)#defineSEC_PER_YEAR(365*24*60*60UL)(Note:Ifyoudefineittobe(365*24*60*60)UL,youmaybefindthatitdoesnotcompilewell.)b)PleasedefineaMacro,whichisusedtocomparetwoparametersandreturn
3、thesmallerparameter.#defineMIN(a,b)((a)<=(b)?(a):(b))2.Whatistheproblemofthebelowcode(5points)#includechar*Func(void){charp[10];strcpy(p,"111");returnp;}Thisfunctioncannotreturnthestringof“111”.3.Datadeclarations(10points)Pleasedefineavariableaccordingtothebelowrequirement,forexamp
4、leRequirement:AnintegerAnswer:inta;a)Apointertoaninteger(1point)int*a;b)Apointertoapointertoaninteger(1point)int**a;c)Anarrayof10integers(1point)inta[10];d)Anarrayof10pointerstointegers(1point)Copyright©2021TietoCorporationTelecom&MediaRecruitmentTestTietoInformationTechnology(Beijing)Co.,Lt
5、d.SoftwareDeveloper叠拓信息技术(北京)有限公司杭州分公司CompanyConfidentialint*a[10];e)Apointertoanarrayof10integers(2points)int(*a)[10];f)Apointertoafunctionthattakesanintegerasanargumentandreturnsaninteger(2points)int(*a)(int)g)Anarrayoftenpointerstofunctionsthattakeanintegerargumentandreturnaninteger(2poin
6、ts)int(*a[10])(int)4.What’stheoutputofthefunctionandwhy?(6points)voidfoo(void){unsignedinta=6;intb=-20;(a+b>6)?puts(">6"):puts("<=6");}Result:“>6”Reason:Whenavariableofintegeroperateswithavariableofunsignedinteger,theintegerwillbeautomaticallyconvertedtounsignedinteger,sothe“-20”willbeconver
7、tedtobealargeunsignedinteger.5.Const(9points)Inthefollowingcodes,therearesome“const”,whatismeaningofeachthem?a)constchar*pa;Thecontentofpaisread-only. b)char*constpc=&ca;Theaddressofpcisread-only. c)constchar*constpd=&cb;Boththeaddressandcontentofp
此文档下载收益归作者所有