0% found this document useful (0 votes)
115 views23 pages

Python Mid Exam Que Ans-1

Decorators in Python allow functions to be modified without permanently changing them. Decorators take in a function, add some functionality, and return it. Generators are functions that can be iterated over, generating a value on each iteration rather than building a list. Decorators and generators both add functionality without changing the original code. Decorators modify functions, while generators modify iteration behavior. Examples show using decorators to add logging and timing functionality to functions, and using generators to iterate over values without storing them all in memory at once.

Uploaded by

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

Python Mid Exam Que Ans-1

Decorators in Python allow functions to be modified without permanently changing them. Decorators take in a function, add some functionality, and return it. Generators are functions that can be iterated over, generating a value on each iteration rather than building a list. Decorators and generators both add functionality without changing the original code. Decorators modify functions, while generators modify iteration behavior. Examples show using decorators to add logging and timing functionality to functions, and using generators to iterate over values without storing them all in memory at once.

Uploaded by

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

Short Questions

1)What is _ _init_ _?
The Default _init_ Constructor in C++ and Java. Constructors are used to
initialize the object’s state. The task of constructors is to initialize(assign
values) to the data members of the class when an object of the class is
created. Like methods, a constructor also contains a collection of
statements(i.e. instructions) that are executed at the time of Object
creation. It is run as soon as an object of a class is instantiated. The
method is useful to do any initialization you want to do with your object.
Example:
# A Sample class with init method
class Person:

# init method or constructor


def _init_(self, name):
self.name = name

# Sample Method
def say_hi(self):
print('Hello, my name is', self.name)

p = Person('Nikhil')
p.say_hi()

Output:

Hello, my name is Nikhil

2)Define: self variable.


self represents the instance of the class. By using the “self” we can
access the attributes and methods of the class in python. It binds the
attributes with the given arguments.

The reason you need to use self. is because Python does not use the @
syntax to refer to instance attributes. Python decided to do methods in a
way that makes the instance to which the method belongs be passed
automatically, but not received automatically: the first parameter of
methods is the instance the method is called on.

In more clear way you can say that SELF has following Characteristic-
Self is always pointing to Current Object.
Self is a convention and not a Python keyword .
Self is the first argument to be passed in Constructor and Instance
Method.

Example:
#it is clearly seen that self and obj is referring to the same object

class check:
def _init_(self):
print("Address of self = ",id(self))

obj = check()
print("Address of class object = ",id(obj))

# this code is Contributed by Samyak Jain

Output:
Address of self = 140124194801032
Address of class object = 140124194801032

3) What is frozen set?

The frozenset() function returns an immutable frozenset object initialized


with elements from the given iterable.

Frozen set is just an immutable version of a Python set object. While


elements of a set can be modified at any time, elements of the frozen set
remain the same after creation.

Due to this, frozen sets can be used as keys in Dictionary or as elements of


another set. But like sets, it is not ordered (the elements can be set at any
index.

Syntax:- frozenset([iterable])
frozenset() Parameters
The frozenset() function takes a single parameter:

● iterable (Optional) - the iterable which contains elements to initialize the


frozenset with.
Iterable can be set, dictionary, tuple, etc.

Return value from frozenset()


The frozenset() function returns an immutable frozenset initialized with
elements from the given iterable.

If no parameters are passed, it returns an empty frozenset.

Example
# tuple of vowels

vowels = ('a', 'e', 'i', 'o', 'u')

fSet = frozenset(vowels)

print('The frozen set is:', fSet)

print('The empty frozen set is:', frozenset())

# frozensets are immutable

fSet.add('v')

Output:
The frozen set is: frozenset({'a', 'o', 'u', 'i', 'e'})

The empty frozen set is: frozenset()

Traceback (most recent call last):

File "<string>, line 8, in <module>

fSet.add('v')

AttributeError: 'frozenset' object has no attribute 'add'


4) Give the basic difference between local and global
variables.
● Global variables are declared outside the functions whereas local
variables are declared within the functions.
● Local variables are created when the function starts its execution
and are lost when the function ends. Global variables, on the
other hand, are created as execution of the program begins and
are lost when the program is ended.
● In contrast to global variables, local variables do not offer data
sharing.
● While global variables are kept in a fixed location selected by the
compiler, local variables are kept on the stack.
● For local variables, parameter passing is necessary, but not for
global variables.
● In Python, Global variables can be defined using global Keyword
whereas local variables can be defined directly

