Question 1. On A Uitableviewcell Constructor:
- (identification)initwithstyle:(uitableviewcellstyle)style Reuseidentifier:(nsstring *)reuseidentifier
what Is The Reuseidentifier Used For?
The reuseIdentifier is used to suggest that a cell may be re-utilized in a UITableView. For instance while the cell appears the same, however has different content. The UITableView will keep an inner cache of UITableViewCell’s with the reuseIdentifier and permit them to be re-used while dequeueReusableCellWithIdentifier: is called. By re-the usage of desk cellular’s the scroll overall performance of the tableview is better because new views do no longer need to be created.
Question 2. Explain The Difference Between Atomic And Nonatomic Synthesized Properties?
Atomic and non-atomic refers to whether the setters/getters for a belongings will atomically study and write values to the assets. When the atomic key-word is used on a belongings, any get right of entry to to it'll be “synchronized”. Therefore a name to the getter might be guaranteed to return a legitimate fee, however this does come with a small performance penalty. Hence in a few situations nonatomic is used to provide faster access to a property, however there's a chance of a race condition inflicting the belongings to be nil under rare situations (when a price is being set from every other thread and the vintage value became launched from reminiscence however the new value hasn’t yet been fully assigned to the region in reminiscence for the assets).
RDBMS Interview Questions
Question 3. Explain The Difference Between Copy And Retain?
Retaining an object way the retain remember increases by one. This way the example of the item might be stored in reminiscence until it’s maintain count number drops to 0. The property will keep a reference to this instance and could share the same instance with all of us else who retained it too. Copy way the object may be cloned with duplicate values. It is not shared with someone else.
Question 4. What Is Method Swizzling In Objective C And Why Would You Use It?
Method swizzling lets in the implementation of an present selector to be switched at runtime for a one of a kind implementation in a training dispatch table. Swizzling allows you to write code that may be accomplished before and/or after the authentic method. For example possibly to song the time method execution took, or to insert log statements
@implementation UIViewController (Log)
static dispatch_once_t once_token;
SEL viewWillAppearSelector = @selector(viewDidAppear:);
SEL viewWillAppearLoggerSelector = @selector(log_viewDidAppear:);
Method originalMethod = class_getInstanceMethod(self, viewWillAppearSelector);
Method extendedMethod = class_getInstanceMethod(self, viewWillAppearLoggerSelector);
- (void) log_viewDidAppear:(BOOL)lively
NSLog(@"viewDidAppear finished for %@", [self class]);
Core Java Tutorial
Question five. What’s The Difference Between Not-going for walks, Inactive, Active, Background And Suspended Execution States?
Not jogging: The app has not been launched or became going for walks however changed into terminated by using the gadget.
Inactive: The app is jogging in the foreground but is presently no longer receiving occasions. (It may be executing other code although.) An app typically remains on this kingdom handiest briefly because it transitions to a extraordinary nation.
Active: The app is running inside the foreground and is receiving events. This is the normal mode for foreground apps.
Background: The app is within the background and executing code. Most apps enter this kingdom briefly on their way to being suspended. However, an app that requests more execution time may also stay on this nation for a period of time. In addition, an app being released at once into the history enters this kingdom in place of the inactive nation.
Suspended: The app is in the historical past however isn't executing code. The device movements apps to this state routinely and does now not notify them before doing so. While suspended, an app remains in reminiscence however does not execute any code. When a low-memory circumstance occurs, the machine might also purge suspended apps without be aware to make greater space for the foreground app.
Core Java Interview Questions
Question 6. What Is A Category And When Is It Used?
A class is a manner of including additional strategies to a class without extending it. It is often used to feature a collection of related strategies. A commonplace use case is to feature additional techniques to constructed in classes inside the Cocoa frameworks. For instance adding async down load strategies to the UIImage magnificence.
Question 7. Can You Spot The Bug In The Following Code And Suggest How To Fix It:
@interface MyCustomController : UIViewController
@assets (strong, nonatomic) UILabel *alert;
CGRect body = CGRectMake(a hundred, a hundred, one hundred, 50);
self.Alert = [[UILabel alloc] initWithFrame:frame];
self.Alert.Text = @"Please wait...";
self.Alert.Textual content = @"Waiting over";
All UI updates have to be carried out on the primary thread. In the code above the update to the alert textual content can also or won't show up on the primary thread, since the global dispatch queue makes no ensures . Therefore the code need to be modified to constantly run the UI update on the primary thread
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
self.Alert.Textual content = @"Waiting over";
MySQL Tutorial MySQL Interview Questions
Question 8. What Is The Difference Between Viewdidload And Viewdidappear? Which Should You Use To Load Data From A Remote Server To Display In The View?
viewDidLoad is referred to as whilst the view is loaded, whether or not from a Xib document, storyboard or programmatically created in loadView. ViewDidAppear is known as every time the view is presented at the device. Which to use relies upon at the use case in your statistics. If the facts in all fairness static and now not possibly to alternate then it could be loaded in viewDidLoad and cached. However if the records modifications frequently then using viewDidAppear to load it's far better. In both situations, the information should be loaded asynchronously on a history thread to avoid blockading the UI.
Question 9. What Considerations Do You Need When Writing A Uitableviewcontroller Which Shows Images Downloaded From A Remote Server?
This is a completely not unusual challenge in iOS and a great solution right here can cowl a whole host of information. The essential piece of data within the question is that the pix are hosted remotely and they'll take time to download, therefore whilst it asks for “considerations”, you need to be talking approximately:
Only download the photo when the cellular is scrolled into view, i.E. When cellForRowAtIndexPath is known as.
Downloading the photo asynchronously on a background thread in order no longer to dam the UI so the consumer can maintain scrolling.
When the image has downloaded for a mobile we need to test if that cell is still inside the view or whether or not it's been re-used by any other piece of facts. If it’s been re-used then we should discard the photo, in any other case we want to interchange back to the principle thread to trade the photograph at the cellular.
Other top solutions will move on to talk approximately offline caching of the pictures, the usage of placeholder snap shots even as the photos are being downloaded.
Hadoop Interview Questions
Question 10. What Is A Protocol, And How Do You Define Your Own And When Is It Used?
A protocol is much like an interface from Java. It defines a listing of required and non-compulsory methods that a class must/can implement if it adopts the protocol. Any elegance can implement a protocol and different lessons can then send messages to that elegance primarily based at the protocol techniques without it knowing the form of the magnificence.
A common use case is supplying a DataSource for UITableView or UICollectionView.
Question 11. What Is Kvc And Kvo? Give An Example Of Using Kvc To Set A Value.?
KVC stands for Key-Value Coding. It's a mechanism by which an object's properties may be accessed the use of string's at runtime instead of having to statically recognise the assets names at development time. KVO stands for Key-Value Observing and permits a controller or class to observe modifications to a assets fee.
Let's say there's a assets name on a category:
@assets (nonatomic, replica) NSString *name;
We can get right of entry to it using KVC:
NSString *n = [object valueForKey:@"name"]
And we can alter it is fee by sending it the message:
[object setValue:@"Mary" forKey:@"name"]
Apache Hive Interview Questions
Question 12. What Are Blocks And How Are They Used?
Blocks are a way of defining a single project or unit of behavior while not having to put in writing an entire Objective-C elegance. Under the covers Blocks are nonetheless Objective C gadgets. They are a language degree function that allow programming strategies like lambdas and closures to be supported in Objective-C. Creating a block is carried out using the ^ syntax:
myBlock = ^
NSLog(@"This is a block");
It can be invoked like so:
It is largely a feature pointer which additionally has a signature that may be used to put in force type protection at collect and runtime. For example you can bypass a block with a specific signature to a technique like so:
- (void)callMyBlock:(void (^)(void))callbackBlock;
If you wanted the block to receive a few information you can exchange the signature to include them:
- (void)callMyBlock:(void (^)(double, double))block
RDBMS Interview Questions
Question 13. What Mechanisms Does Ios Provide To Support Multi-threading?
NSThread creates a new low-degree thread which can be started by using calling the start technique.
NSThread* myThread = [[NSThread alloc] initWithTarget:self
NSOperationQueue permits a pool of threads to be created and used to execute NSOperations in parallel. NSOperations also can be run on the primary thread via asking NSOperationQueue for the mainQueue.
NSOperationQueue* myQueue = [[NSOperationQueue alloc] init];
/* Do something. */
GCD or Grand Central Dispatch is a modern-day characteristic of Objective-C that gives a rich set of techniques and API's to apply with a view to guide commonplace multi-threading duties. GCD gives a way to queue responsibilities for dispatch on either the primary thread, a concurrent queue (obligations are run in parallel) or a serial queue (tasks are run in FIFO order).
Dispatch_queue_t myQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, zero);
printf("Do some paintings here.N");
Apache Hive Tutorial
Question 14. What Is The Responder Chain?
When an event happens in a view, for instance a hint occasion, the view will hearth the event to a chain of UIResponder objects associated with the UIView. The first UIResponder is the UIView itself, if it does now not cope with the event then it continues up the chain to till UIResponder handles the event. The chain will consist of UIViewControllers, determine UIViews and their related UIViewControllers, if none of these take care of the event then the UIWindow is asked if it may cope with it and in the end if that doesn't cope with the event then the UIApplicationDelegate is requested.
Question 15. What's The Difference Between Using A Delegate And Notification?
Both are used for sending values and messages to fascinated events. A delegate is for one-to-one verbal exchange and is a sample promoted by way of Apple. In delegation the class elevating activities can have a belongings for the delegate and could typically expect it to put in force a few protocol. The delegating magnificence can then name the _delegate_s protocol methods.
Notification lets in a category to broadcast occasions throughout the whole software to any interested events. The broadcasting class doesn't need to know some thing about the listeners for this event, consequently notification could be very beneficial in assisting to decouple components in an software.
Hadoop MapReduce Interview Questions
Question sixteen. What's Your Preference When Writing Ui's? Xib Files, Storyboards Or Programmatic Uiview?
There's no proper or incorrect solution to this, but it is exceptional way of seeing if you apprehend the blessings and demanding situations with every method. Here's the not unusual solutions I pay attention:
Storyboard's and Xib's are terrific for quickly producing UI's that match a layout spec. They also are in reality clean for product managers to visually see how a ways alongside a display screen is.
Storyboard's are also wonderful at representing a float through an utility and allowing a excessive-degree visualization of a whole software.
Storyboard's drawbacks are that during a crew surroundings they're difficult to paintings on collaboratively due to the fact they're a unmarried record and merge's grow to be hard to manipulate.
Storyboards and Xib files also can suffer from duplication and come to be tough to replace. For instance if all button's want to appearance equal and all of sudden need a coloration exchange, then it could be a long/tough system to do that across storyboards and xibs.
Programmatically constructing UIView's may be verbose and tedious, however it may allow for extra manage and also less complicated separation and sharing of code. They also can be more easily unit tested.
Most builders will suggest a aggregate of all three in which it makes experience to proportion code, then re-usable UIViews or Xib files.
Hadoop MapReduce Tutorial
Question 17. How Would You Securely Store Private User Data Offline On A Device? What Other Security Best Practices Should Be Taken?
Again there is no proper answer to this, however it's a awesome way to peer how plenty a person has dug into iOS protection. If you are interviewing with a financial institution I'd almost virtually assume a person to know some thing about it, but all organizations need to take safety seriously, so here's the perfect list of subjects I'd assume to pay attention in an answer:
If the information is extremely sensitive then it ought to never be stored offline at the device due to the fact all gadgets are crackable.
The keychain is one alternative for storing statistics securely. However it is encryption is based totally on the pin code of the device. User's are not pressured to set a pin, so in some conditions the data won't also be encrypted. In addition the users pin code can be easily hacked.
A higher answer is to use something like SQLCipher that is a completely encrypted SQLite database. The encryption key may be enforced by means of the utility and separate from the person's pin code.
Other safety best practices are:
Only communicate with faraway servers over SSL/HTTPS.
If feasible put in force certificate pinning in the software to prevent man-in-the-middle attacks on public WiFi.
Clear touchy data out of reminiscence with the aid of overwriting it.
Ensure all validation of data being submitted is also run on the server aspect.
Apache Pig Interview Questions
Question 18. What Is Mvc And How Is It Implemented In Ios? What Are Some Pitfalls You've Experienced With It? Are There Any Alternatives To Mvc?
MVC stands for Model, View, Controller. It is a layout pattern that defines a way to separate out common sense while enforcing user interfaces. In iOS, Apple offers UIView as a base magnificence for all _View_s, UIViewController is supplied to guide the Controller that can pay attention to occasions in a View and update the View when information modifications. The Model represents information in an software and can be implemented the usage of any NSObject, along with statistics collections like NSArray and NSDictionary.
Core Java Interview Questions
Question 19. A Product Manager In Your Company Reports That The Application Is Crashing. What Do You Do?
This is a terrific question in any programming language and is certainly designed to see how you hassle clear up. You're not given an awful lot statistics, however some interviews will slip you extra info of the problem as you go alongside.
get the precise steps to breed it.
Find out the tool, iOS model.
Do they've the present day model?
Get tool logs if possible.
Once you can reproduce it or have extra facts then begin using tooling. Let's say it crashes due to a reminiscence leak, I'd count on to look a person endorse the use of Instruments leak tool. A clearly superb candidate would begin speaking approximately writing a unit take a look at that reproduces the problem and debugging thru it.
Apache Pig Tutorial
Question 20. What Is Autolayout? What Does It Mean When A Constraint Is "broken" By Ios?
AutoLayout is way of laying out UIViews the usage of a hard and fast of constraints that specify the place and size based totally relative to different views or primarily based on express values. AutoLayout makes it easier to design screens that resize and layout out their additives higher based totally on the dimensions and orientation of a screen. _Constraint_s encompass:
setting the horizontal/vertical distance among 2 perspectives
setting the height/width to be a ratio relative to a specific view
a width/height/spacing can be an express static price
Sometimes constraints war with every other. For instance consider a UIView which has 2 top constraints: one says make the UIView 200px high, and the second says make the peak two times the height of a button. If the iOS runtime cannot fulfill each of these constraints then it has to pick out simplest one. The different is then suggested as being "broken" via iOS.
Apache Drill Interview Questions