Practice Library
All MCQs
Browse exam-wise, subject-wise, and country-wise MCQs with explanations.
Choose an option to check your answer.
Correct Answer: A. Code that evaluates to a value
Explanation:
Most Scala constructs, including if blocks, are expressions.
This supports concise functional composition.
Choose an option to check your answer.
Correct Answer: D. The absence of a meaningful return value
Explanation:
Unit is similar to void in other languages.
Its sole value is written as ().
Choose an option to check your answer.
Correct Answer: C. The compiler determines a value's type from its expression
Explanation:
Scala is statically typed even when annotations are omitted.
The compiler infers types where sufficient information exists.
Choose an option to check your answer.
Correct Answer: B. def
Explanation:
Methods are introduced with def and can accept parameter lists.
Their return type may be inferred or written explicitly.
Choose an option to check your answer.
Correct Answer: A. var
Explanation:
A var can be reassigned after declaration.
Functional Scala style generally prefers val when possible.
Choose an option to check your answer.
Correct Answer: D. val
Explanation:
A val can be assigned only once.
The referenced object's internal state may still be mutable depending on its type.
Choose an option to check your answer.
Correct Answer: C. Use many existing Java libraries and runtime tools
Explanation:
Scala and Java share the JVM ecosystem.
Scala code can interoperate with Java classes in most cases.
Choose an option to check your answer.
Correct Answer: B. A language combining object-oriented and functional programming on the JVM
Explanation:
Scala compiles to Java Virtual Machine bytecode.
It is widely used with Apache Spark.
Choose an option to check your answer.
Correct Answer: A. It reveals bottlenecks, failed nodes, and underutilized capacity
Explanation:
Metrics such as CPU, memory, disk, and network usage guide tuning.
Monitoring also supports capacity planning and incident response.
Choose an option to check your answer.
Correct Answer: D. Preventing one container from exceeding its allocated resources and harming others
Explanation:
Memory and CPU controls support predictable multi-tenant operation.
Without isolation, a faulty task could monopolize a worker.
Choose an option to check your answer.
Correct Answer: C. Copying application files and resources to the node where a container will run
Explanation:
Executables, libraries, and cached files must be available locally.
The NodeManager prepares these resources before launching the process.
Choose an option to check your answer.
Correct Answer: B. Failure of the cluster's central resource-management service
Explanation:
Active and standby ResourceManagers reduce control-plane downtime.
State recovery and failover coordination support continuity.