5) What type of language is python?.


Python is an interpreted, object-oriented, high-level programming
language with dynamic semantics. Its high-level built in data structures,
combined with dynamic typing and dynamic binding, make it very
attractive for Rapid Application Development, as well as for use as a
scripting or glue language to connect existing components together.
Python's simple, easy to learn syntax emphasizes readability and
therefore reduces the cost of program maintenance. Python supports
modules and packages, which encourages program modularity and code
reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major platforms,
and can be freely distributed.
6) Define Positional arguments.
During a function call, values passed through arguments should be in the
order of parameters in the function definition. This is called positional
arguments.

Keyword arguments should follow positional arguments only.

def add(a,b,c):
return (a+b+c)
The above function can be called in two ways:

First, during the function call, all arguments are given as positional
arguments. Values passed through arguments are passed to parameters
by their position. 10 is assigned to a, 20 is assigned to b and 30 is
assigned to c.

print (add(10,20,30))#Output:60
The second way is by giving a mix of positional and keyword arguments.
Keyword arguments should always follow positional arguments.

print (add(10,c=30,b=20))#Output:60

7) Define lambda function.

Python Lambda Functions are anonymous function means that the


function is without a name. As we already know that the def keyword is
used to define a normal function in Python. Similarly,
the lambda keyword is used to define an anonymous function in
Python.

Python Lambda Function Syntax


Syntax: lambda arguments: expression
● This function can have any number of arguments but
only one expression, which is evaluated and returned.
● One is free to use lambda functions wherever function
objects are required.
● You need to keep in your knowledge that lambda
functions are syntactically restricted to a single
expression.
● It has various uses in particular fields of programming,
besides other types of expressions in functions.

Python Lambda Function Example


Python3
str1 = 'GeeksforGeeks'

# lambda returns a function object


rev_upper = lambda string: string.upper()[::-1]
print(rev_upper(str1))

Output:
SKEEGROFSKEEG

Long Questions

1) Explain lambdas with filter (), map () and reduce () function.


Using lambda() Function with filter()

The filter() function in Python takes in a function and a list as arguments.


This offers an elegant way to filter out all the elements of a sequence
“sequence”, for which the function returns True. Here is a small program
that returns the odd numbers from an input list:

Example 1: Filter out all odd numbers using filter() and lambda function

Here, lambda x: (x % 2 != 0) returns True or False if x is not even. Since


filter() only keeps elements where it produces True, thus it removes all
odd numbers that generated False.

Python

li = [5, 7, 22, 97, 54, 62, 77, 23, 73, 61]

final_list = list(filter(lambda x: (x % 2 != 0), li))


print(final_list)

Output:
[5, 7, 97, 77, 23, 73, 61]

Example 2: Filter all people having age more than 18, using lambda and
filter() function
Python3

# Python 3 code to people above 18 yrs


ages = [13, 90, 17, 59, 21, 60, 5]

adults = list(filter(lambda age: age > 18, ages))

print(adults)

Output:
[90, 59, 21, 60]

Using lambda() Function with map()

The map() function in Python takes in a function and a list as an


argument. The function is called with a lambda function and a list and a
new list is returned which contains all the lambda modified items
returned by that function for each item. Example:

Example 1: Multiply all elements of a list by 2 using lambda and map()


function

Python

# Python code to illustrate


# map() with lambda()
# to get double of a list.
li = [5, 7, 22, 97, 54, 62, 77, 23, 73, 61]

final_list = list(map(lambda x: x*2, li))


print(final_list)

Output:
[10, 14, 44, 194, 108, 124, 154, 46, 146, 122]

Example 2: Transform all elements of a list to upper case using lambda


and map() function

Python3
# Python program to demonstrate
# use of lambda() function
# with map() function
animals = ['dog', 'cat', 'parrot', 'rabbit']

# here we intend to change all animal names


# to upper case and return the same
uppered_animals = list(map(lambda animal: animal.upper(), animals))

print(uppered_animals)

Output:
['DOG', 'CAT', 'PARROT', 'RABBIT']

Using lambda() Function with reduce()

The reduce() function in Python takes in a function and a list as an


argument. The function is called with a lambda function and an iterable
and a new reduced result is returned. This performs a repetitive
operation over the pairs of the iterable. The reduce() function belongs to
the functools module.

