Top 300 YAML MCQ Questions and Answers Quiz

YAML Multiple Choice Questions

1. What does YAML stand for?
a) Yummy Ain’t Markup Language
b) YAML Ain’t Markup Language
c) Yams Ain’t Markup Language
d) Your Ain’t Markup Language

Answer: b) YAML Ain’t Markup Language

2. What is the file extension for YAML files?
a) .yaml
b) .yml
c) .xml
d) .json

Answer: b) .yml

3. Which of these is NOT a valid YAML data type?
a) Integer
b) Float
c) Boolean
d) Date

Answer: d) Date

4. How do you indicate a comment in YAML?
a) //
b) #
c) /* */
d)

Answer: b) #

5. Which symbol is used to indicate a key-value pair in YAML?
a) :
b) =
c) ->
d) ~

Answer: a) :

YAML MCQs

6. What is the proper indentation syntax in YAML?
a) Spaces only
b) Tabs only
c) Either spaces or tabs
d) No indentation required

Answer: a) Spaces only

7. How do you define a sequence in YAML?
a) [item1, item2]
b) (item1, item2)
c) <item1, item2>
d) {item1, item2}

Answer: a) [item1, item2]

8. What syntax indicates a mapping in YAML?
a) [key: value]
b) (key: value)
c) {key: value}

Answer: c) {key: value}

9. Which of these is an invalid YAML file?
a) key: value

b)key: value

c)#comment
key: value

d)key: value
key2: value2

Answer: d)

10. How do you define a YAML alias?
a) *=
b) @_
c) &
d) ~

Answer: b) @_

11. What does this YAML code produce?
foo: &foo
hello: world

bar: <<: *foo

a) Error, invalid syntax
b) {“foo”:{“hello”:”world”},”bar”:null}
c) {“foo”:{“hello”:”world”},”bar”:{“hello”:”world”}}
d) {“foo”:”hello”,”bar”:”world”}

Answer: c)

12. What does this YAML produce?
values:

one
two
three
a) [“one”, “two”, “three”]
b) {“values”: [“one”, “two”, “three”]}
c) (one, two, three)
d) {one, two, three}

Answer: b)

13. Which data types can a YAML file contain?
a) Only strings
b) Only predefined types
c) Any valid JSON types
d) Any custom types

Answer: d)

14. What is the purpose of anchor and alias in YAML?
a) Importing data
b) Merging files
c) Referencing data
d) Exporting data

Answer: c)

15. Which syntax indicates a YAML document header?
a) ~~~
b) !!!
c) —
d) ###

Answer: c) —

16. What does this YAML produce?
object:
foo: bar
baz:
– one
– two

a) Error, invalid syntax
b) {“object”:{“foo”:”bar”, “baz”: [“one”,”two”]}}

c) {“foo”:”bar”, “baz”: [“one”,”two”]}
d) {“object”: “bar”, “baz”: [“one”,”two”]}

Answer: b)

17. Which function does load() provide in Python for YAML?
a) Loads YAML file
b) Validates YAML string
c) Converts YAML to JSON
d) Prints formatted YAML

Answer: a) Loads YAML file

18. What library is required to parse YAML in Python?
a) json
b) pprint
c) pyaml
d) yaml

Answer: d) yaml

19. What is the purpose of the YAML directive %TAG !?
a) Declares a custom data type
b) Sets global YAML version
c) Disables tag processing
d) Includes external YAML file

Answer: a) Declares a custom data type

20. How do you indicate a literal block scalar in YAML?
a) |
b) >
c) !!str
d) #

Answer: b) >

—–> Click here for Interview Questions
——> Click here for Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *