UpWork (oDesk) & Elance Objective-C Test Question & Answers

14:33
UpWork (oDesk) & Elance Objective-C Test Question & Answers are really very important to pass UpWork & Elance test. You will get top score at this skill test exam. If you found any problem or wrong answer please inform me via contact or comments. We will try to solve it in short. This test is extremely valuable to acquire knowledge of Objective-C. Lets Start test.


Ques : Which of the following is the fastest?
Ans  : Mutex implicit locking

Ques : How do you free an object?
Ans  :  [obj release]

Ques :  What is the isa variable in objects?
Ans  : Object class identification

Ques : What is true regarding C functions inside .m files?
Ans  : They can contain Obj-C code

Ques : What does the following imply?

Worker *ceo = [[Worker alloc] init];
ceo->boss = nil;
Ans  : That the boss instance variable is declared @public

Ques : Can you send messages to nil?
Ans  : Yes

Ques :  In which version of Objective-C did the fast enumeration system appear?
Ans  : 2.0

Ques : What comments are supported in Obj-C?
Ans  :  // Line comments

Ques : What type of variable do you need to use to implement singletons?
Ans  : static

Ques : As categories can't have instance variables, what class could you use to implement a full class only with categories?
Ans  :  NSMutableDictionary

Ques : How do you throw an exception?
Ans  : @throw exception

Ques : What is true regarding strings?
Ans  : Obj-C strings are not of static storage

Ques : How do you include the root "Object" class?
Ans  : It depends on the compiler

Ques : What is true regarding @protected?
Ans  : The instance variable is accessible within the class that declares it and within classes that inherit it

Ques : What is a protocol?
Ans  :  An interface without an implementation

Ques :  Which of the following is incorrect?
Ans  : [AClass release]

Ques : How do you allocate an object?
Ans  : MyClass *obj = [MyClass alloc];

Ques : What will be the output of the following code?

static int
a (void)
{
printf ("a\n");
return 0;
}

static int
b (void)
{
printf ("b\n");
return 1;
}

static int
c (void)
{
printf ("c\n");
return 2;
}

int
main (int argc, const char *argv[])
{
printf ("%d %d %d", a (), b (), c ());
return 0;
}
Ans  : a b c 0 1 2

Ques : What is nil?
Ans  : The null object

Ques : Can an exception caught in @catch be re-thrown?
Ans  : Yes

Ques : What class specifiers are supported?
Ans  : There is no such thing as class specifiers

Ques : Which of the following declares a protocol?
Ans  : @protocol ProtocolName

Ques : What is the Obj-C runtime?
Ans  : A C library

Ques : What's the difference between copy and deepCopy?
Ans  : copy creates a copy at the first level, while deepCopy copies the instance variables

Ques : Which of the following can be inherited?
Ans  : Protocols

Ques : A method can be tagged to be called only by a specific class and its subclasses.
Ans  : False

Ques : Which of the following is not recommended?
Ans  : None of the above

Ques : A class can have two methods with the same name, but with different argument types.
Ans  : False

Ques : What are @try and @catch?
Ans  :  Exception keywords

Ques : A class can conform to only one protocol.
Ans  : False

Ques : Which of the following creates a class that conforms to a protocol?
Ans  : @interface ClassName

Ques : What is the id type?
Ans  :  A generic C type that Objective-C uses for an arbitrary object

Ques : What is a @finally block?
Ans  :  A block of code that is run whenever an exception is thrown or not

Ques : Is the following code a correct allocation?

MyClass myObj;
[&myObj aMessage];
Ans  : No

Ques : What is not supported in Obj-C?
Ans  : Method argument default value

Ques : Which of the following does not happen when you throw an exception in a @synchronized block?
Ans  : The object is deallocated

Ques : What can be linked to an Obj-C program without any particular process?
Ans  : C libraries

Ques : What is the C type used to work with objects in Obj-C?
Ans  : pointer

Ques : What is a category?
Ans  :  A category is a way to add methods to a class which already exists

Ques : Protocols are like classes; they can inherit.
Ans  : True

Ques : Which of the following is false?
Ans  : When a method is called, the send is automatically available as the sender variable, like self or super

Ques : What happens if two categories define methods with the same names for the same class?
Ans  :  At runtime, either method will be called

Ques : What can you do with categories?
Ans  : Add methods to a class without subclassing it

Ques : In which version of Objective-C did the properties system appear?
Ans  :  2.0

Ques : What is the default visibility for instance variables?
Ans  : @protected

Ques : What happens if you release an unretained object twice?
Ans  : MemoryException is raised

Ques : In Obj-C 2.0, what do the fast enumeration protocols rely on to provide fast Enumerations?
Ans  :  C arrays

Ques : What can you use to avoid the msgSend function overhead?
Ans  : SEL

Ques : Which C feature is not supported in Obj-C?
Ans  :  Support is compiler dependant

Ques : What does Obj-C not support?
Ans  : Automatic variables

Ques : When using the garbage collector, which method, that is normally called without the collector, is not called on your objects where they are collected?
Ans  : dealloc

Ques : What can be used as Object instance variables?
Ans  : pointers

Ques : What is a SEL?
Ans  : A pointer to a method

Ques : What is an IMP?
Ans  : The C type of a method implementation pointer

Ques : What is true regarding @public?
Ans  : It breaks encapsulation

Ques : What is an autoreleased object?
Ans  : An object that will be released when the current AutoreleasePool is deallocated.

Ques : If you need to allocate custom memory, in which method will you do so?
Ans  : None of the above

Ques : What is #import
Ans  :  C preprocessor construct to avoid multiple inclusions of the same file

Ques : What is true regarding messaging?
Ans  :  Messaging is fully dynamic, which means you can compile some code that sends a message to a class that doesn't implement it, and add a category later, in a dynamic library for example

Thanks for watching this test Question & Answers. Please don't forget to leave a comment about this post. You can also find some more effective test question & answers, information, techniques, technology news, tutorials, online earning information, recent news, results, job news, job exam results, admission details & another related services on the following sites below. Happy Working!
News For Todays ARSBD UpWorkElanceTests ARSBD-JOBS DesignerTab UpLance

Share this

Related Posts

Previous
Next Post »

We recommend you to subscribe us to get update from your email. EmoticonEmoticon