Sunday, November 27, 2016

Objective Questions in Swift2.2 @iPhone - Set D

Q.31: What will be the output of
               let a = 10
               var b = 5
               b = a
               print(b)
A.         10
B.         5
C.         Error
D.         None

Q.32: What will be the output
         var  x  = -9 % -4
        print(x)
A.         -1
B.         1
C.         0
D.        Error

Q.33: What will be the output
           let  x = -9
           let y =-x
           print(y)
A.         -9
B.         9
C.         0
D.        Error

Q.34:  What will be the output
   for index in 1…4
  {   
  print(index*5)
 }
A.         5,10,15,20
B.         5
C.         20
D.        None

Q.35: What will be the output
                      let allow = true
                      if !allow
                      {
                      print("Allowed")
                      }
                      else
                      {
                      print("Not Allowed")
              }
A. Allowed
B. Not Allowed
C. Error
D. None


Q.36: What will be the output
                      let yes = true
                      let no = false
                      if yes && no
                      {
                       print("Allowed")
                      }
                      else
                      {
                     print("Not Allowed")
             }
A. Allowed
B. Not Allowed
C. Error
D. None

Q.37: What will be the output
                      let yes = true
                      let no = false
                      if yes || no
                      {
                      print("Allowed")
                      }
                      else
                      {
                     print("Not Allowed")
              }
A. Allowed
B. Not Allowed
C. Error
D. None

Q.38: What will be the output
                   var str  = String()
                   if str.isEmpty
                      {
                      print("Nothing")
                      }
                      else
                      {
                      print("Something")
              }
A. Nothing
B. Something
C. Error
D. None

Q.39: What will be the output
                      for char in "Godara".characters
                      {
                       print(char)
              }
A. Run 5 Times
B. Run 4 Times
C. Run 6 Times
D. Compile Time Error

Q.40: What will be the output
                      let name = "Ravi Godara"
                      print(name[name.startIndex])
A. Compile Time Error
B. a
C. R
D. G


Answers  A   A   B    A   B    B   A    A     C    C 

No comments:

Post a Comment