/**/ Python & MySQL: January 2024

Friday, January 19, 2024

IP - PREBOARD (SAMPLE PAPER) 2024

 

SAMPLE PAPER WITH SOLUTION 2024

CLASS – XII

INFORMATICS PRACTICES (065)

TIME 03 HOURS                                                                            M.M. 70

General Instructions:
        This question paper contains five sections, Section A to E.
        All questions are compulsory.
        Section A has 18 questions carrying 01 mark each.
        Section B has 07 Very Short Answer type questions carrying 02 marks each.
        Section C has 05 Short Answer type questions carrying 03 marks each.
        Section D has 02 questions carrying 04 marks each.
        Section E has 03 questions carrying 05 marks each.
        All programming questions are to be answered using Python Language only.


SECTION – A


1. Which of the following topologies is very efficient and all nodes are connected to a central hub?

a)      Star

b)      Tree

c)      Bus

d) Ring


2. Ramandeep is a young woman with great aspirations and has a good team of like-minded people. She along with her team members started a company to sell handicrafts online and also designed a logo for their company. What type of intellectual property does this logo represent?

a)      Patents

b)      Copyright

c)      Design

d) Trademark


3. Which of the following is a type of cybercrime where objectionable and demeaning comments are posted on social media platform about a person, such that he/she is mentally harassed?

a)      Phishing

b)      Hacking

c)      Cyber bullying

d)   Identity theft


4. Which of  the following is the correct output of the following SQL command?

SELECT ROUND(7586.4568, 2)

a)      7876.46

b)      7876.45

c)      7900

d) 7900.4568


5. Aggregate functions are also known as

a)      Scalar functions

b)      Single row functions

c)      Multiple row functions

d) Hybrid functions


6. head() function is used to return first ________ rows.

a)      n-1

b)      n+1

c)      n2

d)  n


7. Abdul deleted all his chat from all his social media accounts and he thinks that all his traces are deleted completely. Is he right in think so?

a)      Yes

b)      No

c)      May be

d) Not sure


8. What is the correct syntax to return the values of first row of a Pandas DataFrame? Assuming the name of the DataFrame is dfRent.

a)      dfRent[0]

b)      dfRent.loc[1]

c)      dfRent.loc[0]

d)   dfRent.iloc[1]



9. ______ refers to a small, single site network.

a)      DSL

b)      RAM

c)      WAN

d)   PAN


10.  Which function returns the length of the string in bytes?

a)      LENGTH()

b)      DATE()

c)      TIME()

d)    MATH()


11.   A software which is available for free and the code is open for all, it is called as…………..

a)      Proprietary software

b)      Free and open source software

c)      Free software

d)   None of these


12.  Which of the following is not a Mathematical function?

a)      LENGTH()

b)      POWER()

c)      MOD()

      d)   ROUND()

13.   The return type of POWER() function is

a)      String

b)      Date

c)      Numeric

      d)    None of these


14.  Given a Pandas Series called sequences, the command which will display the first 4 rows is ______.

a)      print(sequences.head(4))

b)      print(sequences.Head(4))

c)      print(sequences.heads(4))

d)   print(sequences.Heads(4))


15.  The correct output of

SELECT TRIM (LEADING ‘&’ FROM ‘&&& India &&&&’) ; is

a)      India &&&

b)      India &&&&

c)      && India

d)   &&& India


16.  Which of the following is an example of copyleft license?

a)      GPL

b)      BSD

c)      MIT

d)    All of these


17.  Assertion (A) Pandas is an open-source Python library which offers high performance, easy to use data structures and data analysis tools.

Reason (R) Professionals and developers are using the Pandas library in data science and machine learning.

a)      Both A and R are true and R is the correct explanation of A.

b)      Both A and R are true but R is not the correct explanation of A.

c)      A is true but R is false.

d)    A is false but R is true.


18.  Assertion (A) The name Bluetooth is derived from Harald Bluetooth, a king in Denmark.

Reason (R) Bluetooth is used for exchanging data over a short distance from fixed and mobile device.

a)      Both A and R are true and R is the correct explanation of A.

b)      Both A and R are true but R is not the correct explanation of A.

c)      A is true but R is false.

d)    A is false but R is true.



SECTION - B


19.   What is the advantage of using switch over hub?

                                   OR

  List two differences between a website and web page.

Ans: 

(i) A switch is faster than a hub.

(ii) A switch offers full-duplex communication while a hub offers only half-duple.

                                 OR

Web Site

(i) It is a group of related web pages addressed to a typical URL.

(ii) There is ot extension used in the URL of a website. Ex - Amazon, Flipkart etc.

Web Page

(i) It is a part of web site which comprises links to other web pages.

