Monday, December 5, 2016

Objective Questions in >= Swift2.2 @iPhone - Set I

Q.81: Which method is used to invoke a method by timer after a 
          interval
        A. NSTimer.scheduledTimerWithTimeInterval(interval, 
            target: AnyClassselector: Selector(“increaseTimer),  
           userInfo: Any?, repeats: Boolean)
        B. NSTimer.scheduledTimerWithTimeInterval(target:
            AnyClassselector: Selector(“increaseTimer),  
           userInfo: Any?, repeats: Boolean)
        C. NSTimer.scheduledTimerWithTimeInterval(interval,  
            selector: Selector(“increaseTimer),  userInfo: Any?
            repeats: Boolean)
          D. None

Q.82: What is UITableViewDelegate
            A. is a protocol you implement on your class to 
                receive UITableView events. 
            B. is a protocol you implement to provide data for 
                your UITableView .
            C. Both
            D. None

Q.83: What is UITableViewDataSource 
            A. is a protocol you implement on your class to 
                receive UITableView events. 
            B. is a protocol you implement to provide data for 
                your UITableView .
            C. Both
            D. None

Q.84: Which function is used to add number of rows in 
          TableView
            A. func tableView(tableView: UITableView
                  numberOfRowsInSection section: Int)
{
                             return intValue;  //intValue means a valid integer
}
B. func tableView(tableView: UITableView
     numberOfRowsInSection  section: Int) -> Int
{
                             return intValue;  //intValue means a valid integer
}
          C. func tableView(tableView:  ,  numberOfRowsInSection
              section: Int) -> Int
{
                             return intValue;  //intValue means a valid integer
}
          D.  None


Q.85: Which function is used to customize cell  with data source

A. func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> Int
{
    return cell; //cell should be created by you 
}
B. func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: ) -> UITableViewCell
{
    return cell; //cell should be created by you 
}
C. func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
     -> UITableViewCell
{
    return cell; //cell should be created by you 
}
D.   None

Q.86: In Q.85 what is the significant of NSIndexPath

A.   index of Base row of table
B.    index of clicked row in table
C.    number of cells in Table
D.   None


Q.87: How to create cell using prototype cell

A.   let cell = UITableViewCell(style: 
                   UITableViewCellStyle.Default
                   reuseIdentifier: "prototypecell")
B.    let cell = UITableViewCell(
                       UITableViewCellStyle.Default
                   reuseIdentifier: " prototypecell ")
C.    let cell = UITableViewCell(style: 
                   UITableViewCellStyle.Default
                   reuseIdentifier: )
D.   None

Q.88: How user preferences can be stored in iPhone
          A. by using UserDefaults class
          B. by using NSUser class
          C. by using NSUserDefaults class
          D. None

Q.89: Which method is used to set the value with user 
          preferences
          A.  setObject(forKey : “ key name”)
          B.  setObject( “ Value  “ , forKey : “ key name”)
          C. setObject( “ Value  “ , “ key name”)
                D. None
            
            Q.90: Which method is used to retrieve the value for 
                      a key named name
                        A.  objectForKey()
                        B. objectForKey().name
                        C. objectForKey(“name”)
                        D. None


     Answers   A    A     B     B     C     B     A    C    B     C    

Objective Questions in >= Swift2.2 @iPhone - Set H

Q.71: A _______________ is a visual         
         representation of the appearance and flow of            your application.
A.   viewDidLoad()
B.    Storyboard
C.   didReceiveMemoryWarning()
D.   None
Q.72: __________ and ___________  are macros defined to denote variables and methods that can be referred to in Interface Builder.
          A. IBAction
          B. IBOutlet
          C. Both
          D. None

Q.73:How do i get the text from UITextField into an Int variable ?

         A. var data = Int(yourtextField.text!)

                        B. var data =  yourtextField.text!
                        C. var data =  yourtextField.text()
                        D. var data =  Int(yourtextField.text()!)

                Q.74: How textfield is declared in iPhone

                        A.   var textField: UITextField!

                        B.  @IBAction var textField: UITextField!

                        C.  @IBOutlet var textField: UITextField!

                        D. None
                Q.75: How function mapped with button is                
                        declared in iPhone App development

A. @IBAction func fun_name(sender: AnyObject) {}

