Exam 350-401 All QuestionsBrowse all questions from this exam
Question 821

Refer to the exhibit. What is printed to the console when this script is run?

    Correct Answer: D

    The provided Python script defines a dictionary named 'vlans' containing three key-value pairs. The 'vlans_key' function iterates over the keys of the dictionary, converting both the keys and their corresponding values to strings and printing them in the format 'key value', with a space separating the key and value. This results in string representations of the key-value pairs being printed to the console. Therefore, the output consists of key-value pairs in string format.

Discussion
HorsefeathersOption: D

Here is the output of the Python program: ``` vlan10 192.168.1.0 vlan20 192.168.2.0 vlan30 192.168.3.0 ``` A string representation of key-value pairs with a space separating the key and value.

SeMo0o0oOption: D

D is correct vlan10: 192.168.1.0 vlan20: 192.168.2.0 vlan30: 192.168.3.0 Each line represents a key-value pair concatenated as a string. ................

SeMo0o0oOption: D

D is correct

MarcinkoOption: A

def main(): vlans = {'vlan10':'192.168.1.0','vlan20':'192.168.2.0','vlan30':'192.168.3.0'} vlans_key(vlans) def vlans_key(vlans): for key in vlans.keys(): print(str(key) + ' ' + str(vlans[key])) if __name__ == '__main__': main()