iOS Programming Test
Q1. iOS stands for ?
a)Internetwork Operating System
b)iPhone Operating System
c)Internet Operating System
d)None of Them
Answer: b
ios stands for iPhone operating system
Q2. Swift is which type of language?
A) scripting language
B) object oriented programming language
C) type safe language
D) All of the above
Ans :- D
Q3. The IDE used in swift is____
A. swiftc
B. gas
C. Xcode
D. Ld
Answer : C. Xcode
Q4. In iOS, a folder with .app extension is known as Bundle.
A. True
B. False
correct ans- A. True
Q5. To create mutable object __ is used
A) var
B) let
C) both
D) none
Answer: A
Q6. Entry Point function in swift is main()
[A]-True
[B]-False
Correct Answer-[B]
Q7)Which of the following iOS frameworks is a commonly used third party Library?
a) AVFoundation.framework
b) Audiotoolbox.framework
c) AFNetwork.framework
d) CFNetwork.framework
Answer: c
[Q8].Swift will automatically assign the data type based on the initial value?
[A].True
[B].False
Answer :[A].True
Q9.To create constants in swift we use keyword ...
[A]let
[B]const
[C]constants
[D]none of above
Ans :A
Q10. Double has a precision of at least _ decimal digits in swift.
[A] 15
[B] 20
[C] 17
[D] none of these
Ans[A]
Q11. First IOS was written in
1984
1985
1986
1987
Answer: Option C
Q12. We can return multiple values in swift from function by using?
A. Array
B. tuple
C. A&B
D. None
Ans : B
Description: we can return multiple values from function by using tuple .
Q1. Which of the following is incorrect data type in SWIFT ?
[A] UInt
[B] Double
[C] Char
[D] Optional
Ans.: [C] Char
Q. Using tupel we can return multiple values.
A) true
B) False
Ans: A) True
Q)MAC OS X is true 64 bit unix.
A)true
B)false
ans: A) true
Q. If you do not want to mention external name in function call, then what should be preceded before
the parameters while defining the function?
[A] ?
[B] !
[C] _
[D] \
Ans. C
Q: The most recent version of macOS is based on ... ?
A)WINDOWS
B)LINUX
C)UNIX
D)CMOS
Answer: C
QUE.To initialize variable with null require...
[A] ?
[B] !
[C] _
[D]NULL
ANS: [A] ?
Q) Meaning of iOS is?
(A)Integrated operating
(B)systemIntergrated open system
(C)Internetworking operating system
(D)None of above
Answer: Option C
Q. What is a LLVM ?
[A] swiftc compiler
[B] objective c compiler
[C] contains both compiler (swiftc and objective c)
[D] None of the above
Ans : [C]
Q.Which of the following is incorrect value type of the swift?
A]Double
B]character
C]enum
D]class
Ans- D] class
Q.for unwrapping value inside optional what should we use?
[A]?
[B]@
[C]!
[D]none of these
Ans-C
Q. . First IOS was written in
A. 1984
B. 1985
C. 1986
D. 1987
Ans: C. 1986
Q. What was the original name of iOS?
A. iPad OS
B. iOS is original name
C. iPhone OS
D. iPod OS
Ans - C
Qes: what are the features of swift programming?
[A] it eliminates entire classes of unsafe code
[B] Variables are always used before use.
[C] Arrays and integers are checked for overflow.
[D] memory is managed automatically
[E] all of the above.
ans: E : (all of the above)
exp: swift supports all above features .
Q.It is possible to wrap variable value inside optional after unwrapping value
[A]True
[B]False
Answer:B
Q. Which of the following is TRUE
A. let value = 5
value = 10
B. let value: Int = 0.1
C. var value : Int?
value = 100
D. All the above
Ans: Option C
Explanation:
Option A is false, correct code
var value = 5
value = 10
Option B is false, correct code
let value = 0.1
Que. Multitasking in iOS was introduced in which version?
[a] iOS 2.0
[b] iOS 4.0
[c] iOS 6.0
[d] iOS 7.0
ans. [b] iOS 4.0
Q. iOS is a __software.
A. Free and open source
B. Proprietary
C. None of these
Ans : B
Q) Which of the following framework is not used in iOS ?
a)UIKit Framework
b)AppKit Framework
c)Foundation Framework
d)CoreMotion Framework -
Answer: b
Q]Swift will automatically assign the data type based on the intial value ?
A]True
B]False
Ans :True
What is Swift Programming Language?
Swift is an innovative new programming language for Cocoa and Cocoa Touch. Writing code is
interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast. Swift is ready for
your next iOS and OS X project — or for addition into your current app — because Swift code works
side-by-side with Objective-C.
What is difference between ‘let’ and ‘var’ declaration ?
constants are expressed with the ‘let’ keyword. So once assigned value can not be change, but
assigned values using ‘var’ keyword can be change.
In terms of objective -c or compare with objective -c, ‘var’ is Mutable and ‘let’ is NonMutable.
let kMyConstant = 40
Or
let kMyConstant: Int = 40
var myString = “This is my string.”
Ques: Which of the following declares a mutable array in Swift?
A) let x =[Int]()
B)var x=[Int]
C) var x=[Int]()
D) let x=[Int]
Ans: C
Q.Application running in foreground but currently not receiving any events .what is the current state of
Application?
A)Background state
B)Inactive state
C)Suspended state
D)Active state
Ans:b
Que : Tuples as well as structs both allow us to combine different types into one type.
(A) true
(B) false
Answer : A
Q.Which of the following framework is not used in iOS ?
a)UIKit Framework
b)AppKit Framework
c)Foundation Framework
d)CoreMotion Framework
And:b
Q) What is the element that is used to specify the type of variable or expression?
[A]Explicit Title
[B]Named Factor
[C]Type Annotation
[D]Class Annotation
And:-[C]Type Annotation
Q.for unwrapping value inside optional what should we use?
[A]?
[B]@
[C]!
[D]none of these
Ans-C
Which of the following framework is not used in iOS ?
a)UIKit Framework
b)AppKit Framework
c)Foundation Framework
d)CoreMotion Framework
Answer: b
Q. IPhone OS is based on which language?
(A)C++
(B)C
(C) java
(D) both (i) and (ii)
Answer: D
Questions:
To create mutable object __ is used
A) var
B) let
C) both
D) none
Answer: A
1. Meaning of IOS is
A. Integrated operating system
B. Intergrated open system
C. Internetworking operating system
D. None of above
Ans:c
What is the latest version of iPhone operating system ?
a) 3.1
b) 8.4
c) 2.0
d)5.0
Answer - b
Question: Which of the following statements is/are false?
1. var is used to declare variable whose value we can change.
2. let is used to make variable as constant.
[A] 1
[B] 1 and 2
[C] 2
[D] None of the above
Correct Answer: [D] None of the above.
Justification: var is used to declare variable and let is used to make it constant.
Which of the following is immutable?
[ a] var num =5
[ b] num =5
[ c] let num =5
[d]all the above
Answer is :option C
let num =5 is immutable ..coz for immutable state is not changed
Qes: what are the features of swift programming?
[A] it eliminates entire classes of unsafe code
[B] Variables are always used before use.
[C] Arrays and integers are checked for overflow.
[D] memory is managed automatically
[E] all of the above.
ans: E : (all of the above)
exp: swift supports all above features .
Q. iOS is a __software.
A. Free and open source
B. Proprietary
C. None of these
Ans : B
Que.What is Bundle in iOS
A. It is a class
B. It is used to send data
C It is folder with .app extension
D. None of above
Ans. C
Questions:
To create mutable object __ is used
A) var
B) let
C) both
D) none
Answer: A
Question. Which of the following is true.
1.we can wrap unwrapped values
2. we can unwrap wrapped values
3.we cannot wrap unwrapped values
4.we cannot unwrap wrapped values
A)1,2&3
B) 2&3
C) 1&4
D)2&4
Answer. B)
Q.Flash Applications is supported in iPhone browsers.Is it true?
[A]Yes
[B]No
[C]It supports flash applications from apple only.
[D]Supports partially
Correct Answer :A
What is the return type of following function?
Func myfunc( ) -->String{
return "hello"
}
ANSWER-String
To get value inside optional use ....?
A. ?
B. !
C. +
D. #
Ans: B
Q. Objective-C itself has
evolved to support ____enabling framework adoption of modern language technologies without
disruption.
A) blocks
B)collection literals
C) modules
D)all of the above
Correct Answer D)
Q. The class files that you create for your application will have file extension ?
A - .swift
B - .m
C - .c
D- .swf
Answer: A
which compiler is use for swift ?
a) swiftc
b) gcc
c) clang
d)all
Answer - A
Que: in swift which keyword is work as immutable??
A. nil
B. var
C. let
D. enum
Ans: C. let
Q. In swift Variables are always initialized before use.
A. True
B. False
Answer: A
Q.which keyword in swift used to initialize the variable?
A) null
B) nil
C) NIL
D)NULL
Answer. B)
Question : Which of the following framework is not used in iOS ?a)UIKit Framework
b)AppKit Framework
c)Foundation Framework
d)CoreMotion Framework
Answer: b
Q.We can return multiple values in swift from function by using?
A. tuple
B. Array
C.A&B
D.None
Ans : A
Description: we can return multiple values from function by using tuple .
Q)Which of the following iOS frameworks is a commonly used third party Library?
a) AVFoundation.framework
b) Audiotoolbox.framework
c) AFNetwork.framework
d) CFNetwork.framework
Answer: c
Q. Xcode is an IDE containing a suite of software development tools developed by Apple for
developing software for OS X and iOS
A. True
B. False
Ans- A. True
Q. Which of these are not Value type in Swift?
[A]Optional
[B]class
[C]Int
[D]struct
Answer- B class as it is of reference type
Q.We can return multiple values in swift from function by using?
A.Array
B.tuple
C.A&B
D.None
Ans : B
Description: we can return multiple values from function by using tuple .
What is the user interface of Iphone OS called?
A)Touchwiz
B)Mobiface
C)Cocoa
D)Universal Mobile Interface
Ans : A) Touchwiz
Q. iOS remote push notification is introduced by apple in which version?
[A]iOS 2.0
[B]iOS 3.0;
[C]iOS 4.0;
[D]iOS 6.0;
Answer B
[Q] Swift is a
[A] Scripting language
[B] Object Oriented Programming Language
[C] Strictly typed checked Language
[D] Type Safe Language
[E] All of the above
Ans : [E] All of the above
Q.We can return multiple values in swift from function by using?
A.Array
B.tuple
C.A&B
D.None
Ans : B
Description: we can return multiple values from function by using tuple .
Q. The -------- provides the resources you need to develop native iOS apps
A. iOS delegate
B. ios controller
C. iOS SDK
D. iOS playground
Ans C. iOS SDK
Q which is not function of iOS?
A. Carrying network protocols and functions
B. Connecting high speed network
C. Providing scalability for ease of network growth and redundancy
D. Creating session between hosts in LAN
And: D
Q) Which of the following statements is correct about Tuple?
A. Using tuple function can return multiple values
B. Tuple is a collection of different data types
C. We can write function inside it
D. Both A and B
E. All of the above
Ans: D
Q. var name : String?= "CodingBull"
name=name+10
A. It's compile time error
B. It's runtime error
C. It's not an error
D. Syntax is wrong as semicolons are missing in both the line.
Ans -A
Q) Which of the following framework is not used in iOS ?
a)UIKit Framework
b)AppKit Framework
c)Foundation Framework
d)CoreMotion Framework -
Answer: b
What is the full form of "efi"
[A] enhanced firmware interface
[B] enhance firewall interrupt
[C] enhance firmware internet
[D] enhance fireworks interrupt
Ans is [A] enhanced firmware interface
Q. Which iPhone version supports flash?
A. 3.2
B. 4.2
C .both A and B
D. None
Answer: D
Swift was developed by
A. Chris Latter
B. Brad Cox
C. Both A & B
D. None of the above
Answer: A
Q.What symbol is used like a tuple to access arguments in Abbreviated Swift Closure syntax?
A) $
B) *
C) &
D) @
E) ~
Ans: A
Que:- general syntax for closure is_____.
[A] { (parameters) -> return type in
Statements
}
[B] {(return type) -> parameters in
Statements
}
[C] {(statements) -> parameters in
Return type
}
[D] none of these
Ans[A]
By default Set is treated as__
A. Array
B. Collection
C. Structure
D. None of these
Ans - A
Q. Which is not a function of IOS
[A]Carrying network protocols and functions
[B]Connecting high speed traffic between devices
[C]Providing scalability for ease of network growth and redundancy
[D]Creating session between hosts in LAN
Answer:- D
Q1. Which of the following is incorrect about Array collection?
[A] sequence matters
[B] allows duplicate values
[C] can be created implicitly
[D] none of the above
Ans.: [C]
Description.: Array collection can be created implicitly or explicitly
Q.Which of the following iOS frameworks is a commonly used third party Library?
a)AVFoundation.framework
b)Audiotoolbox.framework
c)AFNetwork.framework
d)CFNetwork.framework
Answer: c
[Q] Closure optimizations are :
[A]Inferring parameter and return value types from context.
[B]Implicit returns from single-expression closures
[C]Shorthand argument names
[D]Trailing closure syntax
[E] All of the above
Ans:E
Que. There are __ types of collections in Swift.
[a] 1
[b] 2
[c] 3
[d] 4
ans. [c] 3
Description : 3 types of collections are there i.e. set, array and dictionary.
Q. Which statement is correct in case of set?
A) we can not create set implicitly
B)we can not create set explicitly
C)we can create set explicitly as well as implicitly
D) none of the above
Ans- A)
Que. Which type of collection uses key-value pair in iOS?
[a] Array
[b] Set
[c] Dictionary
[d] All
Ans.: [c] Dictionary
Que. Which is not a type of collections in Swift.
[a] Set
[b] Array
[c] Class
[d] Dictionary
Ans. [c] Class
Explaination: Class is a reference type in Swift.
Q) Which statement is correct .
Difference between Set and Array is :-
(A) In Array, sequence matters but not in Set.
(B) In Array, it allows duplicate values but not in Set.
(C)In Array, it can be created implicitly or explicitly but in Set, it can be created only explicitly.
(D)All of above
Answer :- (D)
[Q] Swift is a
[A] Scripting language
[B] Object Oriented Programming Language
[C] Strictly typed checked Language
[D] Type Safe Language
[E] All of the above
Ans : [E] All of the above
What will be the output of following program?
var array1 = [1,2,3,4,5]
var array2 = array1
array2.append(6)
var len1 = array1.count
var len2 = array2.count
print("len1 = \(len1)")
print("len2 = \(len2)")
A. 5, 6
B. 5, 5
C. 6, 6
D. 6, 5
Ans - A
Q) Class by default initializes the variable using public initializer method.
A] true
B] false
Ans: B] false
justification- struct and not class initializes the variable using public initializer method hy
default.
All swift classes must inherit from which root class?
A) not Required
B )NSObject
C) NSRootObject
D) @Object
Ans :B) NSObject
Q. What is the name of the deinitializer in a Class declaration?
[A] dealloc
[B] release
[C] dint
[D] deinit
ANS : [D]
Q.In swift language by default the members of class are ..?
A.private
B.protected
C.public
D.None
Ans:C
By default the members of structure and class are public in swift language.
Que: General syntax for closure is_____.
[A] { (parameters) -> return type in
Statements
}
[B] {(return type) -> parameters in
Statements
}
[C] {(statements) -> parameters in
Return type
}
[D] none of these
Ans: A.