Mobile App Development
in Kotlin "Int" value range is:
-2,147,483,648 to 2,147,483,647
In Kotlin "Short" value range is:
-32768 to 32767
All source code files are found in the ___ folder.
/java/
_____________ is a directory of various XML files. It includes resources such as strings and colors' definitions
/res/values
In Kotlin Byte value range is:
0 - 255
Study the following code: fun main(args: Array<String>){ var myList = mutableListOf<Int>() myList.add(0,1000) println(myList[0]) } What is the output of this code?
1000
Which of the following is the correct output for this code: var x= arrayOf(10, 20, 30) println(x[1])
20
The Kotlin plugin is bundled with Android Studio version ___ and later.
3.0
Study the following code: fun main(args: Array<String>){ var myArrayList=ArrayList<Int>() myArrayList.add(2) myArrayList.add(4) myArrayList.add(6) println(myArrayList[1]) } What is the output of this code?
4
Consider the following code: var x=arrayOf(5,10,15,20,25,30) fun main(args :Array<String>){ for(index in 0..x.size){ println(x[index]) } } What is the output?
5 10 15 20 25 30 Then a java.lang.ArrayIndexOutOfBoundsException
In Kotlin, "Long" value range is:
64 bit signed
Each application runs in its own process and contains a unique instance of the Android Runtime on Android devices starting with Android version ____ .
8.0
In and if statement, which of the following tests to see if the item on the left is equal to the item on the right?
==
Match the following items main components of an Android Application with its corresponding definition:
Activities: Used for the Android Application's user interface Services: Code that can run that does not have a user interface. This code runs in the background. Content Providers: manages and shares data (such as an Android Database) Broadcast Receivers: Used to trap messages from intents Views: Used to draw objects on the screen. Its the parent class of the activity class Intents: Used to send messages Notifications: Used to alert the user of an event without the current activity losing focus
Includes everything required to build an Android application. Includes the class android.widget
Android Libraries
Based on the Java Virtual Machine. Written for Android devices which run in an environment with limited resources.
Android Runtime (ART)
The IDE used for developing Android Apps is called
Android Studio
_________________ provides essential information about the application for the Android application.
AndroidManifest.xml
Every Android application must have a(n) ____________ in its root directory.
AndroidManifest.xml file
When you create an Android application using Android Studio, which item(s) are included in the Android project's folders / files?
Application Source Code build configurations application resources
When the ________ statement is encountered inside a loop, the loop is immediately terminated and will then resume its work starting with the statement after the loop
Break
Match the following words with its appropriate definition 1) Class 2) Constructors 3) Object 4) Inheritance 5) Abstract Class 6) Interface 7) Generic Class 8) Enum 9) Instance Variables 10) Class Variables 11) Public Variables 12) Private Variables 13) Protected Variables
Class - blueprint from which objects are created Constructors - Executed to create objects from the class definition Object - Single instance of a class Inheritance - Allows the developer to reuse properties and methods from an existing class Abstract Class - at least one members of a class is defined but has no implementation details Interface - No members of the class has an implementation Generic Class - A class that allows a function to handle data types specified when calling the class Enum - A data type that enables a variable to be a set of constants that the developer has defined Instance Variables - variables in which each instance of a class has it's own copy of the variable Class Variables - variables in which all instances of a class contains the same value Public Variables - variables that are accessible from all classes that access the selected class Private Variables - variables accessible only within their own class Protected Variables - a variable that is accessible only from the current class and any subclass of that class
Study the following code: enum class Colors{ Red, Blue, White, Green } fun main(args: Array<String>){ var color=Colors.White println(color) } What is the output?
Colors.White
The ___________ statement lets control go directly to the test condition and after that, continues the looping process
Continue
In Kotlin, which of the following are true about characters:
Data type is Char Always enclosed in single quotes
fun main(args: Array<String>){ var totSales = 5000 var yearsEmployed = 5 if ((totSales >= 6000) && (yearsEmployed >= 5)){ println("Receives bonus.") } else{ println("Does not receive bonus.") } }
Does not receive bonus.
____________ folder contains graphical resources that can be drawn. These can be bitmap or XML files.
Drawable
Study the following code: class Animal{ var Name: String? = null var Breed: String? = null var Age: Int? = null constructor(Name: String, Breed: String, Age: Int{ this.Name=Name this.Breed=Breed this.Age=Age } } fun main(args: Array<String>){ var a1=Animal("Emily","American Shorthair",10) println(a1.Name) } What is the output of this code?
Emily
What is the output of the following code: fun main(args: Array<String) { var temp: Int = 70 var message: String?=null if (temp >= 90) message="It is really hot!" else if (temp>=80) message="It is warm outside." else if (temp>=70) message="It is just right." else if (temp>=60) message="It is cool outside." else message="It is cold outside!" println(message) }
Error message as this code contains a syntax error.
Android Studio is built for Kotlin development; therefore, you can create a "New Kotlin Project"
False
Eclipse is the official IDE for Android application development
False
In Kotlin, a function requires a return statement
False
In Kotlin, a function requires at least 1 item in the parameter list.
False
Study the following code: open class Animal{ var Name: String? = null var Breed: String? = null open var Age: Int? = null constructor(Name: String, Breed: String, Age: Int):this(){ this.Name=Name this.Breed=Breed this.Age=Age } constructor(Name: String):this(){ this.Name=Name } } class Dog():Animal(){ override var Age: Int? = null } fun main(args: <String>){ var d1=Dog("Ruffy","Cocker Spaniel",10) println(d1.Breed) } Due to inheritance, Age in Dog is the same Age in Animal
False
The Android Platform Architecture is based on Microsoft Windows.
False
When creating a new Android application you do not need to create a unique name for the package before publishing it to the google play store.
False
Match the processes with their importance as far as the Android OS is concerned in descending order (1 = most important)
Foreground process - 1 Background Process - 4 Visible Process - 2 Empty Process - 5 Services Process - 3
____________ are files used to automate and administer the build process
Gradle scripts
The _______________ exposes hardware capabilities of devices to the high level Kotlin API framework.
Hardware Abstraction Layer (HAL)
The _____ significantly reduces the time it takes to update your application with changes. It was added with API Level ____
Instant Run 21
What is the output of the following code: fun main(args: Array<String>) { var temp: Int = 70 var message: String?=null if (temp >= 90) message="It is really hot!" else if (temp>=80) message="It is warm outside." else if (temp>=70) message="It is just right." else if (temp>=60) message="It is cool outside." else message="It is cold outside!" println(message) } *The text in this question is larger and the Array<String> has the required carrot*
It is just right.
Study the following code: class Animal{ var Name: String? = null var Breed: String? = null var Age: Int? = null constructor(Name: String, Breed: String, Age: Int):this(){ this.Name=Name this.Breed=Breed this.Age=Age }constructor(Name: String):this(){this.Name=Name}}class Dog():Animal()fun main(args: <String>){ var d1=Dog("Ruffy","Cocker Spaniel",10) println(d1.Breed)}What is the output of the above code?
It will err off since the parent class does not allow for inheritance by default. The parent class must be open. For example: open class Animal{ }
Used to create the Android View system
Java API Framework
_____________ contains the application source code files which are divided by package names
Java directory
The programming language we will be using for Android app development is called
Kotlin
________________ contains XML files that define the structure of the user interface for an Android app.
Layout
The operating system for iOS development is
MacOS
________________ contains different drawable files that can display various icon shapes
Mipmap
Used to build the central Android system components as well as services
Native C/C++ Libraries
Study the following code: package com.example.myapplication open class Animal{ var Name: String? = null var Breed: String? = null var Age: Int? = null constructor(Name: String, Breed: String, Age: Int){ this.Name=Name this.Breed=Breed this.Age=Age } } class Dog(Name: String, Breed: String, Age: Int):Animal(Name, Breed, Age) fun main(args: Array<String>){ var d1=Dog("Ruffy","Cocker Spaniel",10) println(d1.Breed) } What is the output of the above code?
Nothing is wrong. It will compile fine and produce the expected results
fun main(args: Array<String>){ var totSales = 5000 var yearsEmployed = 5 if ((totSales >= 6000) || (yearsEmployed >= 5)){ println("Receives bonus.") } else{ println("Does not receive bonus.") } }
Receives bonus.
Study the following code: fun main(args: Array<String>){ var result=sum(2,40) println("Result = $result") } fun sum(num1:Int, num2:Int) :Int{ var total=num1+num2 return total } What is the output of the above code?
Result = 42
The ___________ statement is used to exit a method and then return the result of an operation to the function that called it.
Return
The language for iOS development is called:
Swift
Study the following code: class Animal{ var Name: String? = null var Breed: String? = null var Age: Int? = null constructor(Name: String, Breed: String, Age: Int):this(){ this.Name=Name this.Breed=Breed this.Age=Age } } class Cat():Animal() fun main(args: <String>){ var c1=Cat("Emily","American Shorthair",10) println(c1.Breed) } What is the output of the above code?
Syntax error message
Study the following code: class Test<T>{ var item:T?=null } fun main(args: Array<String>){ var example =Test(Int) example.item = 1 println(example.item) } What is the output of this code?
Syntax error message. The syntax var example =Test(Int) is not correct.
Study the following code: class Test<T>{ var item:T?=null } fun main(args: <String>){ var example =Test(Int) example.item = "this is a test" println(example.item) } What is the output of this code?
Syntax error message. The syntax var example =Test(Int) is not correct.
________________ includes apps that are already installed such as email.
System apps
Match the following user interface items with the correct description:
Textview: A widget that can hold user entered text. Radio Button: Widgets in which you can select only a single item. Checkboxes: Widgets in which you can select multiple items. RadioGroup: A widget that can contain multiple radio buttons.
Consider the following code: fun main(args: Array<String>){ var count=7 do{ println(count) } while (count><=6) } What would the output be?
There would be no output
What is the output of the following code? fun main(args: Array<String>){ var item = 30 if (item > 40) println("This statement is executed") println("This is the next statement") }
This is the next statement
What is the output of the following code? fun main(args: Array<String>){ var item = 50 if (item > 40) println("This statement is executed") println("This is the next statement") }
This statement is executed This is the next statement
All views in a window are organized in one tree.
True
Any method / function / block of code written outside the main function will be considered a definition and will be called from the main function to do its work.
True
In Kotlin, the return type Unit in a function corresponds to the return type of void in java.
True
Study the following code: class Cats{ val numberOfCats = 0 } The numberOfCats is an immutable variable which can't be changed after it is set.
True
The Android SDK platform is a set of libraries and APIs that are necessary in order to develop Android applications.
True
The Android Studio IDE includes both the Android SDK tools and the Android build tools
True
The When statement is similar in concept to the java switch statement. It can have a number of execution paths.
True
The Android App package name should include:
Two to three words separated by dots.
Study the following code: fun main(args: Array<String>){ var myList = listOf(1, "This is a test") myList[0] =1000 println(myList[0]) } What is the output of this code?
Unresolved reference error message
_______________ is a folder that includes three main XML files that contain definitions for strings, colors and styles
Values
The ____________ class is the building block for creating the user interfaces for an Android application.
View
GUI components are known as
Widgets
The IDE for iOS Development is called
XCode
Study the following code: fun main(args: Array<String>){ println("What size shoes do you want?") println("Enter 1 for small, 2 for medium or 3 for large shoes.") var shoeSize=readline()!!.toInt() var sizeToOrder:String?=null when(shoeSize){ 1-> sizeToOrder="small" 2-> sizeToOrder="medium" 3-> sizeToOrder="large" else->println("You did not enter a correct shoe size.") } println("Shoe size requested is $sizeToOrder") } If the user enters 4 at the user prompt, what will the output be for shoe size?
You did not enter a correct shoe size.
If I wanted to create a new class called Cat that will contain all properties and methods of the Animal class which was previously defined, I could write the following code:
class Cat():Animal()
Consider the following code: fun main(args: Array<String>){ var count=1 while (count<5) { println("count= $count") count++ } } What is the output of the above code?
count= 1 count= 2 count= 3 count= 4
In Kotlin, Double value range is:
double-precision 64 bit floating point
Which of the following will correctly create an application that will display "Hello World"?
fun main(args: Array<String>){ printIn("Hello World") }
Which of the following is the correct code to print out Hello, Android ATC and then have the cursor go to the next line.
fun main(args: Array<String>){ println("Hello, Android ATC") }
To create an iOS app you have to go to the _______ template page to start your app
iOS
Kotlin code depends on what you write in the ______. This is the "starting point" of the application. It calls out to other functions / classes / libraries.
main function
The callbacks executed when the app is "active" are:
onResume onPause
The callbacks executed when the application is "visible" is / are:
onStart onResume onPause onStop
In Kotlin "Float" value range is:
single-precision 32 bit floating point
The package name:
uniquely identifies the app on the device should be unique on the Google Play store Once you publish the app with this package name that name should never be changed. If you were to change the package name, existing users of your application will not see the app as an update
In Kotlin, which is the correct way to define the variable X as an immutable variable called X and assign it the value of 1?
val X=1
Which of the following will successfully create a hashmap called myHashMap whose key is a string and its value is an integer?
val myHashMap = HashMap<String, Integer>()
Which of the following will compile clean (not produce an error).
var price:Float = 5.2f
Which of the following are implicitly defined integer variables?
var x=9 var y=9
Which of the following statements will correctly allow the user to enter an integer
var z = Integer.valueOf(readLine()) var z=readLine()!!.toInt()
What is the output of the following code? var x:Byte =10 var y:Byte=15 fun main(args: Array<String>){ var z=x+y println("z = $z") }
z = 25
Which of the following will add the variables x and y together and then assign the results to z?
z=x.plus(y) z=x+y