Objective-C Quiz
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 80% Most missed: “What is wrong with this code?”

Objective-C MCQs For LinkedIn Skill Assessments.

Objective-C Quiz
Time left 00:00
25 Questions

1. How many items are in set1 after this code executes?

NSMutableSet *set1 = [NSMutableSet setWithObjects: @1,@2, @3, @4, @5, nil];
[set1 add0bject:@3];
2. What is this code an example of?
'[self addObserver: self forKeyPath: @'val' options:0 context: nil];'
3. What is the value of s?

NSMutableString *s = [NSMutableString stringWithString: @'123'];
[s appendString: @'456'];
4. Property defaults include \_?
5. What can you glean from this line?
'#import 'NSString+NameHelper.h
6. What best describes class inheritance in Objective-C?
7. What value is in str after this line in executed?
'NSString str = 'test' + ' ' + 'more';'
8. How would this function be called?
'-(int)foo:(int)a b:(int)c;'
9. What's the value of i after these statements?

NSString *str = nil;
NSInteger i = str.integerValue;
10. What's the difference between an array and a set?
11. If you want to store a small amount of information (e.g., user settings), whats the best, built-in way to go?
12. How many times with this loop be executed?

for (int x=0; x<100; x++) {
x = x + 1;
}
13. What does ARC stand for?
14. What is the key difference between NSDictionary and NSMutableDictionary?
15. What is wrong with this code?

NSMutableDictionary *dict1 = [NSMutableDictionary dictionaryWithCapacity:5];
[dict1 setValue:@'key' forKey:@'value'];
16. What is wrong with this code?

NSDictionary *d1 = @[@'v1', @4, @'v2', @5.6, @'v3'];
NSlog(@'d1: %@', d1);
17. What is special about the code within this block?

dispatch_async(dispatch_get_main_queue(), ^{
// code
});
18. What is printed from this code execution?

typedef enum {
thing1,
thing2,
thing3
} Thing;
-(void) enumStuff {
NSLog(@'%d', thing2);
}
19. What is this Objective-C code checking?

if ([keyPath isInstanceOf:[NSString class]]) {
}
20. What is this a declaration of?
'int(^foo)(int);'
21. What is wrong with this code?

float x = 2.0;
int(^foo)(int) = ^(int n1) {
return (int)(n1*x);
};
foo(5);
22. What is foo?
'-(float)foo;'
23. You are worried about threaded access to a property and possible collision in writing. What directive should you use on the property?
24. What is different about this function?
'+(void)doSomething;'
25. Dot notation can be used for \_?