B. @IBOutlet func fun_name () {

C. @IBAction  fun_name (sender: AnyObject) {

D. None

Q.76: How set text onto a UILabel

        A. labelName = “Hello Jaipur”

        B. labelName.setText = “Hello Jaipur”

        C. labelName.text  = “Hello Jaipur”

        D. None

Q.77: Which one is not the property of Navigation 

          Bar

        A. It appears at the top of an app screen

        B. It appears below the status bar

        C. Enables Navigation

        D. None

Q.78: Which one is not the property of ToolBar

        A. It appears at the bottom of an app screen

        B. It appears below the status bar

        C. Contains buttons

        D. None

Q.79: How to create timer in iPhone using swift

        A.  var timer = NSTimer()

        B. var timer = NStimer()

        C. var timer = Timer()

        D var timer = Timer

Q.80: How do I stop a timer

        A. timervariable.stop

        B. timervariable.stop()

        C. timervariable.invalidate

        D. timervariable.invalidate()


Answers : B    C    A    C    A    C     D     B     A     D

Objective Questions in >= Swift2.2 @iPhone - Set G

Q.61:  What will be the output
           let bits: UInt8 = 4  
           let output = bits << 2            
           print(output)
A.      2
B.      4
C.      8
D.      16
Q.62: What will be the output
          let bits: UInt8 = 4  
          let output = bits << 5            
          print(output)
A.      128
B.      4
C.      8
D.      16
Q.63: What will be the output
          let bits: UInt8 = 4  
          let output = bits << 6         
          print(output)
A.      128
B.      0
C.      8
D.      16
Q.64: What will be the output
          let bits: UInt8 = 4  
          let output = bits >> 2            
          print(output)
A.      2
B.      4
C.      8
D.      1
Q.65: What is UIKit in iPhone App development
                A. Framework
                B. Class
                C. Object
                D. None of the above
Q.66: What does UIKit in iPhone App Development
                A. It defines classes
                B. It defines Labels , Buttons
                C. It defines functions
                D. All of the above
Q.67: What are the responsibilities of               
          UIViewController class
A. Updating the contents of the views
B. Responding to user interactions with views.
C. Resizing views and managing the layout 
    of the overall interface.
D. All the above
Q.68: When amount of available memory is low, 
          Which method is called by app
A.   viewDidLoad()
B.   didReceiveMemoryWarning()
C.  Both
D.  None
Q.69: Which method is invoked after  the         
         controller's view is loaded into memory.
A.  viewDidLoad()
B.  didReceiveMemoryWarning()
C.  Both
D.  None
 Q.70: Which method can be override when you 
          want  to release memory
A.   viewDidLoad()
B.   didReceiveMemoryWarning()
C.  Both
D.  None

Answers : D    A     B     D     A     D     D      B     A   B

Sunday, December 4, 2016

Objective Questions in >= Swift2.2 @iPhone - Set F

  Q.51: What will be the output
           class Demo {
           var count = 5  
           func increase(by num : Int) {
           count += num
            }    }
let ob = Demo()
ob.increase(by: 5)
print(ob.count) 
A.      11
B.      5
C.      10
D.      None

Q.52: Which keyword is used to refer the current instance           of the Class
                A. This
                B. own
                C. auto
                D. self

Q.53: Which is the proper syntax in swift for Inheritance
                A. class SubClass : SuperClass {    }
                B. class SubClass : public SuperClass {    }
                C. class SubClass , SuperClass {    }
                D. class SubClass , public  SuperClass {    }

Q.54: Which keyword is used to prevent overriding in                     swift
                A. self
                B. final
                C. stop
                D. auto

Q.55: What will be the output
          struct Demo {
          var num: Double
          init() {
                     num = 35.56
                   }
        }
var sob = Demo()
print("The default value is  \(sob.num)")
A.      35
B.      35.56
C.      Compile Time Error
D.      None of the abovge

Q.56: What will be the output
          let data: UInt8 = 0b00001111
          let invert = ~data
          print(invert)
A.      Compile Time Error
B.      128
C.      64
D.      240

Q.57: What will be the output
          let num1: UInt8 = 0b11111100
          let num2: UInt8  = 0b00111111
          let output = num1 & num2 
          print(output)
A.      32
B.      16
C.      60
D.      8

Q.58:  What will be the output
           let num1: UInt8 = 0b11111100
           let num2: UInt8  = 0b00111111
           let output = num1 & num2 
           print(output)
A.      128
B.      64
C.      256
D.      255

Q.59:  What will be the output
           let num1: UInt8 = 0b11111100
           let num2: UInt8  = 0b00111111
           let output = num1 ^ num2 
          print(output)
A.      128
B.      255
C.      195
D.      99

Q.60: What will be the output
          let bits: UInt8 = 4  
          let output = bits << 1            
          print(output)
A.      2
B.      4
C.      8
D.      16


Answers     C    D     A    B    B     D     C     D     C     C