
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 67 Articles for Campus Interview

1K+ Views
In this article, we will understand how to display an upper triangular matrix of a given matrix in Java. A matrix has row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix. And, the term upper triangular matrix refers to a matrix whose all elements below the main diagonal are 0. Example Scenario: Input: matrix = { 2, 1, 4 }, { 1, 2, 3 }, { 3, 6, 2 } Output: upptri_mat = 2 1 4 0 2 3 0 0 2 Using ... Read More

3K+ Views
Linear Search on a Java Array using RecursivelyLinear search is an algorithm that we use to check if an element is present in an array or not. It checks all the elements of the array one by one until it finds the element or reaches the end of the array. Recursion is a way where a function calls itself to solve a certain problem until it reaches a base case. In this article, we will understand how to recursively linearly search an element in an array. Let's see an example: Input: int [] arr = {1, 2, 3, 4, 5}; ... Read More

1K+ Views
In this article, we will understand how to multiply two matrices using multi-dimensional arrays in Java. The matrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m × n matrix. Individual entries in the matrix are called elements and can be represented by a[i][j] which suggests that the element a is present in the ith row and jth column. Problem Statement Write a program in Java to multiply two matrices using multi-dimensional arrays. Below is a demonstration of the same − Input First matrix: 2 3 4 ... Read More

1K+ Views
For two given matrices, each of size m x n, we need to write a Java program to add them. Amatrix has a row and column arrangement of its elements. A matrix with m rows and n columns can be called as m x n matrix. Individual entries in the matrix are called elements and can be represented by a[i][j], which means that the element a is present at the ith row and jth column. Matrix is an example of multi-dimensional array. In Java, a multi-dimensional array is an array of arrays. It is used to store data within a ... Read More

302 Views
In this article, we will understand how to interchange the diagonal elements of a given matrix in Java. A matrix is a two-dimensional array made up of rows and columns. A matrix with m rows and n columns is called an m × n matrix. Each element in the matrix is represented by a[i][j], which means that the particular element a is present in the i-th row and j-th column. Problem Statement Write a Java program to interchange the elements of the primary and secondary diagonals of a square matrix. Example Scenario ... Read More

12K+ Views
In this article, we will understand how to compute the sum of diagonals of a matrix. The matrix has a row and column arrangement of its elements. The principal diagonal is a diagonal in a square matrix that goes from the upper left corner to the lower right corner.The secondary diagonal is a diagonal of a square matrix that goes from the lower left corner to the upper right corner.Below is a demonstration of the same −Suppose our input is −The input matrix: 4 5 6 7 1 7 3 4 11 12 13 14 23 24 25 50The desired ... Read More

1K+ Views
In this article, we will understand how to rotate matrix elements using Java. A matrix is a representation of the elements in rows and columns. Matrix rotation is shifting the position of each element of the matrix by 1 position towards its right or left. We will be using two approaches: one where the matrix is rotated based on user input, and another where the matrix is defined within the code. Problem Statement Write a Java program to rotate matrix elements. Below is a demonstration of the same − Input The matrix is defined as 1 2 3 4 5 6 ... Read More