Power Programmer
20+ Power Programmer Interview Questions and Answers

Asked in Infosys

Q. You are given a sequence of N integers, a[1],a[2],,,,,a[n].
Given a sequence of N integers, find the maximum sum of any contiguous subarray.
Use Kadane's algorithm to find the maximum sum subarray in O(n) time complexity.
Initialize two variables, max_so_far and max_ending_here, to track the maximum sum.
Traverse the array and update max_ending_here and max_so_far accordingly.
Return max_so_far as the answer.

Asked in Infosys

Q. Why do we need normalization in DBMS? What are its advantages and disadvantages?
Normalization in DBMS is important to reduce data redundancy and improve data integrity.
Normalization helps in organizing data in a structured manner.
It reduces data redundancy and improves data integrity.
It helps in efficient storage and retrieval of data.
Normalization can also help in avoiding update anomalies.
However, over-normalization can lead to complex queries and slower performance.
Power Programmer Interview Questions and Answers for Freshers

Asked in Infosys

Q. Difference between TCP and UDP protocol and also which is the better one.
TCP is a connection-oriented protocol while UDP is connectionless. Both have their own advantages and disadvantages.
TCP provides reliable, ordered, and error-checked delivery of data while UDP does not guarantee any of these.
TCP is slower but more reliable while UDP is faster but less reliable.
TCP is used for applications that require high reliability and accuracy while UDP is used for applications that require speed and efficiency.
Examples of TCP-based applications include e...read more

Asked in Amazon

Q. Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.
Count the number of islands in a given matrix of 0's and 1's.
Use DFS or BFS to traverse the matrix and mark visited cells.
For each unvisited cell with a value of 1, increment the island count and mark all connected 1's as visited.
Repeat until all cells have been visited.
Time complexity: O(m*n), where m and n are the dimensions of the matrix.

Asked in Infosys

Q. Find out the maximum possible average value of sub-sequences of an array a.
Find the maximum possible average value of sub-sequences of an array.
Calculate the prefix sum of the array.
Iterate through all possible sub-sequences and calculate their average.
Return the maximum average value.

Asked in Infosys

Q. What are the differences between lists and tuples in Python, including their time complexities?
List and tuple are both used to store collections of data in Python, but have different properties and time complexities.
Lists are mutable, while tuples are immutable
Lists use more memory than tuples
Lists have a variety of built-in methods, while tuples have fewer
Accessing an element in a tuple is faster than in a list
Appending to a list is faster than appending to a tuple
Power Programmer Jobs




Asked in Infosys

Q. What is the difference between the TCP/IP model and the OSI model in computer networks?
TCP/IP and OSI are two different models used for computer networks.
TCP/IP has 4 layers while OSI has 7 layers.
TCP/IP is used in the internet while OSI is used in academic and research environments.
TCP/IP is more flexible while OSI is more rigid.
TCP/IP is a practical model while OSI is a theoretical model.
Examples of TCP/IP protocols include HTTP, FTP, and SMTP while examples of OSI protocols include X.25 and ISDN.

Asked in Bounteous x Accolite

Q. What are joins? How are they useful?
Joins are used to combine data from two or more tables based on a related column.
Joins are useful for retrieving data from multiple tables that have a relationship.
There are different types of joins such as inner join, left join, right join, and full outer join.
Inner join returns only the matching rows from both tables.
Left join returns all the rows from the left table and matching rows from the right table.
Right join returns all the rows from the right table and matching row...read more
Share interview questions and help millions of jobseekers 🌟

Asked in Infosys

Q. Explain method overloading and method overriding in detail with examples.
Method overloading and overriding are two concepts in object-oriented programming that allow for the creation of multiple methods with the same name.
Method overloading is when multiple methods have the same name but different parameters.
Method overriding is when a subclass provides a specific implementation of a method that is already defined in its superclass.
Overloading is resolved at compile-time while overriding is resolved at runtime.
Example of overloading: public void p...read more

Asked in Infosys

Q. Explain block size and paging in the operating system.
Block size is the amount of data that can be stored in a single block of memory. Paging is a memory management technique used by the operating system.
Block size determines the amount of data that can be read or written to a storage device at once.
Paging divides memory into fixed-size blocks called pages.
When a program needs to access a page, the operating system loads it into memory.
This allows programs to use more memory than is physically available.
Examples of operating sys...read more

