0% found this document useful (0 votes)
1 views1 page

Coding Questions

The document contains a list of coding interview questions categorized into Java and Python. Each category includes various programming tasks ranging from basic string manipulation to more complex algorithms and data structures. The questions are designed to assess a candidate's coding skills and problem-solving abilities in both languages.

Uploaded by

jayudict
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views1 page

Coding Questions

The document contains a list of coding interview questions categorized into Java and Python. Each category includes various programming tasks ranging from basic string manipulation to more complex algorithms and data structures. The questions are designed to assess a candidate's coding skills and problem-solving abilities in both languages.

Uploaded by

jayudict
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Coding Interview Questions

Java Coding Interview Questions


1 Write a program to count the number of words in a given sentence.
2 Write a program to merge two sorted arrays into a single sorted array.
3 Write a Java program to check if two strings are anagrams of each other.
4 Implement a program to rotate an array to the right by k positions.
5 Write a program to check if a number is a perfect square.
6 Implement a program to find the common elements between two arrays.
7 Write a Java program to convert a string into a character array without using built-in methods.
8 Write a program to count how many times a particular substring appears in a given string.
9 Write a program to calculate the sum of the main diagonal elements of a matrix.
10 Write a program to find the maximum difference between any two elements in an array.
11 Write a program to implement binary search without recursion.
12 Implement a program to find the longest common prefix among an array of strings.
13 Write a Java program to implement the LRU (Least Recently Used) cache mechanism.
14 Implement a program to find all pairs in an array whose sum equals a given number.
15 Write a program to check if a given Sudoku board is valid.
16 Implement a program to find the longest increasing subsequence in an array.
17 Write a program to evaluate a postfix expression using a stack.
18 Implement a program to serialize and deserialize a binary tree in Java.
19 Write a program to implement the producer-consumer problem using threads in Java.
20 Implement a program to detect and remove a cycle in a linked list.

Python Coding Interview Questions


1 Write a Python function to check if a string is a palindrome using slicing.
2 Write a function to count the frequency of each element in a list.
3 Implement a function to normalize a NumPy array (Min-Max scaling).
4 Write a Python program to generate random numbers following a normal distribution and plot a
histogram using Matplotlib.
5 Write a function to find the most common word in a text file.
6 Implement a function to split a dataset into training and testing sets without using sklearn.
7 Write a Python program to calculate the correlation coefficient between two lists of numbers.
8 Write a function to remove outliers from a dataset using the IQR (Interquartile Range) method.
9 Write a Python function to compute the confusion matrix manually given y_true and y_pred.
10 Implement a function to calculate accuracy, precision, recall, and F1-score from scratch.
11 Implement a function to cluster a small dataset into k groups using a simple version of
K-Means.
12 Write a Python function to reduce a dataset to 2 dimensions using NumPy’s SVD.
13 Implement linear regression using the normal equation.
14 Write a Python program to split a dataset into training and validation sets using k-fold
cross-validation.
15 Implement a simple logistic regression using only NumPy.
16 Write a Python function to generate a confusion matrix and calculate accuracy manually.
17 Implement a small recommendation system based on average movie ratings.
18 Write a Python program to implement BFS (Breadth First Search) for a graph.
19 Write a function to calculate the silhouette score for clustering results.
20 Write a Python function to calculate term frequency (TF) for words in a document.

You might also like