(ii) The web page URL has an extension. e.g. Contact pages, registration, login, etc.


20. The Python code written below has syntactical errors. Rewrite the correct code and underline the corrections made.

 Import pandas as pd

import Numpy as np

arr = np.array([1, 2,  3,  4, 5])

my_Series = pd.Series(arr)

print(my_series)

Ans:

import pandas as pd

import numpy as np

arr = np.array([1, 2,  3,  4, 5])

my_series = pd.Series(arr)

print(my_series)

21.  Complete the given Python code to create a DataFrame from the following dictionary ‘data_dict’, and print the sum of all the values in the ‘sales’ column.

import ________ as pd

data_dict = {‘item’ : [‘A’, ‘B’, ‘C’, ‘D’], ‘sales’ : [50, 30, 45, 20]}

df = pd.DataFrame(_________)

print(df[‘sales’]. ________())

Ans:

import pandas as pd

data_dict = {‘item’ : [‘A’, ‘B’, ‘C’, ‘D’], ‘sales’ : [50, 30, 45, 20]}

df = pd.DataFrame(data_dict)

print(df[‘sales’]. sum())

22.  What will be the output of the following code:

>>> import pandas as pd

>>> A = pd.Series(data = [35, 45, 55, 40])

>>> print (A>40)

Ans:

0     False

1     True

2     True

3     False

23.  Kiyaan, a database administrator needs to display house wise total number of records of ‘Blue’ and ‘Green’ house. He is encountering an error while executing the following query:

 SELECT HOUSE, COUNT (*) FROM SCHOOL GROUP BY HOUSE WHERE HOUSE = ‘Blue’ or HOUSE = ‘Green’ ;

 Help him in identifying the reason of the error and write the correct query by suggesting possible corrections.

Ans:

The problem with the given SQL query is that WHERE clause should not be used with GROUP BY  clause. To correct the error, HAVING clause should be used instead of WHERE.

Correct query is:

SELECT HOUSE, COUNT(*) FROM SCHOOL GROUP BY HOUSE HAVING HOUSE = ‘Blue’ OR HOUSE = ‘Green’ ;

24.  Complete the given Python code to get the required output as 16

import ________ as np

data = [1, 4, 9, 16]

series_data = np. __________(data)

print(series_data[_______])

Ans:

import numpy as np

data = [1, 4, 9, 16]

series_data = np.array(data)

print(series_data[3])

25.  Write the output of the given code.

import pandas as pd

s1=pd.Series([5, 6, 7, 8, 10], index =[‘v’, ‘w’, ‘x’, ‘y’, ‘z’])

a = [2, 6, 1, 4, 6]

s2 = pd.Series(a, index = [‘z’,  ‘y’, ‘a’, ‘w’, ‘v’])

print(s1-s2)

Ans:

a    NaN

v     -1.0

w     2.0

x      NaN

y      2.0

z      8.0

SECTION - C

26.  Consider the table BOOK given below

                                                           Table: Book

Code

Title

Author

Publication

Price

D001

Physics

Vikas Sharma

xxx

250

D002

Chemistry

Preeti Goyal

yyy

300

D003

Informatics Practices

Swati Rana

zzz

275

D004

English

Sanjeev Jain

aaa

150

D005

Mathematics

Rajiv Rastogi

bbb

400


Give the output of the following commands:

(i) SELECT SUBSTR(Title, 2, 3) FROM BOOK WHERE CODE = ‘d002’ ;

(ii) SELECT CONCAT (Author, Publication) FROM BOOK WHERE Price = 250 ;

(iii) SELECT MAX(Price) FROM BOOK ;

Ans:

(i) SUBSTR(Title, 2,3)

      hem

 (ii) CONCAT(Author, Publication)

       Vikas Sharmaxxx

 (iii) MAX(Price)

       400


27. Write a code to create the following DataFrame:

 

Name

Marks

Subject

a

Abhi

75

Maths

b

Chirag

82

Science

c

Tushar

69

English

d

Mahi

70

Science

e

Vanshika

92

Computer


Ans:

import pandas as pd

data = {‘Name’ : [‘Abhi’, ‘Chirag’, ‘Tushar’, ‘Mahi’, ‘Vanshika’],

             ‘Marks’ : [75, 82, 69, 70, 92],

           ‘Subject’ : [‘Maths’, ‘Science’, ‘English’, ‘Science’, ‘Computer’] }

df = pd.DataFrame(data, index = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’])

print(df)

28.  Sanyukta is event incharge in a school. One of her students gave her a suggestion to use Python Pandas and Matplotlib for analysing and visualising the data, respectively. She has created a DataFrame “df” to keep track of the number of First, Second and Third prize won by different houses in various events.

 

