Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Mahesh Parahar
147 articles
Difference between Fedora and Red Hat
Fedora and Red Hat Enterprise Linux (RHEL) are both Linux-based operating systems from the Red Hat ecosystem. Fedora is the free, community-driven distribution that serves as a testing ground for new technologies, while RHEL is the commercial, enterprise-grade distribution built for production environments. Fedora vs Red Hat Enterprise Linux Fedora • Free & Open Source • 6-month releases • Latest packages • Community support • Testing ground Red Hat (RHEL) • Commercial license ...
Read MoreMathematical Logical Terms and Definitions
Tautologies A Tautology is a formula which is always true for every value of its propositional variables. Example − Prove [ (A → B) ∧ A ] → B is a tautology The truth table is as follows − A B A → B (A → B) ∧ A [ (A → B) ∧ A ] → B True True True True True True False False False True False True True False True False False True False True As we can see every value ...
Read MoreHow do you convert an ArrayList to an array in Java?
An ArrayList provides two toArray() methods to convert it into an array − one returns an Object[] array, and the other returns a typed array. Method 1: toArray() (Returns Object[]) Object[] toArray() Returns an array containing all elements in proper sequence. The returned array type is Object[], so casting is needed to use specific types. Method 2: toArray(T[]) (Returns Typed Array) T[] toArray(T[] a) Returns a typed array containing all elements. Pass an empty array of the desired type and Java allocates the correct size. This is the preferred ...
Read MoreMatrix Representation of Graphs
A graph can be represented using an Adjacency Matrix, which is a 2D array that stores the connection information between vertices. Adjacency Matrix An Adjacency Matrix A[V][V] is a 2D array of size V × V where V is the number of vertices in the graph. For an undirected graph, if there is an edge between Vx and Vy, then A[Vx][Vy] = 1 and A[Vy][Vx] = 1 (symmetric matrix). For a directed graph, if there is an edge from Vx to Vy, then only A[Vx][Vy] = 1. Otherwise the value is 0. Adjacency Matrix of an Undirected ...
Read MoreHow do I add an element to an array list in Java?
We can add elements to an ArrayList easily using its add() method. The method appends the specified element to the end of the list, or inserts it at a specific index. Syntax boolean add(E e) void add(int index, E element) The first form appends the element to the end. The second form inserts the element at the specified index, shifting existing elements to the right. Example The following example shows how to add elements to an ArrayList using both forms of the add() method ? import java.util.ArrayList; import java.util.List; public ...
Read MoreDifference between ArrayBlockingQueue and LinkedBlockingQueue
ArrayBlockingQueue and LinkedBlockingQueue both implement the BlockingQueue interface from the java.util.concurrent package. Both store elements in FIFO order, are thread-safe, and do not accept null elements. They differ in their internal data structure, capacity behavior, and locking mechanism. ArrayBlockingQueue ArrayBlockingQueue is backed by a fixed-size array. Once created, the capacity cannot be changed. It uses a single lock with two conditions (notEmpty and notFull) for both put and take operations, meaning producers and consumers cannot operate concurrently. LinkedBlockingQueue LinkedBlockingQueue is backed by linked nodes. It is optionally bounded − if no capacity is specified, it defaults ...
Read MoreDifference between grep and fgrep command
Both grep and fgrep are Linux commands used to search for strings in files, directories, or command output. The key difference is that grep supports regular expressions, while fgrep treats the search pattern as a fixed (literal) string. grep (Global Regular Expression Print) grep searches for strings or regular expressions in files. It interprets special characters like ., *, ^, $, [ ] as regex metacharacters. It uses the Boyer-Moore algorithm for fast searching. fgrep (Fixed grep / grep -F) fgrep (equivalent to grep -F) searches for fixed strings only. It does not recognize regular expressions ...
Read MoreDifference between the Ternary operator and Null coalescing operator in php
In PHP, the ternary operator (?:) and the null coalescing operator (??) are both shorthand for conditional expressions. The ternary operator evaluates a condition and returns one of two values, while the null coalescing operator specifically checks if a variable is set and not null. Ternary Operator (?:) The ternary operator replaces if-else statements into a single expression − Syntax: (condition) ? expression1 : expression2; Equivalent: if (condition) { return expression1; } else { return expression2; } If the condition is true, it returns expression1; ...
Read MoreDifference between AngularJS and Angular.
AngularJS (version 1.x) and Angular (version 2+) are both open-source front-end frameworks developed by Google for building web applications. Despite sharing a name, Angular is a complete rewrite of AngularJS with a fundamentally different architecture, language, and design philosophy. AngularJS AngularJS is a JavaScript-based framework mainly used to develop single-page applications. It extends static HTML into dynamic HTML using directives and follows the MVC (Model-View-Controller) design pattern. AngularJS reached end-of-life in December 2021. Angular Angular (version 2 and above) is a complete rewrite of AngularJS, built with TypeScript. It uses a component-based architecture, has Angular CLI ...
Read MoreDifference between RDBMS and MongoDB
RDBMS (Relational Database Management System) stores data in structured tables with rows and columns, using SQL to query databases. MongoDB is a NoSQL document-oriented database that stores data as BSON (Binary JSON) documents with dynamic schemas, using its own query language (MQL). RDBMS RDBMS stores data as entities in tables. It provides multiple layers of information security and uses primary keys to uniquely identify records and foreign keys to define relationships between tables. RDBMS follows the ACID principle (Atomicity, Consistency, Isolation, Durability). Examples include Oracle, SQL Server, and MySQL. MongoDB MongoDB is an open-source NoSQL database ...
Read More