A prime number is a number that is divisible only by two numbers itself and one. The factor of a number is a number that can divide it.The list of the first ten prime numbers is 2, 3, 5, 7, 11, 13, 17, 23, 29, 31.A number that is not prime is a composite number. A composite number is a number that can be divided by more than two numbers.Else then prime and composite there is 1 which is neither Prime nor composite because it can be divided only by itself.How to check if a number is prime or composite ... Read More
The lexical analysis is the first phase of the compiler where a lexical analyser operate as an interface between the source code and the rest of the phases of a compiler. It reads the input characters of the source program, groups them into lexemes, and produces a sequence of tokens for each lexeme. The tokens are sent to the parser for syntax analysis.If the lexical analyzer is located as a separate pass in the compiler it can need an intermediate file to locate its output, from which the parser would then takes its input. It can eliminate the need for ... Read More
Computer registers are high-speed memory storing units. It is an element of the computer processor. It can carry any type of information including a bit sequence or single data.A register should be 32 bits in length for a 32-bit instruction computer. Registers can be numbered relies upon the processor design and language rules.The instructions in a computer are saved in memory locations and implemented one after another at a time. The function of the control unit is to fetch the instruction from the memory and implement it. The control does the similar for all the instructions in the memory in ... Read More
Transmission Control Protocol (TCP) provides a secure and reliable connection between two devices using the 3-way handshake process. TCP uses the full-duplex connection to synchronize (SYN) and acknowledge (ACK) each other on both sides. There are three steps for both establishing and closing a connection. They are − SYN, SYN-ACK, and ACK.3-Way Handshake Connection Establishment ProcessThe following diagram shows how a reliable connection is established using 3-way handshake. It will support communication between a web browser on the client and server sides whenever a user navigates the Internet.Synchronization Sequence Number (SYN) − The client sends the SYN to the serverWhen ... Read More
Graph coloring is the procedure of assignment of colors to each vertex of a graph G such that no adjacent vertices get same color. The objective is to minimize the number of colors while coloring a graph. The smallest number of colors required to color a graph G is called its chromatic number of that graph. Graph coloring problem is a NP Complete problem.Method to Color a GraphThe steps required to color a graph G with n number of vertices are as follows −Step 1 − Arrange the vertices of the graph in some order.Step 2 − Choose the first ... Read More
In electrical engineering, the power factor of an AC system is the expression of energy efficiency. The power factor (PF) is defined as the ratio of active power (measured in Watts) to the apparent power (measured in VA). The power factor expresses the ratio of true power which is used in an AC circuit to the total power delivered to the circuit. Mathematically, the power factor can be expressed using the following formula − $$\mathrm{Power \: factor \, \mathrm{=}\, \frac{Active \: power}{Apparent \: power}}$$ There are two major terms are associated with the power factor of an AC circuit viz. ... Read More
An SCR is a three-terminal, three-junction, and four-layer semiconductor device that is used to perform switching functions in power circuits.Sometimes the SCR is also called as Thyristor.Constructional Details of SCRThe SCR has three pn – junctions, and four layer of p and n type semiconductor joined alternatively to get pnpn device. The three terminals are taken – one from outer p – type layer called anode (A), second from the outer n – type layer called cathode (K) and the third from the internal p –type layer called gate (G).Working of SCRIn a SCR, the load is connected in series ... Read More
Locking and unlocking of the database should be done in such a way that there is no inconsistency, deadlock, and no starvation.2PL locking protocolEvery transaction will lock and unlock the data item in two different phases.Growing Phase − All the locks are issued in this phase. No locks are released, after all changes to data-items are committed and then the second phase (shrinking phase) starts.Shrinking phase − No locks are issued in this phase, all the changes to data-items are noted (stored) and then locks are released.The 2PL locking protocol is represented diagrammatically as follows −In the growing phase transaction ... Read More
Triangle consists of three sides and three angles. Based on the three sides, there are three types of triangle −Equilateral triangle: All three sides are equal.Isosceles triangle: All two sides are equal.Scalene triangle: No sides are equal.Follow the algorithm given below for writing the respective program.AlgorithmStep 1: Declare three sides of triangle. Step 2: Enter three sides at run time. Step 3: If side1 == side2 && side2 == side3 Go to step 6 Step 4: If side1 == side2 || side2 == side3 || side3 == side1 Go to Step 7 Step 5: Else Go to step 8 Step ... Read More
Introduction The tar command in Linux is one of the most essential commands when it comes to file management. It is short for Tape Archive and is used to create and extract archive files. An archive file is a compressed file that contains one or more files bundled together for more accessible storage and portability. In this guide, we'll demonstrate, through examples, how to create, list, edit, and extract tar archive files, and cover some of the more commonly used tar command options. Syntax of the tar command The tar command accepts the following syntax − $ $ tar [options][archive-file] ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP