Objective-C LinkedIn Skill Assessment Answer

Here, We see Objective-C LinkedIn Skill Assessment Answer. This assessment test consists 15-20 MCQs to demonstrate your knowledge in your selected skills. MCQs comes from different topics – Classes, Collections, Functions, General, Variables.



Objective-C LinkedIn Skill Assessment :-

Q1. What is the value of s?

NSMutableString *s = [NSMutableString stringWithString: @"123"];
[s appendString: @"456"];
  1. 123456✔️
  2. 123
  3. 456
  4. This code contains an error.

Q2. What’s the value of i after these statements?

NSString *str = nil;
NSInteger i = str.integerValue;
  1. nil
  2. 0 (technically nil == 0 but i will have a literal value of 0 and not the void* value of nil)✔️
  3. -1
  4. This code crashes.

Q3. What value is in str after this line in executed?

NSString str = "test" + " " + "more";

  1. This code contains an error✔️
  2. test
  3. nil
  4. test more

Q4. What does this code print?

    NSPredicate *p2 = [NSPredicate predicateWithBlock:^BOOL(NSString*  evaluatedObject, NSDictionary * _Nullable bindings) {
      return evaluatedObject.intValue % 2 == 0;
    }];
    NSArray *vals = @[@"1", @"2", @"3"];
    NSArray *n2 = [vals filteredArrayUsingPredicate:p2];
    NSLog(@"%@", n2.firstObject);
  1. 2✔️
  2. 1,2,3
  3. 1,2
  4. Nothing, since this code contains an error.

Q5. Property defaults include _?

  1. atomic/strong✔️
  2. atomic/weak
  3. nonatomic/weak
  4. nonatomic/strong

Q6. What is the key difference between NSDictionary and NSMutableDictionary?

  1. NSMutableDictionary’s values can change✔️
  2. NSMutableDictionary has not initializers.
  3. NSDictionary can’t be copied.
  4. NSDictionary’s values can change.

Q7. What is foo?

-(float)foo;

  1. A function with a return type of float.✔️
  2. This code contains an error.
  3. A variable declaration of type float.
  4. A property of type float.

Q8. What can you glean from this line?

#import "NSString+NameHelper.h"

  1. NameHelper is a category of NSString.✔️
  2. NameHelper is a subclass of NSString.
  3. NSString implements the NameHelper protocol.
  4. NSString has a helper class.

Q9. What’s wrong with this code?

float x = 5.;

  1. Nothing is wrong with this code.✔️
  2. Declarations do not need semicolons.
  3. x=5 is an invalid float.
  4. Variables can’t be declared and initialized in the same state.

Q10. How many times with this loop be executed?

for (int x=0; x<100; x++) {
  x = x + 1;
}
  1. 50✔️
  2. 99
  3. 100
  4. This code contains an error.


Q11. What is this code an example of?

[self addObserver: self forKeyPath: @"val" options:0 context: nil];

  1. Key-Value Observing✔️
  2. Class Value Observing
  3. Key-Data Observing
  4. KeyPath Observing

Q12. What does ARC stand for?

  1. Automatic Reference Counting✔️
  2. Automatic Retain Checking
  3. Async Retain Cycles
  4. Automatic Release Code

Q13. What is printed for this code?

int val = 0;
val = 1.5;
printf("%d", val);
  1. 1✔️
  2. 2
  3. 0
  4. This code contains an error.

Q14. What best describes class inheritance in Objective-C?

  1. single inheritance but multiple protocol implementation✔️
  2. Objective-C doesn’t support inheritance
  3. dual class inheritance
  4. unlimited class inheritance and protocol adherence

Q15. How many keys does this NSDictionary have after this code is executed?

NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys: @"b", @"e", @"a", @"r", nil];

  1. 2✔️
  2. 4
  3. 5
  4. This code contains an error.

Q16. What is wrong with this code?

NSMutableDictionary *dict1 = [NSMutableDictionary dictionaryWithCapacity:5];
[dict1 setValue:@"key" forKey:@"value"];
  1. The key and value items are mixed
  2. Nothing is wrong with it✔️
  3. You can’t set the capacity of a dictionary
  4. NSMutableDictionary doesn’t have a :setValue:forKey function.

Q17. What is printed from this code?

NSData *data = [@"print" dataUsingEncoding:NSASCIIStringEncoding];
NSLog(@"%@", [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]);
  1. print✔️
  2. This code is invalid
  3. Nothing is printed from this code.
  4. nil

Q18. What is different about this function?

+(void)doSomething;

  1. It is static✔️
  2. It is abstract.
  3. It is inline.
  4. This code contains an error.

Q19. Structs can have _?

  1. functions
  2. initializers
  3. fields✔️
  4. all of these answers

Q20. What is wrong with this code?

@interface MyClass : NSObject
    @property (strong, nonatomic, readonly) NSString *name;
  @end
  1. There is nothing wrong with this code.✔️
  2. There is not read-only directive.
  3. MyClass doesn’t implement NSObject.
  4. Properties are declared in the implementation.


Q21. What is an enums base type for the code below?

