0% found this document useful (0 votes)
32 views4 pages

Some Important Questions Cs Class 12

Uploaded by

jatinmehra1415
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)
32 views4 pages

Some Important Questions Cs Class 12

Uploaded by

jatinmehra1415
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/ 4

SOME IMPORTANT QUESTIONS CS CLASS

Write definition of a method FIND(CITIES) to display all the city names from a

list of cities, which are starting with alphabet A.

For eg: If the list CITIES contain [“AGRA”,”AHMEDABAD”,”BOMBAY”,”KOCHI”]

The following should get displayed AGRA

AHMEDABAD

Write a Python method/function Count3and7(N) to find and display the count of all those numbers
which are in between 1 and N, which are either divisible by 3 or 7.

For example: If the value of N is 15 The count should be displayed as 7 as 3,6,7,9,12,14,15 are in
between 1 to 15 which are divisible either by 3 or 7.

Ms. Shalini has just created a table named “Employee” containing columns Ename,

Department, Salary with Ename as the primary key. After creating the table, she realized that she has
forgotten to add Empid in the table. Help her in writing SQL command to add a column Empid of
integer type and set it as the primary key column.

Ms. Sharma created a table student with the following fields: Rollno, Name. While creating the table
Student, Ms. Sharma forgot to include the column Marks. Help her to write a command to insert the
Marks column with integer data type of size 3 into the Student table.

In Marks column of ‘Student’ table, for Rollno 2, the Class Teacher entered the marks as 45. However
there was a totalling error and the student has got her marks incr…

Write a method LINECOUNT() in Python to the read lines from a text file ‘STORY.TXT’ and display the
number of lines which are starting with any vowel.

Write a function ETCount() in Python, which should read the content of a text file “TESTFILE.TXT” and
then count and display the count of occurrences of alphabets E and T individually (including small
cases e and t too).

Rohan is a Python programmer working in a school. For the Social Project, he

has created a CSV file named COUNTRY.CSV, to store the details of different countries. The structure
of COUNTRY.CSV is :

[C_Name, Capital, Population]

For efficiently maintaining data, Rohan wants to write the following user defined functions:

i. Accept() – to accept n records from the user and add it to the file COUNTRY.CSV. The column
headings should also be added on top of the CSV file.

ii. ShowRec() - To display all the records present in the CSV file named

COUNTRY.CSV
As a Python expert, help him complete the task.

Consider a file, STUDENT.DAT, containing records of the following structure: [Sid, StudentName,
Class, Marks]

Write a function, copyData(), that reads contents from the file STUDENT.DAT and copies the records
with marks above 33 to the file named PASS.DAT. The function should also return the total number of
students promoted.

Give any two points of difference between a text file and a binary file.

A Binary file, EMP.DAT has the structure: { EID:[NAME, JOB, SALARY] } Where EID – Employee id,
NAME – Employee Name, Job - Job Type and SALARY is the salary earned.

Infotainment Ltd. is an event management company with its prime office located in Bengaluru.
The company is planning to open its new division at three different locations in Chennai named as
– Vajra, Trishula and Sudershana.
You, as a networking expert need to suggest solutions to the questions in part (i) to (v), keeping IN
mind the distances and other given parameters.

(i) Suggest and draw the cable layout to efficiently connect various locations in Chennai division for
connecting the digital devices.
(ii) Which block in Chennai division should host the server ? Justify your answer.
(iii) Which fast and effective wired transmission medium should be used to connect the prime office
at Bengaluru with the Chennai division ?
(iv) Which network device will be used to connect the digital devices within each location of Chennai
division so that they may communicate with each other ?
(v) A considerable amount of data loss is noticed between different locations of the Chennai division,
which are connected in the network. Suggest a networking device that should be installed to refresh
the data and reduce the data loss during transmission to and from different locations of Chennai
division.

(i) Differentiate between ‘w’ and ‘a’ file modesin Python.


(ii) Consider a binary file, items.dat, containing records stored in the given format :
{item_id: [item_name, amount] }
Write a function, Copy_new(), that copies all records whose amount is greater than 1000 from
items.dat to new_items.dat.
What is the advantage of using with clause while opening a data file in Python ? Also give syntax of
with clause.
A binary file, EMP.DAT has the following structure :
[Emp Id, Name, Salary]
where
Emp _Id : Employee id
Name : Employee Name
Salary : Employee Salary
Write a user defined function, disp_Detail (), that would read the contents of the file EMP.DAT and
display the details of those employees whose salary is below 25000.

Define cartesian product with respect to RDBMS.


(ii) Sunil wants to write a program in Python to update the quantity to 20 of the records whose item
code is 111 in the table named shop in MySQL database named Keeper.
The table shop in MySQL contains the following attributes :
Item_code: Item code (Integer)
Item_name: Name of item (String)
Qty: Quantity of item (Integer)
Price: Price of item (Integer)
Consider the following to establish connectivity between Python and MySQL:
Username: admin
Password : Shopping
Host: localhost
(B) (i) Give any two features of SQL.
(ii) Sumit wants to write a code in Python to display all the details of the passengers from the table
flight in MySQL database, Travel. The table contains the following attributes :
F_code: Flight code (String)
F_name: Name of flight (String)
Source: Departure city of flight (String)
Destination: Destination city of flight (String)
Consider the following to establish connectivity between Python and MySQL :
Username : root
Password : airplane
Host : localhost

You might also like