Showing posts with label Objective Questions. Show all posts
Showing posts with label Objective Questions. Show all posts

Sunday, November 27, 2016

Objective Questions in Swift2.2 @iPhone - Set C


     
Q.21 : var arr = [4,5,6,7,”Ravi"]  
           Is a
A.         Valid Declaration and Initialization of an Array
B.         Compile Time Error
C.         Run Time Error
D.        None of the Above

Q.22 : What will be the output
          var array  = [11,22,33,44,55]
          print(array.length)          
A.         Compile Time Error
B.         Run Time Error
C.         5
D.        None of the above

Q.23 : What will be the output
           var array  = [11,22,33,44,55]
           print(array.count)
    A.         Compile Time Error
B.       Run Time Error
C.         5
D.       None of the above

Q.24 Which syntax is valid for array declaration

A.        var arr : Array
B.        var arr : NSArray
C.        Both
D.        None

Q.25: What will be the output
          var array  = [11,22,33,44,55]
         print(array[3])
          
A.         Compile Time Error
B.         33
C.         44
D.        22

Q.26:  What will happen
          var array  = [11,22,33,44,55]
          array.append(1)
          print(array)
          
A.         Compile Time Error
B.         [11,22,33,44,55,1]
C.         [11,22,33,44,1]
D.        [1]

Q.27: What will be the output
          var array  = [11,22,33,44,55]
          array.removeAtIndex[2]
          print(array)
          
A.         Compile Time Error
B.         [11,22,33,55]
C.         [11,22,44,55]
D.        [11,22,33,44]

Q.28: What will be the output
          var array  = [111,22,33,404,-55]
          array.sort()
          print(array)
          
A.         Compile Time Error
B.         [22,33,111,404,-55]
C.         [-55,22,33,111,404]
D.        [111,22,33,404,-55]

Q.29: Which syntax is valid for Dictionary
     
      A.  var dictionary : NSDictionary
      B. var dictionary : Dictionary
      C. Both
      D. None

Q.30 What will be the output
        var dictionary = [“Android” : “Mobile OS”, ”Chess” :       
                                      ”Game”, ”Ravi” : “Trainer”]
       print(dictionary[“Ravi”])

A.         Mobile OS
B.         Game
C.         Trainer
D.        Compile Time Error

Answers   A     A    C     B     C     B    C    C    A    C 

Saturday, November 26, 2016

Objective Questions in Swift2.2 @iPhone - Set B

Q.11 : Which is the correct syntax to declare constant in swift
A. var x = 10
B. let x = 10
C. Const x = 10
D. None of the above  

Q.12 : var red , green ,blue : Double
A. It will create 3 variables of Double type
B. Compile time Erroe
C. Run time error
D. None of the above

Q.13: Which is wrong syntax
A. let x = 10
B. let  na me = “Ravi”
C.  let Õ  = 10    
D. Both B & C

Q.14 :  Compare the below declaration syntax
         1. let array : Array <String> = [ “ Ravi “ , “Kumar”, ”Godara”]
         2. let array :     [String]          =  [ “ Ravi “ , “Kumar”, ”Godara”]
A. Syntax 1 is not valid
B. Syntax 2 is not valid
C. Both can be used to declare String Array
D. Both syntax wrong


Q.15 : Compare the below declaration syntax
         1. let dictionary : [String : Int] = [“Ravi” : 30, “Raj” : 35]
         2. let dictionary : Dictionary<String , Int> =  [“Ravi” : 30, “Raj” : 35]
A. Both can be used to declare String Array
B. Syntax 1 is not valid
C. Syntax 2 is not valid
D. Both syntax wrong


Q.16:Compare the below declaration syntax
         1. var  optional :  Int?
         2. var  optional :  Optional<Int>
A. Syntax 1 is not valid
B. Syntax 2 is not valid
C. Both can be used to declare String Array
D. Both syntax wrong



Q.17: Compare the below declaration syntax
         1. var  a=10 ,b=20 ,c=30
         2. let  a=10 ,b=20 ,c=30
A. Syntax 1 is not valid
B. Syntax 2 is not valid
C. Both can be used to declare String Array
D. Both syntax wrong



Q.18: What will be the output
let row : Int = 3
      row  = 5
     A.         value of row is 5
     B.         Compile time error
     C.         value of row is 3
     D.        None of the above  

Q.19 : What will be the output
var int  : Int = 20
var dec : Double = 15.6
int = dec
     A.         int will be 15
     B.         int will be 16
     C.         int will be 15.6
     D.        Compile time error

Q.20 : What will be the output
var int  : Int = 20
var dec : Double = 15.6
int = Int(dec)
    A.         int will be 15
    B.         int will be 16
    C.         int will be 15.6 

    D.        Compile time error

   Answers     B     A    B     C    A     C     C      B     D     A