Skip to main content

Questions & Answers

1) - Name Of Four Important Data Type

  • NSString - Representing String
  • NSInteger -  Representing Integer
  • CGFloat -   Representing a floating point value
  • BOOL -      Representing Boolean value
2) - What are the UI Elements in ios?

      UI Elements are ios Button, textField, label, image or more
3)  reuseIdentifier in the UITableViewCell ?

     The reuseIdentifier tells UITableView which cells may be reused within the table, effectively        grouping together rows in a UITableView that differ only in content but have similar layouts. This improves scroll performance by alleviating the need to create new views while scrolling. Instead the cell is reused whenever dequeueReusableCellWithIdentifier: is called.

4) Execution States in iOS

      Not Running: The app is completely switched off, no code is being executed.
Inactive: The app is running in the foreground without receiving any events.
Active: The app is running in the foreground and receiving events.
Background: The app is executing code in the background.
Suspended: The app is in the background but is not executing any code

5) Difference between Stored Properties and Computed Properties

Stored Properties:- Stored Properties concept to store the instance of constants and variables. Store property define the "let" Keyword and Stored property of variable "var" Keyword defined

struct Number {
let price = 1000.8
var digits: Int
var n = Number(digits: 12345)
n.digits = 87

print("\(n.price )")
n.price = 8.7 //cannot assign to property: 'price ' is a 'let' constant (error)

Lazy Stored Property:- 

class Bacic{
   lazy var a = number()    // `var` declaration is required.
class number {
   var name = "Swift 4"
var firstsample = Bacic()


Instance Variables - Computed Properties :- Stored properties also have instance variables for back up purposes to store the values declared in stored property.

"Computed Properties provide a getter and an optional setter to retrieve and set other properties and values indirectly."

class sample {
   var x = 0.0, y = 0.0
   var leth = 100.0, brdth = 50.0

   var middle: (Double, Double) {
      get {
         return (leth / 2, brdth / 2)
         x = axis.0 - (leth / 2)
         y = axis.1 - (brdth / 2)

var result = sample()
result.middle = (0.0, 10.0)


6):- What is Difference Between Synchronous and Asynchronous Task ?

 Synchronous:- Wait until the task had completed A Synchronous

Asynchronous:- Complete a task in background and can notify you when completed an Asynchronous

7):- NSArray Object ?
There are three part of NSArray object
  1) A Domain
  2) an error code
  3) user info Directory

The domain is a string that identifies what categories of errors this error is coming from.

8):- What is the Enum
 Enum is a type Basically that contains a group of related values in the same umbrella and enables you to work with those values in a type-safe way within your code.

9):- What is @synthesize in Objective-C ? 

Synthesize generates getter and setter methods for your property or the Variable.

10):- how to use @dynamic in Objective-C ? 

We use dynamic for subclasses of NSManagedObject. @dynamic tells the compiler that getter and setters are implemented somewhere else.

11):- What is the difference strong, weaks, read only and copy ? 

Strong, weak, assign property attributes define how memory for that property will be managed.

Strong means that the reference count will be increased and the reference to it will be maintained through the life of the object

Weak, means that we are pointing to an object but not increasing its reference count.
It’s often used when creating a parent child relationship. The parent has a strong reference to the child but the child only has a weak reference to the parent.

Read only, we can set the property initially but then it can’t be changed.

Copy, means that we’re copying the value of the object when it’s created. Also prevents its value from changing.

11):- Difference Between Concurrency, Operation Queue, Grand Central Dispatch

Concurrency:- Doing multiple things at the same time, Running multiple program in parallel or Talking advantage of number of cores available multicore CPUs  Concurrency is dividing up the execution paths of your program so that they are possibly running at the same time. The common terminology: process, thread, multithreading, and others. Terminology.

Process:- An instance of an executing app
Thread:- Path of execution for code
Multithreading:- Multiple threads or multiple paths of execution running at the same time.
Concurrency:- Execute multiple tasks at the same time in a scalable manner.
Queues;- Queues are lightweight data structures that manage objects in the order of First-in, First-out (FIFO).
Synchronous vs Asynchronous tasks

Grand Central Dispatch (GCD) - GCD is a library that provides a low-level and object-based API to run tasks concurrently while managing threads behind the scenes. Terminology.

Dispatch Queues:- A dispatch queue is responsible for executing a task in the first-in, first-out order.
Serial Dispatch Queue :- A serial dispatch queue runs tasks one at a time.
Concurrent Dispatch Queue:- A concurrent dispatch queue runs as many tasks as it can without waiting for the started tasks to finish.
Main Dispatch Queue:- A globally available serial queue that executes tasks on the application’s main thread.

