iOS For Beginner

Interview Question- Database

Question: An app is loaded into memory but is not executing any code. In which state will it be in?
Answer: An app is said to be in suspended state when it is still in memory but is not executing any code.

Question: Assume that system is running low on memory. What can system do for suspended apps?
Answer: In case system is running low on memory, the system may purge suspended apps without notice.

Question: What is Plist?
Answer: Property lists organize data into named values and lists of values using several object types. These types give you the means to produce data that is meaningfully structured, transportable, storable, and accessible, but still as efficient as possible. Property lists are frequently used by applications running on both Mac OS X and iOS. The propertylist programming interfaces for Cocoa and Core Foundation allow you to convert hierarchically structured combinations of these basic types of objects to and from standard XML. You can save the XML data to disk and later use it to reconstruct the original objects.

The user defaults system, which you programmatically access through the NSUserDefaults class, uses property lists to store objects representing user preferences. This limitation would seem to exclude many kinds of objects, such as NSColor and NSFont objects, from the user default system. But if objects conform to the NSCoding protocol they can be archived to NSData objects, which are property list–compatible objects

Question: Difference between coreData and Database Database.
● Primary function is storing and fetching data
● tables and edit data without loading into memory.
● Perpetually saved to disk (and often crash resilient).
● Can be slow to create millions of new rows
● Offers data constraints like “unique” keys

Core Data

● Primary function is graph management (although reading and writing to disk is an important supporting feature)
● Operates on objects stored in memory (although they can be lazily loaded from disk)
● Works with fullyfledged objects that selfmanage a lot of their behaviour and can be subclassed and customized for further behaviours
● Nontransactional, single threaded, single user (unless you create an entire abstraction around Core Data which provides these things)
● Only operates in memory
● Requires a save process

Question: Core data vs sqlite.
Answer: Core data is an object graph management framework. It manages a potentially very large graph of object instances, allowing an app to work with a graph that would not entirely fit into memory by faulting objects in and out of memory as necessary. Core Data also manages constraints on properties and relationships and maintains reference integrity (e.g. keeping forward and backwards links consistent when objects are added/removed to/from a relationship). Core Data is thus an ideal framework for building the “model” component of an MVC architecture.

To implement its graph management, Core Data happens to use sqlite as a disk store. Itcould have been implemented using a different relational database or even a nonrelational database such as CouchDB. As others have pointed out, Core Data can also use XML or a binary format or a userwritten atomic format as a backend (though these options require that the entire object graph fit into memory).

Question: Difference between categories and extensions?
Answer: Class extensions are similar to categories. The main difference is that with an extension, the compiler will expect you to implement the methods within your main @implementation, whereas with a category you have a separate @implementation block. So you should pretty much only use an extension at the top of your main .m file (the only place you should care about ivars, incidentally) — it’s meant to be just that, an extension.

Question: What are KVO and KVC?
Answer: KVC: Normally instance variables are accessed through properties or accessors but KVC gives another way to access variables in form of strings. In this way your class acts like a dictionary and your property name for example “age” becomes key and value that property holds becomes value for that key.

KVO: The mechanism through which objects are notified when there is change in any of property is called KVO.

Please login to get access to the quiz
Interview Question-Web Service (Prev Lesson)
(Next Lesson) Interview Question- XCode & Framework
Back to iOS For Beginner
Inquire Now
close slider