
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

2K+ Views
In this article, we will understand how to print even-length words. The string is a datatype that contains one or more characters and is enclosed in double quotes (“ ”). Char is a datatype that contains an alphabets an integer or a special character. Problem Statement Write a Java program to print even-length words. Below is a demonstration of the same − Input Input string: Java Programming are cool Output The words with even lengths are: Java cool Approaches to print even length words Below are the different approaches to print even length words − Using ... Read More

424 Views
In this article, we will understand how to determine the unicode code point at a given index. Each character is represented by a unicode code point. A code point is an integer value that uniquely identifies the given character. Unicode characters can be encoded using different encodings, like UTF-8 or UTF-16.Below is a demonstration of the same −Suppose our input is −Input String: Java Program Index value: 5The desired output would be −Unicode Point: 80AlgorithmStep 1 - START Step 2 - Declare a string value namely input_string and two integer values namely index and result Step 3 - Define the ... Read More

770 Views
In this article, we will understand how to print the first letter of each word using regex. A regular expression is a sequence of characters that forms a search pattern. A regular expression can be a single character or a more complicated pattern. A regular expression helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. They can be used to search, edit, or manipulate text and data. Problem Statement Write a program in Java to print the first letter of each word using regex. Below is a demonstration of the same ... Read More

697 Views
In this article, we will understand how to check whether the given string is a pangram in Java. A string is a pangram string if it contains all the characters of the alphabet ignoring the case of the alphabet. Here, we will be using two different approaches: using the main() method and using encapsulation. Problem Statement Given a string write a program in Java to find whether the string is pangram or not. Below is a demonstration of the same − Input Input string: Abcdefghijklmnopqrstuvwxyz Output Yes, the string is a pangram Different approaches Following are the steps to check whether ... Read More

2K+ Views
In this article, we’ll learn how to swap pairs of characters in a Java string. We start with a simple method that converts the string into a character array, allowing us to swap characters directly. Then, we’ll explore an object-oriented approach where the swapping logic is encapsulated in a separate method. Both approaches highlight key Java concepts such as string manipulation and method encapsulation. Problem Statement Write a Java program to swap a pair of characters. Below is a demonstration of the same − Input Input string: Java program Output The string after swapping is: Javg proaram Steps for basic ... Read More

3K+ Views
In this article, we will understand how to sort a string. String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). Strings are a sequence of charactersBelow is a demonstration of the same −Suppose our input is −Input string: javaprogramThe desired output would be −String after sorting is: [a, a, a, g, j, m, o, p, r, r, v]AlgorithmStep 1 - START Step 2 - Declare a string value namely input_string, a character array charArray, char value name temp and an int value namely string_size. Step 3 - Define the values. Step 4 ... Read More

2K+ Views
Stack is a linear data structure where we can store elements. It uses the LIFO (last in, first out) principle, which means the item we add last will be the first one to be removed. In this article, we will understand how to reverse a string using stacks. Let's take an example: Input: String input_string = "Java Program"; Output: String reversed_string = "margorP avaJ"; Ways to Reverse a String Using Stacks Below are the different approaches to reverse a string using stacks: Reverse a string using built-in stack methods ... Read More

2K+ Views
Given a String, let's say "str", write a Java program to reverse it. In reverse string operation, we need to display the individual characters of string backwards or from right to left. Here, String is a datatype that contains one or more characters and is enclosed in double quotes(“ ”). Let's understand the problem with an example − Example Scenario: − Input: str = "Java Program"; Output: reversed_string = margorP avaJ For better understanding refer to the below illustration − Reverse String .main { background-color: rgb(151, 231, 89); ... Read More

4K+ Views
In this article, we'll learn how to replace a character at a specific index in a string. Strings in Java are sequences of characters enclosed in double-quotes (" "). We use strings to represent text in our programs. Problem Statement You are given a string, an index, and a character. Your task is to replace the character at the specified index in the string with the new character. Input string: Java Programming, Index: 6 Output: Java P%ogramming Different Approaches There are multiple ways to achieve this in Java. Below are two common approaches: Using substring() ... Read More

434 Views
What is a Sparse Matrix? A matrix is said to be a sparse matrix if most of the elements of that matrix are 0. It means that the number of non-zero elements has a lesser count than the number of zero elements.Let's say we have a matrix of size 3*3, which means it has 9 elements. If 5 or more of those elements are 0, then we can say that the matrix is sparse. A = [ 0 2 0 ] [ 0 5 4 ] [ 0 0 0 ] ... Read More