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
No comments:
Post a Comment