Asked in Infosys

Q. Describe the approach to find the maximum XOR subset.
Finding maximum XOR subset
Use Trie data structure to store binary representation of numbers
For each number, traverse the Trie and find the maximum XOR value
Repeat the above step for all numbers and return the maximum XOR value

Asked in TCS iON

Q. You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position. Determine if you can reach the l...
read moreThe task is to implement a jump game where each element specifies the maximum jump from that index.
Iterate through the array and keep track of the maximum reachable index at each step.
If the current index exceeds the maximum reachable index, return false.
If the loop completes without any issues, return true.

Asked in HCLTech

Q. What is virtual memory?
Virtual memory is a memory management technique that allows a computer to use more memory than physically available.
Virtual memory uses a combination of RAM and hard disk space to store data.
It allows multiple programs to run simultaneously without running out of memory.
When RAM is full, the operating system moves some data from RAM to the hard disk, freeing up space in RAM.
This process is called paging.
Virtual memory can slow down a computer if the hard disk is slow or if th...read more

Asked in Infosys

Q. Write code to return the second largest value from two arrays.
Code to return 2nd most value from 2 arrays of strings
Merge both arrays into one
Remove duplicates
Sort the array in descending order and return the second element

Asked in Infosys

Q. Explain the Incremental Model.
Incremental model is a software development model where the product is developed in small parts and each part is delivered incrementally.
The product is divided into small parts or modules.
Each module is developed and delivered incrementally.
Each increment adds new functionality to the product.
Testing is done after each increment is delivered.
Examples include Agile and Scrum methodologies.

Asked in Info Edge

Q. Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is no...
read moreReverse a linked list in groups of k
Divide the linked list into groups of k nodes
Reverse each group using iterative or recursive approach
Connect the reversed groups to form the final linked list
Handle edge cases like incomplete groups or empty list
Example: Input: 1->2->3->4->5, k=2, Output: 2->1->4->3->5

Asked in Amazon

Q. Given an array of integers and a window of size k, find the maximum (or minimum) of each window as it slides through the array.
Sliding Window Algorithm is used to solve problems where we need to find a substring or subarray of fixed size in a larger string or array.
The window size should be fixed and not change during the algorithm
The window should slide through the larger string or array one element at a time
The algorithm should keep track of the maximum or minimum value in the current window
Examples: Maximum Sum Subarray of Size K, Smallest Subarray with a given sum

Asked in MagicBricks

Q. What are your weaknesses?
One of my weaknesses is procrastination.
I tend to put off tasks until the last minute.
To overcome this, I have started using time management techniques such as the Pomodoro technique.
I also try to break down tasks into smaller, more manageable chunks.
I have found that setting deadlines for myself and holding myself accountable helps me stay on track.

Asked in Infosys

Q. tree diagram from the data structures
A tree diagram is a data structure that represents a hierarchical structure.
Nodes represent elements of the structure
Edges represent relationships between elements
Root node is the topmost node
Leaf nodes have no children
Examples include binary trees, AVL trees, and B-trees
Asked in Thiran Technologies

Q. What are the features of Python?
Python is a high-level, interpreted programming language known for its simplicity and ease of use.
Python has a large standard library with built-in modules for various tasks
It supports multiple programming paradigms including object-oriented, functional and procedural programming
Python is dynamically typed and garbage-collected
It has a simple and easy-to-learn syntax, making it a popular choice for beginners
Python is widely used in web development, scientific computing, data ...read more

Asked in Infosys

Q. Greedy Algorithm
Greedy algorithm is a technique to make locally optimal choices at each step to find a global optimum.
Greedy algorithm is used in optimization problems where the goal is to find the best solution among many possible solutions.
It works by making the best possible choice at each step, without considering the future consequences.
Examples include finding the shortest path in a graph, scheduling tasks to minimize completion time, and Huffman coding.
Greedy algorithm may not always ...read more

Asked in Infosys

Q. Describe a sorting technique.
Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
Compare each pair of adjacent elements in the array and swap them if they are in the wrong order
Repeat this process for each element in the array until no swaps are needed
Time complexity of O(n^2) makes it inefficient for large datasets
Interview Questions of Similar Designations



Reviews
Interviews
Salaries
Users