Example 1: Sum of all elements in a list using lambda and reduce()


function

Python

# Python code to illustrate


# reduce() with lambda()
# to get sum of a list

from functools import reduce


li = [5, 8, 10, 20, 50, 100]
sum = reduce((lambda x, y: x + y), li)
print(sum)

Output:
193
2) Discuss Decorators and Generators in python with example.
Decorators are one of the most helpful and powerful tools of Python.
These are used to modify the behavior of the function. Decorators provide
the flexibility to wrap another function to expand the working of wrapped
function, without permanently modifying it.

In Decorators, functions are passed as an argument into


another function and then called inside the wrapper
function.

It is also called meta programming where a part of the program attempts


to change another part of program at compile time.
1. def outer_div(func):
2. def inner(x,y):
3. if(x<y):
4. x,y = y,x
5. return func(x,y)
6. return inner
7. # syntax of generator
8. @outer_div
9. def divide(x,y):
10. print(x/y)

Output: -2.0

Generator-Function: A generator-function is defined like a normal


function, but whenever it needs to generate a value, it does so with
the yield keyword rather than return. If the body of a def contains yield,
the function automatically becomes a generator function.

Python3

# A generator function that yields 1 for first time,


# 2 second time and 3 third time
def simpleGeneratorFun():
yield 1
yield 2
yield 3

# Driver code to check above generator function


for value in simpleGeneratorFun():
print(value)

Output
1
2
3

Generator-Object : Generator functions return a generator object.


Generator objects are used either by calling the next method on the
generator object or using the generator object in a “for in” loop (as
shown in the above program).

3) What is the use of Matplotlib in Python? Explain the use of


plot(), show() and title()functions of Matplotlib.

Matplotlib is a popular data visualization library in Python that is used to


create high-quality plots, charts, and graphs. It provides a wide range of
functions and tools for creating different types of visualizations and
customizing them as per the requirement.

The plot() function in Matplotlib is used to create a basic line plot. It


takes two arrays of equal length as input, where the first array contains
the x-axis values and the second array contains the y-axis values. It can
also take a single array as input, in which case it will be used as the y-axis
values and the x-axis values will be automatically generated as a
sequence of integers starting from zero.

The show() function is used to display the plot on the screen. It takes no
input parameters and simply displays the plot that has been created
using the plot() function.

The title() function is used to set the title of the plot. It takes a string as
input, which is used as the title of the plot. For example, the following
code snippet creates a line plot of the values in the array y and sets the
title of the plot to "My Plot":
pythonCopy code
import matplotlib.pyplot as plt

y = [1, 2, 3, 4, 5]
plt.plot(y)
plt.title("My Plot")
plt.show()
4) Explain Exceptional Handling with example.

Exception handling is a programming construct that helps us deal with


errors and unexpected situations that may occur during program
execution. In Python, exceptions are raised when errors or unexpected
situations occur during runtime, and exception handling allows us to
handle these exceptions gracefully. The basic syntax for exception
handling in Python is as follows:
pythonCopy code
try:
# some code that may raise an exceptionexcept ExceptionType:
# handle the exceptionelse:
# execute if there was no exceptionfinally:
# always execute
Here, the try block contains the code that may raise an exception, and
the except block contains the code that is executed when an exception
of the specified type occurs. The else block contains the code that is
executed if there was no exception, and the finally block contains code
that is always executed, regardless of whether an exception was raised
or not.
Let's take an example to understand exception handling in Python
better. Suppose we want to divide two numbers and handle the
ZeroDivisionError exception that may occur if the second number is zero.
Here's how we can do it:
pythonCopy code
try:
num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: "))
result = num1 / num2
print("Result is:", result)except ZeroDivisionError:
print("Error: Division by zero")except ValueError:
print("Error: Invalid input")else:
print("No exception occurred")finally:
print("Execution complete")

5) Sequences in Python
Explain sequences with python code.

• A sequence represents a group of elements or items.


• There are six types of sequences in Python
– str
– bytes
– bytearray
– list
– tuple
– range

str datatype

• A string is represented by a group of characters. Strings are


enclosed in single quotes or double quotes.

• We can also write string inside “““ (triple double quotes) or ‘‘‘
(single double quotes)
str = “Welcome to TMES”
str = ‘Welcome to TMES’

