O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Top 100 C Interview Questions and Answers

24.829 visualizações

Publicada em

If you're searching for the Top 100 C Interview Questions and Answers in 2014, then we have just the thing for you! We've created a monster resource of top 100 interview questions in c language and this PDF is free to download.

This list of the op 100 Technical C Interview Questions and Answers is perfect for both freshers and experienced candidates as it covers a wide range of questions and topics. So in case you're appearing for a C interview in TCS, Infosys, HCL, Wipro, Cognizant, Microsoft, Google, Mahindra, Satayam etc, then this is a must for you to download and prepare.

This list includes Technical C interview questions in the below categories:

top 100 c interview questions
top 100 c interview questions and answers
top 100 interview questions c language
monster top 100 interview questions
top 100 interview questions on c language
top 100 interview questions and answers
top 100 interview questions and answers pdf
top 100 interview questions and answers book
top 100 interview questions for lawyers
top 100 interview questions and answers ebook pdf free download
100 C interview questions and answers
C interview questions and answers for freshers and experienced
Top 100 Interview Questions and Answers Book
C Interview Questions & C FAQs
Top C Language Interview Questions and Answer
Top 100 C Questions Asked in Actual Interviews
Top 100 C Questions
Basic C Interview Questions
top 100 c interview questions and answers pdf
c interview questions and answers pdf for freshers
c interview questions and answers pdf free download
embedded c interview questions and answers pdf
c interview questions and answers pdf for experienced
c sharp interview questions and answers pdf
objective c interview questions and answers pdf
data structures in c interview questions and answers pdf
tcs c interview questions and answers pdf

Publicada em: Carreiras
  • DOWNLOAD FULL BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • DOWNLOAD FULL BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui
  • its is very useful to who r trying for interviews very good ques r there
       Responder 
    Tem certeza que deseja  Sim  Não
    Insira sua mensagem aqui

