1) What are the functionalities of an
operating system?
operating system?
These are some major functionalities of an
operating system:
operating system:
- An
operating system act like an interface between user and hardware. - An
operating system also responsible for process management, memory
management and resource management. - Perform
some basic tasks, i.e., managing the peripheral devices. - It is
also responsible for file management which refers to the way it stores,
retrieves, manipulates, and saves data.
2) What is the difference between
PRIMARY key and UNIQUE key constraints?
PRIMARY key and UNIQUE key constraints?
Primary key
Primary key is used to uniquely
identifies the row in the table.
identifies the row in the table.
A table can contain only one Primary
key.
key.
NULL values are not allowed in Primary
key.
key.
Unique key
A table can contain multiple unique
keys.
keys.
NULL values are allowed in Unique key.
It helps to maintain unique data in a column of a table.
3) How can you delete the duplicate row
in a table?
in a table?
we use a DISTINCT keyword to delete the duplicate
row in the table.
row in the table.
It is very simple to use DISTINCT keyword. It is applied
on the SELECT statement to eliminate all duplicate rows and fetching unique row.
on the SELECT statement to eliminate all duplicate rows and fetching unique row.
Syntax:
The basic syntax to use DISTINCT Keyword is:
- SELECT
DISTINCT name of column FROM table name - WHERE
[conditions]
EXAMPLE:
Let us take an example of the STUDENT table.
ROLL_NO
|
NAME
|
%
|
1
|
Ravi
|
72.8
|
2
|
Anuj
|
63.5
|
3
|
Prakhar
|
72.3
|
4
|
Hardik
|
72.3
|
5
|
Azeem
|
75.5
|
6
|
Arzoo
|
71.2
|
Now let see the SELECT query with DISTINCT keyword
and find out the result. This will eliminate the duplicate entry.
and find out the result. This will eliminate the duplicate entry.
- SQL
> SELECT DISTINCT PERCENTAGE FROM STUDENTS
PERCENTAGE
|
63.5
|
71.2
|
72.3
|
72.8
|
75.5
|
4) Define the SQL Profiler?
SQL Profiler can be defined as the GUI based utility
which is mainly used to keep track and analyse the activity on SQL Server and
also used to track connections to the SQL Server. It is used to determine
the activities such as which SQL Scripts are running, and which one is getting
failed, etc.
which is mainly used to keep track and analyse the activity on SQL Server and
also used to track connections to the SQL Server. It is used to determine
the activities such as which SQL Scripts are running, and which one is getting
failed, etc.
5) What is stored procedure? Explain
with example.
with example.
Stored procedures are a collection or batch of SQL
statements that can be executed in a couple of ways. It makes the task easy as
we can able to store procedure in the system and it also increases the
reusability as here the code or the procedure is stored
statements that can be executed in a couple of ways. It makes the task easy as
we can able to store procedure in the system and it also increases the
reusability as here the code or the procedure is stored
Syntax:
1.
CREATE PROCEDURE procedure
name (you can choose any name)
CREATE PROCEDURE procedure
name (you can choose any name)
2.
AS
AS
3.
sql_statement
sql_statement
4.
GO;
GO;
To execute a stored procedure
1.
EXEC procedure_name; (it
should be same as mentioned above)
EXEC procedure_name; (it
should be same as mentioned above)
6) What is a process and how it is
different from thread?
different from thread?
Thread is known as lightweight sub-process; it is the
smallest unit of processing.
smallest unit of processing.
Threads are independent of each other because exception
in one thread, doesn’t affect execution of other threads. It makes use of shared
memory area. It has very less context so switch in thread is faster than
process. Here context include process id, state, register used, resource hold
by process, program counter.
in one thread, doesn’t affect execution of other threads. It makes use of shared
memory area. It has very less context so switch in thread is faster than
process. Here context include process id, state, register used, resource hold
by process, program counter.
The process is heavyweight and can consists of
multiple threads. The context switch between the process is slower then thread.
multiple threads. The context switch between the process is slower then thread.
7) What are the advantages of a thread?
How does the multithreading look like?
How does the multithreading look like?
These are the following advantages of a
Thread:
Thread:
- It
reduced the context switching time. - By
using thread, we can able to increase concurrency within a process. - Thread
allows proper utilization of multiprocessor architectures to a greater extant
and efficiency. - A
process which executes multiple threads simultaneously is known as multithreading. - A
thread is a lightweight sub-process, the smallest unit of processing.
Multiprocessing and multithreading are a mean of achieving
Multi-tasking.
Multi-tasking.
One process contains more than one thread which is executing
simultaneously is known as multi-threading.
simultaneously is known as multi-threading.
8) What are Multi-Processing and
Multitasking?
Multitasking?
Multitasking: Multitasking mean
executing multiple tasks run on a single CPU. We use multitasking to utilize
the CPU.
executing multiple tasks run on a single CPU. We use multitasking to utilize
the CPU.
Multitasking can be achieved in two
ways:
ways:
- Process-based
Multitasking (Multiprocessing) - Thread-based
Multitasking (Multithreading)
Multi-processing: Multi processing is
a mean to achieve multi-tasking. Multi-processing refers to the ability of a
system to execute more than one process at the same time.
a mean to achieve multi-tasking. Multi-processing refers to the ability of a
system to execute more than one process at the same time.
Multithreading: As the name
indicates multiple threads run concurrently.
indicates multiple threads run concurrently.
A thread is the smallest unit of processing and
also known as a lightweight sub-process.
also known as a lightweight sub-process.
9) What are Queue and stack also mention
its applications?
its applications?
Stack
- The
stack is an ordered list in which, insertion and deletion can be performed
only at one end that is called a top. - The
stack is a data structure having a pointer to its top element. - Stacks
work on the principle of Last-In-First-Out so also known as LIFO lists,
i.e., the element which is inserted first in the stack will be deleted
last from the stack.
Applications of Stack:
- Recursion
- Expression
evaluations and conversions - Parsing
- Browsers
- Editors
- Tree
Traversals
Queue
- A
queue can be defined as a linearly ordered list which enables insert
operations to be performed at one end called REAR and
delete operations to be performed at another end called FRONT. - The
queue is referred to be as the First-In-First-Out list. - Queue
is a data structure. - For
example, people waiting in line for a metro ticket form a queue.
Applications of Queue:
- The
queues are widely used as waiting lists for a single shared resource like
a printer, disk, CPU. - The
queues are used in the asynchronous transfer of data (where data is not
being transferred at the same rate between two processes), e.g., Pipes,
file IO, sockets. - The
queues are used as buffers in most of the applications like MP3 media
player, CD player, etc. - The
queues are used to maintain the playlist in media players to add and
remove the songs from the playlist. - The
queues are used in operating systems for handling interrupts.
10) What is indexing, what are the
advantages and disadvantages of it?
advantages and disadvantages of it?
Indexes are special lookup tables. It is used to
retrieve data from the database very fast.
retrieve data from the database very fast.
An Index is used to speed up select procedure. Without
affecting the data, we can create or drop indexes
affecting the data, we can create or drop indexes
An index in a database is just like an index in the
back of a book.
back of a book.
Indexing can be of the following types
Primary index, secondary index, and clustering
index.
index.
The advantages of indexes are as
follows:
follows:
- An
index makes it possible to retrieve data quickly. - Index’s
use in queries usually results in much better performance. - They
can be used for sorting. A post-fetch-sort operation can be eliminated. - Index
guarantees uniquely identifiable records in the database.
The disadvantages of indexes are as follows:
- Indexes
reduce the performance on inserts, updates, and deletes. - Indexes
take up space (this increase with the number of fields used and the length
of the fields). - Databases
will have mono case values in fields that are indexed.