Difference Between ++i and i++ in C

Jayashree
Updated on 12-Sep-2023 02:57:07

38K+ Views

In C, ++ and -- operators are called increment and decrement operators. They are unary operators needing only one operand. Hence ++ as well as -- operator can appear before or after the operand with same effect. That means both i++ and ++i will be equivalent.i=5; i++; printf("%d", i);and i=5 ++i; printf("%d", i);both will make i=6.However, when increment expression is used along with assignment operator, then operator precedence will come into picture. i=5; j=i++;In this case, precedence of = is higher than postfix ++. So, value of i is assigned to i before incrementing i. Here j becomes 5 and i becomes 6.i=5; ... Read More

Difference Between DDL and DML in DBMS

Kiran Kumar Panigrahi
Updated on 12-Sep-2023 02:13:39

39K+ Views

Anybody dealing with databases must comprehend the distinction between DDL and DML commands because it has an impact on how data is saved, accessed, and modified. A collection of commands called DDL are used to specify a database's structure. Database objects including tables, views, indexes, and constraints can be created, modified, and deleted using these commands. DDL statements specify how the data is arranged and accessed rather than altering the data that is stored in the database. DML, on the other hand, is a set of instructions used to work with the data that is kept in the ... Read More

Compile a Java Program

Akshaya Akki
Updated on 12-Sep-2023 02:07:51

35K+ Views

Compiling a Java program is very easy after JDK installation. Following are the steps −Open a command prompt window and go to the directory where you saved the java program. Assume it's C:\.Type 'javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors in your code, the command prompt will take you to the next line (Assumption: The path variable is set).The file is compiled and you can see MyFirstJavaProgram.class file generated in the same folder.

Difference Between Class Variables and Instance Variables in Java

Johar Ali
Updated on 12-Sep-2023 02:05:05

39K+ Views

Following are the notable differences between Class (static) and instance variables. Instance variables Static (class) variables Instance variables are declared in a class, but outside a method, constructor or any block. Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block. Instance variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed. Static variables are created when the program starts and destroyed when the program stops. ... Read More

Constraints in DBMS

Hardik Gupta
Updated on 12-Sep-2023 02:01:06

87K+ Views

In DBMS (Database Management Systems), constraints are guidelines or limitations imposed on database tables to maintain the integrity, correctness, and consistency of the data. Constraints can be used to enforce data linkages across tables, verify that data is unique, and stop the insertion of erroneous data. A database needs constraints to be reliable and of high quality. What are the Constraints of DBMS? In DBMS, constraints refer to limitations placed on data or data processes. This indicates that only a particular type of data may be entered into the database or that only a particular sort of operation can be ... Read More

Select Last 10 Rows from MySQL

Chandu yadav
Updated on 12-Sep-2023 01:58:16

38K+ Views

To select last 10 rows from MySQL, we can use a subquery with SELECT statement and Limit concept. The following is an example. Creating a table. mysql> create table Last10RecordsDemo -> ( -> id int, -> name varchar(100) -> ); Query OK, 0 rows affected (0.75 sec) Inserting records into the table. mysql> insert into Last10RecordsDemo values(1, 'John'), (2, 'Carol'), (3, 'Bob'), (4, 'Sam'), (5, 'David'), (6, 'Taylor'); Query OK, 6 rows affected (0.12 sec) Records: 6 Duplicates: 0 Warnings: 0 mysql> insert into Last10RecordsDemo ... Read More

Get Correlation Between Two Columns in Pandas

Rishikesh Kumar Rishi
Updated on 12-Sep-2023 01:32:26

32K+ Views

We can use the .corr() method to get the correlation between two columns in Pandas. Let's take an example and see how to apply this method.StepsCreate a two-dimensional, size-mutable, potentially heterogeneous tabular data, df.Print the input DataFrame, df.Initialize two variables, col1 and col2, and assign them the columns that you want to find the correlation of.Find the correlation between col1 and col2 by using df[col1].corr(df[col2]) and save the correlation value in a variable, corr.Print the correlation value, corr.Exampleimport pandas as pd df = pd.DataFrame(    {       "x": [5, 2, 7, 0],       "y": [4, ... Read More

Hide Axes and Gridlines in Matplotlib

Rishikesh Kumar Rishi
Updated on 12-Sep-2023 01:31:20

45K+ Views

To hide axes (X and Y) and gridlines, we can take the following steps −Create x and y points using numpy.Plot a horizontal line (y=0) for X-Axis, using the plot() method with linestyle, labels.Plot x and y points using the plot() method with linestyle, labels.To hide the grid, use plt.grid(False).To hide the axes, use plt.axis('off')To activate the labels' legend, use the legend() method.To display the figure, use the show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(-10, 10, 50) y = np.sin(x) plt.axhline(y=0, c="green", linestyle="dashdot", label="y=0") plt.plot(x, y, c="red", lw=5, linestyle="dashdot", label="y=sin(x)") plt.grid(False) plt.axis('off') ... Read More

Add Rows to a Table Using JavaScript DOM

Saurabh Jaiswal
Updated on 12-Sep-2023 01:30:07

47K+ Views

We will learn how to add a row to a table using JavaScript dom. To achieve this, we have multiple methods. Some of them are the following. Using the insertRow() method By creating the new Element Using the insertRow() Method The inserRow() method is used to insert a new row at the starting of the table. It creates a new element and inserts it into the table. This takes a number as a parameter that specifies the position of the table. If we do not pass any parameter then it inserts the row at the starting of ... Read More

Difference Between Primary Key and Foreign Key in Database

Kiran Kumar Panigrahi
Updated on 12-Sep-2023 01:24:28

32K+ Views

In a relational database, keys are the most important elements to maintain the relationship between two tables or to uniquely identify the data from a table. Primary key is used to identify data uniquely therefore two rows can't have the same primary key. It can't be null. On the other hand, foreign key is used to maintain relationship between two tables. The primary key of a table acts as the foreign key in another table. The Foreign key in a table helps enforce Referential Integrity constraint. Read this tutorial to find out more about Primary and Foreign keys and how ... Read More

Advertisements