Sample Questions and Answers
Which Python statement is used to handle exceptions?
A) try/except
B) while/error
C) do/rescue
D) loop/fail
Answer: A) try/except
Explanation: try/except handles runtime errors gracefully in Python.
Which Git command creates a new branch?
A) git branch new-branch
B) git create new-branch
C) git new-branch
D) git make branch
Answer: A) git branch new-branch
Explanation: This command creates a new branch in your local repository.
Which Cisco platform helps developers build and test network applications?
A) DevNet Sandbox
B) Packet Tracer
C) Cisco Meraki Dashboard
D) UCS Manager
Answer: A) DevNet Sandbox
Explanation: Cisco DevNet Sandbox offers a virtual environment to test APIs and automation workflows.
What is an Ansible playbook?
A) A YAML file that defines automation tasks
B) A log file
C) A Python script
D) A container image
Answer: A) A YAML file that defines automation tasks
Explanation: Playbooks contain instructions to automate configuration, deployment, and other tasks.
Which function is used to get input from users in Python?
A) input()
B) get()
C) ask()
D) fetch()
Answer: A) input()
Explanation: input() reads a line from input and returns it as a string.
Which of these is an open-source automation platform?
A) Ansible
B) Outlook
C) MySQL
D) Azure
Answer: A) Ansible
Explanation: Ansible is an open-source tool for automating infrastructure and application deployment.
What is the correct syntax to import the math module in Python?
A) import math
B) load math
C) include math
D) require math
Answer: A) import math
Explanation: This is the standard way to import built-in or external modules in Python.
What command shows a summary of Git changes to be committed?
A) git status
B) git show
C) git commit
D) git log
Answer: A) git status
Explanation: git status provides information about the working directory and staging area.
What does return do in a Python function?
A) Sends a value back to the caller
B) Exits the program
C) Starts a loop
D) Prints to console
Answer: A) Sends a value back to the caller
Explanation: return terminates a function and optionally returns a value.
Which HTTP method retrieves resource data without modifying it?
A) GET
B) POST
C) PUT
D) DELETE
Answer: A) GET
Explanation: GET requests retrieve data and do not alter server state.
What is the output of len([1, 2, 3, 4]) in Python?
A) 4
B) 3
C) 5
D) 0
Answer: A) 4
Explanation: len() returns the number of items in a list, which is 4 in this case.
What Git command combines changes from another branch into the current one?
A) git merge
B) git clone
C) git init
D) git commit
Answer: A) git merge
Explanation: git merge integrates changes from one branch into another.
What data type is returned by input() in Python?
A) String
B) Integer
C) Float
D) Boolean
Answer: A) String
Explanation: input() always returns a string, even if the user types a number.
Which keyword is used to define a function in Python?
A) def
B) func
C) method
D) define
Answer: A) def
Explanation: def is used to declare a function in Python.
What does the elif keyword in Python mean?
A) Else if
B) End loop
C) Evaluate if
D) Else inside function
Answer: A) Else if
Explanation: elif is short for “else if” and is used to test multiple conditions.
Which Python data structure is best for ensuring unique elements?
A) Set
B) List
C) Tuple
D) Dictionary
Answer: A) Set
Explanation: Sets automatically discard duplicate values, ensuring all elements are unique.
What does pip stand for in Python?
A) Pip Installs Packages
B) Python Interpreter Program
C) Package Integration Protocol
D) Python Indexed Platform
Answer: A) Pip Installs Packages
Explanation: pip is the standard package manager for Python, used to install and manage libraries.
In Git, what does git clone do?
A) Copies a remote repository locally
B) Creates a new branch
C) Updates files
D) Stages changes for commit
Answer: A) Copies a remote repository locally
Explanation: git clone downloads an entire repository to your local system.
What is the role of the __name__ == “__main__” condition in Python?
A) It checks if a script is run directly
B) It defines global variables
C) It initializes packages
D) It imports libraries
Answer: A) It checks if a script is run directly
Explanation: This condition lets you write code that executes only if the script is run directly.
Which HTTP method is typically used to update an existing resource entirely?
A) PUT
B) POST
C) PATCH
D) GET
Answer: A) PUT
Explanation: PUT replaces the entire resource at a specified URI.
What is a webhook?
A) A user-defined HTTP callback
B) A Git command
C) A Cisco SDK function
D) A type of VPN
Answer: A) A user-defined HTTP callback
Explanation: Webhooks are triggered by events and send real-time data to other systems.
What does CRUD stand for in REST APIs?
A) Create, Read, Update, Delete
B) Connect, Route, Use, Deliver
C) Create, Run, Upload, Debug
D) Clone, Retrieve, Use, Deploy
Answer: A) Create, Read, Update, Delete
Explanation: CRUD operations form the foundation of persistent storage interaction via APIs.
Which tool allows you to simulate and test Cisco API calls in a browser?
A) API Console
B) SwaggerHub
C) Cisco DevNet API Explorer
D) Postman
Answer: C) Cisco DevNet API Explorer
Explanation: The API Explorer provides a graphical interface to test Cisco APIs interactively.
What does the requests.get() function in Python do?
A) Sends a GET request to a specified URL
B) Starts a server
C) Encrypts a message
D) Loads a file
Answer: A) Sends a GET request to a specified URL
Explanation: requests.get() is part of the requests library for handling HTTP in Python.
What is a JSON Web Token (JWT) used for?
A) Secure user authentication
B) Encrypt database traffic
C) Generate SSH keys
D) Scan networks
Answer: A) Secure user authentication
Explanation: JWTs are used to transmit secure claims between parties, often for authentication.
Which language is used to write Ansible playbooks?
A) YAML
B) JSON
C) Python
D) XML
Answer: A) YAML
Explanation: Ansible playbooks are written in YAML due to its readability and simplicity.
Which of the following HTTP status codes means “Unauthorized”?
A) 401
B) 403
C) 404
D) 500
Answer: A) 401
Explanation: 401 indicates that the request lacks valid authentication credentials.
What is the primary purpose of using virtualization in DevNet environments?
A) Isolate environments for testing
B) Increase network speed
C) Create new IP addresses
D) Manage DNS zones
Answer: A) Isolate environments for testing
Explanation: Virtualization helps create separate environments to safely test changes and code.
Which command is used to initialize a new Git repository?
A) git init
B) git start
C) git create
D) git setup
Answer: A) git init
Explanation: git init creates an empty Git repository in the current directory.
What does Cisco DNA Center primarily manage?
A) Enterprise networks
B) Cloud applications
C) Servers
D) Wireless keyboards
Answer: A) Enterprise networks
Explanation: Cisco DNA Center provides automation and assurance across enterprise networks.
What Python structure is best for storing key-value pairs?
A) Dictionary
B) List
C) Set
D) Tuple
Answer: A) Dictionary
Explanation: Dictionaries store data in key-value pairs, ideal for mappings.
What does REST stand for?
A) Representational State Transfer
B) Remote Standard Transmission
C) Regional Service Template
D) Routed Encryption Service Technology
Answer: A) Representational State Transfer
Explanation: REST is an architectural style for designing networked applications.
What is the purpose of the except block in Python?
A) Handle exceptions
B) Define variables
C) Import modules
D) Create loops
Answer: A) Handle exceptions
Explanation: except defines code to execute if an error occurs in the try block.
In Python, what is the result of 3 * ‘Dev’?
A) DevDevDev
B) Dev3
C) Error
D) 3Dev
Answer: A) DevDevDev
Explanation: Strings can be multiplied in Python, repeating the string n times.
What is the purpose of using version control systems like Git?
A) Track and manage code changes
B) Monitor network latency
C) Convert IP addresses
D) Run background processes
Answer: A) Track and manage code changes
Explanation: Git helps developers track, manage, and collaborate on code changes efficiently.
What does int(“100”) return in Python?
A) 100
B) “100”
C) Error
D) 1.00
Answer: A) 100
Explanation: The string “100” is converted into the integer 100.
What is the primary use of RESTCONF in network programmability?
A) A protocol for accessing YANG data using REST APIs
B) A CLI command
C) A network sniffing tool
D) A router configuration format
Answer: A) A protocol for accessing YANG data using REST APIs
Explanation: RESTCONF allows applications to access YANG-modeled data via HTTP methods.
Which Python loop structure runs a block of code while a condition is true?
A) while
B) for
C) loop
D) until
Answer: A) while
Explanation: The while loop executes as long as the condition evaluates to True.
What tool helps package Python projects for distribution?
A) setuptools
B) Git
C) Jenkins
D) Bash
Answer: A) setuptools
Explanation: setuptools is used to package and distribute Python projects.
Which HTTP status code means “OK”?
A) 200
B) 201
C) 204
D) 400
Answer: A) 200
Explanation: 200 indicates a successful request.
In Ansible, what does the hosts: directive specify?
A) Target machines to run tasks on
B) Variable files
C) Playbook roles
D) Output format
Answer: A) Target machines to run tasks on
Explanation: hosts: identifies which inventory hosts the playbook tasks will be executed on.
What does Python’s type() function do?
A) Returns the data type of an object
B) Checks syntax
C) Converts data
D) Types characters
Answer: A) Returns the data type of an object
Explanation: type() tells you the class or type of a Python variable.
Which of the following tools is used for container orchestration?
A) Kubernetes
B) Git
C) Jenkins
D) Netmiko
Answer: A) Kubernetes
Explanation: Kubernetes automates the deployment, scaling, and management of containerized applications.
What is __pycache__ in Python?
A) Stores compiled bytecode
B) A virtual environment
C) A requirements file
D) A test folder
Answer: A) Stores compiled bytecode
Explanation: Python saves bytecode in __pycache__ to optimize performance.
What is the role of Netmiko in network automation?
A) SSH library for interacting with network devices
B) Network monitoring dashboard
C) REST API builder
D) Ansible module
Answer: A) SSH library for interacting with network devices
Explanation: Netmiko simplifies SSH connections to network devices for automation.
Reviews
There are no reviews yet.