0% found this document useful (0 votes)
4 views5 pages

Difference Question

Uploaded by

ghost23riley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Difference Question

Uploaded by

ghost23riley
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1 RAM ROM

2 APPLICATION SOFTWARE SYSTEM SOFTWARE


3 SCRIPT MODE INTERACTIVE MODE
4 KEYWORDS VARIABLES
5 LIST, TUPLE, DICTIONARY , STRING
6 TYPE CASTING TYPE CONVERSION
7 SYNTAX ERROR LOGICAL ERROR
8 WHILE LOOP FOR LOOP
9 PRIMARY KEY FOREIGN KEY
10 SQL MYSQL
11 CHAR VARCHAR
12 DDL DML
13 UPDATE DELETE
14 WHERE HAVING
15 DROP TABLE ALTER TABLE
16 Compiler Interpreter
17 Mutable Immutable

QUESTIONS ON DIFFERENCE
RAM ROM
RAM is Random Access Memory ROM is Read-only Memory
Expensive Cheaper
High Speed Slow Speed
Data in RAM can be modified, erased, or read. Data in ROM can only be read, it cannot be modified
or erased.
The data stored in RAM is used by the Central The data stored in ROM is used to bootstrap the
Processing Unit (CPU) to process current computer.
instructions
Temporary Permanent

SYSTEM SOFTWARE APPLICATION SOFTWARE


gives the path for application software to run. Application software is built for specific tasks.

Low level languages are used to write the While high level languages are used to write the
system software. application software.
It is a general-purpose software. While its a specific purpose software.
Without system software, the stops system While without application software system always
can’t run. runs.
System software runs when the system is While application software runs as per the user’s
turned on and stop when the system is turned request.
off.
Example: System software is operating Example: Application software are Photoshop, VLC
system(Windows, Linux), etc. player etc.(MS Words, Paint, Adobe Reader)

1. Interactive mode
 Script Mode, is used when the user is working with more than one single code or a block of code.
 Useful for small programs of one or two lines
2. Script mode
 Interactive mode is used when an user wants to run one single line or one block of code. If one
needs to write a long piece of Python code or if the Python script spans multiple files, interactive
mode is not recommended. In script mode, You write your code in a text file then save it with
a .py extension.
 Useful for large programs

LIST AND TUPLE , String and Dictionary


List Tuple String Dictionary
List is a non- Tuple is also a non- Store Dictionary is also a non-
homogeneous data homogeneous data Homogeneous homogeneous data
structure that stores the structure that stores single Data in double structure which stores
elements in single row row and multiple rows and quotes or single key value pairs
and multiple rows and columns quotes “ “ , ‘ ‘
columns
List can be represented by Tuple can be represented “kv 1 surat” Dictionary can be
[] by ‘ kv1surat ‘ represented by { }
()
List allows duplicate Tuple allows duplicate String Allow Set will not allow
elements elements Duplicate duplicate elements and
elements dictionary doesn’t allow
duplicate keys.
List can use nested Tuple can use nested Dictionary can use
among all among all nested among all
Example: [1, 2, 3, 4, 5] Example: (1, 2, 3, 4, 5) S= “KV 1 Surat” Example: {1, 2, 3, 4, 5}
List can be created Tuple can be created Data in String can Dictionary can be
using list() function using tuple() function. be converted in to created
str(‘123’) function using dict() function.
List is mutable i.e we can Tuple is immutable i.e we String is Dictionary is mutable.
make any changes in list. can not make any changes Immutable But Keys are not
in tuple duplicated.
List is ordered Tuple is ordered String is ordered Dictionary is ordered
(Python 3.7 and above)
Creating an empty list Creating an empty Tuple Creating an Creating an empty
l=[] t=() empty String dictionary
S= “” d={}
S=’ ‘

TYPE CONVERSION V/S TYPE CASTING


 Type Conversion - Implicit Conversion - automatic type conversion –
 Type Casting - Explicit Conversion - manual type conversion (Type Conversion)

Python Implicit Type Conversion


