Debug School

Akanksha
Akanksha

Posted on

Top 30 YAML Interview Questions with Answers multiple choice style

1. What does YAML stand for?

a) Yet Another Markup Language
b) YAML Ain't Markup Language
c) Your Awesome Markup Language
d) YAML Markup Language
Answer: b

2. Which file extension is commonly used for YAML files?

a) .json
b) .xml
c) .yml
d) .yaml
Answer: c

3. What is the primary use of YAML?

a) Data serialization
b) Website design
c) Game development
d) File compression
Answer: a

4. In YAML, what character is used to indicate the beginning of a comment?

a) #
b) //
c) --
d) /*
Answer: a

5. Which of the following is true about YAML syntax?

a) It uses curly braces {} to define blocks.
b) It uses indentation and colons to define structure.
c) It uses square brackets [] for arrays.
d) It uses quotation marks for all values.
Answer: b

6. What does YAML support for representing lists or arrays?

a) [square brackets]
b) (parentheses)
c) {curly braces}
d) |pipe symbols|
Answer: a

7. In YAML, how do you represent a key-value pair?

a) key = value
b) key: value
c) key => value
d) key :: value
Answer: b

8. Which YAML data type is used to represent a string with special characters preserved?

a) String
b) Scalar
c) Literal
d) Text
Answer: c

9. What is the purpose of anchors and aliases in YAML?

a) To create loops in the YAML structure
b) To reference the same data in multiple places
c) To specify the end of a YAML document
d) To add metadata to YAML documents
Answer: b

10. What is the role of the YAML document separator "---"?

a) It indicates the end of a YAML document.
b) It specifies the beginning of a new YAML document.
c) It is used to create nested structures.
d) It represents a comment in YAML.
Answer: b

11. In YAML, how do you include multi-line strings?

a) Using double quotes
b) Using single quotes
c) Using the '>' symbol
d) Using square brackets
Answer: c

12. What is a YAML alias?

a) A reference to another YAML document
b) A way to create loops in YAML structures
c) A named anchor for a value
d) A way to include external files in YAML
Answer: c

13. Which YAML data type is used for representing null or empty values?

a) void
b) nil
c) None
d) null
Answer: d

14. How do you specify a list of key-value pairs in YAML?

a) Using the sequence notation with hyphens
b) Using curly braces {}
c) Using square brackets []
d) Using the notation
Answer: a

15. What does the '>>' symbol indicate in YAML?

a) A comment
b) A mapping
c) A merge key
d) A list
Answer: c

16. Which YAML data type is used for representing dates and times?

a) Date
b) Time
c) Timestamp
d) Datetime
Answer: c

17. In YAML, how do you include a literal block of text?

a) Enclose it in single quotes ('').
b) Enclose it in double quotes ("").
c) Use the '>' symbol.
d) Use the '|' symbol.
Answer: d

18. What is the primary purpose of YAML anchors?

a) To create loops in the YAML structure
b) To mark the beginning of a YAML document
c) To reference the same data in multiple places
d) To add comments to YAML documents
Answer: c

19. Which character is used to escape special characters in a YAML string?

a) /
b)
c) |
d) &
Answer: b

20. What is the correct way to include an integer in a YAML document?

a) "42"
b) 42
c) int: 42
d) '42'
Answer: b

21. In YAML, what does the '---' marker at the beginning of a document signify?

a) A comment
b) The end of the document
c) A section separator
d) A nested document
Answer: c

22. What does the '>' character mean when used in a YAML block scalar style?

a) It indicates a scalar value.
b) It starts a comment.
c) It specifies a list.
d) It folds long lines of text into a single line.
Answer: d

23. In YAML, what is a mapping?

a) A way to create loops in the data structure
b) A key-value pair
c) A comment block
d) A way to include external files
Answer: b

24. Which of the following is not a valid YAML scalar type?

a) String
b) Integer
c) Float
d) Boolean
Answer: d

25. How can you represent a list of strings in YAML?

a) - Item1, Item2
b) ["Item1", "Item2"]
c) (Item1, Item2)
d) {Item1, Item2}
Answer: b

26. What is the primary use of the '<<' merge key in YAML?

a) To merge multiple YAML documents into one
b) To create a new YAML document
c) To indicate a nested structure
d) To define a comment
Answer: a

27. Which of the following is a valid YAML comment?

a) // This is a comment
b) # This is a comment
c) /* This is a comment /
d) -- This is a comment
**Answer: b
*

28. What is the significance of the '---' marker at the end of a YAML document?

a) It marks the end of the document.
b) It indicates a comment.
c) It is used to add metadata.
d) It specifies the beginning of a new document.
Answer: a

29. In YAML, how do you represent a boolean value?

a) "true" or "false"
b) true or false
c) 1 or 0
d) on or off
Answer: b

30. Which YAML data type is used for representing a block of text with preserved line breaks and formatting?

a) String
b) Scalar
c) Literal
d) Text
Answer: c

Top comments (0)