str1 = “““ This is book on python which discusses all the topics of Core
python
in a very lucid manner.”””
str1 = ‘‘‘This is book on python which discusses all the topics of Core
python in a very lucid manner.’’’

str datatype

str1 = “ This is ‘Core Python’ book.”


print(str1) # This is ‘Core Python’ book.
str1 = ‘‘This is ‘Core Python’ book.’’
print(str1) # This is ‘Core Python’ book.
s = ‘Welcome to Core Python’
print(s[0]) #display 0th character from s
W
print(s[3:7]) #display from 3rd to 6th character
come
print(s[11:]) #display from 11th characters onwards till end.
Core Python
print(s[-1]) #display first character from the end
str datatype

• The repetition operator is denoted by ‘*’ symbol and useful to


repeat the string for several times. For example s * n repeats
the string for n times.

print(s*2)
Welcome to Core PythonWelcome to Core Python

bytes Datatype

• A byte number is any positive integer from 0 to 255.


• Bytes array can store numbers in the range from 0 to
255 and it cannot even store negative number.

• We can not modify or edit any element in the bytes


type array.
elements = [10, 20, 0, 40, 15] #this is a list of byte numbers
x = bytes(elements) #convert the list into byte array
print(x[0]) #display 0th element, i.e 10

bytearray Datatype

• A bytearray is similar to bytes datatype.


• Bytearray can be modified or edit any element
in the bytearray datatype.
elements = [10, 20, 0, 40, 15] #this is a list of byte numbers
x = bytearray(elements) #convert the list into byte array
print(x[0]) #display 0th element, i.e 10

x[0]=88
x[1]=99
print(x[0])

list Datatype
• Lists in Python are similar to arrays in C or Java.
• The main difference between a list an array is that a list can
store different types of elements, but array can store only one
type of elements.
• List can grow dynamically in memory.
• But the size of arrays is fixed and they cannot grow at
runtime.

list = [10, -20, 15.5, ‘vijay’, “Marry”]

6/14/2021 Prepared By: Yogeshwari M. Lohar 24

list Datatype

• The slicing operation like [0:3] represents elements from 0


th to

2
nd positions. i.e 10,20,15.5
>>>list = [10, -20, 15.5, ‘vijay’, “Marry”]
>>>print(list)
10, -20, 15.5, ‘vijay’, “Marry”
>>> print(list[0])
10
>>>print(list[1:3])
[-20,15.5]
>>>print(list[-2])
vijay
>>>print(list*2)
[ 10, -20, 15.5, ‘vijay’, “Marry” 10, -20, 15.5, ‘vijay’, “Marry”]
6/14/2021 Prepared By: Yogeshwari M. Lohar 25

tuple datatype

• A tuple contains a group of elements which


can be of different types.
• The elements in the tuple are separated by
commas and enclosed in parentheses().
• It is not possible to modify the tuple elements.
tpl = (10, -20, 15.5, ‘Vijay’ , “Marry”)

tuple datatype

>>> tpl = (10,-20,14.5, “Kabir”, ‘Pranav')


>>> print(tpl)
(10, -20, 14.5, ‘Kabir ', ‘Pranav ')
>>> print(tpl[1:3])
(-20, 14.5)
>>> print(tpl[0])
10
>>> print(tpl[-1])
‘Pranav’
>>> print(tpl*2)
(10, -20, 14.5, ‘Kabir ', ‘Pranav ', 10, -20, 14.5, ‘Kabir ', ‘Pranav ')
>>> tpl[0] = 1
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
tpl[0] = 1
TypeError: 'tuple' object does not support item assignment
6/14/2021 Prepared By: Yogeshwari M. Lohar 27

range Datatype

• The range datatype represents a sequence of


numbers.
• The numbers is the range are not modifiable.
• Range is used for repeating a for loop for a
specific number of times.

range Datatype

>>> r = range(10)
>>> for i in r : print(i)
0
1
2
3
4
5
6
7
8
9

range Datatype

>>> r = range(30,40,2)
>>> for i in r:print(i)
30
32
34
36
38

>>> lst = list(range(10))


>>>
>>> print(lst)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

6) Explain garbage collection python.


Garbage collection in Python is the process of automatically
freeing up memory space occupied by objects that are no longer
being used by the program. This is done by the Python interpreter,
which automatically detects objects that are no longer being
referenced by the program and frees up the memory space they
are occupying.