In certain situations, Python automatically converts one data type to another automatically. This is known
as implicit type conversion.

Example 1: Converting integer to float


Let's see an example where Python promotes the conversion of the lower data type (integer) to the higher
data type (float) to avoid data loss.

S= ‘MANGILAL ‘
X = 123
Y = 1.23
Z = X + Y
W = S * 2

Explicit Type Conversion

In Explicit Type Conversion, users convert the data type of an object to required data type.
We use the built-in functions like int(), float(), str(), etc to perform explicit type conversion.
This type of conversion is also called typecasting because the user casts (changes) the data type of the
objects.
X = float( 55 //11 )
Y = int(input(“Enter you Number “)) # string is converted to int
Event Syntax Error vs Logical Error
** A syntax error is an error in the syntax of a A logical error is an error in a program that
sequence of characters or tokens that is causes it to operate incorrectly but not to
intended to be written in a particular terminate abnormally.
programming language.
Occurrence A syntax error occurs due to fault in the A logical error occurs due to a fault in the
program syntax. algorithm./ method / formulae
Detection In compiled languages, the compile indicates The programmer/user has to detect the error
the syntax error with the location and what by himself.
the error is.
Simplicity It is easier to identify a syntax error. It is comparatively difficult to identify a
logical error.

For vs While Loop in Python


Let's see the difference between the for loop and the while loop:
Parameter For Loop While Loop
Keyword For Keyword is used. While Keyword is used.
Use Number of iterations already known. No prior information on the number of
iterations.
In absence of Loop runs infinite times. Display the compile time error.
condition
Initialization Nature Once done cannot be repeated. Repeat at every iteration.
Initialization in To be done at starting of the loop. Can be done anywhere in the loop body.
accordance with
iteration
Function used Range or xrange function is used to No such function is used in the while loop.
iterate.
Generator Support For loop can be iterated on While loop cannot be iterated on
generators in Python. Generators directly.
Speed For loop is faster than while loop. While loop is slower as compared to for
loop.

Difference Mutable / Immutable


SR.NO Mutable Immutable
.
1. Data can be changed Data can not be changed
2. Exp list, dictionary Exp. Tuple , string
3. L = [10,20,30] String = “mangilal”

L[0] = 40 String[3] = ‘e’ # Error


String = “sohan Lal “ # Allowed String
Allowed is changed not corrected
4.

Difference Compiler / Interpreter


SR.NO Compiler Interpreter
.
1. Program from HLL to LLL is Program from HLL to LLL is converted
converted in one go in Line by Line
2. Speed is Fast Speed is Slow
3. Errors with line no is shown Errors shown one by one
4. No partial output can be Displayed Partial output can be displayed
5 Once program is converted During conversion of program Every
Compiler is not required in memory time interpreter is required in memory

================================================================

S.No Primary Key Foreign Key


.
1 A primary key generally focuses on A foreign key is generally used to build a relationship
the uniqueness of the table. It between the two tables.
assures the value in the specific
column is unique.
2 Table allows only one primary key. Tables can allow more than one foreign key.
3 The primary key doesn’t allow null Foreign key accepts multiple null values.
values.
4 It can identify the record uniquely in A foreign key is a field in the table that is the primary
the database table. key in another table.
6 Its restriction can be completely Its restriction cannot be defined on the global or local
defined on the temporary tables. temporary tables.

SQL MySQL
SQL is a query programming language that MySQL is a relational database management system that
manages RDBMS. uses SQL.
SQL is primarily used to query and operate MySQL allows you to handle, store, modify and delete
database systems. data and store data in an organized way.
SQL does not support any connector. MySQL comes with an in-built tool known as MySQL
Workbench that facilitates creating, designing, and
building databases.
SQL follows a simple standard format without MySQL has numerous variants and gets frequent
many or regular updates. updates.
SQL supports only a single storage engine. MySQL offers support for multiple storage engines along
with plug-in storage, making it more flexible.
SQL does not allow other processors or even MySQL is less secure than SQL, as it allows third-party
its own binaries to manipulate data during processors to manipulate data files during execution.
execution.

Difference between CHAR and VARCHAR datatypes:


SR.NO CHAR VARCHAR
.

1. CHAR datatype is used to store character VARCHAR datatype is used to store character
strings of fixed length strings of variable length
2. In CHAR, If the length of the string is less In VARCHAR, If the length of the string is less than
than set or fixed-length then it is padded the set or fixed-length then it will store as it is
with extra memory space. without padded with extra memory spaces.
3. CHAR stands for “Character” VARCHAR stands for “Variable Character”
4. Storage size of CHAR datatypes is equal to The storage size of the VARCHAR datatype is equal
n bytes i.e. set length to the actual length of the entered string in bytes.
5. We should use the CHAR datatype when We should use the VARCHAR datatype when we
we expect the data values in a column are expect the data values in a column are of variable
of the same length. length.
6. CHAR takes 1 byte for each character VARCHAR takes 1 byte for each character and some
extra bytes for holding length information
9. Better performance than VARCHAR Performance is not good as compared to CHAR

Structured Query Language(SQL) as we all know is the database language by the use of which we can
perform certain operations on the existing database and also we can use this language to create a
database. SQL uses certain commands like Create, Drop, Insert, etc. to carry out the required tasks.
These SQL commands are mainly categorized into four categories as:
1. DDL – Data Definition Language
2. DQL – Data Query Language
3. DML – Data Manipulation Language
4. DCL – Data Control Language
5. TCL – Transaction Control Language
DDL (Data Definition Language):
DDL or Data Definition Language actually consists of the SQL commands that can be used to define the
database schema. List of DDL commands: CREATE: DROP: ALTER:

DML(Data Manipulation Language): The SQL commands that deals with the manipulation of
data present in the database belong to DML or Data Manipulation Language and this includes
most of the SQL statements.
List of DML commands:
 INSERT : It is used to insert data into a table.
 UPDATE: It is used to update existing data within a table.
 DELETE : It is used to delete records from a database table.
DCL (Data Control Language):
DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and
other controls of the database system.
List of DCL commands:
 GRANT: This command gives users access privileges to the database.
 REVOKE: This command withdraws the user’s access privileges given by using the GRANT command.

TCL (Transaction Control Language):


Transactions group a set of tasks into a single execution unit. COMMIT: Commits a Transaction.
 ROLLBACK: Rollbacks a transaction in case of any error occurs.
 SAVEPOINT: Sets a save point within a transaction.
 SET TRANSACTION: Specifies characteristics for the transaction.

Difference between Where and Having Clause in SQL :


SR.NO WHERE Clause HAVING Clause
.
1. WHERE Clause is used to filter the records from HAVING Clause is used to filter record from the
the table based on the specified condition. groups based on the specified condition.
2. WHERE Clause can be used without GROUP BY HAVING Clause cannot be used without GROUP
Clause BY Clause
3. WHERE Clause implements in row operations HAVING Clause implements in column
operation
4. WHERE Clause cannot contain aggregate HAVING Clause can contain aggregate function
function
5. WHERE Clause can be used with SELECT, HAVING Clause can only be used with SELECT
UPDATE, DELETE statement. statement.
6. WHERE Clause is used before GROUP BY Clause HAVING Clause is used after GROUP BY Clause
7. WHERE Clause is used with single row function HAVING Clause is used with multiple row
like UPPER, LOWER etc. function like SUM, COUNT etc.

Alter and Drop table


Alter Table is used to modify an existing table, like adding a row or column. Alter preserves the existing
data. Example, deleting a column won't affect the data in the other columns. Changing a column datatype
will result in conversion of existing data, which may result in data loss when there are errors such as
overflows, under flows, or integrity constraint violations.

Drop Table is used to remove a table completely. You can drop and then recreate a table, but you will
lose all the data it. If that's an issue, then Alter is the preferred solution. However, not all changes you
might want to a table definition can be done with Alter, so your only option might be to drop/create.

You might also like