House

Frist

Second

Third

0

Chenab

5

7

6

1

Gangas

10

5

4

2

Jamuna

8

13

15

3

Jhelum

12

9

12

4

Ravi

5

11

10

5

Satluj

10

5

3


Help her to write Python commands to do the following questions:

(i) Display the House names where the number of Second prize are in the range of 12 to 20.

(ii) Display all the records in the reverse order.

(iii) display the bottom 3 records.

Ans:

(i) df [ ‘House’][(df [‘Second’ ] > = 12) and (df [ ‘Second’] <= 20)]

(ii) print(df.iloc[: : -1 ]

(iii) df.tail(3)

29.  Consider the following table CLUB.

                                                             Table : CLUB

COACH_ID

COACHNAME

AGE

SPORTS

DATE_OF_JOINING

PAY

1

Rajesh

30

Karate

1990-08-25

1000

2

Anuj

35

Swimming

2000-01-05

750

3

Shuchi

25

Basketball

2005-01-04

1200

4

Reetika

28

Badminton

2002-08-25

1400

5

Virendra

32

Cricket

1996-05-17

1500


Write SQL queries for the following:

(i) To display the substring of 4 characters of the name of each coach, starting from second character, with chair age.

(ii) To display the day for the Date_of_Joining column.

(iii) to concat the COACHNAME  with AGE where age of coach is above 30 years.

                                                      OR

What is the purpose of GROUP BY clause in MYSQL? How is it different from ORDER BY clause.

Ans:

(i) SELECT SUBSTR(COACHNAME, 2, 4), AGE FROM CLUB ;

(ii) SELECT DAY(DATE_OF_JOINING) FROM CLUB ;

(iii) SELECT CONCAT (COACHNAME, AGE) FROM CLUB WHERE AGE > 30 ;

                                                 OR

The GROUP BY clause can be used to combined all those records that have identical value in a particular field or a group fields.

Whereas, ORDER BY clause is used to display the records either in ascending or descending order based on a particular field. For ascending order, ASC is used and for descending order DESC is used. The default order is ascending order.

30.  Write the output of following queries:

(i) mysql> SELECT POWER(9, 3) ;

(ii) mysql> SELECT MID(‘SUCHI GOYAL’ , 8, 5) ;

(iii) mysql> SELECT RIGHT(‘Dushyant’ , 5) ;

Ans:

(i) 729

(ii) GOYAL

(iii) hyant

SECTION - D


31.  Zeenat has created the following DataFrame1 to keep track of data Rollno, Name, Marks1 and Marks2 for various students of her class, where row indexes are taken as the default values:

Rollno

Name

Marks1

Marks2

1

Swapnil Sharma

30

50

2

Raj Batra

75

45

3

Bhoomi Singh

82

95

4

Jay Gupta

90

95


(a) What will be the output of the following codes?

(i) print(dataframe1.size)

(ii) print(dataframe1[‘Rollno’] ==2)

(b) Write the code to print the highest marks obtained in Marks1 and Marks2.

(c) Write the code to add new column “Marks3” with relevant data.

OR (option for part (c) only)

Write the code for delete the 3rd column.

Ans:

(i) 16

(ii) 2         Raj Batra                    75                        45

(iii) print(dataframe1.Marks1.max()), (dataframe1.Marks2.max()))

                                       OR

del dataframe1[‘Marks1’]

32.  A Gift Gallery has different stores in India. Database Administrator Abhay wants to maintain database of their Salesman in SQL to store the data.

Consider the following records in ‘Salesman’ table and answer the given questions.

                                                  Table : Salesman

Scode

Sname

Address

Dtofjoin

Sales

Area

100

Sushant

Delhi

2017/09/29

5000.90

East

101

sushant

Gurgaon

2018/01/01

7000.75

East

102

Priya

Noida

2018/04/25

3450.45

West

103

Mohit

Delhi

2018/11/03

6000.50

North

104

Priyanshi

Delhi

2019/12/25

8000.62

North


(i) Display Sname and Sales of East and West areas.

(ii) Display the total Sales made in East Area.

(iii) the command to display the Name of the Salesman along with the Sales amount rounded off to one decimal point.

(iv) The command to display the length of salesman name.

Ans:

(i) SELECT SNAME, SALES FROM SALESMAN WHERE AREA = ‘EAST’ OR AREA = ‘WEST’ ;

(ii) SELECT SUM(SALES) FROM SALESMAN WHERE AREA = ‘EAST’ ;

(iii) SELECT SNAME, ROUND(SALES, 1) FROM SALESMAN ;

(iv) SELECT LENGTH (SNAME) FROM SALESMAN ;

SECTION - E

33.  Write the output of the following queries:

