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 

No comments:

Post a Comment