iphone Interview Questions part-14

151-Types of NSTableView

Cell based and View based. In view based we can put multiple objects.

152-Abstract class in cocoa.

Cocoa doesn’t provide anything called abstract. We can create a class abstract which gets check only at runtime, compile time this is not checked.

@interface AbstractClass : NSObject

@end

@implementation AbstractClass

+ (id)alloc{

if (self == [AbstractClass class]) {

NSLog(@”Abstract Class cant be used”);

}

return [super alloc];

@end

153- Difference between HTTP and HTTPS.

· HTTP stands for HyperText Transfer Protocol, whereas, HTTPS is HyperText Transfer Protocol Secure.

· HTTP transmits everything as plan text, while HTTPS provides encrypted communication, so that only the recipient can decrypt and read the information. Basically, HTTPS is a combination of HTTP and SSL (Secure Sockets Layer). This SSL is that protocol which encrypts the data.

· HTTP is fast and cheap, where HTTPS is slow and expensive.

As, HTTPS is safe it’s widely used during payment transactions or any sensitive transactions over the internet. On the other hand, HTTP is used most of the sites over the net, even this blogspot sites also use HTTP.

· HTTP URLs starts with “http:// “ and use port 80 by default, while HTTPS URLs stars with “https:// “ and use port 443.

· HTTP is unsafe from attacks like man-in-the-middle and eavesdropping, but HTTPS is secure from these sorts of attacks.

154-GCD

Grand Central Dispatch is not just a new abstraction around what we’ve already been using, it’s an entire new underlying mechanism that makes multithreading easier and makes it easy to be as concurrent as your code can be without worrying about the variables like how much work your CPU cores are doing, how many CPU cores you have and how much threads you should spawn in response. You just use the Grand Central Dispatch API’s and it handles the work of doing the appropriate amount of work. This is also not just in Cocoa, anything running on Mac OS X 10.6 Snow Leopard can take advantage of Grand Central Dispatch ( libdispatch ) because it’s included in libSystem.dylib and all you need to do is include #import <dispatch/dispatch.h> in your app and you’ll be able to take advantage of Grand Central Dispatch.

155-How you attain the backward compatibility?

  1. 1.    Set the Base SDK to Current version of Mac (ex. 10.7)
  2. 2.    Set the Deployment SDK to older version (ex.1.4)

156-Call Back.

Synchronous operations are ones that happen in step with your calling code. Most of Cocoa works this way: you send a message to an object, say to format a string, etc, and by the time that line of code is “done”, the operation is complete.

But in the real world, some operations take longer than “instantaneous” (some intensive graphics work, but mainly high or variably latency things like disk I/O or worse, network connectivity). These operations are unpredictable, and if the code were to block until finish, it might block indefinitely or forever, and that’s no good.

So the way we handle this is to set up “callbacks”– you say “go off and do this operation, and when you’re done, call this other function”. Then inside that “callback” function, you start the second operation that depends on the first. In this way, you’re not spinning in circles waiting, you just get called “asynchronously” when each task is done.