(i) SELECT POWER(9, 3) ;

(ii) SELECT MID(‘SUCHI GOYAL’, 8, 5) ;

(iii) SELECT RIGHT(‘DUSHYANT’, 5) ;

(iv) SELECT INSTR(‘SQL FUNCTIONS’, ‘C’) ;

(v) SELECT LEFT(‘ARIHANT’, 2) ;

OR

Kabir has created following table exam:

                                                        Table: Exam

RegNO

Name

Subject

Marks

1

Sanya

Computer Science

98

2

Sanchay

IP

100

3

Vinesh

Cs

90

4

Sneha

IP

99

5

Akshita

IP

100


Help him in writing SQL queries to the perform the following task:

(i) Insert new record in the table having following values:

     [6, ‘Khushi’ , ‘CS’, 85]

(ii) To change the value ‘IP’ to ‘Informatics Practices’ in subject column.

(iii) To remove the records of those students whose marks are less than 30.

(iv) To add a new column Grade of suitable datatype.

(v) To display records of “Informatics Practices” subject

Ans:

(i) 729

(ii) OYAL

(iii) hyant

(iv) 8

(v) Ar

OR

(i) INSERT INTO EXAM VALUES(6, ‘KHUSHI’, ‘CS’, 85) ;

(ii) UPDATE EXAM SET SUBJECT = ‘INFORMATICS PRACTICES’ WHERE SUBJECT = ‘IP’ ;

(iii) DELETE FROM EXAM WHERE MARKS < 30 ;

(iv) ALTER TABLE EXAM ADD COLUMN GRADE VARCHAR(2) ;

(v) SELECT * FROM EXAM WHERE SUBJECT = ‘INFORMATICS PRACTICES’ ;

34.  China Middleton Fashion is planning to expand their network in India, starting with tow cities to provide infrastructure for distribution of their products.

The company has planned to setup their main office in Chennai at three different locations and have named their offices as Production Unit, Finance Unit and Media Unit. The company has its Corporate Unit in Delhi.

A rough layout of the same is as follows:


Approximate distance between these units is as follows:

From

To

Distance

Production Unit

Finance Unit

70 m

Production Unit

Media Unit

15 m

Production Unit

Corporate Unit

2112 m

Finance Unit

Media Unit

15 m


In continuation of the above, the company experts have planned to install the following number of computers in each of these units.

Unit

Computers

Production Unit

150

Finance Unit

35

Media Unit

10

Corporate Unit

30



(i) Suggest the kind of network required (out of LAN, MAN, WAN) for each of the following units.

(a)   Production Unit and Media Unit.

(b)   Production Unit and Finance Unit.

(ii) Which of the following devices will you suggest for connecting all computers with each of their office units?

(a)   Switch/Hub                         (b) Modem                    (c) Telephone

(iii) Suggest a cable/wiring layout for connecting the company’s local office units located in Chennai.

(iv) After setting up the lab and Internet in the lab, company now requires to enable video and animations to be played on the web browser for it’s employees. Which browser tool/service can be used for the same.

(v) Give an example of Open Source web browser.


Ans:

(i) (a) Local Area Network (LAN)

(b)   The type of network between Production Unit and Finance Unit is MAN (Metropolitan Area Network)

(ii) Switch/Hub

(iii) The cable/wiring layout for connection is as follows:


(iv) Add-one browser tool/service can be used to enable videos and animations to be played on the web browser for multimedia class.

(v) Google Chrome, Firefox

35.  The heights of 10 students of eighth grade are given below: Height_cms=[145,141,142,142,143,144,141,140,143,144]

Write suitable Python code to generate a histogram based on the given data, along with an appropriate chart title and both axis labels.

Also give suitable python statement to save this chart.

OR

Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below:


Also give suitable python statement to save this chart.

Ans:

import matplotlib.pyplot as plt 

Height_cms=[145,141,142,142,143,143,141,140,143,144]  

 plt.hist(Height_cms)       

plt.title("Height Chart") 

plt.xlabel("Height in cms")

plt.ylabel("Number of people") 

plt.show()     

 plt.savefig("heights.jpg")

 OR

import matplotlib.pyplot as plt 

hobby = ('Dance', 'Music', 'Painting', 'Playing Sports')       

users = [300,400,100,500] 

plt.bar(hobby, users)                                    

plt.title("Favourite Hobby") 

plt.ylabel("Number of people") 

plt.xlabel("Hobbies")                     

plt.show()                          

plt.savefig("hobbies.jpg") 

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



CLASS XI HALF YEARLY QP WTH MS 2024

  Half Yearly Examination: 2024-25 Informatics Practices (065) Class- XI       Time Allowed: 3hrs                                     ...