Home / insert new column in dataframe python / PART-A (SECTION-I) (Attempt any 15 questions from …

PART-A (SECTION-I) (Attempt any 15 questions from … - insert new column in dataframe python


PART-A (SECTION-I) (Attempt any 15 questions from …-insert new column in dataframe python

PART-A (SECTION-I)
(Attempt any 15 questions from questions 1 to 21)
1. ___________ function applies the passed function on each individual data element of the dataframe.
1
1. apply() 2. applymap() 3. pivot() 4. None
2. The command used to give a title along X-Axis to a graph is _________. 1
1. LabelX() 2. xtitle() 3. xlabel() 4. label()
3. By default, ORDER BY clause lists the records in _______ order. 1
1. Ascending 2. Descending 3. Both (1 and 2) 4. None
4. Write the output: SELECT CHAR(70, 65, 67, 69); 1
1. ASLL 2. FACE 3. ACEF 4. CEAF
5. SQL applies condition on groups through ________ command. 1
1. Group by 2. Select 3. Where 4. Having
6. Given a Pandas Series SQ, the command which will display the first 4 rows is _____. 1
1. print(SQ.head(4)) 3. print(SQ.Head(4))
2. print(SQ,heads(4)) 4. print(head(4))
7. What is output of the following: 1
x=np.array([1,2,3])
y=np.array([3,2,1])
z=np.concatenate([x,y])
print(z)
1. [(1,2,3),(3,2,1)] 3. [1,2,3,2,1]
2. [1,2,3,3,2,1] 4. [1,1,2,2,3,3]
8. Which is not an example of topology? 1
1. Tree 2. Star 3. Bus 4. Branch
9. The __________ function is used to draw Horizontal bar Chart. 1
1. bar_Chart() 2. barh() 3. b_Chart() 4. None
10. Which amongst the following is not an example of Network device? 1
1. HUB 2. MESH 3. Router 4. Switch
11. Commit, Rollback and Savepoint are the example of ____ Statement. 1
1. DDL 2. DML 3. DCL 4. TCL
12. The python statement to delete the 3rd and 5th rows from a dataframe df is ? 1
1. df.drop([2,4]) 3. df.delete([2,4])
2. df.droprows([2,4]) 4. df.rows_del([2,4)]
13. Which function is used to generate quartile in python pandas? 1
1. quartile() 3. quantile()
2. Both 4. None of the above
14. Which is not an example of DDL staements? 1
Page 1 of 8
1. CREATE 2. DROP 3. ALTER 4. UPDATE
15. When we perform basic itertions in Series, the result it produces is? 1
1. Values 2. Column Labels 3.Item Labels 4. Index
16. Which operator is used to slice the rows in DataFrame? 1
1. - 2. = 3. * 4. :
17. Adding a new column using the existing columns in DataFrame the command is? 1
1. df['four']=df['one']+df['three'] 3. df=df.new()
2. new.DF() 4. df[]
18. The attribute used to jump rows in csv file while reading the data, is? 1
1. Jump 2. Skip 3. Goto 4. Skiprows
19. Stealing someone else intellectual work and representing it as your own is known as? 1
1. Piracy 2. Plagiarism 3. Scam 4. Coping
20. Which amongst the following is not an example of unguided media? 1
1. Fiber Optic Cable
2. Microwave
3. Radio Frequency
4. Satellite
21. MySQL uses the port number________ to start. 1
1. 1007 2. 1402 3. 3306 4. 2403
SECTION - II
Both the case study based questions (22 and 23) are compulsory. Attempt any four sub parts from each
question. Each sub question carries 1 mark.
22. Choose appropriate answer with respect to the following code snippet.
(Attempt Any Four sub parts)
CREATE TABLE student (
name CHAR(30),
student_id INT,
gender CHAR(1),
PRIMARY KEY (student_id)
);
1. What will be the degree of the table student? 1
a. 2 b. 3 c. 4 d. 5
2. What does the `name' represent in the above code snippet? 1
a. A Table c. A Row
b. A Column d. A Database
3. State the SQL command that will give the output as: 1
a. Displays contents of table `student'
b. Displays column names and contents of table Student
c. Result in Error
d. Displays only column names of the table student
Page 2 of 8
4. What will be the output of following query? 1
INSERT INTO student
VALUES ("Suhana",109,'F'),
VALUES ("Rivaan",102,'M'),
VALUES ("Atharv",103,'M'),
VALUES ("Rishika",105,'F'),
VALUES ("Garvit",104,'M'),
VALUES ("Shaurya",109,'M');
a. Error
b. No Error
c. Depends on Compiler
d. Successful compilation of query
5. In the following query, how many rows will be deleted? 1
DELETE STUDENT WHERE STUDENT_ID=109;
a. One Row
b. All the row where student ID equal to 109
c. No row will be deleted
d. Two Rows
23. Consider the following data (Attempt Any Four sub parts):
Roll_No Name Age Marks
1 Arun 18 68
2 Mohit 14 47
3 Karan 13 78
4 Lalit 16 87
5 Ravi 14 60
1. Display the details of the student who scored highest marks. 1
2. Display the sum of all the marks. 1
3. Display the average marks. 1
4. Display the detail of the student whose Roll_No is 2. 1
5. The command use to print the dataframe. 1
PART-B (Section - I)
24. Write python statements to create a data frame for the following data. 2
Name Age Designation
RAJIV 20 CLERK
SAMEER 35 MANAGER
KAPIL 45 ACCOUNTANT
25. State any two differences between update and alter statement of SQL. 2
OR
What are the differences between Database and DBMS?
Page 3 of 8

How to add multiple columns to pandas Dataframe? Here are two commands which can be used: Use Dataframe join command to append the columns Use Pandas concat command to append the columns Both methods can be used to join multiple columns from different data frames and create one data frame.