typedef enum { Foo1, Foo2} Foo;

  1. There is no base type.✔️
  2. NSObject
  3. int
  4. NSNumber

Q22. If you want to store a small amount of information (e.g., user settings), whats the best, built-in way to go?

  1. UserDefaults✔️
  2. plist file
  3. CoreData
  4. TextFile

Q23. What are categories used for?

  1. to extend other classes✔️
  2. to manage access control
  3. to coordinate objects
  4. to group classes

Q24. What is this Objective-C code checking?

if ([keyPath isInstanceOf:[NSString class]]) {
}
  1. This code contains an error✔️
  2. if keyPath is an instance of NSString
  3. if keyPath’s baseclass is the same as NSString’s baseclass
  4. if keyPath implements the same methods as NSString

Q25. What is this a declaration of?

int(^foo)(int);

  1. an Extension
  2. a Generic
  3. a block of code✔️
  4. an abstract class

Q26. For observing changes to a property, which of these two statements cause the related method to be called and why?

1. _val = 1;
2. self.val= 100;
  1. Statement 2, since it calls the auto-created setter on the property.✔️
  2. Statement 1, since it uses the property directly.
  3. Statement 2, since it specifies the class instance to use.
  4. Statement 1, since it calls the auto-created setter on the property.

Q27. What is wrong with this code?

float x = 2.0;
int(^foo)(int) = ^(int n1) {
  return (int)(n1*x);
};
foo(5);
  1. Ints and floats can’t be multiplied.
  2. The parameter isn’t declared correctly.
  3. x is not in the right scope.
  4. Nothing is wrong with this code.✔️

Q28. What’s the difference between an array and a set?

  1. Arrays are ordered, non-unique values.✔️
  2. Arrays are stored sorted.
  3. Sets are ordered, unique values.
  4. Sets can contain nils.

Q29. Dot notation can be used for _?

  1. nothing, as they’re never used in Objective-C
  2. function calls only
  3. property getter/setter✔️
  4. parameter delimiters

Q30. What is the value of newVals after this code is executed?

    NSArray *vals = @[@"1", @"2", @"3"];
    NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF.intValue > 1"];
    NSArray *newVals = [vals filteredArrayUsingPredicate:pred];
  1. 2,3✔️
  2. nil
  3. This code contains an error
  4. 2,"3"


Q31. How would this function be called?

-(int)foo:(int)a b:(int)c;

  1. self.foo(5, b:10);
  2. This code contains an error.
  3. [self foo:5:10:20];
  4. [self foo:5 b:10];✔️

Q32. What is the type of the error return value stored in json?

    NSError *error;
    NSData *data;
    id json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
  1. NSString
  2. NSArray
  3. id
  4. NSDictionary

Q33. What is significant about this function declaration?

    -(void)testFunc:(NSString**)str;
  1. The parameter is passed by value and can not be changed
  2. ** is not allowed on a parameter
  3. The parameter may be nil
  4. The parameter is passed by reference and may be changed✔️

Q34. What is printed from this code execution?

    typedef enum {
        thing1,
        thing2,
        thing3
    } Thing;
    -(void) enumStuff {
        NSLog(@"%d", thing2);
    }
  1. 0
  2. 1✔️
  3. thing2
  4. This code does not print anything

Q35. You are worried about threaded access to a property and possible collision in writing. What directive should you use on the property?

  1. non-atomic
  2. strong
  3. weak
  4. atomic✔️

Q36. What is wrong with this line of code?

int temp = 1==1;
  1. temp is a keyword.
  2. 1==1 is invalid.
  3. 1==1 evaluates to a Boolean.
  4. Nothing is wrong with it.✔️

Q37. What is special about the code within this block?

dispatch_async(dispatch_get_main_queue(), ^{
// code
});
  1. It executes on the main queue.✔️
  2. It is the last code to run before the app goes inactive.
  3. It executes on a background thread.
  4. It is queued to execute in the background.


Link for more programming Language Quiz Answer

LinkedIn Objective-C Quiz Answers, LinkedIn Objective-C Assessment Answers, Objective-C LinkedIn Quiz Answers, Objective-C Assessment LinkedIn Answers, LinkedIn Skill Quiz Answers Objective-C, LinkedIn Objective-C Quiz, Objective-C LinkedIn Quiz, LinkedIn Quiz Answers Objective-C, LinkedIn Objective-C Assessment Quiz Answers, LinkedIn Skill Assessment Objective-C Answers, Objective-C LinkedIn Quiz, LinkedIn Objective-C Assessment Test Answers, LinkedIn Objective-C Test Answers, LinkedIn Objective-C Skill Assessment Answers, LinkedIn Skill Assessment Answers Objective-C, Objective-C LinkedIn Assessment Answers, LinkedIn Objective-C Assessment Answers, Objective-C LinkedIn Assessment Answers, Answers to LinkedIn Quizzes, LinkedIn Skill Assessment Answers GitHub, LinkedIn Assessment Test Answers, LinkedIn Skill Assessments Answers, Objective-C LinkedIn Skill Assessment Answer, Objective-C LinkedIn Skill Assessment Answer

Leave a Comment

Scroll to Top
Scroll to Top