Monday , August 15 2022
Home / cognitive class / Scala 101 Cognitive Class Exam Answers:-

Scala 101 Cognitive Class Exam Answers:-

 Course Name:- Scala 101

Scala 101 Cognitive Class  Final Exam Answers:-

Question 1. A higher-order function allows us to:

  • Be more declarative and not write “how” to perform work
  • Pass a function to a data container
  • Compose multiple transformations within a context
  • Remain immutable
  • All of the above

Question 2. How does Scala determine types when they are not specified?

  • Implicit typing
  • Type compliance
  • Type inference
  • Dynamic typing
  • Type coercion

Question 3. What are valid members in objects?

  • Class factories
  • None of the above
  • All of the above
  • Utility methods
  • Constant definitions

Question 4. What do default values and named parameters help you avoid in your code?

  • Method overriding
  • Singleton instances
  • Method overloading
  • Type declarations
  • None of the above

Question 5. What does the Scala REPL stand for?

  • Read, Evaluate and Print Loop
  • React, Evaluate and Print Loop
  • React, Emulate and Print Loop
  • Read, Emulate and Print Loop
  • Read, Emulate and Process Loop

Question 6. What is not true about class parameters?

  • They are automatically immutable
  • You must specify their type
  • They live for the life of the class
  • They are visible to outsiders
  • None are true

Question 7. What is the maximum number of elements in a tuple?

  • 22
  • 11
  • 2
  • 32
  • 12

Question 8.  What keyword does not exist in Scala?

  • new
  • val
  • implicit
  • for
  • static

Question 9. Which accessibility rule is not true?

  • private is visible within a package
  • private does not allow outsiders to see a field
  • public does allow outsiders to see a field
  • public is not visible outside of a package
  • All are true

Question 10. Which are valid collection types in the Scala standard library?

  • Vector
  • ByteSet
  • HashSeq
  • LinkedSet
  • All are valid

Question 11. Which collection type has effectively constant time performance characteristics for all operations?

  • Vector
  • Stream
  • HashMap
  • List
  • Array

Question 12. Which combination is thread-safe?

  • val and mutable data
  • var and mutable data
  • var and immutable data
  • val and immutable data
  • None are thread-safe

Question 13. Which feature is not synthetically generated for case classes?

  • Companion object
  • clone method
  • equals method
  • apply and unapply
  • All are generated

Question 14. Which is not a valid data container type in Scala?

  • Try
  • Future
  • Companion object
  • Option
  • None of the above

Question 15. Which is the top-most collection type in the Scala collections hierarchy?

  • Interpretable
  • Transformable
  • Iterable
  • Traversable
  • Observable

Question 16. Which keyword constructs a new instance of a class?

  • make
  • new
  • instance
  • create
  • None of the above

Question 17. Which language cannot be compiled to run on the JVM?

  • JRuby
  • C
  • Clojure
  • Scala
  • Java

Question 18. Which language features are true about Scala?

  • Statically typed
  • Multi-Platform
  • Object-Oriented
  • Functional
  • All of the above

Question 19. Which statement is not true about infix notation?

  • You can omit parentheses
  • You can use it when you pass multiple parameters
  • You can use it with symbolic method names (+, -, etc)
  • All are true
  • None are true

Quesstion 20. Which statement is true about field and method evaluation?

  • Fields are evaluated at the call site, methods are evaluated at construction
  • Fields are evaluated at construction, methods are evaluated at the call site
  • Fields and methods are evaluated at construction
  • Fields and methods are evaluated at the call site
  • None of the above

About Machine Learning

Check Also

Python for Data Science Cognitive Class Exam Answers:-

Course Name:- Python for Data Science Module 1. Python Basics Question 1. What is the …

Leave a Reply

Your email address will not be published.