Courseiva
Data SerializationhardMultiple SelectObjective-mapped

JNCIA-DevOps Data Serialization Practice Question

When working with PyYAML in Python for Junos automation scripts, which THREE of the following practices enhance script security and robustness? (Choose three)

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Always using yaml.safe_load() instead of yaml.load() to prevent arbitrary code execution.

Using safe loading methods, verifying file existence, and handling scanner errors properly are best practices when processing external YAML configurations.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Always using yaml.safe_load() instead of yaml.load() to prevent arbitrary code execution.

    Why this is correct

    Correct. yaml.safe_load() mitigates security vulnerabilities by restricting deserialization.

  • Catching yaml.scanner.YAMLError exceptions to handle malformed configuration syntax gracefully.

    Why this is correct

    Correct. Catching parsing exceptions prevents script crashes on bad syntax.

  • Storing unencrypted credentials directly inside YAML global anchors.

    Why it's wrong here

    Incorrect. Credentials should never be hardcoded insecurely.

  • Relying on yaml.load() to automatically execute embedded Python object constructors.

    Why it's wrong here

    Incorrect. Executing arbitrary constructors is dangerous and discouraged.

  • Using yaml.safe_dump() when generating output configurations for consistency.

    Why this is correct

    Correct. safe_dump ensures safe serialization of data structures.

About these practice questions

One of 307 original JNCIA-DevOps practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed August 2026 · checked against the official Juniper Networks exam blueprint

This JNCIA-DevOps practice question is part of Courseiva's free Juniper Networks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the JNCIA-DevOps exam.