Bird
0
0

You want to print the numbers 1, 2, and 3 on the same line separated by spaces, then print "Done" on the next line. Which Kotlin code achieves this?

hard📝 Application Q15 of 15
Kotlin - Basics and JVM Runtime
You want to print the numbers 1, 2, and 3 on the same line separated by spaces, then print "Done" on the next line. Which Kotlin code achieves this?
Aprint("1 2 3") print("Done")
Bprint("1 2 3") println("Done")
Cprint("1 ") print("2 ") print("3\n") println("Done")
Dprintln("1") println("2") println("3") print("Done")
Step-by-Step Solution
Solution:
  1. Step 1: Print numbers on same line with spaces

    Using print("1 2 3") outputs "1 2 3" on the same line.
  2. Step 2: Print "Done" on next line

    println("Done") prints "Done" and moves to the next line.
  3. Final Answer:

    print("1 2 3") println("Done") -> Option B
  4. Quick Check:

    Use print for same line, println for new line = A [OK]
Quick Trick: Use print for same line, println to move to next line [OK]
Common Mistakes:
MISTAKES
  • Using println for each number causing new lines
  • Using print after println without newline
  • Adding \n inside print incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes