Bird
0
0

In Kotlin, which function outputs text and keeps the cursor on the same line?

easy📝 Conceptual Q2 of 15
Kotlin - Basics and JVM Runtime
In Kotlin, which function outputs text and keeps the cursor on the same line?
Awrite()
Bprintln()
Cprintf()
Dprint()
Step-by-Step Solution
Solution:
  1. Step 1: Understand print()

    The print() function outputs text without appending a newline character.
  2. Step 2: Understand println()

    The println() function outputs text and moves the cursor to the next line.
  3. Final Answer:

    print() keeps the cursor on the same line -> Option D
  4. Quick Check:

    print() does not add a newline [OK]
Quick Trick: print() outputs without newline, println() adds newline [OK]
Common Mistakes:
MISTAKES
  • Confusing print() with println()
  • Assuming printf() exists in Kotlin
  • Thinking write() is a Kotlin print function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes