Cisco Interview Questions
Practice with real Cisco interview questions
01
A Software Engineer was asked
Asked in 2024
Q. How can you manipulate strings in Python? Please demonstrate with examples of common operations such as reversal, concatenation, and finding a substring.
Ans. String manipulation is a fundamental aspect of programming in Python. Here are some common operations:
1. Reversing a String:
You can reverse a string using slicing:
2. Concatenation:
** You can concatenate strings using the
+ operator:**
3. Finding a Substring:
You can check if a substring exists in a string using the in keyword:
These examples demonstrate Python's ease of string manipulation while effectively handling basic operations.Software EngineerCore Concept
02
A Software Engineer was asked
Asked in 2024
Q. Explain the data structures stacks and queues. Provide a code example that implements both using arrays in JavaScript.
Ans. Stacks and queues are fundamental data structures used to store collections of elements. A stack follows the Last In First Out (LIFO) principle, whereas a queue follows the First In First Out (FIFO) principle.
Here’s an implementation of both using arrays in JavaScript:
In this example, the
Stack class provides methods to push, pop, and peek at elements, while the Queue class provides methods to enqueue, dequeue, and check the front element. Edge cases such as popping from an empty stack or dequeuing from an empty queue return null, which can be handled in application logic. This implementation demonstrates the fundamental operations of both data structures effectively.
Software EngineerCore Concept
