Question
QUESTION 1 A Kotlin source file is compiled into a .class file containing _____. a. Java b. text c. a Kotlin class d. bytecode QUESTION
QUESTION 1
A Kotlin source file is compiled into a .class file containing _____.
a. | Java | |
b. | text | |
c. | a Kotlin class | |
d. | bytecode |
QUESTION 2
If total = 20, which expression is true?
a. | total in 10..20 && total > 50 | |
b. | total !in 10..20 || total > 50 | |
c. | total in 10..20 || total > 50 | |
d. | total < 10 || total > 50 |
QUESTION 3
What function call prints 4?
fun test(x: Int, y: Int) { println(x - y) }
a. | test(-4) | |
b. | test(4) | |
c. | test(1, 5) | |
d. | test(5, 1) |
QUESTION 4
What does the code print?
val sum = 5 + 2 println("${sum % 2} + 3")
a. | 4 | |
b. | 1 + 3 | |
c. | 3.5 + 3 | |
d. | $7 % 5 |
QUESTION 5
What is missing to print the numbers 10, 11, 12, 13, 14, 15?
for (_____) { println(count) }
a. | count in 10..15 | |
b. | var count 10 to 15 | |
c. | count = 10; count <= 15; count++ | |
d. | count < 16 |
QUESTION 6
What is assigned to sum?
val x = 4 val sum = x + 2 * x
a. | 2 | |
b. | 12 | |
c. | 20 | |
d. | 32 |
QUESTION 7
Which function is a valid single-expression function?
a. |
fun getSum(x: Int, y: Int) = "Sum is ${x + y}"
| |
b. |
fun getSum(x: Int, y: Int) = return "Sum is ${x + y}"
| |
c. |
fun getSum(x: Int, y: Int) = { "Sum is ${x + y}" }
| |
d. |
fun getSum(x: Int, y: Int): String { return "Sum is ${x + y}"; }
|
QUESTION 8
What does the code segment print to the screen?
val auto = "Civic" println("auto $auto")
a. | auto $auto | |
b. | Civic auto | |
c. | auto Civic | |
d. | Civic $Civic |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started