Você está na página 1de 3

Top25ObjectiveCInterviewQuestions&Answers

1)ExplainwhatobjectiveCprogrambasicallyconsistsof?

ObjectiveCprogrambasicallyconsistsof

Preprocessorcommands
Interface
Implementation
Method
Variables
Statements&Expressions
Comments

2)ExplainwhatisOOP?
OOPmeansObjectOrientedProgrammingitisatypeofprogrammingtechniquethathelpstomanageaset
ofobjectsinasystem.Withthehelpofvariousprogramminglanguages,thismethodhelpstodevelop
severalcomputerprogramsandapplications.

3)ExplainwhatistheprotocolinObjectiveC?
InObjetiveC,aprotocolisalanguagefeature,thatprovidesmultipleinheritancesinasingleinheritance
language.ObjectiveCsupportstwotypesofprotocol.

Adhocprotocolsknownasinformalprotocol
Compilerprotocolsknownasaformalprotocol

4)Explainwhatisthedifferencebetweenpolymorphismandabstraction?
AbstractioninOOPistheprocessofreducingtheunwanteddataandmaintainingonlytherelevantdatafor
theuserswhilepolymorphismenablesanobjecttoexecutetheirfunctionsintwoormoreforms.

5)ExplainwhatisparsingandmentionwhichclasscanweuseforpassingofXMLiniphone?

ParsingistheprocessreferredtoaccessthedataintheXMLelement.WecanuseclassNSXMLparser
forpassingXMLiniphone.

6)Mentionwhichclassareusedtoestablishaconnectionbetweenapplicationstothewebserver?
Theclassusedtoestablishconnectionbetweenapplicationstowebserverare

NSURL
NSURLREQUEST
NSURLCONNECTION

7)Explainwhatisanaccessormethods?
Accessormethodsaremethodsbelongingtoaclassthatenablesyoutogetandsetthevaluesofinstance
valuablecontainedwithintheclass.

8)Explainwhatis#import?
#importisaCpreprocessorconstructtoavoidmultipleinclusionsofthesamefile.

9)Mentionwhatistheclassofaconstantstring?
ItsandNXConstantString.NXConstantString*myString=@mystring

10)ListoutthemethodsusedinNSURLconnection?

MethodsusedinNSURLconnectionare

Connectiondidreceiveresponse
Connectiondidreceivedata
Connectionfailwitherror
Connectiondidfinishloading

11)ExplainclassdefinitioninObjectiveC?

Aclassdefinitionbeginswiththekeyword@interfacefollowedbytheinterface(class)name,andtheclass
body,closedbyapairofcurlybraces.InObjectiveC,allclassedareretrievedfromthebaseclass
calledNSObject.Itgivesbasicmethodslikememoryallocationandinitialization.

12)MentionwhatistheuseofcategoryinObjectiveC?

TheuseofcategoryinObjectiveCistoextendanexistingclassbyappendingbehaviorthatisusefulonly
incertainsituations.Inordertoaddsuchextensiontoexistingclasses,objectiveCprovidesextensions
andcategories.Thesyntaxusedtodefineacategoryis@interfacekeyword.
13)Explainwhatarethecharacteristicsofthecategory?

Characteristicsofcategoryincludes

Evenifyoudonthavetheoriginalsourcecodeforimplementation,acategorycanbedeclaredforany
class
Anymethodsthatyoudefineinacategorywillbeavailabletoallinstancesoftheoriginalclassaswellas
anysubclassesfortheoriginalclass
Atruntime,thereisnovariationbetweenamethodappendedbyacategoryandonethatisimplemented
bytheoriginalclass

14)ExplainwhatissingleinheritanceinObjectiveC?

Objectivecsubclasscanonlybeobtainedfromasingledirectparentclassthisconceptisknownassingle
inheritance.
15)ExplainwhatispolymorphisminObjectiveC?
PolymorphisminObjectiveCisreferredtoacapabilityofbaseclasspointertocallthefunction.
16)ExplainwhentouseNSArrayandNSMutableArray?

NSArray:YouwilluseanNSarraywhendatainthearraydontchange.Forexample,thecompany
nameyouwillputinNSArraysothatnoonecanmanipulateit.
NSMutableArray:Thisarraywillbeusedinanarray,whendatainanarraywillchange.Forinstance,if
youarepassinganarraytofunctionandthatfunctionwillappendsomeelementsinthatarraythenyou
willchooseNSMutableArray.

17)ExplainwhatissynthesizedinObjectiveC?
OnceyouhavedeclaredthepropertyinobjectiveC,youhavetotellthecompilerinstantlybyusing
synthesizedirective.Thiswilltellthecompilertogenerateagetter&settermessage.

18)ExplainhowstringisrepresentedinObjectiveC?

InObjectiveC,thestringisrepresentedbyusingNSSstringanditssubclassNSMutableStringprovides
severalwaysforcreatingstringobjects.

19)ExplainwhatisdataencapsulationinObjectiveC?
InObjectiveC,dataencapsulationisreferredtothemechanismofconnectingthedataandthefunctions
thatusethem.
20)ExplainhowtocallthefunctioninObjectiveC?

TocallthefunctioninObjectiveC,youhavetodoAccount>ObjectName>Displayaccountinformation
>Methodname

21)ExplainwhatareobjectiveCblocks?
InObjectiveCclass,thereisanobjectthatcombinesdatawithrelatedbehavior.Itenablesyoutoform
distinctsegmentsofcodethatcanbepassedaroundtofunctionsormethodsasiftheywerevalues.
ObjectiveCblockscanbeaddedtocollectionslikeNSDictionaryorNSArray.

22)Explainwhatisthemaindifferencebetweenthefunctioncallsandmessages?

Themaindifferencebetweenfunctioncallandmessageisthatafunctionanditsargumentsarelinked
togetherinthecompiledcode,butamessageandareceivingobjectarenotlinkeduntiltheprogramis
executingandthemessageissent.
23)ExplainhowmessagingworksinObjectiveC?
MessagingarenotboundtomethodimplementationuntilruntimeinObjectiveC.Thecompilertransformsa
messageexpression,intoacallonamessagingfunction,objc_msgSend().Thisfunctionconnectsthe
receiverandthenameofthemethodmentionedinthemessage.
24)ExplainhowtheclassIMPLEMENTATIONisrepresentedinObjectiveC?
InObjectiveCtheclassIMPLEMENTATIONisrepresentedwith@implementationdirectiveandends
with@end.
25)Explainwhatisdotnotation?
Dotnotationinvolvesassessinganinstancevariablebydeterminingaclassinstancefollowedbyadot
followedinturnbythenameofinstancevariableorpropertytobeaccessed.

26)MentionwhetherNSobjectisaparentclassorderivedclass?
NSobjectistheparentclassandconsistsofanumberofinstancevariablesandinstancemethods.

Você também pode gostar