Do you know that? 70% Elance jobs are fixed-price next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Upwork (oDesk) test answers << General Programming category

Test answers for Objective-C Test 2016

(30) Last updated: June 16
Upwork (oDesk) • General Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

30 Answered Test Questions:

1. What comments are supported in Obj-C?

Answers:

• // Line comments

• /* Block comments */

• # Line comments

• ; Line comments

• -[[ block comments ]]

2. What is a protocol?

Answers:

• A class that uses functions instead of methods

• A method signature

• A class signature

• An interface without an implementation

• None of the above

3. What is the isa variable in objects?

Answers:

• Object size

• Object memory footprint

• Object class identification

• Object serial numbe

• None of the above

4. In which version of Objective-C did the fast enumeration system appear?

Answers:

• 2.0

• 1.5

• 1.0

• 3.0

5. What is an IMP?

Answers:

• A special type used for computation

• An alias for SEL

• A preprocessor directive defined to the implementation name

• The C type of a method implementation pointe

• None of the above

6. What is the default visibility for instance variables?

Answers:

• @private

• @package

• @public

• @protected

• None of the above

7. What type of variable do you need to use to implement singletons?

Answers:

• static

• auto

• const

• volatile

8. What is a category?

Answers:

• A namespace

• A category is a way to add instance variables to a class which already exists

• A category is a group of classes

• A category is a way to add methods to a class which already exists

• None of the above

9. How do you allocate an object?

Answers:

• MyClass *obj = malloc(sizeof(MyClass));

• MyClass *obj = [MyClass alloc];

• MyClass *obj = alloc(MyClass);

• MyClass *obj = [MyClass new];

• None of the above

10. Is the following code a correct allocation?


MyClass myObj;

[&myObj aMessage];

Answers:

• Yes

• No

11. What is an autoreleased object?

Answers:

• A C object.

• A static object.

• An object that is garbage collected.

• An object that will be released when the current AutoreleasePool is deallocated.

• None of the above

12. Which of the following declares a protocol?

Answers:

• @proto ProtocolName

• protocol ProtocolName {};

• @protocol ProtocolName

• @interface <ProtocolName>

• @interface ProtocolName::Protocol

13. In which version of Objective-C did the properties system appear?

Answers:

• 3.0

• 2.5

• 2.0

• 1.5

• 1.0

14. What is the id type?

Answers:

• A generic C type that Objective-C uses for an arbitrary object

• A memory address type

• A type to hold serialized objects

• The type used for Classes

• None of the above

15. When using the garbage collector, which method, that is normally called without the collector, is not called on your objects where they are collected?

Answers:

• free

• dealloc

• destroy

• uninit

16. Which of the following creates a class that conforms to a protocol?

Answers:

• @interface ClassName [ProtocolName]

• @interface ClassName <ProtocolName>

• @interface ClassName < ProtocolName

• @interface ClassName::ProtocolName

• @interface ClassName(ProtocolName)

17. What is a @finally block?

Answers:

• A block that is executed when the program quits

• A block that is executed within a dynamic library when it's unloaded

• A block of code that is run whenever an exception is thrown or not

• None of the above

18. What is true regarding @protected?

Answers:

• The instance variable is accessible within the class that declares it and within classes that inherit it

• The instance variable is accessible everywhere

• The instance variable is accessible only within the class that declares it.

• This is analogous to private_extern for variables and functions. Any code outside the class implementation's image that tries to use the instance variable will get a link error

• None of the above

19. A class can conform to only one protocol.

Answers:

• True

• False

20. What class specifiers are supported?

Answers:

• FINAL

• STATIC

• FAST

• ITERATIVE

• There is no such thing as class specifiers

21. How do you throw an exception?

Answers:

• Raise Exception

• @throw exception

• RAISE exception

• THROW exception

• None of the above

22. What is nil?

Answers:

• The null object

• The null class

• It doesn't exist

• None of the above

23. What does the following imply?

Worker *ceo = [[Worker alloc] init];
ceo->boss = nil;

Answers:

• That the ceo object is statically typed

• That the boss instance variable is declared @protected

• That the boss instance variable is declared @public

• That the ceo is in fact a structure

• This code is not correct

24. Can an exception caught in @catch be re-thrown?

Answers:

• Yes

• No

25. What is true regarding @public?

Answers:

• It doesn't exist in Objective-C

• It breaks encapsulation

• It can be used only on singleton objects

• None of the above

26. Which of the following is false?

Answers:

• Method lookup is done at runtime

• When a method is called, the send is automatically available as the sender variable, like self or supe

• Messages can be sent to nil

• Methods in static libraries must be present at link time

27. What can you use to avoid the msgSend function overhead?

Answers:

• SEL

• IMP

• You can't use anything

• None of the above

28. What does Obj-C not support?

Answers:

• Instance variables

• Class variables

• Static variables

• Automatic variables

29. What is not supported in Obj-C?

Answers:

• Recursive method call

• Variable argument count to method

• Byte manipulation

• Method argument default value

• None of the above

30. 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;

}

Answers:

• a b c 0 1 2

• a b c 2 1 0

• c b a 0 1 2

• c b a 2 1 0

• None of the above


Comments

Post Comment

Eva July 27, 2015
please update test, it looks like outdated
Administrator July 28, 2015
updated