1

I have an online quiz I am trying to complete and this is the question:

One of the following can't be stored in NSDictionary. It can't be stored because it is a _____ type:

UIView NSNumber NSInteger UIColor

Fill in in the blank.


I can't seem to find the answer anywhere online. As far as I can tell they all have a way of being stored in NSDictionary, any ideas?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
hatz
  • 225
  • 1
  • 4
  • 13

2 Answers2

5

NSInteger! because it's a primitive type

Puran
  • 984
  • 6
  • 15
2

Primitive types since they are not objects. Anything that is an object can be added.

The main difference is related to where they stay in the memory, objects are stored in the heap while value type are stored directly in the Stack ...

heap : is an area of memory used for dynamic memory allocation.

stack : is the section of memory that is allocated for automatic variables within functions. Data is stored in stack using the Last In First Out (LIFO) method.

About NSInteger and NSNumber :

NSInteger is nothing more than a synonym for a long integer, while NSNumber is an Objective-C class, a subclass of NSValue to be specific.

What is the difference between primitive data type vs an non primitive data type(apple defined data type)?

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/

Community
  • 1
  • 1
Mark McCorkle
  • 9,349
  • 2
  • 32
  • 42