The garbage collector in Python uses a reference counting


mechanism to keep track of the number of references to an
object. When the reference count of an object drops to zero, it
means that the object is no longer being used by the program and
is considered garbage. The garbage collector then frees up the
memory space occupied by the object, making it available for use
by other parts of the program.
In addition to reference counting, Python also uses a cyclic
garbage collector to detect and clean up circular references.
Circular references occur when objects reference each other in a
cycle, making it impossible to determine which objects are still
being used and which ones are garbage. The cyclic garbage
collector detects and breaks these cycles, freeing up the memory
space occupied by the circularly-referenced objects.

Garbage collection in Python is automatic and transparent to the


programmer, which means that the programmer does not have to
worry about managing memory allocation and deallocation.
However, it is important to note that while Python's garbage
collector is very effective at freeing up memory space, it can
introduce performance overhead due to the extra
work it has to do.

7) Discuss at least 6 mathematical in-built functions with


appropriate example.

The math module is a standard module in Python and is always available.


To use mathematical functions under this module, you have to import
the module using import math.

ceil() :- This function returns the smallest integral value greater than
the number. If number is already integer, same number is returned. 2.
floor() :- This function returns the greatest integral value smaller than
the number. If number is already integer, same number is returned.

Python

# Python code to demonstrate the working of


# ceil() and floor()

# importing "math" for mathematical operations


import math
a = 2.3

# returning the ceil of 2.3


print ("The ceil of 2.3 is : ", end="")
print (math.ceil(a))

# returning the floor of 2.3


print ("The floor of 2.3 is : ", end="")
print (math.floor(a))
Output:
The ceil of 2.3 is : 3
The floor of 2.3 is : 2
Time Complexity: O(1)
Auxiliary Space: O(1)
3. fabs() :- This function returns the absolute value of the number. 4.
factorial() :- This function returns the factorial of the number. An error
message is displayed if number is not integral.

Python

# Python code to demonstrate the working of


# fabs() and factorial()

# importing "math" for mathematical operations


import math

a = -10

b= 5

# returning the absolute value.


print ("The absolute value of -10 is : ", end="")
print (math.fabs(a))

# returning the factorial of 5


print ("The factorial of 5 is : ", end="")
print (math.factorial(b))

Output:
The absolute value of -10 is : 10.0
The factorial of 5 is : 120
Time Complexity: O(b)
Auxiliary Space: O(1)
5. copysign(a, b) :- This function returns the number with the value of
‘a’ but with the sign of ‘b’. The returned value is float type. 6. gcd() :-
This function is used to compute the greatest common divisor of 2
numbers mentioned in its arguments. This function works in python 3.5
and above.

Python

# Python code to demonstrate the working of


# copysign() and gcd()

# importing "math" for mathematical operations


import math

a = -10
b = 5.5
c = 15
d=5

# returning the copysigned value.


print ("The copysigned value of -10 and 5.5 is : ", end="")
print (math.copysign(5.5, -10))

# returning the gcd of 15 and 5


print ("The gcd of 5 and 15 is : ", end="")
print (math.gcd(5,15))

Output:
The copysigned value of -10 and 5.5 is : -5.5
The gcd of 5 and 15 is : 5

8) Discuss difference between tuple and list.

SR.NO. LIST TUPLE

1 Lists are mutable Tuples are immutable

The implication of iterations is The implication of iterations


2
Time-consuming is comparatively Faster

The list is better for performing Tuple data type is


3 operations, such as insertion appropriate for accessing
and deletion. the elements

Tuple consumes less


4 Lists consume more memory memory as compared to the
list

Lists have several built-in Tuple does not have many


5
methods built-in methods.

The unexpected changes and In tuple, it is hard to take


6
errors are more likely to occur place.

List

List = [1, 2, 4, 4, 3, 3, 3, 6, 5]
print("Original list ", List)

List[3] = 77
print("Example to show mutability ", List)

Original list [1, 2, 4, 4, 3, 3, 3, 6, 5]


Example to show mutability [1, 2, 4, 77, 3, 3, 3, 6, 5]
Tuple

tuple1 = (0, 1, 2, 3)
tuple1[0] = 4
print(tuple1)

