




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This exam evaluates candidates on their ability to use Scala in cloud-based data engineering solutions. It emphasizes distributed computing, Spark optimization, data streaming, advanced ETL pipeline design, big data storage, and security. Candidates are expected to demonstrate their expertise in functional programming with Scala, integrated into modern cloud platforms such as AWS, Azure, and GCP.
Typology: Exams
1 / 181
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. In Scala, which keyword is used to define an immutable data structure? A) var B) val C) def D) mutable Answer: B Explanation: The keyword 'val' defines an immutable variable in Scala, meaning once assigned, its value cannot be changed. 'var' is mutable, 'def' defines a method, and 'mutable' is not a Scala keyword. Question 2. What is the primary advantage of pure functions in Scala? A) They modify external states
B) They produce side effects C) They are deterministic and easier to test D) They are less reusable Answer: C Explanation: Pure functions always produce the same output for the same inputs and have no side effects, making them deterministic and easier to test and reason about. Question 3. Which Scala construct allows passing functions as arguments? A) Classes B) Traits C) Higher-order functions D) Objects
Question 5. What is the primary purpose of traits in Scala? A) To define concrete classes B) To enable multiple inheritance C) To create mutable data structures D) To manage state Answer: B Explanation: Traits in Scala serve as interfaces with implemented behavior, allowing classes to inherit multiple traits, thus supporting mixin composition and multiple inheritance. Question 6. Which Scala feature allows for type inference? A) Explicit type annotations only B) The compiler deduces variable types automatically
C) Requires manual type declaration for all variables D) Only used in Java interoperability Answer: B Explanation: Scala's type inference allows the compiler to deduce the type of variables based on assigned values, reducing verbosity. Question 7. Which of the following demonstrates covariance in Scala's type system? A) List[Animal] is a subtype of List[Dog] B) Array[Dog] is a subtype of Array[Animal] C) List[Dog] is a subtype of List[Animal] D) Map[String, Dog] is a subtype of Map[String, Animal] Answer: C
Question 9. Which pattern matching expression correctly extracts values from a case class? A) match { case Person(name, age) => ... } B) case class Person(name: String, age: Int) C) if Person => ... D) def matchPerson(p: Person) = ... Answer: A Explanation: The pattern 'case Person(name, age)' matches a Person object and extracts its fields for use within the case block. Question 10. Which Scala collection is immutable by default? A) List B) ArrayBuffer
C) HashMap D) mutable.ListBuffer Answer: A Explanation: 'List' in Scala is immutable by default, meaning its contents cannot be changed after creation. Question 11. How does the Option type help in Scala? A) It manages null values explicitly B) It replaces try-catch blocks C) It handles side effects D) It simplifies concurrency Answer: A
A) libraryDependencies B) dependencies C) buildDependencies D) projectDependencies Answer: A Explanation: 'libraryDependencies' in build.sbt declares external dependencies required for the project. Question 14. Which statement correctly creates a multi-module project in SBT? A) Define multiple project blocks in build.sbt B) Use multiple build.sbt files in separate directories C) Use only one project per SBT build
D) Multi-module projects are unsupported in SBT Answer: A Explanation: In SBT, multiple modules are defined within a single build by specifying multiple project blocks, each representing a module. Question 15. Which method in Spark is used to trigger execution of transformations? A) collect() B) count() C) cache() D) The transformations are lazy and only execute upon an action Answer: D Explanation: Spark transformations are lazy; they only execute when an action like 'collect()' or 'count()' is called.
B) Dataset C) RDD D) List Answer: C Explanation: RDDs (Resilient Distributed Datasets) provide low-level, fault- tolerant distributed data structures suitable for fine-grained transformations. Question 18. How does Spark optimize query execution? A) By executing all transformations immediately B) By creating a physical and logical plan and applying optimizations C) By ignoring data partitioning D) By executing transformations on the client side only Answer: B
Explanation: Spark builds logical and physical execution plans and applies optimizations like predicate pushdown and partition pruning. Question 19. Which file format is optimized for big data analytics and supports columnar storage? A) CSV B) JSON C) Parquet D) TXT Answer: C Explanation: Parquet is a columnar storage format optimized for analytics, enabling efficient compression and encoding.
C) Batch processing of historical data only D) Executing streaming jobs without any batching Answer: B Explanation: Micro-batching processes streaming data in small, discrete batches, enabling low-latency processing. Question 22. Which component manages fault tolerance in Spark Structured Streaming? A) Checkpointing B) Caching C) Partitioning D) Serialization Answer: A
Explanation: Checkpointing saves streaming state periodically, allowing recovery from failures and ensuring fault tolerance. Question 23. In cloud data lakes, which storage class is typically used for infrequently accessed data? A) Standard B) Archive C) Hot D) Cool Answer: B Explanation: Archive storage classes are designed for infrequently accessed data, offering lower costs at the expense of higher retrieval latency.
C) DataProc D) Synapse Answer: B Explanation: Databricks is a cloud-native managed Spark platform known for collaborative data science and engineering. Question 26. When deploying Spark on cloud platforms, which factor most influences cost management? A) Number of users B) Number of clusters and their size C) Data format D) Programming language used Answer: B
Explanation: The size and number of clusters directly impact resource consumption and costs; optimizing cluster configurations helps manage expenses. Question 27. Which tool is commonly used for orchestrating data pipelines in cloud environments? A) Jenkins B) Apache Airflow C) Maven D) Spark Answer: B Explanation: Apache Airflow provides scheduling, monitoring, and managing complex data workflows effectively.