Top 100 C Interview Questions and Answers

  1. 1. hirist .com www.hirist.com TOP 100 INTERVIEW QUESTIONS & ANSWERS C
  2. 2. For the hottest C jobs, please visit www.hirist.com hirist .com WhoinventedCLanguage? 2 QUESTION DennisRitchiein1972developedanewlanguagebyinheritingthefeaturesofbothBCPLandBandaddingadditionalfeatures.HenamedthelanguageasjustC ANSWER QUESTION 1
  3. 3. For the hottest C jobs, please visit www.hirist.com hirist .com WhatarethefeaturesofCLangauges? 3 QUESTION •InConecanwriteprogramslikethatofhighlevellanguagesasinCOBOL,BASIC,FORTRANetc.aswellasitpermitsverycloseinteractionwiththeinnerworkingsofthecomputer. •Itisageneralpurposeprogramminglanguage.Itisusuallycalledsystemprogramminglanguagebutequallysuitedtowritingavarietyofapplications. •Itsupportsvariousdatatypes •Itfollowstheprogrammingstylebasedonfundamentalcontrolflowconstructionsforstructuredprogramming •Functionsmaybepre–definedoruserdefinedandtheymayreturnvaluesofbasictypes,structures,unionsorpointers ANSWER QUESTION 2
  4. 4. For the hottest C jobs, please visit www.hirist.com hirist .com Whataretheadvantagesofclanguage? 4 QUESTION •Easytowrite •Richsetofoperatorsandfunctionsthatarebuilt–in •Supportforbit–wiseoperation •Flexibleuseofpointers •Directcontroloverthehardware •AbilitytoaccessBIOS/DOSroutines •InteractingusingInterrupts •AbilitytowriteTSRprograms •Abilitytocreate.COMfiles •Abilitytocreatelibraryfiles(.LIB) •Abilitytowriteinterfaceprograms •IncorporatingassemblylanguageinCprogram ANSWER QUESTION 3
  5. 5. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisaheaderfile? 5 QUESTION Headerfilesprovidethedefinitionsanddeclarationsforthelibraryfunctions.Thus,eachheaderfilecontainsthelibraryfunctionsalongwiththenecessarydefinitionsanddeclarations.Forexample,stdio.h,math.h,stdlib.h, string.hetc. ANSWER QUESTION 4
  6. 6. For the hottest C jobs, please visit www.hirist.com hirist .com ListthedifferenttypesofCtokens? 6 QUESTION •Constants •Identifiers •Keywords •Operators •Specialsymbols •Strings ANSWER QUESTION 5
  7. 7. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisaconstant?Whatarethedifferenttypesofconstants? 7 QUESTION Aconstantisavaluethatdoesnotchangeduringtheprogramexecution.AconstantusedinCdoesnotoccupymemory.Therearefivetypesofconstants.Theyare: •Integerconstants •Floatingpointconstants •Characterconstants •Stringliterals •Enumerationconstants ANSWER QUESTION 6
  8. 8. For the hottest C jobs, please visit www.hirist.com hirist .com Whatarethedifferenttypesofcinstructions? 8 QUESTION •TherearebasicallythreetypesofinstructionsinCare: •TypeDeclarationInstruction •ArithmeticInstruction •ControlInstruction ANSWER QUESTION 7
  9. 9. For the hottest C jobs, please visit www.hirist.com hirist .com WhyCiscalledamiddlelevellanguage? 9 QUESTION CcombinesthefeaturesofbothAssemblyLevelLanguages(LowLevelLanguages)andHigherLevelLanguages. Forthisreason,CisreferredtoasaMiddleLevelLanguage.ThefeatureofALLsisthatofenablingustodevelopsystemlevelprogramsandthefeaturesofHLLsarethoseofhigherdegreeofreadabilityandmachine independence. ANSWER QUESTION 8
  10. 10. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisthepurposeofmain()function? 10 QUESTION •Thefunctionmain()invokesotherfunctionswithinit.Itisthefirstfunctiontobecalledwhentheprogramstartsexecution. •Itisthestartingfunction. •Itreturnsanintvaluetotheenvironmentthatcalledtheprogram. •Recursivecallisallowedformain()also. •Itisauser-definedfunction. ANSWER QUESTION 9
  11. 11. For the hottest C jobs, please visit www.hirist.com hirist .com Whatismeantbytypespecifiers? 11 QUESTION Typespecifiersdecidetheamountofmemoryspaceoccupiedbyavariable.Intheeaseofintegraltypes;italsoexplicitlystatestherangeofvaluesthattheobjectcanhold. ANSWER QUESTION 10
  12. 12. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisthedifferencebetweensinglecharaterconstantandstringconstant? 12 QUESTION •Asinglecharacterconstantconsistsofonlyonecharacteranditisenclosedwithinapairofsinglequotes. •Astringconstantconsistsofoneormorecharactersanditisenclosedwithinapairofdoublequotes. ANSWER QUESTION 11
  13. 13. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisaloop? 13 QUESTION Aloopisaprocesstodoajobrepeatedlywithpossiblydifferentdataeachtime.Thestatementsexecutedeachtimeconstitutetheloopbody,andeachpassiscallediteration.Aconditionmustbepresenttoterminatetheloop. ANSWER QUESTION 12
  14. 14. For the hottest C jobs, please visit www.hirist.com hirist .com Whatarethetypesofdatatypesandexplain? 14 QUESTION TherearefivebasicDatatypesinC.Theseare: •void:meansnothingi.e.nodatainvolvementinanaction •char:toworkwithalltypesofcharactersusedincomputeroperations •int:toworkwithanintegertypeofdatainanycomputationalwork •float:toworkwiththerealtypeofdataorscientificnumbersintheexponentialform •double:toworkwithdoubleprecisionofnumberswhentheapproximationisverycrucial. ANSWER QUESTION 13
  15. 15. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisthegeneralformofaCprogram? 15 QUESTION ACprogrambeginswiththepreprocessordirectives,inwhichtheprogrammerwouldspecifywhichheaderfileandwhatconstants(ifany)tobeused.Thisisfollowedbythemainfunctionheading.Withinthemainfunctionliesthevariabledeclarationandprogramstatement. ANSWER QUESTION 14
  16. 16. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisthedifferencebetweenCallbyValueandCallbyReference? 16 QUESTION WhenusingCallbyValue,youaresendingthevalueofavariableasparametertoafunction,whereasCallbyReferencesendstheaddressofthevariable.Also,underCallbyValue,thevalueintheparameterisnotaffectedbywhateveroperationthattakesplace,whileinthecaseofCallbyReference,valuescanbeaffectedbytheprocesswithinthefunction. ANSWER QUESTION 15
  17. 17. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisastack? 17 QUESTION Astackisoneformofadatastructure.DataisstoredinstacksusingtheFILO(FirstInLastOut)approach.Atanyparticularinstance,onlythetopofthestackisaccessible,whichmeansthatinordertoretrievedatathatisstoredinsidethestack,thoseontheupperpartshouldbeextractedfirst.StoringdatainastackisalsoreferredtoasaPUSH,whiledataretrievalisreferredtoasaPOP. ANSWER QUESTION 16
  18. 18. For the hottest C jobs, please visit www.hirist.com hirist .com Whatistheuseofa„0′character? 18 QUESTION Itisreferredtoasaterminatingnullcharacter,andisusedprimarilytoshowtheendofastringvalue. ANSWER QUESTION 17
  19. 19. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisthedifferencebetweenthe=symboland==symbol? 19 QUESTION The=symbolisoftenusedinmathematicaloperations.Itisusedtoassignavaluetoagivenvariable.Ontheotherhand,the==symbol,alsoknownas“equalto”or“equivalentto”,isarelationaloperatorthatisusedtocomparetwovalues ANSWER QUESTION 18
  20. 20. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisthemodulusoperator? 20 QUESTION Themodulusoperatoroutputstheremainderofadivision.Itmakesuseofthepercentage(%)symbol.Forexample: 10%3=1,meaningwhenyoudivide10by3,theremainderis1. ANSWER QUESTION 19
  21. 21. For the hottest C jobs, please visit www.hirist.com hirist .com Whichofthefollowingoperatorsisincorrectandwhy?(>=,<=,<>,==) 21 QUESTION <>isincorrect.Whilethisoperatoriscorrectlyinterpretedas“notequalto”inwritingconditionalstatements,itisnottheproperoperatortobeusedinCprogramming.Instead,theoperator!=mustbeusedtoindicate“notequalto”condition. ANSWER QUESTION 20
  22. 22. For the hottest C jobs, please visit www.hirist.com hirist .com Whatissyntaxerror? 22 QUESTION Syntaxerrorsareassociatedwithmistakesintheuseofaprogramminglanguage.Itmaybeacommandthatwasmisspelledoracommandthatmustwasenteredinlowercasemodebutwasinsteadenteredwithanuppercasecharacter.Amisplacedsymbol,orlackofsymbol,somewherewithinalineofcodecanalsoleadtosyntaxerror. ANSWER QUESTION 21
  23. 23. For the hottest C jobs, please visit www.hirist.com hirist .com CanIuse“int”datatypetostorethevalue32768?Why? 23 QUESTION No.“int”datatypeiscapableofstoringvaluesfrom-32768to32767.Tostore32768,youcanuse“longint”instead. Youcanalsouse“unsignedint”,assumingyoudon‟tintendtostorenegativevalues. ANSWER QUESTION 22
  24. 24. For the hottest C jobs, please visit www.hirist.com hirist .com Whenisthe“void”keywordusedinafunction? 24 QUESTION Whendeclaringfunctions,youwilldecidewhetherthatfunctionwouldbereturningavalueornot.Ifthatfunctionwillnotreturnavalue,suchaswhenthepurposeofafunctionistodisplaysomeoutputsonthescreen,then“void”istobeplacedattheleftmostpartofthefunctionheader.Whenareturnvalueisexpectedafterthefunctionexecution,thedatatypeofthereturnvalueisplacedinsteadof“void”. ANSWER QUESTION 23
  25. 25. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisthesignificanceofanalgorithmtoCprogramming? 25 QUESTION Beforeaprogramcanbewritten,analgorithmhastobecreatedfirst.Analgorithmprovidesastepbystepprocedureonhowasolutioncanbederived.Italsoactsasablueprintonhowaprogramwillstartandend, includingwhatprocessandcomputationsareinvolved. ANSWER QUESTION 24
  26. 26. For the hottest C jobs, please visit www.hirist.com hirist .com HowdoyougeneraterandomnumbersinC? 26 QUESTION RandomnumbersaregeneratedinCusingtherand()command.Forexample:anyNum=rand()willgenerateanyintegernumberbeginningfrom0,assumingthatanyNumisavariableoftypeinteger. ANSWER QUESTION 25
  27. 27. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisdebugging? 27 QUESTION Debuggingistheprocessofidentifyingerrorswithinaprogram.Duringprogramcompilation,errorsthatarefoundwillstoptheprogramfromexecutingcompletely.Atthisstate,theprogrammerwouldlookintothepossibleportionswheretheerroroccurred.Debuggingensurestheremovaloferrors,andplaysanimportantroleinensuringthattheexpectedprogramoutputismet. ANSWER QUESTION 26
  28. 28. For the hottest C jobs, please visit www.hirist.com hirist .com Whatdoesthe&&operatordoinaprogramcode? 28 QUESTION The&&isalsoreferredtoasANDoperator.Whenusingthisoperator,allconditionsspecifiedmustbeTRUEbeforethenextactioncanbeperformed.Ifyouhave10conditionsandallbut1failstoevaluateasTRUE,theentireconditionstatementisalreadyevaluatedasFALSE. ANSWER QUESTION 27
  29. 29. For the hottest C jobs, please visit www.hirist.com hirist .com Whatis||operatorandhowdoesitfunctioninaprogram? 29 QUESTION The||isalsoknownastheORoperatorinCprogramming.Whenusing||toevaluatelogicalconditions,anyconditionthatevaluatestoTRUEwillrendertheentireconditionstatementasTRUE. ANSWER QUESTION 28
  30. 30. For the hottest C jobs, please visit www.hirist.com hirist .com Whatwillbetheoutcomeofthefollowingconditionalstatementifthevalueofvariablesis10?s>=10&&s<25&&s!=12 30 QUESTION TheoutcomewillbeTRUE.Sincethevalueofsis10,s>=10evaluatestoTRUEbecausesisnotgreaterthan10butisstillequalto10.s<25isalsoTRUEsince10islessthen25.Justthesame,s!=12,whichmeanssisnotequalto12,evaluatestoTRUE.The&&istheANDoperator,andfollowstherulethatifallindividualconditionsareTRUE,theentirestatementisTRUE. ANSWER QUESTION 29
  31. 31. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisFIFO? 31 QUESTION InCprogramming,thereisadatastructureknownasqueue.Inthisstructure,dataisstoredandaccessedusingFIFOformat,orFirst-In-First-Out.Aqueuerepresentsalinewhereinthefirstdatathatwasstoredwillbethefirstonethatisaccessibleaswell. ANSWER QUESTION 30
  32. 32. For the hottest C jobs, please visit www.hirist.com hirist .com InClanguage,thevariablesNAME,name,andNameareallthesame.TRUEorFALSE? 32 QUESTION FALSE.Clanguageisacasesensitivelanguage.Therefore,NAME,nameandNamearethreeuniquelydifferentvariables. ANSWER QUESTION 31
  33. 33. For the hottest C jobs, please visit www.hirist.com hirist .com Whenisa“switch”statementpreferableoveran“if”statement? 33 QUESTION Theswitchstatementisbestusedwhendealingwithselectionsbasedonasinglevariableorexpression.However, switchstatementscanonlyevaluateintegerandcharacterdatatypes. ANSWER QUESTION 32
  34. 34. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisgets()function? 34 QUESTION Thegets()functionallowsafulllinedataentryfromtheuser.Whentheuserpressestheenterkeytoendtheinput, theentirelineofcharactersisstoredtoastringvariable.Notethattheenterkeyisnotincludedinthevariable,butinsteadanullterminator0isplacedafterthelastcharacter. ANSWER QUESTION 33
  35. 35. For the hottest C jobs, please visit www.hirist.com hirist .com DifferencebetweenSyntaxandlogicalerror? 35 QUESTION Syntaxerror: Theseinvolvesvalidationofsyntaxoflanguage Compilerprintsdiagnosticmessage. Logicalerror: Logicalerrorarecausedbyanincorrectalgorithmorbyastatementmistypedinsuchawaythatitdoesn‟tvioletsyntaxoflanguage. Itisdifficulttofind. ANSWER QUESTION 34
  36. 36. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisstaticmemoryallocation? 36 QUESTION Compilerallocatesmemoryspaceforadeclaredvariable.Byusingtheaddressofoperator,thereservedaddressisobtainedandthisaddressisassignedtoapointervariable.Thiswayofassigningpointervaluetoapointervariableatcompilationtimeisknownasstaticmemoryallocation. ANSWER QUESTION 35
  37. 37. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisdynamicmemoryallocation? 37 QUESTION Adynamicmemoryallocationusesfunctionssuchasmalloc()orcalloc()togetmemorydynamically.Ifthesefunctionsareusedtogetmemorydynamicallyandthevaluesreturnedbythesefunctionareassignedtopointervariables,suchawayofallocatingmemoryatruntimeisknownasdynamicmemoryallocation. ANSWER QUESTION 36
  38. 38. For the hottest C jobs, please visit www.hirist.com hirist .com ArePointersInteger? 38 QUESTION No,Pointersarenotintegers.Apointerisanaddress.Itisapositivenumber. ANSWER QUESTION 37
  39. 39. For the hottest C jobs, please visit www.hirist.com hirist .com Inheaderfileswhetherfunctionsaredeclaredordefined? 39 QUESTION Functionsaredeclaredwithinheaderfile.Thatisfunctionprototypesexistinaheaderfile,notfunctionbodies.Theyaredefinedinlibrary(lib). ANSWER QUESTION 38
  40. 40. For the hottest C jobs, please visit www.hirist.com hirist .com Differencebetweenstrdupandstrcpy? 40 QUESTION Bothcopyastring.Strcpywantsabuffertocopyinto.Strdupallocatesabufferusingmalloc().Unlikestrcpy(), strdup()isnotspecifiedbyANSI. ANSWER QUESTION 39
  41. 41. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisspaghettiprogramming? 41 QUESTION Spaghettiprogrammingreferstocodesthattendtogettangledandoverlappedthroughouttheprogram.Thisunstructuredapproachtocodingisusuallyattributedtolackofexperienceonthepartoftheprogrammer. Spaghettiprogramingmakesaprogramcomplexandanalyzingthecodesdifficult,andsomustbeavoidedasmuchaspossible. ANSWER QUESTION 40
  42. 42. For the hottest C jobs, please visit www.hirist.com hirist .com InCprogramming,howdoyouinsertquotecharacters(„and“)intotheoutputscreen? 42 QUESTION Thisisacommonproblemforbeginnersbecausequotesarenormallypartofaprintfstatement.Toinsertthequotecharacteraspartoftheoutput,usetheformatspecifiers‟(forsinglequote),and”(fordoublequote). ANSWER QUESTION 41
  43. 43. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisanestedloop? 43 QUESTION Anestedloopisaloopthatrunswithinanotherloop.Putitinanothersense,youhaveaninnerloopthatisinsideanouterloop.Inthisscenario,theinnerloopisperformedanumberoftimesasspecifiedbytheouterloop.Foreachturnontheouterloop,theinnerloopisfirstperformed. ANSWER QUESTION 42
  44. 44. For the hottest C jobs, please visit www.hirist.com hirist .com Canthecurlybrackets{}beusedtoencloseasinglelineofcode? 44 QUESTION Whilecurlybracketsaremainlyusedtogroupseverallinesofcodes,itwillstillworkwithouterrorifyouuseditforasingleline.Someprogrammerspreferthismethodasawayoforganizingcodestomakeitlookclearer,especiallyinconditionalstatements. ANSWER QUESTION 43
  45. 45. For the hottest C jobs, please visit www.hirist.com hirist .com Whatarecompoundstatements? 45 QUESTION Compoundstatementsaremadeupoftwoormoreprogramstatementsthatareexecutedtogether.ThisusuallyoccurswhilehandlingconditionswhereinaseriesofstatementsareexecutedwhenaTRUEorFALSEisevaluated.Compoundstatementscanalsobeexecutedwithinaloop.Curlybrackets{}areplacedbeforeandaftercompoundstatements. ANSWER QUESTION 44
  46. 46. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisaregistervariable? 46 QUESTION RegistervariablesarestoredintheCPUregisters.Itsdefaultvalueisagarbagevalue.Scopeofaregistervariableislocaltotheblockinwhichitisdefined.Lifetimeistillcontrolremainswithintheblockinwhichtheregistervariableisdefined.VariablestoredinaCPUregistercanalwaysbeaccessedfasterthantheonethatisstoredinmemory.Therefore,ifavariableisusedatmanyplacesinaprogram,itisbettertodeclareitsstorageclassasregister Example:registerintx=5; Variablesforloopcounterscanbedeclaredasregister.Notethatregisterkeywordmaybeignoredbysomecompilers. ANSWER QUESTION 45
  47. 47. For the hottest C jobs, please visit www.hirist.com hirist .com Whatissizeofvoidpointer? 47 QUESTION Sizeofanytypeofpointerincisindependentofdatatypewhichispointerispointingi.e.sizeofalltypeofpointer(near)incistwobyteeitheritischarpointer,doublepointer,functionpointerornullpointer.Voidpointerisnotexceptionofthisruleandsizeofvoidpointerisalsotwobyte. ANSWER QUESTION 46
  48. 48. For the hottest C jobs, please visit www.hirist.com hirist .com Whatareprintfandscanf,callbyreferenceorcallbyvalue? 48 QUESTION Printf:Callbyvalue Scanf:Callbyreference ANSWER QUESTION 47
  49. 49. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisaconstpointer? 49 QUESTION aconstpointermeansthepointerwhichrepresentstheaddressofonevalue.soifyoudeclareapointerinsidethefunction,itdoesn'thavescopeoutsidethefunction.ifitisalsoavailabletotheoutsidefunctionwheneverwedeclareapointerasconst. ANSWER QUESTION 48
  50. 50. For the hottest C jobs, please visit www.hirist.com hirist .com Whydoesn++executemuchfasterthann+1? 50 QUESTION n++takesmorethanoneinstruction,++nisfaster.n++hastostoren,incrementthevariableandreturnn,while++nincrementnandreturnwithoutstoringthepreviousvalueofn. ANSWER QUESTION 49
  51. 51. For the hottest C jobs, please visit www.hirist.com hirist .com WhatismodularProgramming? 51 QUESTION Ifaprogramislarge,itissubdividedintoanumberofsmallerprogramsthatarecalledmodulesorsubprograms.Ifacomplexproblemissolvedusingmoremodules,thisapproachisknownasmodularprogramming. ANSWER QUESTION 51
  52. 52. For the hottest C jobs, please visit www.hirist.com hirist .com Whydoesn'tCsupportfunctionoverloading? 52 QUESTION OverloadingispolymorphismwhichisoneofthecharacteristicsofObjectorientedprogramming.CisnotandobjectorientedlanguagelikeC++orJava.Therefore,nooverloading,inheritance,etc. ANSWER QUESTION 51
  53. 53. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisanincompletetype? 53 QUESTION Incompletetypesreferstopointersinwhichthereisnonavailabilityoftheimplementationofthereferencedlocationoritpointstosomelocationwhosevalueisnotavailableformodification. ANSWER QUESTION 52
  54. 54. For the hottest C jobs, please visit www.hirist.com hirist .com ExplaintheDifferencebetweenCandC++? 54 QUESTION CisthepredecessorofC++.C++isanObjectOriented,non-procedurallanguage,unlikeC,whichisaprocedurallanguage.C++treatsalldataandfunctionalhandlingintermsofObjectsandtheirrelationships. ANSWER QUESTION 53
  55. 55. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisNestinginC? 55 QUESTION Includingoneconstructedinsideanother,isnesting.Nestingcanbeastructureinsideanotherstructure,anif-elsestatementwithinanother,multiplewhileloops,oneinsidetheother.Continuingourearlierexample,ifyouhaveacollectionofbikes,insteadofgroupingthemseparately,youcannestthemwithinamainstructure,whichyoucanname“CollectionofBikes”. ANSWER QUESTION 54
  56. 56. For the hottest C jobs, please visit www.hirist.com hirist .com Howiscalloc()differentfrommalloc()? 56 QUESTION Themaindifferencebetweenthetwoisthatcalloc(),whenitisusedtoassignablockofmemory,theallocatedcontentsareinitializedto0.Malloc(),ontheotherhand,doesnotinitialisethememoryblockitassigns.Thememoryjusthasrandomvaluesleftoverfromprevioususage. ANSWER QUESTION 55
  57. 57. For the hottest C jobs, please visit www.hirist.com hirist .com WhatareDestructorsinCLanguage? 57 QUESTION Classifyingadestructoryoucancallitaclassobjectanditiscalledadestructoronceitgoesoutofscopeorgetsdeletedovertly.Thejobofadestructoristoputanendtoobjectsbeingproducedbyaconstructor.Justliketheconstructoryoucanconsiderdestructorafunctionalmemberanditisspecificallyknownbyaclassname. ANSWER QUESTION 56
  58. 58. For the hottest C jobs, please visit www.hirist.com hirist .com Whataretheusesofapointer? 58 QUESTION Pointerisusedinthefollowingcases i)Itisusedtoaccessarrayelements ii)Itisusedfordynamicmemoryallocation. iii)ItisusedinCallbyreference iv)Itisusedindatastructuresliketrees,graph,linkedlistetc. ANSWER QUESTION 57
  59. 59. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisaunion? 59 QUESTION Unionisacollectionofheterogeneousdatatypebutitusesefficientmemoryutilizationtechniquebyallocatingenoughmemorytoholdthelargestmember.Hereasingleareaofmemorycontainsvaluesofdifferenttypesatdifferenttime.Aunioncanneverbeinitialized. ANSWER QUESTION 58
  60. 60. For the hottest C jobs, please visit www.hirist.com hirist .com Whataremacros?Whatareitsadvantagesanddisadvantages? 60 QUESTION Macrosareabbreviationsforlengthyandfrequentlyusedstatements.Whenamacroiscalledtheentirecodeissubstitutedbyasinglelinethoughthemacrodefinitionisofseverallines. Theadvantageofmacroisthatitreducesthetimetakenforcontroltransferasincaseoffunction. Thedisadvantageofitisheretheentirecodeissubstitutedsotheprogrambecomeslengthyifamacroiscalledseveraltimes. ANSWER QUESTION 59
  61. 61. For the hottest C jobs, please visit www.hirist.com hirist .com Whatareenumerations? 61 QUESTION Theyarealistofnamedinteger-valuedconstants.Example:enumcolor{black,orange=4,yellow,green,blue, violet};Thisdeclarationdefinesthesymbols“black”,“orange”,“yellow”,etc.tohavethevalues“1,”“4,”“5,”…etc. Thedifferencebetweenanenumerationandamacroisthattheenumactuallydeclaresatype,andthereforecanbetypechecked. ANSWER QUESTION 60
  62. 62. For the hottest C jobs, please visit www.hirist.com hirist .com Whatistheuseoftypedef? 62 QUESTION Thetypedefhelpineasiermodificationwhentheprogramsareportedtoanothermachine.Adescriptivenewnamegiventotheexistingdatatypemaybeeasiertounderstandthecode. ANSWER QUESTION 61
  63. 63. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisthedifferencebetweenStringsandArrays? 63 QUESTION StringisasequenceofcharactersendingwithNULL.itcanbetreatedasaonedimensionalarrayofcharactersterminatedbyaNULLcharacter. ANSWER QUESTION 62
  64. 64. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisanormalizedpointer,howdowenormalizeapointer? 64 QUESTION Itisa32bitpointer,whichhasasmuchofitsvalueinthesegmentregisteredaspossible.Sinceasegmentcanstartevery16bytessotheoffsetwillhaveavaluefrom0toF.fornormalizationconverttheaddressinto20bitaddressthenusethe16bitforsegmentaddressand4bitfortheoffsetaddress.Givenapointer500D:9407,weconvertittoa20bitabsoluteaddress549D7,Whichthennormalizedto549D:0007. ANSWER QUESTION 63
  65. 65. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisgenericpointerinC? 65 QUESTION InCvoid*actsasagenericpointer.Whenotherpointertypesareassignedtogenericpointer,conversionsareappliedautomatically(implicitconversion). ANSWER QUESTION 64
  66. 66. For the hottest C jobs, please visit www.hirist.com hirist .com Differencebetweenlinkerandlinkage? 66 QUESTION Linkerconvertsanobjectcodeintoanexecutablecodebylinkingtogetherthenecessarybuiltinfunctions.Theformandplaceofdeclarationwherethevariableisdeclaredinaprogramdeterminethelinkageofvariable. ANSWER QUESTION 65
  67. 67. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisafunction? 67 QUESTION Alargeprogramissubdividedintoanumberofsmallerprogramsorsubprograms.Eachsubprogramspecifiesoneormoreactionstobeperformedforthelargerprogram.Suchsubprogramsarecalledfunctions. ANSWER QUESTION 66
  68. 68. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisanargument? 68 QUESTION Anargumentisanentityusedtopassdatafromthecallingtoacalledfunction. ANSWER QUESTION 67
  69. 69. For the hottest C jobs, please visit www.hirist.com hirist .com WriteaprogramwhichemploysRecursion? 69 QUESTION intfact(intn){returnn>1?n*fact(n–1):1;} ANSWER QUESTION 68
  70. 70. For the hottest C jobs, please visit www.hirist.com hirist .com Whatdothe„c‟and„v‟inargcandargvstandfor? 70 QUESTION Thecinargc(argumentcount)standsforthenumberofcommandlineargumenttheprogramisinvokedwithandvinargv(argumentvector)isapointertoanarrayofcharacterstringthatcontainthearguments. ANSWER QUESTION 69
  71. 71. For the hottest C jobs, please visit www.hirist.com hirist .com WhatareCidentifiers? 71 QUESTION Thesearenamesgiventovariousprogrammingelementsuchasvariables,function,arrays.Itisacombinationofletter,digitandunderscore.Itshouldbeginwithletter.Backspaceisnotallowed. ANSWER QUESTION 70
  72. 72. For the hottest C jobs, please visit www.hirist.com hirist .com Whatdothefunctionsatoi(),itoa()andgcvt()do? 72 QUESTION atoi()isamacrothatconvertsintegertocharacter. itoa()Itconvertsanintegertostring gcvt()Itconvertsafloatingpointnumbertostring ANSWER QUESTION 71
  73. 73. For the hottest C jobs, please visit www.hirist.com hirist .com Howisfopen()used? 73 QUESTION Thefunctionfopen()returnsafilepointer.Henceafilepointerisdeclaredanditisassignedas FILE*fp; fp=fopen(filename,mode); filenameisastringrepresentingthenameofthefileandthemoderepresents: “r”forreadoperation “w”forwriteoperation “a”forappendoperation “r+”,”w+”,”a+”forupdateoperation ANSWER QUESTION 72
  74. 74. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisthepurposeofftell? 74 QUESTION Thefunctionftell()isusedtogetthecurrentfilerepresentedbythefilepointer. ftell(fp); returnsalongintegervaluerepresentingthecurrentfilepositionofthefilepointedbythe filepointerfp.Ifanerroroccurs,-1isreturned. ANSWER QUESTION 73
  75. 75. For the hottest C jobs, please visit www.hirist.com hirist .com Discussonpointerarithmetic? 75 QUESTION 1.Assignmentofpointerstothesametypeofpointers. 2.Addingorsubtractingapointerandaninteger. 3.Subtractingorcomparingtwopointer. 4.Incrementingordecrementingthepointerspointingtotheelementsofanarray.Whenapointertoanintegerisincrementedbyone,theaddressisincrementedbytwo.Itisdoneautomaticallybythecompiler. 5.Assigningthevalue0tothepointervariableandcomparing0withthepointer.Thepointerhavingaddress0pointstonowhereatall. ANSWER QUESTION 74
  76. 76. For the hottest C jobs, please visit www.hirist.com hirist .com Whatistheinvalidpointerarithmetic? 76 QUESTION i)adding,multiplyinganddividingtwopointers. ii)Shiftingormaskingpointer. iii)Additionoffloatordoubletopointer. iv)Assignmentofapointerofonetypetoapointerofanothertype? ANSWER QUESTION 75
  77. 77. For the hottest C jobs, please visit www.hirist.com hirist .com Canweinitializeunions? 77QUESTION ANSIStandardCallowsaninitializerforthefirstmemberofaunion.Thereisnostandardwayofinitializinganyothermember(nor,underapre-ANSIcompiler,istheregenerallyanywayofinitializingaunionatall). ANSWER QUESTION 76
  78. 78. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisOutputoffollowingcsnippet? intmain(){ char*s="Abhas"; printf("%s",s+2); getch(); } 78 QUESTION Has.Explanation:Intheaboveprogramroleof%sistodisplaythestringwhoseaddressispassedasanargument.Thisishowastandardprintfstatementworksinclanguage.Nowsincewehavepasseds+2asanargumentthereforefirstvalueofthisexpressionisevaluated.Here„s‟wouldrefertoaddressoffirstcharacterinstring„s‟.Nowprintfwouldgetaddressofthirdcharacter(addressoffirstcharacter+2)asargumentsoitwilldisplaythestringstartingfromthirdposition.Henceoutputwouldbe„has‟. ANSWER QUESTION 77
  79. 79. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisdifferencebetween.comprogramand.exeprogram? 79 QUESTION Both.comand.exeprogramareexecutableprogrambut.comprogramexecutesfasterthan.exeprogram.Alldriversare.comprogram..comfilehashigherpreferencethan.exe. ANSWER QUESTION 78
  80. 80. For the hottest C jobs, please visit www.hirist.com hirist .com DescribeturbocCompiler? 80 QUESTION TurbocisanIDEprogramminglanguagecreatedbyBorland.TurboC3.0isbasedonMSDOSoperationsystem.Itisoneofthemostpopularccompilers.Ituses8086microprocessorwhichis16bitmicroprocessor.Ithas20addressbusesand16databus.Itswordlengthistwobyte. ANSWER QUESTION 79
  81. 81. For the hottest C jobs, please visit www.hirist.com hirist .com Outoffgets()andgets()whichfunctionissafetouseandwhy? 81 QUESTION Fgets()issaferthangets(),becausewecanspecifyamaximuminputlength.Neitheroneiscompletelysafe, becausethecompilercan‟tprovethatprogrammerwon‟toverflowthebufferhepasstofgets(). ANSWER QUESTION 80
  82. 82. For the hottest C jobs, please visit www.hirist.com hirist .com Differentiatebetweena“forloop”anda“whileloop”? 82 QUESTION Forexecutingasetofstatementsfixednumberoftimesweuse“forloop”whilewhenthenumberofiterationstobeperformedisnotknowninadvanceweuse“whileloop”. ANSWER QUESTION 81
  83. 83. For the hottest C jobs, please visit www.hirist.com hirist .com Isthereabuilt-infunctioninCthatcanbeusedforsortingdata? 83 QUESTION Yes,usetheqsort()function.Itisalsopossibletocreateuserdefinedfunctionsforsorting,suchasthosebasedontheballoonsortandbubblesortalgorithm. ANSWER QUESTION 82
  84. 84. For the hottest C jobs, please visit www.hirist.com hirist .com Whataretheadvantagesanddisadvantagesofaheap? 84 QUESTION Storingdataontheheapisslowerthanitwouldtakewhenusingthestack.However,themainadvantageofusingtheheapisitsflexibility.That‟sbecausememoryinthisstructurecanbeallocatedandremoveinanyparticularorder.Slownessintheheapcanbecompensatedifanalgorithmwaswelldesignedandimplemented. ANSWER QUESTION 83
  85. 85. For the hottest C jobs, please visit www.hirist.com hirist .com HowdoyouconvertstringstonumbersinC? 85 QUESTION Youcanwriteyouownfunctionstodostringtonumberconversions,orinsteaduseC‟sbuiltinfunctions.Youcanuseatoftoconverttoafloatingpointvalue,atoitoconverttoanintegervalue,andatoltoconverttoalongintegervalue. ANSWER QUESTION 84
  86. 86. For the hottest C jobs, please visit www.hirist.com hirist .com Createasimplecodefragmentthatwillswapthevaluesoftwovariablesnum1andnum2. 86 QUESTION inttemp; temp=num1; num1=num2; num2=temp; ANSWER QUESTION 85
  87. 87. For the hottest C jobs, please visit www.hirist.com hirist .com Whatistheuseofasemicolon(;)attheendofeveryprogramstatement? 87 QUESTION Ithastodowiththeparsingprocessandcompilationofthecode.Asemicolonactsasadelimiter,sothatthecompilerknowswhereeachstatementends,andcanproceedtodividethestatementintosmallerelementsforsyntaxchecking. ANSWER QUESTION 86
  88. 88. For the hottest C jobs, please visit www.hirist.com hirist .com Whatdoesthecharacters“r”and“w”meanwhenwritingprogramsthatwillmakeuseoffiles? 88 QUESTION “r”means“read”andwillopenafileasinputwhereindataistoberetrieved.“w”means“write”,andwillopenafileforoutput.Previousdatathatwasstoredonthatfilewillbeerased. ANSWER QUESTION 87
  89. 89. For the hottest C jobs, please visit www.hirist.com hirist .com WhichfunctioninCcanbeusedtoappendastringtoanotherstring? 89 QUESTION Thestrcatfunction.Ittakestwoparameters,thesourcestringandthestringvaluetobeappendedtothesourcestring. ANSWER QUESTION 88
  90. 90. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisthedifferencebetweenfunctionsgetch()andgetche()? 90 QUESTION Bothfunctionswillacceptacharacterinputvaluefromtheuser.Whenusinggetch(),thekeythatwaspressedwillnotappearonthescreen,andisautomaticallycapturedandassignedtoavariable.Whenusinggetche(),thekeythatwaspressedbytheuserwillappearonthescreen,whileatthesametimebeingassignedtoavariable. ANSWER QUESTION 89
  91. 91. For the hottest C jobs, please visit www.hirist.com hirist .com Whatdoesthefunctiontoupper()do? 91 QUESTION Itisusedtoconvertanylettertoitsuppercasemode.Toupper()functionprototypeisdeclaredin<ctype.h>.Notethatthisfunctionwillonlyconvertasinglecharacter,andnotanentirestring. ANSWER QUESTION 90
  92. 92. For the hottest C jobs, please visit www.hirist.com hirist .com Whatarerun-timeerrors? 92 QUESTION Theseareerrorsthatoccurwhiletheprogramisbeingexecuted.Onecommoninstancewhereinrun-timeerrorscanhappeniswhenyouaretryingtodivideanumberbyzero.Whenrun-timeerrorsoccur,programexecutionwillpause,showingwhichprogramlinecausedtheerror. ANSWER QUESTION 91
  93. 93. For the hottest C jobs, please visit www.hirist.com hirist .com Isthisprogramstatementvalid?INT=10.50; 93 QUESTION AssumingthatINTisavariableoftypefloat,thisstatementisvalid.OnemaythinkthatINTisareservedwordandmustnotbeusedforotherpurposes.However,recallthatreservedwordsareexpressinlowercase,sotheCcompilerwillnotinterpretthisasareservedword. ANSWER QUESTION 92
  94. 94. For the hottest C jobs, please visit www.hirist.com hirist .com Whatiswrongwiththisprogramstatement?void=10; 94 QUESTION ThewordvoidisareservedwordinClanguage.Youcannotusereservedwordsasauser-definedvariable. ANSWER QUESTION 93
  95. 95. For the hottest C jobs, please visit www.hirist.com hirist .com WhatwouldhappentoXinthisexpression:X+=15;(assumingthevalueofXis5) 95 QUESTION X+=15isashortmethodofwritingX=X+15,soiftheinitialvalueofXis5,then5+15=20. ANSWER QUESTION 94
  96. 96. For the hottest C jobs, please visit www.hirist.com hirist .com Notallreservedwordsarewritteninlowercase.TRUEorFALSE? 96 QUESTION FALSE.Allreservedwordsmustbewritteninlowercase;otherwisetheCcompilerwouldinterpretthisasunidentifiedandinvalid. ANSWER QUESTION 95
  97. 97. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisfloatingpointconstants? 97 QUESTION Floating-pointconstantsarenumberswithdecimalparts.Afloating-pointconstantsconsistsof: Anintegralpart Adecimalpoint Afractionalpart Anexponentpart Anoptionalsuffix ANSWER QUESTION 96
  98. 98. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisthedifferencebetweenfreadandfwritefunction? 98 QUESTION Thefread()functionreturnsthenumberofitemsread.Thisvaluemaybelessthancountiftheendofthefileisreachedoranerroroccurs.Thefwrite()functionreturnsthenumberofitemswritten.Thisvaluewillequalcountunlessanerroroccurs. ANSWER QUESTION 97
  99. 99. For the hottest C jobs, please visit www.hirist.com hirist .com Whatismeantbyinheritance? 99QUESTION Inheritanceistheprocessbywhichobjectsofoneclassacquirepropertiesofobjectsofanotherclass. ANSWER QUESTION 98
  100. 100. For the hottest C jobs, please visit www.hirist.com hirist .com WhatisaternaryoperatorinC? 100 QUESTION PerhapsthemostunusualoperatorinClanguageisonecalledtheconditionalexpressionoperator.UnlikeallotheroperatorsinCwhichareeitherunaryorbinaryoperatorstheconditionalexpressionoperatorisaternaryoperator; thatis,ittakesthreeoperands.Thetwosymbolsthatareusedtodenotethisoperatorarethequestionmark(?) andthecolon(:).Thefirstoperandisplacedbeforethe?,thesecondbetweenthe?andtheandthethirdafterthe:. ANSWER QUESTION 99
  101. 101. For the hottest C jobs, please visit www.hirist.com hirist .com Whatisunaryoperator? 101 QUESTION Theoperatorsthatactuponasingleoperandtoproduceanewvalueareknownasunaryoperators. ANSWER QUESTION 100
  102. 102. For the hottest C jobs, please visit www.hirist.com hirist .com Resources 102 http://www.fresherventure.net/frequently-asked-c-language-interview-questions- and-answers/ http://www.itechaleart.com/2014/06/top-100-c-interview-qa.html http://placement.freshersworld.com/power-preparation/technical-interview- questions/C-programming-answers-21419 http://career.guru99.com/top-100-c-interview-questions-answers/ http://www.slideshare.net/vineetkumarsaini/top-c-language-interview-questions- and-answer http://www.cquestions.com/2010/10/c-interview-questions-and-answers.html http://placementsindia.blogspot.com/2007/10/basic-c-interview-questions.html https://www.udemy.com/blog/c-programming-questions/ http://crackaninterview.com/c-language-interview-questions/ http://www.cwithabhas.com/2013/09/simple-c-interview-questions-for-mass.html http://www.freejobalert.com/c-interview-questions/2891/
  103. 103. www.hirist.com TOP 100 INTERVIEW QUESTIONS & ANSWERS C

×