Tuesday

Sample Question Answers Class 12 - Part 3

 

 

Section-II

 

34.

Write a function swap2List(arr,n) in Python, that would accept a list arr of n numbers. The functions should modify the content of the List in such a way that the elements, which are multiples of 5 swap with the value present in very next position in the array.

example if the list arr contains: [1, 15, 7, 18, 20, 14]

then after rearrangement the list should contain [1, 7, 18, 20, 14, 15]

3

35.

Write a function in Python that counts the number of “Me” or “My” words present in a text file “STORY.TXT”. If the “STORY.TXT” contents are as follows:

My best word is all right.

 

My friend is going to meet him.

 

The output of the function should be: Count of Me/My in file: 3

 

OR

 

Write a function AMCount() in Python, which should read each character of a text file STORY.TXT, should count and display the occurrences of alphabets A and M (including small cases a and m too).

Example: If the file content is as follows:

 

More apple and mango trees have to be grown

The AMCount() function should display the output as: A or a: 4 M or m :2

3

36.

Consider the table Books given below. Write outputs of following SQL Commands for (i) to (iii)

Book_Id      Book_Name      Author_Name                    Publishers         Price                    Qty 1001       The Human        J P Singh           TDH                    550               10

1002            Ninety Nine      W P Ram             EPB              700                    5

1003            Fast Cook          Lata Kapoor        Sagar            650                    2

1004            Vidur                 H P Nayak           Hillman        250                    7

1005            Officer              K Prakash            EPB              370                    11

 

(i)  SELECT AVG(Price) FROM Book WHERE Qty>5;

(ii)  SELECT Book_Name, Publishers From Book WHERE Publishers like ‘T%’;

(iii)   SELECT Book_Id FROM Book WHERE Price between 400 and 650;

3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


37.

Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this list push all numbers divisible by 5 into a stack implemented by using a list. Display the stack if it has at least one element, otherwise display appropriate error message.

OR

Write a function in Python POP(Arr), where Arr is a stack implemented by a list of numbers. The function returns the value deleted from the stack.

3

 

Section-III

 

38.

Rehan Consultants are setting up a secured network for their office campus at Ahmedabad for their web-based activities. They have planning to have connectivity between 3 Blocks and the head office situated in Delhi. Answer the questions (i) to (v) after going through the building positions in the campus and other details. Which are as:

 

 

BLOCK-1                                  BLOCK-2

 

Head Office

Delhi

BLOCK-3

 

Ahmedabad

 

 

 

Distance between various buildings

Block-1 to Block-2                                    120 m

Block-1 to Block-3                                    45 m

Block-3 to Block-2                                    65 m Ahemdabad  campus  to  Head  office                                                                     1100 km Delhi

Number of Computers

Block-1                                   40

Block-2                                   150

Block-3                                   30

Head office Delhi                   20

 

(i)   Suggest the most suitable place (i.e., Block) to install the server of this office campus with a suitable reason.

(ii)  Suggest a cable layout of connection between the blocks inside the campus.

(iii)   Suggest the placement of following devices with justification

(a)   Repeater             (b) Hub/Switch

(iv)    Organization is planning to connect high speed link with its head office situated in Delhi using a wired connection. Which of the following cables will be most suitable for this job?

1. Optical fibre           2. Ethernet cable 3. Co-axial cable

(v) Which hardware device will you suggest to be installed by company to protect and control the internet used within the campus?

5

39.

Write SQL commands for the queries (i) to (v) based on a table PRODUCT and CUSTOMER.

5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 

PRODUCT

 

 

 

 

 

 

PID

CNAME

PRODUCTNAME

PRICE

111

SONY

TV

50000

222

NOKIA

MOBILE

35000

333

ONIDA

TV

25000

444

SONY

MOBILE

42000

555

BLACKBERRY

MOBILE

58000

666

DELL

LAPTOP

65000

 

 

 

 

 

 

 

 

 

 

 

(i)  To show all the product name of SONY company from product table

(ii)   To display the PID, PRODUCTNAME and CNAME of all products whose price between 25000 to 60000.

(iii)   To display PID, PRICE and CUSOMTER_NAME from tables Product and Customer.

(iv)  To increase the price of product MOBILE by 500 in table PRODUCT.

(v)  To display the PRODUCTNAME and QTY_ORDER from tables Product and Customer where quantity orders are more than 10.

40.

A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price].

i.  Write a user defined function CreateFile() to input data for a record and add to “Book.dat” .

ii.  Write a function CountRec(Author) in Python which accepts the Author name as parameter and count and return number of books by the given Author are stored in the binary file “Book.dat”

OR

A binary file “STUDENT.DAT” has structure (admission_number, Name, Percentage). Write a function countrec() in Python that would read contents of the file “STUDENT.DAT” and display the details of those students whose percentage is above 75. Also display number of students scoring above 75%.

5