12):- NSOperation  Vs NSOperationQueue Vs NSBlockOperation

NSOperation :- NSOperation adds a little extra overhead compared to GCD, but we can add dependency among various operations and re-use, cancel or suspend them.

NSOperationQueue:- It allows a pool of threads to be created and used to execute NSOperations in parallel. Operation queues aren’t part of GCD.

NSBlockOperation :- NSBlockOperation allows you to create an NSOperation from one or more closures. NSBlockOperations can have multiple blocks, that run concurrently.

Part 2 - Top 50 iOS Interview Questions and Answers Swift and Objective C

Top 50 Mostly Put Up  iOS Interview Questions and Answers

1 - introduction your self, Name, Qualifications what,done, where, experience strong week, family like etc.
2 - Basic Knowlage basic knowledge OOPS C, java, Databade

   Overriding versus Overloading
   Types versus Instances
   Access Control

3. How to call the function in objective c
    ans - [className methodName]
     if a same class then [self methods]

4. Explain dot(.) notation
    ans - dot(.) notation shortcut for calling getters and setters properties

5.  Difference between the atomic and Nonatomic 

   Atomic is the default behavior will ensure the present process is completed by the CPU, before           another process accesses the variable is not fast, as it ensures the process is completed entirely
   Non-Atomic is NOT the default behavior faster (for synthesized code, that is, for variables                   created  using @property and @synthesize) not thread-safe may result in unexpected behavior,           when two different process access the same variable at the same time.

6. What is the KVC and KVO.
     KVC (Key Value Coding ) means accessing a property or value using a string.
     id someValue  = [myObject valueForKeyPath: @"nnnn"];
    KVO (Key Value Observer ) allows you to observe change to a property or value.




Post a Comment

Popular posts from this blog

How Create Animated Circle Progress Bar iOS 11 Swift 4

  Animated Circle Progress Bar iOS 11 Swift 4 With MBCircularProgressBa r - A circular, animatable & highly customizable progress bar from the Interface Builder Swift, Using pod fite MBCircularProgressBar Installation Cocoapods terminal. pod "MBCircularProgressBar" That - A Simple Steps to installed pod file -        Open terminal        Command on terminal go to project folder Cd path        set your project path on terminal.        command : pod init        open pod file - open -e podfile        added in pod file with in : pod "MBCircularProgressBar"        Command : Pod install        Close project of Xcode        open your Project from terminals        Command : open PodDemos.xcworkspace After opern StoryBoard and Now drag a UIView over the viewController in storyboard Or set UIView Constraint width, height or verticle or horzentail space and set a class MBCircul

Add a Scene Delegate to your existing project with Storyboard in Swift

To add a scene delegate, first, create a new Swift file that you’ll call "SceneDelegate" containing a subclass of UIResponder, just like the AppDelegate, and that conforms to UIWindowSceneDelegate.  As your app might supports other versions than iOS 13, make this class only available for iOS 13. This is what you should have : If you are working a project that is storyboard based, please set storyboard  initial view controller SceneDelegate.swift import UIKit @available ( iOS 13.0 , *) class SceneDelegate : UIResponder , UIWindowSceneDelegate {     var window : UIWindow ?     func scene ( _ scene: UIScene , willConnectTo session: UISceneSession , options connectionOptions: UIScene . ConnectionOptions ) {                  let storyboard = UIStoryboard (name: "Main" , bundle: nil )         let initialViewController = storyboard. instantiateViewController (withIdentifier: "ViewController" )         let mainNavigationController = UINavigationControlle

How to Use Multiple Sections in UITableView iOS Swift !

Multiple sections in UITableView iOS Swift. UITableView is very important part of iOS ecosystem. So we split tableviews in sections. Then its easier to find right information.  1. First let’s create a project as usual. Create a new single view application X code project. Set project name to UIViewController.  2. Go to main storyboard & select view controller & use UITableView 3. Select tableview & make it initial view controller  4 Create a custom Sections Class like Name => TableSections, create register cell static return “ getCellNibs ” method. Then create  4 section enum “TableItems” then after append all sections to an array model. import UIKit struct CellNib {      static func getCellNibs () -> [ String ] {          return [ "Cell1" , "Cell2" , "Cell3" , "Cell4" ]     } } enum TableItems : Int {      case TableSections1      case TableSections2      case TableSections3      case TableSections4 } class TableSec