Output:
Traceback (most recent call last):
File "e0eaddff843a8695575daec34506f126.py", line 3, in
tuple1[0]=4
TypeError: 'tuple' object does not support item assignment

9) Assume that EMP.CSV file contains (empid, name, salary, gender,


DOB,
date_join). Write a python statement to do following operations in
Data
frame.
a. Create a data frame from emp.csv file.
b. Retrieve number of rows and columns
c. Retrieve 3rd row to 4th rows from data frame
d. Retrieve employee id and name of employees whose salary is not
more
than 10000
e. Display emp record in sorted order of date of joining.
f. Display all rows having minimum salary
g. Make empid as an index column

import pandas as pd

filepath = "emp.csv"
df = pd.read_csv(filepath)
print("Read the CSV file:-")
print("Printing the Data Frame:-\n ",df)
print("\n\nNum of rows and coloumns:-\n ",df.shape)
print("\n\nData of the 3rd row\n",df.iloc[2])
print("\n\nData of the 4th row\n",df.iloc[3])
row=df[df["salary"]<=10000]
print("\n\nData of the employee whose salary is not more than
10000:- ")
print(row[["empid","empname"]].to_string(index=False))
print("\n\nSorted data as per Date of joining:- ")
print(df.sort_values(by=['DOJ']))
print("The data having minimum salary:- ")
print(df[df["salary"]==df["salary"].min()])
df1=df.set_index('empid')
print("\n\nEmp id as an index :- ")
print(df1)
output:-
Read the CSV file:-
Printing the Data Frame:-
empid empname salary gender dob DOJ
0 101 tanjiro 50000 male 01-01-2002 25-05-2022
1 102 zenitsu 20000 male 02-02-2002 14-09-2021
2 103 inosuke 15000 male 03-03-2002 11-05-2021
3 104 giyu 9000 male 04-04-2002 16-07-2020
4 105 naruto 5000 male 11-05-2002 15-08-2015
5 106 yuji 9500 male 06-06-2002 20-10-2019
6 107 steve 15000 male 07-07-2002 25-10-2018
7 108 light 20000 male 08-08-2002 02-08-2019
8 109 nezuko 40000 female 09-09-2002 09-09-2022
9 110 mitsuri 100000 female 10-10-2002 24-10-2019

Num of rows and coloumns:-


(10, 6)

Data of the 3rd row


empid 103
empname inosuke
salary 15000
gender male
dob 03-03-2002
DOJ 11-05-2021
Name: 2, dtype: object

Data of the 4th row


empid 104
empname giyu
salary 9000
gender male
dob 04-04-2002
DOJ 16-07-2020
Name: 3, dtype: object

Data of the employee whose salary is not more than 10000:-


empid empname
104 giyu
105 naruto
106 yuji

Sorted data as per Date of joining:-


empid empname salary gender dob DOJ
7 108 light 20000 male 08-08-2002 02-08-2019
8 109 nezuko 40000 female 09-09-2002 09-09-2022
2 103 inosuke 15000 male 03-03-2002 11-05-2021
1 102 zenitsu 20000 male 02-02-2002 14-09-2021
4 105 naruto 5000 male 11-05-2002 15-08-2015
3 104 giyu 9000 male 04-04-2002 16-07-2020
5 106 yuji 9500 male 06-06-2002 20-10-2019
9 110 mitsuri 100000 female 10-10-2002 24-10-2019
0 101 tanjiro 50000 male 01-01-2002 25-05-2022
6 107 steve 15000 male 07-07-2002 25-10-2018
The data having minimum salary:-
empid empname salary gender dob DOJ
4 105 naruto 5000 male 11-05-2002 15-08-2015

Emp id as an index :-
empname salary gender dob DOJ
empid
101 tanjiro 50000 male 01-01-2002 25-05-2022
102 zenitsu 20000 male 02-02-2002 14-09-2021
103 inosuke 15000 male 03-03-2002 11-05-2021
104 giyu 9000 male 04-04-2002 16-07-2020
105 naruto 5000 male 11-05-2002 15-08-2015
106 yuji 9500 male 06-06-2002 20-10-2019
107 steve 15000 male 07-07-2002 25-10-2018
108 light 20000 male 08-08-2002 02-08-2019
109 nezuko 40000 female 09-09-2002 09-09-2022
110 mitsuri 100000 female 10-10-2002 24-10-2019

You might also like