Friday, November 25, 2016

Objective Questions in Swift2.2 @iPhone - Set A

Q.1: Which syntax is wrong in Swift2.2
A.  var str1
B.  var str2 : String
C.  var  str3 = “Hello “
D. var str4 : String  = “Hi….”


Q.2: What will be the output
var str = “Hello”
print(“Hello ”+str)
      A.         Error
      B.         Hello
      C.         Hello Hello
      D.        None of the above

Q.3: What will be the output
var int  = 9
int = int/2

     A.         4
     B.         Error 
     C.         3
     D.        4.5

Q.4: What will be the output
var  int : Int = 9
print(int)

     A.         Compile Time error
     B.         Run time error
     C.        
     D.        none of the above

Q.5: What will be the output
var int = 2
var num  : Double = 8.4
print(int * num)

      A.         Compile time error
      B.         Run time error
      C.         16.8
      D.        16

Q.6: What will be the output
var int = 2
print("The value is int ")

A. The value is 2
B. Compile time error
C. The value is int
D. None of the above

Q.7: What will be the output
var int = 2
print("The value is \(int) ")

A. The value is 2
B. Compile time error
C. The value is int
D. None of the above

Q.8 : var isFemale : Bool  = false  is a valid syntax or nor
A. Yes
B. No
C. May Be
D. None of the above


Q.9: What will be the output
var int = 2
var num  : Double = 8.4
print( num * Double (int))

      A.         Compile time error
      B.         Run time error
      C.         16.8
      D.        16

Q.10: Which is not a valid data type keyword in Swift2.2
A. Int
B. Bool
C. Char
D. Character




  A    C    A    C     A    C      A       A      C      C  



No comments:

Post a Comment