Kotlin Output Quiz

Kotlin Output Quiz

Professional Development

18 Qs

quiz-placeholder

Similar activities

De todo

De todo

1st Grade - Professional Development

16 Qs

Basics of Java

Basics of Java

University - Professional Development

20 Qs

Ultrasonic

Ultrasonic

Professional Development

15 Qs

HiTech Quiz 6

HiTech Quiz 6

Professional Development

22 Qs

Arrays

Arrays

Professional Development

20 Qs

Kotlin quiz 3

Kotlin quiz 3

Professional Development

19 Qs

Quiz 3

Quiz 3

Professional Development

19 Qs

PSC Quiz1

PSC Quiz1

University - Professional Development

20 Qs

Kotlin Output Quiz

Kotlin Output Quiz

Assessment

Quiz

Computers

Professional Development

Hard

Created by

Nisha V

FREE Resource

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? fun greet(name: String): String { return "Hello, $name" } fun main() { println(greet("Kotlin")) }

Hello Kotlin

Hello, Kotlin

greet(Kotlin)

Kotlin

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? fun sum(a: Int, b: Int): Int = a + b fun main() { val result = sum(10, 15) println(result) }

25

10 + 15

sum

0

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? fun loopTest() { for (i in 1..3) { print(i) } } fun main() { loopTest() }

123

012

1 2 3

Error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? fun operate(a: Int, b: Int, op: (Int, Int) -> Int): Int { return op(a, b) } fun main() { val result = operate(3, 4) { x, y -> x * y } println(result) }

12

7

1

0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? val square: (Int) -> Int = { it * it } fun main() { println(square(5)) }

25

10

5

Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? fun compute(op: (Int) -> Int) { println(op(3)) } fun main() { compute { it + 10 } }

13

10

3

Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? inline fun greet(block: () -> Unit) { println("Start") block() println("End") } fun main() { greet { println("Hello Inline") } }

Start Hello Inline End

Hello Inline

Start End

Error

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?