Cisco
300+ Interview Questions and Answers
You are given a 2D matrix (containing either ‘0’ or ‘1’) of size N x M, where each row is in sorted order. Find the 0-based index of the first row that has the maximum number of...read more
You are given two Singly Linked List of integers, which are merging at some node of a third linked list.
Your task is to find the data of the node at which merging starts. If there is...read more
You are given three strings 'A', 'B' and 'C'. Check whether 'C' is formed by an interleaving of 'A' and 'B'.
'C' is said to be interleaving 'A' and 'B', if the length of 'C' is equal to ...read more
You are given a pattern in the form of a string and a collection of words. Your task is to determine if the pattern string and the collection of words have the same order.
Note :
The strings are...read more
You and your friend Ninjax are playing a game of coins. Ninjax place the 'N' number of coins in a straight line.
The rule of the game is as follows:
1. Each coin has a value associate...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
You are given an array arr of length N. You have to return a list of integers containing the NGE(next greater element) of each element of the given array. The NGE for an element X is the fir...read more
You are given a starting position for a rat which is stuck in a maze at an initial point (0, 0) (the maze can be thought of as a 2-dimensional plane). The maze would be given in the form of a squar...read more
Explain all the seven layers of OSI Model in detail.
If I have 4 devices in the network and I want to send my data from server to these devices then which data structure would be best for it.
I...read more
Alice always loves to visit her garden and collect apples. The garden can be represented in the form of ‘N’ * ’N’ grid say ‘MATRIX’, where each cell of the grid can have one of the possible values:
...read moreYou are given two strings 'S' and 'P' consisting of lowercase English alphabets. Your task is to find whether the 'P' is present in 'S' as a substring or not.
Note
1. There may be more tha...read more
You have been given a Snake and Ladder Board with 'N' rows and 'N' columns with the numbers written from 1 to (N*N) starting from the bottom left of the board, and alternating direction each row...read more
We are suffering from the Second wave of Covid-19. The Government is trying to increase its vaccination drives. Ninja wants to help the Government to plan an effective method to help increase v...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
Given a string 'S' of length 'L', return the length of the longest substring without repeating characters.
Example:
Suppose given input is "abacb", then the length ...read more
There were 2 Problems from which we were asked to go with one.
The one I had selected was:
Given the challenges that exist in our country, using possible sensor data from future cars, derive soluti...read more
Aahad and Harshit always have fun by solving problems. Harshit took a sorted array and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4,...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
You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change fo...read more
You have given a Singly Linked List of integers, determine if it forms a cycle or not.
A cycle occurs when a node's next points back to a previous node in the list. The li...read more
You are given a single non-negative integer ‘N’ who’s binary representation consists of a single ‘1’ digit and the rest of the digits are ‘0’s. Your task is to find the position of the only...read more
You are given a list of “N” strings A. Your task is to check whether you can form a given target string using a combination of one or more strings of A.
Note :
You can use any string of A multiple tim...read more
You are given two linked lists representing two non-negative numbers. The digits in the linked list are stored in reverse order, i.e. starting from least significant digit (LSD) t...read more
Given a singly linked list, you have to detect the loop and remove the loop from the linked list, if present. You have to make changes in the given linked list itself and return the update...read more
You are given a non-empty binary tree where each node has a non-negative integer value. Return the maximum possible sum of path between any two leaves of the given tree.
The p...read more
You have been given a binary tree of 'N' nodes. Print the Spiral Order traversal of this binary tree.
For example
For the given binary tree [1, 2, 3, -1, -1, 4, 5, -1, -1,...read more
You have been given a square chessboard of size ‘N x N’. The position coordinates of the Knight and the position coordinates of the target are also given.
Your task is t...read more
You have been given an undirected graph of ‘V’ vertices (labelled from 0 to V-1) and ‘E’ edges. Each edge connecting two nodes u and v has a weight denoting the distance between them.
Yo...read more
You are given a 'N' * 'N' maze with a rat placed at 'MAZE[0][0]'. Find and print all paths that rat can follow to reach its destination i.e. 'MAZE['N' - 1]['N' - 1]'. Rat can move in any ...read more
You have been given a Binary Tree of integers. You are supposed to return the level order traversal of the given tree.
For example:
For the given binary tree
The level order traversal wil...read more
You are given a string S which represents a number. You have to find the smallest number strictly greater than the given number which contains the same set of digits as of the original number...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.
To capture the latest 20 malicious logs from a log table, which was having many logs with the time stamp on it. Also to get this logs data stored in a Data structure best suited for the use of di...read more
Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:
1. get(key) - Return the value of the key if the key exists in the cache, o...read more
Q31. 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
Pre-requisites: Anagrams are defined as words or names that can be formed by rearranging letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "r...read more
You are 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 Target.
Note:
We cannot use the element at a given inde...read more
You need to implement the Stack data structure using a Singly Linked List.
Create a class named 'Stack' which supports the following operations(all in O(1) time):
getSize: Retur...read more
It mainly consisted of computer networks and practical theory of data structure, and operating systems.
Number Of MCQs - 35
You have been given a Binary Tree of 'N' nodes where the nodes have integer values and three integers 'N1', 'N2', and 'N3'. Find the LCA(Lowest Common Ancestor) of the three nodes represented ...read more
You are given a Singly Linked List of integers. You need to reverse the Linked List by changing the links between nodes.
Input Format :
The first line of input contains a single integer T, re...read more
Given an array arr of length N consisting of positive and negative integers, return the length of the longest subarray whose sum is zero.
Input Format:
The first line of input contains ...read more
You are given an 'N' * 'M' sized binary-valued matrix 'MAT, where 'N' is the number of rows and 'M' is the number of columns. You need to return the maximum size (a...read more
You are given a N x M matrix of integers, return the spiral path of the matrix
Example Of Spiral Path
Input Format:
The first line contains an integer 'T' which denotes the number of test cases or...read more
our enemy challenges you to play Russian Roulette with a 6-cylinder pistol (meaning it has room for 6 bullets). He puts 2 bullets into the gun in consecutive slots, and leaves the next four slots blank. H...read more
You have been given a matrix of ‘N’ rows and ‘M’ columns filled up with integers. Find the minimum sum that can be obtained from a path which from cell (x,y) and ends at the top left corner (1,...read more
Q43. 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.
You are given an arbitrary tree consisting of 'N' nodes numbered from 0 to 'N' - 1. You need to find the total number of elements in all the subtrees of the given tree. In other wo...read more
Q45. 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<>();
Q46. 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
You have been given a Binary Tree of 'N' nodes, where the nodes have integer values. Your task is to find the ln-Order, Pre-Order, and Post-Order traversals of the given binary tree.
For example ...read more
Q48. 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.
Q49. 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.
Q50. 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
There is an 8 by 8 chessboard in which two diagonally opposite corners have been cut off.You are given 31 dominos, and a single domino can cover exactly two squares. Can you use the 31 dominos to cover th...read more
Q52. 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
Q53. 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
he game of Tic-Tac-Toe is being played between two players and it is in below state after six moves.
X | O |
X | |
O | O | X
Who will win the game, O or X?
Q55. 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
You are given a string (STR) of length N, consisting of only the lower case English alphabet.
Your task is to remove all the duplicate occurrences of characters in the string.
For E...read more
Q57. 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
Q58. 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
Code snippets : 7
Database & SQL : 7
Computer Science Basic :7
Computer Networks : 9
Aptitude & Reasoning : 7
Communication Based : 7
Math Problem : 7
few others from this domains only
Number Of MCQs - 55
What is an IP address and how many bits are required to represent an IP address?
This was a Machine learning problem. I was given a scenario where I had a dataset of many users with their likes and dislikes for many movies. Now given a user with some information about his ...read more
Q62. 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
Q63. main() { int *i; int s=(int *)malloc(10*sizeof(int)); for (i=0;i<10;i++) { printf(?%d?,i*i) } whats the output?
Q64. 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.
Q65. 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
Q66. 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.
Q67. 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
Describe how a website sends data to server ?
Q69. 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
Q70. 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
Q71. 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.
What are the different types of semaphores ?
Q73. 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.
Q74. 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.
What’s the Difference Between IPv4 and IPv6?
What is the use of a router and how is it different from a gateway?
How do beat Google if u want to make a search engine?
Q78. 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
What happens when you boot your system?
How does C++ support Polymorphism?
Explain why MAC addresses are required despite having IP addresses
Q82. 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
What is deadlock? How to prevent deadlock?
Q84. 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
Q85. 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.
What is the Difference Between Abstraction and Inheritance?
Why do we need the Friend class and function?
What is Priority Inversion?
What happens when you enter Google.com on the web browser.
What is the difference between anycast, unicast, and multicast?
What is Memory Protection in OS ?
Q92. one packet is 64bytes..no of pkts send is 16000..then total no of bytes sent is ans 1024000
Q93. 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
Q94. 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
Q95. 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
Q96. 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.
What is the ARP protocol?
Q98. 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
1. Why have you used this particular technology stack in project?
Q100. 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
Top HR Questions asked in null
Interview Process at null
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month