
Cisco


200+ Cisco Interview Questions and Answers
Q1. Find Row With Maximum 1's in a Sorted 2D Matrix
You are provided with a 2D matrix containing only the integers 0 or 1. The matrix has dimensions N x M, and each row is sorted in non-decreasing order. Your objec...read more
Find the row with the maximum number of 1's in a sorted 2D matrix.
Iterate through each row of the matrix and count the number of 1's in each row.
Keep track of the row index with the maximum number of 1's seen so far.
Return the index of the row with the maximum number of 1's.
If multiple rows have the same number of 1's, return the row with the smallest index.
Q2. Intersection of Linked List Problem
You are provided with two singly linked lists containing integers, where both lists converge at some node belonging to a third linked list.
Your task is to determine the data...read more
Find the node where two linked lists merge, return -1 if no merging occurs.
Traverse both lists to find the lengths and the last nodes
Align the starting points of the lists by adjusting the pointers
Traverse both lists simultaneously until a common node is found
Q3. Next Greater Element Problem Statement
You are given an array arr
of length N
. For each element in the array, find the next greater element (NGE) that appears to the right. If there is no such greater element, ...read more
The task is to find the next greater element for each element in an array to its right, if no greater element exists, return -1.
Use a stack to keep track of elements for which the next greater element is not found yet.
Iterate through the array from right to left and update the stack accordingly.
Pop elements from the stack until a greater element is found or the stack is empty.
Q4. Rat in a Maze Problem Statement
You need to determine all possible paths for a rat starting at position (0, 0) in a square maze to reach its destination at (N-1, N-1). The maze is represented as an N*N matrix w...read more
Find all possible paths for a rat in a maze from source to destination.
Use backtracking to explore all possible paths in the maze.
Keep track of visited cells to avoid revisiting them.
Recursively try moving in all directions (up, down, left, right) until reaching the destination.
Return a list of strings representing valid paths sorted in alphabetical order.
Q5. Interleaving Two Strings Problem Statement
You are given three strings 'A', 'B', and 'C'. Determine if 'C' is formed by interleaving 'A' and 'B'.
String 'C' is an interleaving of 'A' and 'B' if the length of 'C...read more
The problem involves determining if a string is formed by interleaving two other strings while maintaining their order.
Check if the length of string C is equal to the sum of the lengths of strings A and B.
Iterate through string C and check if all characters of A and B exist in C in the correct order.
If at any point a character in C does not match the corresponding character in A or B, return False.
Return True if all characters of A and B are found in C in the correct order.
Q6. Optimal Strategy for a Coin Game
You are playing a coin game with your friend Ninjax. There are N
coins placed in a straight line.
Here are the rules of the game:
1. Each coin has a value associated with it.
2....read more
The task is to find the maximum amount you can definitely win in a game of coins against an opponent who plays optimally.
The game is played with alternating turns, and each player can pick the first or last coin from the line.
The value associated with the picked coin adds up to the total amount the player wins.
To maximize your winnings, you need to consider all possible combinations of coin picks.
Use dynamic programming to calculate the maximum amount you can win.
Keep track o...read more
Q7. Pattern Matching Problem Statement
Given a pattern as a string and a set of words, determine if the pattern and the words list align in the same sequence.
Input:
T (number of test cases)
For each test case:
patte...read more
The problem involves determining if a given pattern aligns with a list of words in the same sequence.
Iterate through the pattern and words list simultaneously to check for alignment
Use a hashmap to store the mapping between characters in the pattern and words in the list
Compare the mappings to determine if the sequence matches
Return 'True' if the sequence matches, otherwise return 'False'
Q8. Pattern Search in Strings
Given two strings S
and P
consisting of lowercase English alphabets, determine if P
is present in S
as a substring.
Input:
The first line contains an integer T
, the number of test case...read more
The task is to determine if a given substring is present in a given string.
Iterate through the string S and check if each substring of length equal to the length of P matches P.
Use string comparison to check for equality between substrings.
Return 'YES' if a match is found, otherwise return 'NO'.
Q9. Covid Vaccination Distribution Problem
As the Government ramps up vaccination drives to combat the second wave of Covid-19, you are tasked with helping plan an effective vaccination schedule. Your goal is to ma...read more
This question asks for finding the maximum number of vaccines administered on a specific day during a vaccination drive, given the total number of days, total number of vaccines available, and the day number.
Read the number of test cases
For each test case, read the number of days, day number, and total number of vaccines available
Implement a logic to find the maximum number of vaccines administered on the given day number
Print the maximum number of vaccines administered for e...read more
Q10. Apple Pickup Problem Statement
Alice has a garden represented as a ‘N’ * ‘N’ grid called ‘MATRIX’. She wants to collect apples following these rules:
1
-> Alice can pick an apple from this cell and pass throug...read more
The problem involves finding the maximum number of apples Alice can collect in a grid while following specific rules.
Create a recursive function to explore all possible paths from the starting point to the ending point while keeping track of the collected apples.
Consider the constraints and optimize the solution to avoid unnecessary computations.
Use dynamic programming to store and reuse the results of subproblems to improve efficiency.
Ensure to handle cases where there is no...read more
Q11. Snake and Ladder Problem Statement
Given a 'Snake and Ladder' board with N rows and N columns, where positions are numbered from 1 to (N*N) starting from the bottom left, alternating direction each row, find th...read more
Find the minimum number of dice throws required to reach the last cell on a 'Snake and Ladder' board.
Start from the bottom left cell and move according to dice outcomes (1-6).
Utilize snakes and ladders to reach the last cell faster.
Keep track of the minimum number of throws required to reach the last cell.
If unreachable, return -1 as output.
Q12. Problem: Search In Rotated Sorted Array
Given a sorted array that has been rotated clockwise by an unknown amount, you need to answer Q
queries. Each query is represented by an integer Q[i]
, and you must determ...read more
This is a problem where we need to search for a given number in a rotated sorted array.
The array is sorted and then rotated, so we can use binary search to find the number.
We can find the pivot point where the rotation happened and then perform binary search on the appropriate half of the array.
To find the pivot point, we can use a modified binary search algorithm.
Once we find the pivot point, we can determine which half of the array the target number lies in and perform bina...read more
Q13. How many clients are possible for a /24 address?. What is the network address and broadcast address here?
A /24 address can have 256 clients. Network address is the first IP and broadcast address is the last IP.
A /24 address has 256 IP addresses
The network address is the first IP in the range
The broadcast address is the last IP in the range
Q14. Dijkstra's Shortest Path Problem Statement
You are given an undirected graph with V
vertices (numbered from 0 to V-1) and E
edges. Each edge connects two nodes u
and v
and has an associated weight representing ...read more
Q15. Minimum Steps for a Knight to Reach Target
Given a square chessboard of size 'N x N', determine the minimum number of moves a Knight requires to reach a specified target position from its initial position.
Expl...read more
Calculate the minimum number of moves a Knight requires to reach a specified target position on a chessboard.
Use breadth-first search (BFS) algorithm to find the shortest path for the Knight.
Consider all possible moves of the Knight on the chessboard.
Keep track of visited positions to avoid revisiting them.
Return the minimum number of moves required to reach the target position.
Q16. Next Greater Number Problem Statement
Given a string S
which represents a number, determine the smallest number strictly greater than the original number composed of the same digits. Each digit's frequency from...read more
The task is to find the smallest number greater than the given number, with the same set of digits.
Iterate through the digits of the given number from right to left.
Find the first digit that is smaller than the digit to its right.
Swap this digit with the smallest digit to its right that is greater than it.
Sort the digits to the right of the swapped digit in ascending order.
If no such digit is found, return -1.
Implement Stack with Linked List
Your task is to implement a Stack data structure using a Singly Linked List.
Explanation:
Create a class named Stack
which supports the following operations, each in O(1) time:
Implement a Stack data structure using a Singly Linked List with operations in O(1) time.
Create a class named Stack with getSize, isEmpty, push, pop, and getTop methods.
Use a Singly Linked List to store the elements of the stack.
Ensure each operation runs in constant time complexity.
Handle edge cases like empty stack appropriately.
Example: If input is '5 3 10 5 1 2 4', the output should be '10 1 false'.
Q18. Cycle Detection in a Singly Linked List
Determine if a given singly linked list of integers forms a cycle or not.
A cycle in a linked list occurs when a node's next
points back to a previous node in the list. T...read more
Detect if a singly linked list forms a cycle by checking if a node's next points back to a previous node.
Use Floyd's Tortoise and Hare algorithm to detect a cycle in the linked list.
Initialize two pointers, slow and fast, and move them at different speeds to detect a cycle.
If there is a cycle, the fast pointer will eventually catch up to the slow pointer.
If the fast pointer reaches the end of the list (null), there is no cycle.
Q19. Find the Lone Set Bit
Your task is to identify the position of the only '1' bit in the binary representation of a given non-negative integer N
. The representation contains exactly one '1' and the rest are '0's....read more
Find the position of the lone '1' bit in the binary representation of a given non-negative integer.
Iterate through the bits of the integer to find the position of the lone '1'.
Use bitwise operations to check if there is exactly one '1' bit in the binary representation.
Return the position of the lone '1' or -1 if there isn't exactly one '1'.
Q20. LCA of Three Nodes Problem Statement
You are given a Binary Tree with 'N' nodes where each node contains an integer value. Additionally, you have three integers, 'N1', 'N2', and 'N3'. Your task is to find the L...read more
Q21. When would I go for a router to make two computers communicate?
A router is needed to connect two computers in different networks or to share internet connection.
When two computers are in different networks, a router is needed to connect them.
A router can also be used to share internet connection between multiple devices.
Routers can provide additional security features like firewall and VPN.
Examples of routers include Cisco, Netgear, and TP-Link.
Q22. Word Break Problem Statement
You are given a list of N
strings called A
. Your task is to determine whether you can form a given target string by combining one or more strings from A
.
The strings from A
can be u...read more
Given a list of strings, determine if a target string can be formed by combining one or more strings from the list.
Iterate through all possible combinations of strings from the list to check if they form the target string.
Use recursion to try different combinations of strings.
Optimize the solution by using memoization to store intermediate results.
Handle edge cases like empty input or target string.
Q23. Find All Pairs Adding Up to Target
Given an array of integers ARR
of length N
and an integer Target
, your task is to return all pairs of elements such that they add up to the Target
.
Input:
The first line conta...read more
Given an array of integers and a target, find all pairs of elements that add up to the target.
Iterate through the array and for each element, check if the target minus the element exists in a hash set.
If it exists, add the pair to the result. If not, add the element to the hash set.
Handle cases where the same element is used twice to form a pair.
Return (-1, -1) if no pair is found.
Q24. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
The task is to find the total number of ways to make change for a specified value using given denominations.
Use dynamic programming to solve this problem efficiently.
Create a 1D array to store the number of ways to make change for each value from 0 to the target value.
Iterate through the denominations and update the array based on the current denomination.
The final answer will be the value at the target index of the array.
Q25. Add Two Numbers Represented as Linked Lists
Given two linked lists representing two non-negative integers, where the digits are stored in reverse order (i.e., starting from the least significant digit to the mo...read more
Add two numbers represented as linked lists in reverse order and return the sum as a linked list.
Traverse both linked lists simultaneously while keeping track of carry.
Create a new linked list to store the sum digits.
Handle cases where one list is longer than the other or there is a final carry.
Remember to reverse the final linked list before returning the head.
Q26. Anagram Pairs Verification Problem
Your task is to determine if two given strings are anagrams of each other. Two strings are considered anagrams if you can rearrange the letters of one string to form the other...read more
Check if two strings are anagrams of each other by comparing their sorted characters.
Sort the characters of both strings and compare them.
Use a dictionary to count the frequency of characters in each string and compare the dictionaries.
Ensure both strings have the same length before proceeding with comparison.
Example: For input 'spar' and 'rasp', after sorting both strings, they become 'aprs' which are equal, so return True.
Q27. What is the difference between an arraylist and a linkedlist in Java?
ArrayList is a resizable array while LinkedList is a doubly linked list.
ArrayList is faster for accessing elements while LinkedList is faster for adding or removing elements.
ArrayList uses contiguous memory while LinkedList uses non-contiguous memory.
ArrayList is better for random access while LinkedList is better for sequential access.
Example: ArrayList - List
names = new ArrayList<>(); LinkedList - List names = new LinkedList<>();
Q28. What are possible security issues and How to manage Security concerns in web application
Possible security issues and how to manage them in web applications
SQL injection attacks
Cross-site scripting (XSS) attacks
Cross-site request forgery (CSRF) attacks
Insecure authentication and authorization mechanisms
Sensitive data exposure
Implementing secure coding practices
Regularly updating software and security patches
Conducting regular security audits and penetration testing
Implementing multi-factor authentication
Using HTTPS and SSL/TLS encryption
Limiting access to sensiti...read more
Q29. Spiral Matrix Problem Statement
You are given a N x M
matrix of integers. Your task is to return the spiral path of the matrix elements.
Input
The first line contains an integer 'T' which denotes the number of ...read more
Q30. Maximum Path Sum Between Two Leaves
Given a non-empty binary tree where each node has a non-negative integer value, determine the maximum possible sum of the path between any two leaves of the given tree.
Expla...read more
Find the maximum path sum between two leaf nodes in a binary tree.
Traverse the tree to find the maximum path sum between two leaf nodes
Consider both cases where the path passes through the root and where it doesn't
Keep track of the maximum sum while traversing the tree
Q31. LRU Cache Design Question
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwise, re...read more
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.
Implement a doubly linked list to maintain the order of recently used keys.
Use a hashmap to store key-value pairs for quick access.
When capacity is reached, evict the least recently used item before inserting a new item.
Update the position of a key in the linked list whenever it is accessed or updated.
Handle get and put operations efficiently to maintain the L...read more
Q32. Spiral Order Traversal of a Binary Tree
Given a binary tree with N
nodes, your task is to output the Spiral Order traversal of the binary tree.
Input:
The input consists of a single line containing elements of ...read more
Implement a function to return the spiral order traversal of a binary tree.
Traverse the binary tree in a spiral order, alternating between left to right and right to left at each level
Use a queue to keep track of nodes at each level and a flag to switch direction
Return the list of nodes in spiral order traversal
Q33. Level Order Traversal Problem Statement
Given a binary tree of integers, return the level order traversal of the binary tree.
Input:
The first line contains an integer 'T', representing the number of test cases...read more
Return the level order traversal of a binary tree given in level order with null nodes represented by -1.
Create a queue to store nodes for level order traversal
Start with the root node, enqueue it, then dequeue and print its value, enqueue its children, repeat until queue is empty
Handle null nodes represented by -1 by skipping them during traversal
Q34. Reverse Linked List Problem Statement
Given a Singly Linked List of integers, your task is to reverse the Linked List by altering the links between the nodes.
Input:
The first line of input is an integer T, rep...read more
Reverse a singly linked list by altering the links between nodes.
Iterate through the linked list and reverse the links between nodes
Use three pointers to keep track of the previous, current, and next nodes
Update the links between nodes to reverse the list
Return the head of the reversed linked list
Q35. What is the difference between an object oriented and object based language?
Object-oriented languages support inheritance and polymorphism, while object-based languages do not.
Object-oriented languages allow for the creation of classes and objects, and support inheritance and polymorphism.
Object-based languages only support objects, but do not have the concept of classes or inheritance.
Examples of object-oriented languages include Java, C++, and Python, while JavaScript is an example of an object-based language.
Q36. Maximum Size Rectangle Sub-matrix with All 1's Problem Statement
You are provided with an N * M
sized binary matrix 'MAT' where 'N' denotes the number of rows and 'M' denotes the number of columns. Your task is...read more
Find the maximum area of a submatrix with all 1's in a binary matrix.
Iterate over the matrix and calculate the maximum area of submatrices with all 1's.
Use dynamic programming to efficiently solve the problem.
Consider the current cell and its top, left, and top-left diagonal neighbors to calculate the area.
Q37. Longest Substring Without Repeating Characters Problem Statement
Given a string S
of length L
, determine the length of the longest substring that contains no repeating characters.
Example:
Input:
"abacb"
Output...read more
Find the length of the longest substring without repeating characters in a given string.
Use a sliding window approach to keep track of the longest substring without repeating characters.
Use a hashmap to store the index of each character as it appears in the string.
Update the start index of the window when a repeating character is found.
Calculate the maximum length of the window as you iterate through the string.
Return the maximum length as the result.
Q38. Explain what happens underneath when you enter a URL in the browser
Entering a URL in the browser triggers a series of events to retrieve and display the requested webpage.
The browser checks the cache for a previously stored copy of the webpage
If not found, the browser sends a request to the DNS server to resolve the domain name to an IP address
The browser then sends a request to the web server at the IP address for the webpage
The web server responds with the requested webpage
The browser renders the webpage and displays it to the user
Q39. What is virtual memory? What is its size in relation to main memory?
Virtual memory is a memory management technique that allows a computer to use more memory than physically available.
Virtual memory is created by using hard disk space as an extension of RAM.
It allows running more programs than the physical memory can handle.
The size of virtual memory is typically larger than the size of main memory.
Virtual memory is divided into pages, which are swapped in and out of main memory as needed.
Examples of virtual memory include Windows pagefile an...read more
Q40. Longest Subarray Zero Sum Problem Statement
Given an array of integers arr
, determine the length of the longest contiguous subarray that sums to zero.
Input:
N (an integer, the length of the array)
arr (list of ...read more
Find the length of the longest contiguous subarray that sums to zero in an array of integers.
Use a hashmap to store the cumulative sum and its corresponding index.
Iterate through the array, updating the sum and checking if the current sum exists in the hashmap.
If the sum exists in the hashmap, update the maximum length of subarray with sum zero.
Return the maximum length of subarray with sum zero.
Q41. Detect and Remove Loop in Linked List
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
Expected Complexity:
Aim for a...read more
Detect and remove loop in a singly linked list in place with O(n) time complexity and O(1) space complexity.
Use Floyd's Cycle Detection Algorithm to identify the loop in the linked list.
Once the loop is detected, use two pointers to find the start of the loop.
Adjust the pointers to remove the loop and return the modified linked list.
Q42. What is the difference between anycast, unicast, and multicast?
Anycast, unicast, and multicast are different ways of routing network traffic.
Unicast is one-to-one communication between a sender and a receiver.
Anycast is one-to-nearest communication where the sender sends a message to the nearest receiver.
Multicast is one-to-many communication where the sender sends a message to a group of receivers.
Anycast is used for load balancing and finding the nearest server.
Unicast is used for regular client-server communication.
Multicast is used f...read more
Q43. Subtree Node Count Problem
We are provided with a tree containing 'N' nodes, numbered from 0 to N-1. The objective is to determine the total number of nodes within each subtree of the provided tree. Specificall...read more
Given a tree, find the number of nodes in each subtree rooted at every node.
Traverse the tree using Depth First Search (DFS) to count nodes in each subtree.
Maintain a count of nodes in each subtree while traversing the tree.
Start the DFS from the root node (node 0) and recursively count nodes in each subtree.
For leaf nodes, the subtree size will be 1 (the node itself).
Q44. Minimum Cost Path Problem Statement
Given an N x M
matrix filled with integers, determine the minimum sum obtainable from a path that starts at a specified cell (x, y)
and ends at the top left corner of the mat...read more
The problem involves finding the minimum sum path from a specified cell to the top left corner of a matrix.
Start from the specified cell and calculate the minimum sum path to reach the top left corner of the matrix.
You can move down, right, or diagonally down right from any cell.
Keep track of the minimum sum obtained at each cell to determine the overall minimum sum path.
Example: For the input matrix 4 8 2, 2 5 7, 6 1 9 and starting cell 3 3, the minimum sum path is 9 -> 1 ->...read more
Q45. 1.Two routers are connected,Ospf is enabled but link is down, what are the specific methods to link up
To link up two routers with OSPF enabled but link down, specific methods include checking physical connections, verifying OSPF configurations, and troubleshooting network issues.
Check physical connections and ensure cables are properly connected and not damaged
Verify OSPF configurations and ensure that the routers are configured with the same OSPF process ID and network type
Troubleshoot network issues by checking for any network outages or misconfigurations
Use tools such as p...read more
Q46. JS Interview: How async works in javascript given that it is single threaded?
Async in JS allows non-blocking code execution despite being single-threaded.
JS uses event loop to handle async operations
Callbacks, Promises, and Async/Await are used for async programming
setTimeout() and setInterval() are examples of async functions
JS runtime delegates async tasks to the browser or Node.js environment
Async code can improve performance and user experience
Q47. In a tournament with N teams, where in one team can play only one match per day, develop an algo which schedules the matches in the tournament. Each team shall play with the other team once(same as designing th...
read moreAn algorithm to schedule matches in a tournament with N teams, where each team plays only one match per day.
Create a round-robin schedule where each team plays every other team once.
Start by assigning each team a number.
Generate a schedule by pairing teams based on their numbers.
Optimize the schedule by minimizing the number of days required.
Consider using a graph-based approach to find the optimal schedule.
Q48. Explain why MAC addresses are required despite having IP addresses
MAC addresses are required for identifying devices on a local network, while IP addresses are used for identifying devices on a global network.
MAC addresses are used for communication within a local network
IP addresses are used for communication across different networks
MAC addresses are assigned by the manufacturer and cannot be changed
IP addresses can be assigned dynamically or statically
MAC addresses are used in the data link layer of the OSI model
IP addresses are used in ...read more
Q49. What are the new flags which RSTP BPDU's introduces?
RSTP BPDU introduces two new flags: TCN and Proposal.
TCN (Topology Change Notification) flag is used to indicate a topology change in the network.
Proposal flag is used to speed up the convergence process by allowing a switch to immediately transition to the forwarding state.
TCN flag is set by the root bridge and propagated to all switches in the network.
Proposal flag is set by a switch and sent to the root bridge.
Both flags are included in the BPDU message.
TCN flag triggers a...read more
Use two wires of different lengths to measure a specific amount of time by burning them simultaneously.
Burn both wires at the same time, one wire will finish burning before the other
Measure the time it takes for the first wire to burn completely
Use this time as a reference to measure the specific amount of time by burning the second wire
Q51. main() { int *i; int s=(int *)malloc(10*sizeof(int)); for (i=0;i<10;i++) { printf(?%d?,i*i) } whats the output?
The code will not compile due to type mismatch in malloc and incorrect usage of pointers.
Use correct type casting in malloc, like int *s = (int *)malloc(10*sizeof(int));
Correct the for loop syntax to iterate over the array elements, like for (i=0; i<10; i++)
Use correct syntax for printf function, like printf("%d", i*i);
Q52. Binary Tree Traversals
You are provided with a binary tree consisting of integer-valued nodes. The task is to compute the In-Order, Pre-Order, and Post-Order traversals for the given binary tree.
Input:
The inp...read more
Compute In-Order, Pre-Order, and Post-Order traversals for a given binary tree.
Implement tree traversal algorithms like In-Order, Pre-Order, and Post-Order.
Use recursion to traverse the binary tree efficiently.
Maintain separate lists for each traversal type and return them as nested lists.
Q53. Program to print the elements of a binary tree in spiral order
Program to print binary tree elements in spiral order
Use two stacks to keep track of nodes at odd and even levels
Push nodes from left to right in odd level stack and right to left in even level stack
Pop nodes from the stack alternatively and print them
Repeat until both stacks are empty
A website sends data to a server through HTTP requests, which include the data in the request body or parameters.
When a user interacts with a website (e.g. submits a form), the website sends an HTTP request to the server.
The data can be sent in the request body (e.g. JSON or XML) or as parameters in the URL.
The server processes the request, retrieves the data, and sends a response back to the website.
Examples of data sent to a server include user input, file uploads, and API ...read more
Q55. Given two numbers m and n, write a method to return the first number r that is divisible by both (e.g., the least common multiple). ANS:Define q to be 1. for each prime number p less than m and n: find the larg...
read moreThe method returns the least common multiple (LCM) of two numbers m and n.
The method uses prime factorization to find the LCM.
It iterates through all prime numbers less than m and n.
For each prime number, it finds the largest power of the prime that divides both m and n.
The method then multiplies the current LCM by the prime raised to the maximum power.
Finally, it returns the computed LCM.
An IP address is a unique numerical label assigned to each device connected to a computer network, typically represented by 32 bits.
An IP address is used to identify and locate devices on a network.
It consists of four sets of numbers separated by periods, such as 192.168.1.1.
IPv4 addresses are 32 bits long, while IPv6 addresses are 128 bits long.
Q57. Mention the number of bits in IPv4 and IPv6 addresses
IPv4 has 32 bits and IPv6 has 128 bits.
IPv4 addresses are in the format of xxx.xxx.xxx.xxx where each xxx is an 8-bit number.
IPv6 addresses are in the format of xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx where each xxxx is a 16-bit number.
IPv6 addresses allow for a much larger number of unique addresses than IPv4.
Q58. 1. Write a program to find second largest in an integer array. 2. Write a program to find denomination to get amount as 1976 for below {2000, 1000,500,200,100,50,20,10,5,1} If Amount :1976 Then it should return...
read morePrograms to find second largest in an integer array and denomination to get amount.
For finding the second largest number, sort the array in descending order and return the second element.
For finding the denomination, loop through the array of denominations and keep dividing the amount until it becomes zero.
Use integer division to get the number of notes of each denomination.
Q59. Remove Duplicates from String Problem Statement
You are provided a string STR
of length N
, consisting solely of lowercase English letters.
Your task is to remove all duplicate occurrences of characters in the s...read more
Remove duplicate occurrences of characters in a given string.
Use a hash set to keep track of characters seen so far.
Iterate through the string and add non-duplicate characters to a new string.
Return the new string without duplicate characters.
Q60. Explain inheritance and abstraction with a concrete example
Inheritance is a way to create new classes based on existing ones. Abstraction is a way to hide implementation details.
Inheritance allows a subclass to inherit properties and methods from a superclass.
Abstraction allows a class to provide a simplified interface to its users while hiding its implementation details.
For example, a Car class can inherit properties and methods from a Vehicle class, while also implementing its own unique features.
Abstraction can be seen in a TV rem...read more
Q61. A user is unable to SSH the server, how do you troubleshoot this?
To troubleshoot SSH issue, check network connectivity, firewall settings, SSH configuration, and user permissions.
Check if the server is reachable over the network
Verify if the SSH service is running on the server
Check if the firewall is blocking SSH traffic
Verify SSH configuration on the server
Check if the user has the necessary permissions to access the server
Check SSH logs for any errors or warnings
The topic of the video I submitted for my assignment was the impact of renewable energy on reducing carbon emissions.
Discussed various sources of renewable energy such as solar, wind, and hydro power
Highlighted the benefits of transitioning to renewable energy for the environment and economy
Provided examples of countries successfully implementing renewable energy initiatives
Q63. How Does DHCP Work please describe us within 2 minutes
DHCP is a network protocol that automatically assigns IP addresses to devices on a network.
DHCP stands for Dynamic Host Configuration Protocol.
It allows devices to obtain IP addresses, subnet masks, default gateways, and other network configuration settings automatically.
DHCP uses a client-server model, where the DHCP server assigns IP addresses to clients.
The DHCP server maintains a pool of available IP addresses and leases them to clients for a specific period of time.
When ...read more
Q64. Design an algorithm that, given a list of n elements in an array, finds all the elements that appear more than n/3 times in the list. The algorithm should run in linear time ( n >=0 ) You are expected to use co...
read moreAlgorithm to find elements appearing more than n/3 times in an array in linear time
Divide the array into three equal parts
Iterate through the array and count the occurrences of each element in each part
Check if the count of any element is greater than n/3
Return the elements that meet the condition
Q65. Can you use a variable in a file using extern which is defined as both static and global in base file?
No, it is not possible to use a variable defined as both static and global in base file using extern.
A variable cannot be both static and global at the same time.
Static variables have file scope and cannot be accessed from other files using extern.
Global variables can be accessed from other files using extern, but cannot be static.
Therefore, it is not possible to use a variable defined as both static and global in base file using extern.
Q66. arrays base address is 1000?.array is a[5][4]..then what is the correct address of a[4][3]? ans:1056
The correct address of a[4][3] in the given array is 1056.
The base address of the array is 1000.
Each element in the array occupies a certain amount of memory.
To calculate the address of a specific element, we need to consider the size of each element and the dimensions of the array.
Q67. JS interview: What is event bubble and capture?
Event bubble and capture are two ways of propagating events in the DOM tree.
Event bubble is the default behavior where an event is first captured by the innermost element and then propagated to the outer elements.
Event capture is the opposite of event bubble where an event is first captured by the outermost element and then propagated to the inner elements.
Both event bubble and capture can be used together to handle events in a more controlled way.
Event.stopPropagation() meth...read more
A router is a networking device that forwards data packets between computer networks. It differs from a gateway in terms of functionality and scope.
A router operates at the network layer of the OSI model, making decisions based on IP addresses.
Routers connect multiple networks together and determine the best path for data to travel.
Gateways, on the other hand, translate between different types of networks or protocols.
Gateways operate at the application layer of the OSI model...read more
To compete with Google in search engine, focus on niche markets, improve user experience, and leverage AI technology.
Focus on niche markets where Google may not have as strong of a presence
Improve user experience by providing more relevant search results and faster load times
Leverage AI technology to personalize search results and enhance user experience
Invest in marketing and partnerships to increase visibility and user adoption
Offer unique features or services that differen...read more
Q70. How TCP works? How does it handle cognition?
TCP is a protocol that ensures reliable communication by establishing a connection, managing data transfer, and handling errors.
TCP establishes a connection between two devices before data transfer begins.
It breaks data into packets and numbers them for sequencing.
It uses acknowledgments and retransmissions to ensure all packets are received.
TCP handles flow control by adjusting the transmission rate based on receiver's capacity.
It also handles congestion control by detecting...read more
Q71. How do you implement a queue using as stacks
Implement a queue using two stacks by using one stack for enqueue operation and another stack for dequeue operation.
Use one stack for enqueue operation by pushing elements onto it.
Use another stack for dequeue operation by popping elements from it. If the dequeue stack is empty, transfer all elements from the enqueue stack to the dequeue stack.
Maintain the order of elements by transferring elements between the two stacks as needed.
MAC addresses are necessary for local network communication and are used to uniquely identify devices on a network.
MAC addresses are used at the data link layer of the OSI model to identify devices within the same local network.
IP addresses are used at the network layer to identify devices across different networks.
MAC addresses are hardcoded into network interface cards (NICs) and are used for communication within the same network segment.
MAC addresses are essential for Ethe...read more
Q73. What happens when you type google.com on your web browser?
When you type google.com on your web browser, it sends a request to Google's server and loads the website.
The browser sends a DNS request to resolve the domain name 'google.com' to an IP address
The browser establishes a TCP connection with Google's server
The browser sends an HTTP request to the server for the homepage of google.com
The server responds with the HTML code for the homepage
The browser renders the HTML code and displays the webpage
Q74. If you are not having a sizeof operator in C, how will you get to know the size of an int ?
Use the sizeof operator on a variable of type int to get its size.
Use sizeof operator on a variable of type int
Size of int is typically 4 bytes
Size may vary depending on the system architecture
Q75. When we declare union in C, how is the size of union allocated in the memory?
Size of union in C is allocated based on the size of the largest member.
The size of the union is equal to the size of the largest member.
The memory allocated for a union is shared by all its members.
Unions are used to save memory when only one member is accessed at a time.
The OSI model is a conceptual framework that standardizes the functions of a telecommunication or computing system into seven layers.
Physical Layer: Transmits raw data bits over a physical medium (e.g. Ethernet cable)
Data Link Layer: Provides error detection and correction (e.g. MAC addresses in Ethernet)
Network Layer: Routes data packets between networks (e.g. IP addresses in Internet)
Transport Layer: Ensures reliable data transfer (e.g. TCP)
Session Layer: Manages communicat...read more
Friend class and function in OOP allows specific classes or functions to access private and protected members of a class.
Friend class/function can access private and protected members of a class without violating encapsulation.
It allows for selective sharing of data between classes without exposing all members to the outside world.
Friendship is not mutual - a class can declare another class as a friend, but the other class does not automatically become a friend.
Example: In a ...read more
To measure exactly 4 liters of water, fill the 3-liter can, pour it into the 5-liter can, refill the 3-liter can, pour enough to fill the 5-liter can, leaving 1 liter in the 3-liter can, then empty the 5-liter can and pour the remaining 1 liter from the 3-liter can into the 5-liter can, finally refill the 3-liter can and pour it into the 5-liter can to get exactly 4 liters.
Fill the 3-liter can and pour it into the 5-liter can.
Refill the 3-liter can and pour enough to fill the...read more
Q79. What is the need for IPv6?
IPv6 is needed due to the exhaustion of IPv4 addresses and the need for more unique IP addresses.
IPv6 provides a significantly larger address space compared to IPv4.
It allows for the allocation of unique IP addresses to every device connected to the internet.
IPv6 supports improved security features and better network performance.
It enables the growth of Internet of Things (IoT) devices and services.
Transitioning to IPv6 ensures the long-term sustainability of the internet.
Q80. What is an arraylist in Java?
An ArrayList is a dynamic array in Java that can grow or shrink in size during runtime.
ArrayList is a class in Java's Collection framework.
It implements the List interface and allows duplicate elements.
Elements can be added or removed using methods like add(), remove(), etc.
It can also be sorted using the sort() method.
Example: ArrayList
names = new ArrayList<>(); names.add("John"); names.add("Mary"); names.remove(0);
Q81. one packet is 64bytes..no of pkts send is 16000..then total no of bytes sent is ans 1024000
Q82. Generate a spiral for given matrix in clockwise direction
Generate a spiral order traversal of a given matrix in clockwise direction
Initialize variables for top, bottom, left, right boundaries
Iterate through the matrix in a spiral order while adjusting boundaries
Add elements to the result array in the spiral order
Q83. What is the boundary problem in allocation of size of structures?
Boundary problem refers to the difficulty in deciding the optimal size of structures to allocate resources.
It involves determining the trade-off between the benefits of larger structures and the costs of building and maintaining them.
The problem is particularly relevant in fields such as architecture, civil engineering, and urban planning.
For example, in urban planning, deciding the optimal size of roads, buildings, and parks can have a significant impact on the quality of li...read more
I faced challenges in data collection, analysis, and time management during my master's thesis.
Difficulty in finding relevant research papers and data sources
Struggling with complex statistical analysis techniques
Managing time effectively to meet deadlines
Dealing with unexpected setbacks and technical issues
Balancing thesis work with other academic and personal commitments
Q85. How PING works? ICMP protocol.so add ICMP header to ip payload field and stuff.
PING works by sending ICMP echo request packets to a destination host and waiting for ICMP echo reply packets in response.
PING uses the ICMP protocol to send echo request packets to a destination host.
The destination host responds with ICMP echo reply packets if it is reachable.
PING measures the round-trip time for the packets to travel to the destination and back.
PING can also be used to check network connectivity and diagnose network issues.
Q86. what is your plan for honeymoontrip?
I am not comfortable discussing my personal life in a professional interview.
I prefer to keep my personal life separate from my professional life.
I believe in maintaining a work-life balance.
I am fully committed to my work and will prioritize it over personal matters.
I appreciate the question, but I would rather not discuss my honeymoon plans.
Q87. How to motivate a customer if case is on Escalation edge ?
Motivating a customer on escalation edge
Show empathy and understanding of their frustration
Provide regular updates on the progress of the case
Offer solutions or workarounds to mitigate the issue
Highlight the importance of resolving the issue for their business
Escalate the case to higher management if necessary
Thank them for their patience and cooperation
Q88. Difference between ArrayList and LinkedList. Different ways to iterate in list. (Syntax) List set map difference. Write an abstract class and its implementation. Challanges faced during automation. Different ty...
read moreQuestions related to Java and automation testing
ArrayList is implemented as a resizable array, while LinkedList is implemented as a doubly linked list
For loop, enhanced for loop, Iterator, ListIterator can be used to iterate through a list
List is an ordered collection, Set is an unordered collection, Map is a collection of key-value pairs
Abstract class cannot be instantiated, its implementation is done by extending it and providing implementation for its abstract methods
Chall...read more
Q89. How did you build a sourcing strategy, what were the steps?
To build a sourcing strategy, I followed these steps:
Identified the business needs and goals
Conducted market research to identify potential suppliers
Evaluated supplier capabilities and performance
Negotiated contracts and pricing
Developed a supplier relationship management plan
Monitored supplier performance and made adjustments as needed
Q90. Explain the DS which is well suited to implement UNIX commands like PWD, LS, MKDIR, CD in an imaginary OS. No code required. Just the DS
A trie data structure is well suited to implement UNIX commands like PWD, LS, MKDIR, CD in an imaginary OS.
Trie data structure allows for efficient storage and retrieval of strings, making it ideal for storing and executing UNIX commands.
Each node in the trie represents a character in the command, allowing for quick traversal and execution.
Trie can handle commands with common prefixes efficiently, reducing the overall storage and lookup time.
Example: Storing commands like 'PW...read more
Q91. A triangle ABC is given, a line DE is paralel to base side and that cuts the triangle. The ratio of area of triangle to the area of trapezium .given DE/BC=3/5
The question asks about the ratio of the area of a triangle to the area of a trapezium formed by a parallel line cutting the triangle.
The given line DE is parallel to the base side of triangle ABC.
The ratio of DE to BC is 3:5.
We need to find the ratio of the area of triangle ABC to the area of the trapezium formed by DE and the base side of the triangle.
Object Oriented Programming concepts include encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data into a single unit (class). Example: Class Car with properties like color and methods like drive().
Inheritance: Creating new classes based on existing classes, inheriting their attributes and methods. Example: Class SUV inheriting from class Car.
Polymorphism: Objects of different classes can be treated as obje...read more
Synchronization in operating systems ensures proper coordination and communication between multiple processes or threads.
Synchronization is necessary to prevent race conditions and ensure data consistency.
Common synchronization mechanisms include mutexes, semaphores, and monitors.
Mutexes allow only one thread to access a resource at a time, preventing concurrent access.
Semaphores control access to a shared resource by allowing a specified number of threads to access it.
Monito...read more
Q94. main() { int a; printf(?%d?,scanf(%d,&a)); } whats o/p of this pgm. What will be printed ans :0
The program will print 0 as the output.
The scanf function returns the number of input items successfully matched and assigned, which in this case will be 0 as there is no input provided.
The printf function will print the return value of scanf, which is 0.
Q95. Can you mention the biggest bid you conducted and what was the outcome?
I led a bid for a software implementation project worth $5 million, resulting in a successful contract with a major client.
Led bid for $5 million software implementation project
Negotiated contract terms with major client
Ensured project met client's requirements and deadlines
Q96. What are specific terms in the technology (Authentication mechanism, how they work, how servers communicate)
Authentication mechanisms in technology involve various methods for verifying the identity of users and ensuring secure communication between servers.
Authentication mechanisms include passwords, biometrics, two-factor authentication, and digital certificates.
Servers communicate using protocols such as HTTPS, SSL/TLS, SSH, and OAuth.
Authentication mechanisms work by verifying the credentials provided by the user against stored data or by generating and validating digital signa...read more
ArrayList is implemented using a dynamic array while LinkedList is implemented using a doubly linked list.
ArrayList provides fast random access but slow insertion and deletion operations.
LinkedList provides fast insertion and deletion operations but slow random access.
Example: ArrayList is suitable for scenarios where frequent access and traversal of elements is required, while LinkedList is suitable for scenarios where frequent insertion and deletion of elements is required.
Abstraction focuses on hiding implementation details, while inheritance allows a class to inherit properties and behavior from another class.
Abstraction is the concept of hiding the complex implementation details and showing only the necessary features of an object.
Inheritance is a mechanism where a new class inherits properties and behavior from an existing class.
Abstraction is achieved through interfaces and abstract classes, while inheritance is implemented using the 'exte...read more
The total amount of water on Earth is approximately 1.386 billion cubic kilometers.
The majority of Earth's water is in the form of saltwater in the oceans, accounting for about 97.5% of the total water volume.
Only about 2.5% of Earth's water is freshwater, with the majority of that being stored in glaciers and ice caps.
The total amount of water on Earth is constantly cycling through the atmosphere, oceans, rivers, and other bodies of water.
Different types of semaphores include binary semaphores, counting semaphores, and mutex semaphores.
Binary semaphores: Can only have two states - 0 or 1. Used for mutual exclusion.
Counting semaphores: Can have multiple states. Used for synchronization among multiple processes.
Mutex semaphores: Similar to binary semaphores but with additional features like priority inheritance and deletion safety.
Top HR Questions asked in Cisco
Interview Process at Cisco

Top Interview Questions from Similar Companies





