CS 4405 - Mobile Applications - Study for Exam
What will be the output of the following Swift code snippet? var arr = [1,2,3,4] for element in arr { print(element, terminator: " ") }
1 2 3 4
How many types of primary collections are there in swift?
3
Which of the following is a native framework used for data persistence in iOS?
Core Data
What does CRUD in database management stand for?
Create, Read, Update, Delete
In Kotlin, which class contains methods to perform database operations like insert, select, update, delete, and so on?
DB Helper class
Below code snippet is valid in Swift. let chocolates = ["Kitkat", "Cadbury"] let kitKat = chocolate["Kitkat"]
False
CSS is used for structuring the webpage.
False
Every Kotlin class does NOT need to have a constructor.
False
Kotlin list cannot have duplicate elements.
False
Native app for iOS can be developed on which IDE?
XCode
What IDE is used to develop native applications for Apple devices?
Xcode
What will be the output produced by the below Swift code? let str = "Hello world" print(str.split(separator: "l"))
["He", "o wor", "d"]
What will be printed by the following swift code snippet? var arr = Array(repeating: 1, count: 3) print(arr)
[1, 1, 1]
In Swift, multiple protocols can be listed, and are separated by ______.
commas
In Swift, which parameters are returned to the completion handler of URLSession's data task?
data, response, error
In Kotlin, execSQL(String sql) is used to____.
execute a query on a database
What will be the output of the below Swift code? class Bird { var canFly: Bool? } var ostrich = Bird() let canFly = ostrich.canFly ?? false print(canFly)
false
Which of the following keywords is used in Swift control flow?
guard
What will be the output of the below code? let bigInteger = Int.max + 1 print(bigInteger)
it will give a runtime error
Which of the following is a valid variable declaration in Kotlin?
let age = 21
Which of the below options is a valid declaration for constants in Swift?
let pi = 3.14
In Kotlin, a class that inherits the members of another class is known as ______.
superclass
The front end of a mobile application includes ______.
the visual and interactive part of the app
Exceptions in Kotlin are thrown using the_____ expression.
throw
Which of the following keyword is used to declare a variable in the Swift programming language?
var
Which of the following lines creates a new variable in Swift?
var greetings = "hello"
Which of the following is the correct way of declaring raw string in Kotlin?
var str = """Hello"""
Which of the following is a control statement in Kotlin?
If
________ view is an object used to display an image in the android app.
Image
Which constraint is added in the below Swift code for the generic parameter? func sum<T: Numeric>(val1: T, val2: T) -> T { return val1 + val2 }
Numeric
What will be the data type assigned to the test in the below Swift code? enum Planet: Int { case Mercury = 1 case Venus case Earth case Mars } let test = Planet(rawValue: 3)
Planet?
Which Database, by default, is embedded in android?
SQLite
Which is the default web browser of an iOS device?
Safari
What will be the output of the following Kotlin code snippet? fun main() { val number = 10 if (number/2 == 0) { print("Fizz") } else { print("Buzz") } }
Buzz
Which of the below statement is true about Android Toast?
It is used to display a piece of text for a short span of time.
Which of the following is true about JavaScript?
It is used to program the behavior of web pages.
Kotlin classes are public by default.
True
In Kotlin, exception is a_______ that occurs in a program.
runtime problem
With the help of mobile apps, businesses can ________.
- engage more customers - provide better customer service - increase revenues
Mobile application front end needs to interact with the back end of the application in order to ________.
- render some services like sign up/sign in - feed data to the UI - provide access to remote resources like cloud etc.
What will be the output of the following Swift code snippet? let three = 3 let minusThree = -three print(minusThree + 1)
-2
What will be the output of the following Kotlin program? fun main() { var a = 10 print(++a) }
11
What will be the output of the following Swift code? func swap<T>( val1: inout T, val2: inout T) { let temp = val1 val1 = val2 val2 = temp } var value1 = 12 var value2 = 11 swap(val1: &value1, val2: &value2) print(value1, value2)
11 12
What will the value printed by the below Swift code? let val = 0x10 print(val)
16
What will be the output of the following Kotlin program? fun main () { var a = 10 var b = 20 println(a*b)
200
What will be the output of the below code snippet? enum Directions: Int { case north = 1 case south case east case west } print(Directions.east.rawValue)
3
What will be the output of the following Swift code snippet? var x = 2 x += 3 print(x)
5
Which of the following is the correct HTML syntax for an end tag
</tagname>
Which element contains meta information about the HTML page?
<head>
Which of the following is the property of Swift sets?
All the elements in a set must be unique.
Among the following options what is the correct order of mobile application development life cycle?
Analyze, Develop, Test, Release, Monitor
Which IDE is used to write the code using the Flutter framework?
Android Studio
Which of the following holds true for both swift classes and structs?
Conform protocols to provide standard functionality of a certain kind.
Which language is used to write code in the Flutter framework?
Dart
In Swift, protocols cannot be confirmed by structs.
False
Kotlin enum is a special data type that allows a variable to hold any value a user wants it to store.
False
Swift classes inherit from a universal base class.
False
Flutter is an open-source framework provided by ________.
What will be the output of the following Swift code snippet? let greetings = "Hello there!" print(greetings[greetings.startIndex])
H
What will be the output of the below code? func greet(_ person: String = "Taylor") { print("Hello, \(person)!") } let greetCopy = greet greetCopy("Simon")
Hello Simon!
What will be the output of the following Kotlin program? class MyClass { var name = "my name" fun sayGreetings() { println("Hello" + " " + this.name) } } fun main() { var myObject = MyClass() myObject.sayGreetings() }
Hello my name
What will be the output of the following Swift code snippet? var greetings = "Hello" greetings = "Hey there" print(greetings)
Hey there
What is the full form of HTML?
Hyper Text Markup Language
Which of the following object (in Swift) is true about NSManagedObjectModel class of the Core Data stack?
It sets up the model for data.
Which of the given options is true about the below code? fun main() { var amount = 600 try { validateMinAmount(amount) } catch (e : Exception){ println(e.message) } } fun validateMinAmount(amount : Int) { throw Exception("Your balance $amount is less than minimum balance 1000.") }
It will execute smoothly and will throw an exception.
What will be the output of the following Kotlin code? fun main() { for (number in 1..5) { result = when(number) { 1,3,5 -> "odd" 2,4 -> "even" } } }
It will throw an error
What will be the output of the following Swift code snippet? for i in 1..3 { print(i) }
It will throw an error
What will be the output of the following Kotlin program? fun main () { var text = "Hello" print(text[5]) }
It will throw run time error
Kotlin is a programming language developed by _______.
JetBrains
In Kotlin, properties declared in a super class then redeclared in a subclass ______.
Must be prefixed with keyword override and should have the same type as in the case of super class
Which of the following class (in Swift) is responsible for fetching data from Core Data?
NSFetchRequest
What will be the output of the following Kotlin program? fun main() { var age = 6 if (age < 5) { print("Baby") } else { print("Not a baby") } }
Not a baby
What is the use of the setOnClickListener method in Kotlin?
Perform some action when the button gets clicked.
What will be the output of the following Swift code? struct Person { var name: String } var person1 = Person(name: "Person1") var person2 = person1 person1.name = "Taylor" print(person2.name)
Person1
What will be the output of the following Kotlin program? fun main() { println("Hello"); println("World") }
Prints Hello followed by World in the next line
What is HTML used for?
Structuring web content.
What is CSS used for?
Styling the web page
What output will be generated by the Swift code below? struct Book { var name: String } var book = Book(name: "Swift for beginners") book.name = "Swift advanced" print(book.name)
Swift advanced
Which of the following is NOT a JavaScript library?
Swift.js
Which of the following is true about computed properties in Swift?
Their value is computed at runtime.
What will be the output of the following Swift code? struct Department { static var name: String = "Computer science" } let deptt = Department(name: "Mobile development")
This code will give compile time error
What output will be generated by the Swift code below? class Person { var name: String override init(initialName: String) { name = initialName } } let myself = Person(initialName: "Daniel") print(myself.name)
This code will not compile
What will the type of sampleBook be with respect to the following Swift code? struct Swift: Book { var author: String } Let sampleBook = Swift(author: "Taylor")
This code will not compile
A computed property (in Swift) having only a getter but NOT a setter is called read-only property.
True
Hybrid apps are easier to develop than native apps, but they have less access to device APIs and give a slow performance.
True
Important parameters like the number of resources that will be consumed and the performance of the application are taken into consideration while choosing an alternative for building a mobile app.
True
In Kotlin, generics is a concept that allows defining class methods that can be used on different data types.
True
In Kotlin, the catch block is used to catch the exception thrown by the try block.
True
In Kotlin, the method public abstract void onCreate(SQLiteDatabase db) is created only the first time the database is created.
True
In Swift, Core Data uses SQLite Database as the default persistent store.
True
In Swift, variables declared inside a class are called properties.
True
Javascript is used to bring functionality to the webpage.
True
Kotlin is a statically typed programming language.
True
Mobile Web apps are websites that can work on mobile devices and give an app like experience.
True
Native mobile apps have direct access to device API and give the best performance.
True
Web Apps are websites designed for mobile devices developed using web technologies like HTML and JavaScript.
True
Button in android is a _______.
UI component that a user can tap on to trigger some action
Which API is used to make an internet connection in Swift?
URLSession
Which of the following rendering engine is used in the safari browser?
WebKit
What will be the output of the below Swift code? let nestedArr = [[1, 2, 3], [4, 5, 6], [3, 4, 5]] print(nestedArr.flatMap({$0}))
[1, 2, 3, 4, 5, 6, 3, 4, 5]
What will be the output printed by the below Swift code? let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] let result = numbers.filter { $0 % 2 == 1 } print(result)
[1, 3, 5, 7, 9]
Which of the following keywords is used for exception handling in Kotlin?
block
Which of the following is the correct way of declaring a generic function in Kotlin?
func <T> funcName(params: T)
What is the correct syntax for declaring a throwing function in swift?
func canThrowErrors() throws -> String
Which of the following is NOT a valid function declaration in Swift?
func sayGreetings(to person withName: String) -> String
Identify the keyword (in Swift) that is used to give the ability to a structured method to modify its properties within the structure.
mutating
Which of the following method is used to set the color for an android button title?
setTextColor()
The following syntax for creating an enum in Kotlin is incorrect because: Enum class className { case constantName1, constantName2, constantName3 }
the case keyword is not allowed.
All exception classes in Kotlin are descendants of the ______ class.
throwable
Which of the following array declaration statement will raise a syntax error in Swift?
var arr: Array