Question
Consider the following Data Frame ‘‘emp’’ and answer any four questions from (i) – (v).

Ecode Name Age Fav_Color Salary
101 Rohit 20 Blue 45000
102 Mohanti 24 Red 36000
103 Tushar Koul 23 Green 42000
104 Rupali 22 Yellow 38000
105 Gurpreet 21 Pink 40000

(a) Select the command from the given options that will give the following output:-

(i) print(emp.max)

(ii) print(emp.max(axis=1))

(iii) print(emp.max,axis=1)

(iv) print(emp.max())

(b) A manager wants to know the Favourite colour of the employee with the employee code 103. Help him to identify the correct set of statements from the given options:

(i) df1=emp[emp[‘Ecode’]==103]

print(df1)

(ii) df1=emp['Ecode'==103]

print(df1)

(iii) df1=emp[emp.Ecode=103]

print(df1)

(iv) df1=emp[emp.Ecode==103]

print(df1)

(c) Which of the following statement will give the names of the employees whose salary is more than 40000.

(i) print(emp.max())

(ii) print(emp[emp["Salary"]>40000])

(iii) print(emp["Salary"]>40000)

(iv) print(emp.max()>40000)

(d) Which of the following command will list only the columns Ename and Salary using loc:

(i) print(emp.loc[:,[0,2]]

(ii) print(emp.loc[:,["Ename","Salary"]])

(iii) print(emp.loc(:["Ename","Salary"]))

(iv) print(emp.loc[["Ename","Salary"]])

(e) Mr. Singh, the manager wants to add a new column, the Rank with the values ‘IV’, ‘II’, ‘III’, ‘IV’, ‘I’, to the data frame Help him to identify the right command from the followings to do so :

(i) emp.column=[‘IV’, ‘II’, ‘III’, ‘IV’, ‘I’ ]

(ii) emp.iloc["Rank"] =[‘IV’, ‘II’, ‘III’, ‘IV’, ‘I’]

(iii) emp["Rank"] =[‘IV’, ‘II’, ‘III’, ‘IV’, ‘I’ ]

(iv) None of the above

Answer

(a) (iv) print(emp.max())

(b) (i) df1 = emp[emp["Ecode"]==103]

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Krishna of class 12 is writing a program to read the details of Sports performance and store in the csv file “games.csv” delimited with a tab character. As a programmer, help him to achieve the task.

(a)Line 1 : Name the module he should import.

(b)Line 2 : To create an object to enable to write in the csv file.

(c)Line 3 : To store the data in list

(d)Line 4 : To write a record.

(e)Line 5 : To close the file.

Answer the following question on the basis of given dataset:

a b c d
0 1 2 3 4
1 100 200 300 400
2 1000 2000 3000 4000

(i) To create the data frame for the above dictionary.

(ii) To print the dictionary.

(iii) To change the index of the above data frame 'a1','a2','a3'.

(iv) To change the columns headings to 'units','tens','hundred',' thousand'.

(v) To display the tens columns.

(vi) To create another datframe with values of thousand.

(vii) To use the iterrows() to display the complete records.

(viii) To display the column wise data using iteritems().

Write the output on the basis of the given data frame:

units tens hundred thousand
a1 1 2 3 4
a2 100 200 300 400
a3 1000 2000 3000 4000

The following is the code related to the data structure QUEUE

Now answer the following based on the code given:

(a) What is the purpose of EnQueue function

(# Statement-1) defined above:

(i) It is a user defined function to scan / access QUEUE elements

(ii) It is a pre defined function to scan / access QUEUE elements

(iii) It is a user defined function working on double ended queue

(iv) It is a user defined function working on circular queue

(b) What is the line QUEUE.append(VALUE)

(# Statement-2) doing

(i) This will add the element at the end of the QUEUE

(ii) This will remove the element from the end of the QUEUE

(iii) This will add the element at the beginning of the QUEUE

(iv) This will remove the element from the beginning of the QUEUE

(c) Conceptually if the QUEUE is already full , what will happen

(i) PEEK() function will be executed

(ii) OVERFLOW occurs

(iii) UNDERFLOW occurs

(iv) We may still add more elements in it.

(d) What is the use of the variable VALUE used in argument (# Statement-1)

(i) This is the position of FRONT

(ii) This is the position of REAR

(iii) This is an element added in a QUEUE

(iv) This is the name of the list

(e) When the else part (# Statement-3) of the above code will be executed

(i) When the length of the QUEUE is zero

(ii) When the length of the QUEUE is one

(iii) When the length of the QUEUE is more than one

(iv) This part of the code will always executed

(a) Create the Dictionary Student with the following key and add the 5 values. Dictionary will be created from 4 different list:

Column Name Key
Student Number sno
Student Name sname
E-mail mail
Marks mark

(b) Create the data frame for the above specification containing index parameter along with column.

(c) Add a new column grade into above Data Frame with at least 3 methods.

(d) Insert the 2 rows.

(e) Create another Data Frame with two rows named DF2.

(f) Add this data frame to your existing data frame.

(g) Display the alternate rows.

(h) Display the name and marks of the students whose marks is greater than equal to 90.

(i) Fill all NaN in the data.

(j) Increase the marks by 10.

Write some of the health issues caused due to technology.
Software Development Company has set up its new center at Raipur for its office and web-based activities. It has 4 blocks of buildings named Block A, Block B, Block C, Block (d).

Block Number of Computers
A 25
B 50
C 125
D 10

Shortest distances between various Blocks in meters:

Block A to Block B 60m
Block B to Block C 40m
Block C to Block A 30m
Block D to Block C 50m

(a) Suggest most suitable place to store server of this company.

(i) Block A (ii) Block B

(iii) Block C (iv) Block D

(b) Suggest the topology within the blocks.

(i) Bus (ii) Ring

(iii) Tree (iv) Star

(c) Suggest the placement of the Router in the network.

(i) Block A (ii) Block B

(iii) Block C (iv) Block D

(d) The company wants to design a website for its customers that can be changing the contents as per the responses of customers. What type of website can they design for this purpose?

(i) Static Website (ii) HTML website

(iii) Dynamic Website (iv) Blog

(e) What type of network would be formed if the Raipur office is connected to their New Delhi office?

(i) LAN (ii) PAN

(iii) MAN (iv) WAN

Answer the following questions:

id Feature1 Feature2
0 1 A B
1 2 C D
2 3 E F
3 4 G H
4 5 I J


id Feature1 Feature2
0 1 K L
1 2 M N
2 6 O P
3 7 Q R
4 8 S T

(i) To create the data frame for the above dataset.

(ii) To join the data frames.

(iii) To count the the rows in new data frame.

(iv) To reset the index.

Indian Law Organization is planning to computerized their application form. For registration, organization has setup the rules imposed by Indian Law. Citizen can check their eligibility criteria by providing Nationality, Gender and Age.

On the basis of above code, choose the best appropriate option.

(a) Which statement will be executed if Nationality is Indian, Gender is Male and Age is 19.

(i) Statement 1 (ii) Statement 2

(iii) Statement 3 (iv) Statement 4

(b) Which Statement will be executed, if Nationality is American, Gender is Female and Age is 27.

(i) Statement 1 (ii) Statement 2

(iii) Statement 4 (iv) Statement 5

(c) Which Statement is executed, if Nationality is Indian, Age is 25 and Gender if Female.

(i) Statement 1 (ii) Statement 2

(iii) Statement 3 (iv) Statement 4

(d) Which Statement is executed, if Nationality is Indian, Age is 17 and Gender is Female.

(i) Statement 1 (ii) Statement 2

(iii) Statement 3 (iv) Statement 4

(e) Which statement will be executed if Nationality is Indian, Gender is Male and Age is 29.

(i) Statement 1 (ii) Statement 2

(iii) Statement 3 (iv) Statement 4

Consider the following DataFrameDf1 and answer any four questions from (i) – (iv)

City Hospitals Schools
0 Delhi 189 7916
1 Mumbai 208 8508
2 Kolkata 149 7226
3 Chennai 157 7617

(a) Choose the right statement to get the given output:

(i) Df1.mean()

(ii) Df1.mean(axis=1)

(iii) Df1.average()

(iv) Df1.median()

(b) Write the command to get the given output:

City Hospitals Schools
3 Chennai 157 7617
0 Delhi 189 7916
2 Kolkata 149 7226
1 Mumbai 208 8508

(i) Df1.sort(by=‘City’)

(ii) Df1.sort_values(‘City’)

(iii) Df1.sort_values(by=‘City’)

(iv) Df1.sort_values(by==‘City’)

(c) Choose the right statement to get given output:

Hospitals Schools
count 4,000000 4,000000
mean 175.750000 7816.750000
std 27.584718 540.543785
min 149.000000 7226.000000
25% 155.000000 7519.250000
50% 173.000000 7766.500000
75% 193.000000 8064.000000
max 208.000000 8508.000000

(i) Df1.desc()

(ii) Df1.statistics()

(iii) Df1.desctibe()

(iv) Df1.showall()

(d) Chose the right function to fill in given statement to make the city as index value:

Df1._________________(‘City’,inplace=True)

(i) Df1.set_index(‘City’,inplace=True)

(ii) Df1.index('City',inplace=True)

(iii) Df1.new_index(‘City ‘,inplace=True)

(iv) Df1.reset_index(‘City’,inplace=True)

(e) Which Pandas command is used to rename the columns & index name of the above dataframe

(i) Df1.renamecolumns()

(ii) Df1.Rename()

(iii) Df1.rename()

(iv) Df1.indexrename()

Consider the following tables CARHUB and CUSTOMER and answer (a) and (b) parts of this question: [Delhi 2012]

Table: CARHUB

Vcode Vehicle Name Make Color Capacity Charges
100 Innova Toyota WHITE 7 15
102 SX4 Suzuki BLUE 4 14
104 C Class Mercedes RED 4 35
105 A-Star Suzuki WHITE 3 14
108 Indigo Tata SILVER 3 12

Table: CUSTOMER

CCode CName VCode
1 Hemant Sahu 101
2 Raj Lal 108
3 Feroza Shah 105
4 Ketan Dhal 104

(a) Write SQL commands for the following statements:

(i) To display the names of all white colored vehicles

(ii) To display name of vehicle, make and capacity of vehicles in ascending order of their sitting capacity

(iii) To display the highest charges at which a vehicle can be hired from CARHUB.

(iv) To display the customer name and the corresponding name of the vehicle hired by them.

(b) Give the output of the following SQL queries:

(i) Select count(distinct make) from cabhub;

(ii) Select max(charges), min(charges) from carhub;

(iii) Select count(*), make from carhub;

(iv) Select vehiclename from carhub where capacity = 4;