Scala Quiz | 5 Min Challenge for Scala Programming

This Scala Quiz will help you to boost your Scala knowledge and help to prepare for Scala interview.

DataFlair has published a series of Scala Quizzes from basic to advanced.

Before you start, please bookmark all quizzes and finish them before appearing for the next interview:

All The Best For Scala Quiz!!

We hope, you give all correct answers to this Scala Quiz. Have you enjoyed the Scala Quiz? Share your feedback with us!

Do not forget to share your score in the comments and challenge your friends to score more.

7 Responses

  1. jefferson says:

    Q.17. How do you turn the string “batmanstein” to the string “Man”?
    b. “batmanstein”.drop(3).take(3).capitalize
    d. “batmanstein”.drop(3).capitalize.take(3)
    b and d are correct

    • DataFlair Team says:

      Hi Jefferson,
      Thanks for the observation for Scala quiz. We already made the necessary changes.\
      Keep exploring DataFlair

  2. Paresh says:

    Q.13. Select the statements that will successfully compile and run:
    a. val msg:String = "Testing" println(msg+" a horse ");
    b. var msg="Testing" println(msg+" a test")
    c. var msg="Testing" println("msg is :"+(msg=msg+" " +msg)
    d. All of the above

    What will be output, Can you give me explanation..!

    • DataFlair Team says:

      Hello Paresh,
      Nice Catch!
      Thanks for pointing out our typo mistake in this Scala Quiz. We make all the necessary changes. Now, all the statements will execute successfully.
      Regards,
      DataFlair

  3. Archana says:

    Q.19. What does the variable x hold in the following code:
    var x,y,z=(1,2,3)
    Correct answer should be 1

  4. Alejandro says:

    Which of the following statements are true about Lists and Arrays?
    Lists are immutable
    Arrays are mutable
    Once you have declared a List, you cannot add more elements later
    All of the above

    List can add more element with the method ::

  5. DataFlair Team says:

    Hello Alejandro,
    Thanks for playing the above Scala Quiz.
    Here is the answer of your query, Scala Lists are immutable whereas arrays are mutable in Scala. For complete information you can refer our Scala list tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.